Add coexistence checks to all enqueue methods to prevent loading both React and Grid.js assets simultaneously. Changes: - ReactAdmin.php: Only enqueue React assets when ?react=1 - Init.php: Skip Grid.js when React active on admin pages - Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0 - Customer.php, Product.php, License.php: Add coexistence checks Now the toggle between Classic and React versions works correctly. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
// @ts-check
|
|
|
|
"use strict";
|
|
|
|
const { addErrorContext, forEachLine, isBlankLine } = require("../helpers");
|
|
const { lineMetadata } = require("./cache");
|
|
|
|
const codeFencePrefixRe = /^(.*?)\s*[`~]/;
|
|
|
|
module.exports = {
|
|
"names": [ "MD031", "blanks-around-fences" ],
|
|
"description": "Fenced code blocks should be surrounded by blank lines",
|
|
"tags": [ "code", "blank_lines" ],
|
|
"function": function MD031(params, onError) {
|
|
const listItems = params.config.list_items;
|
|
const includeListItems = (listItems === undefined) ? true : !!listItems;
|
|
const { lines } = params;
|
|
forEachLine(lineMetadata(), (line, i, inCode, onFence, inTable, inItem) => {
|
|
const onTopFence = (onFence > 0);
|
|
const onBottomFence = (onFence < 0);
|
|
if ((includeListItems || !inItem) &&
|
|
((onTopFence && !isBlankLine(lines[i - 1])) ||
|
|
(onBottomFence && !isBlankLine(lines[i + 1])))) {
|
|
const [ , prefix ] = line.match(codeFencePrefixRe) || [];
|
|
const fixInfo = (prefix === undefined) ? null : {
|
|
"lineNumber": i + (onTopFence ? 1 : 2),
|
|
"insertText": `${prefix}\n`
|
|
};
|
|
addErrorContext(
|
|
onError,
|
|
i + 1,
|
|
lines[i].trim(),
|
|
null,
|
|
null,
|
|
null,
|
|
fixInfo);
|
|
}
|
|
});
|
|
}
|
|
};
|