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>
43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
// @ts-check
|
|
|
|
"use strict";
|
|
|
|
const { addErrorDetailIf, filterTokens, headingStyleFor } =
|
|
require("../helpers");
|
|
|
|
module.exports = {
|
|
"names": [ "MD003", "heading-style", "header-style" ],
|
|
"description": "Heading style",
|
|
"tags": [ "headings", "headers" ],
|
|
"function": function MD003(params, onError) {
|
|
let style = String(params.config.style || "consistent");
|
|
filterTokens(params, "heading_open", function forToken(token) {
|
|
const styleForToken = headingStyleFor(token);
|
|
if (style === "consistent") {
|
|
style = styleForToken;
|
|
}
|
|
if (styleForToken !== style) {
|
|
const h12 = /h[12]/.test(token.tag);
|
|
const setextWithAtx =
|
|
(style === "setext_with_atx") &&
|
|
((h12 && (styleForToken === "setext")) ||
|
|
(!h12 && (styleForToken === "atx")));
|
|
const setextWithAtxClosed =
|
|
(style === "setext_with_atx_closed") &&
|
|
((h12 && (styleForToken === "setext")) ||
|
|
(!h12 && (styleForToken === "atx_closed")));
|
|
if (!setextWithAtx && !setextWithAtxClosed) {
|
|
let expected = style;
|
|
if (style === "setext_with_atx") {
|
|
expected = h12 ? "setext" : "atx";
|
|
} else if (style === "setext_with_atx_closed") {
|
|
expected = h12 ? "setext" : "atx_closed";
|
|
}
|
|
addErrorDetailIf(onError, token.lineNumber,
|
|
expected, styleForToken);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
};
|