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>
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
// @ts-check
|
|
|
|
"use strict";
|
|
|
|
const { addErrorContext, forEachHeading } = require("../helpers");
|
|
|
|
module.exports = {
|
|
"names": [ "MD024", "no-duplicate-heading", "no-duplicate-header" ],
|
|
"description": "Multiple headings with the same content",
|
|
"tags": [ "headings", "headers" ],
|
|
"function": function MD024(params, onError) {
|
|
const siblingsOnly = !!params.config.siblings_only ||
|
|
!!params.config.allow_different_nesting || false;
|
|
const knownContents = [ null, [] ];
|
|
let lastLevel = 1;
|
|
let knownContent = knownContents[lastLevel];
|
|
forEachHeading(params, (heading, content) => {
|
|
if (siblingsOnly) {
|
|
const newLevel = heading.tag.slice(1);
|
|
while (lastLevel < newLevel) {
|
|
lastLevel++;
|
|
knownContents[lastLevel] = [];
|
|
}
|
|
while (lastLevel > newLevel) {
|
|
knownContents[lastLevel] = [];
|
|
lastLevel--;
|
|
}
|
|
knownContent = knownContents[newLevel];
|
|
}
|
|
if (knownContent.includes(content)) {
|
|
addErrorContext(onError, heading.lineNumber,
|
|
heading.line.trim());
|
|
} else {
|
|
knownContent.push(content);
|
|
}
|
|
});
|
|
}
|
|
};
|