fix: prevent asset conflicts between React and Grid.js versions

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>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,50 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.TextHighlight = void 0;
var _react = require("react");
var _element = require("@wordpress/element");
var _strings = require("../utils/strings");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Highlights occurrences of a given string within another string of text. Wraps
* each match with a `<mark>` tag which provides browser default styling.
*
* ```jsx
* import { TextHighlight } from '@wordpress/components';
*
* const MyTextHighlight = () => (
* <TextHighlight
* text="Why do we like Gutenberg? Because Gutenberg is the best!"
* highlight="Gutenberg"
* />
* );
* ```
*/
const TextHighlight = props => {
const {
text = '',
highlight = ''
} = props;
const trimmedHighlightText = highlight.trim();
if (!trimmedHighlightText) {
return (0, _react.createElement)(_react.Fragment, null, text);
}
const regex = new RegExp(`(${(0, _strings.escapeRegExp)(trimmedHighlightText)})`, 'gi');
return (0, _element.createInterpolateElement)(text.replace(regex, '<mark>$&</mark>'), {
mark: (0, _react.createElement)("mark", null)
});
};
exports.TextHighlight = TextHighlight;
var _default = TextHighlight;
exports.default = _default;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_element","require","_strings","TextHighlight","props","text","highlight","trimmedHighlightText","trim","_react","createElement","Fragment","regex","RegExp","escapeRegExp","createInterpolateElement","replace","mark","exports","_default","default"],"sources":["@wordpress/components/src/text-highlight/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { escapeRegExp } from '../utils/strings';\nimport type { TextHighlightProps } from './types';\n\n/**\n * Highlights occurrences of a given string within another string of text. Wraps\n * each match with a `<mark>` tag which provides browser default styling.\n *\n * ```jsx\n * import { TextHighlight } from '@wordpress/components';\n *\n * const MyTextHighlight = () => (\n * <TextHighlight\n * text=\"Why do we like Gutenberg? Because Gutenberg is the best!\"\n * highlight=\"Gutenberg\"\n * />\n * );\n * ```\n */\nexport const TextHighlight = ( props: TextHighlightProps ) => {\n\tconst { text = '', highlight = '' } = props;\n\tconst trimmedHighlightText = highlight.trim();\n\n\tif ( ! trimmedHighlightText ) {\n\t\treturn <>{ text }</>;\n\t}\n\n\tconst regex = new RegExp(\n\t\t`(${ escapeRegExp( trimmedHighlightText ) })`,\n\t\t'gi'\n\t);\n\n\treturn createInterpolateElement( text.replace( regex, '<mark>$&</mark>' ), {\n\t\tmark: <mark />,\n\t} );\n};\n\nexport default TextHighlight;\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,GAAKC,KAAyB,IAAM;EAC7D,MAAM;IAAEC,IAAI,GAAG,EAAE;IAAEC,SAAS,GAAG;EAAG,CAAC,GAAGF,KAAK;EAC3C,MAAMG,oBAAoB,GAAGD,SAAS,CAACE,IAAI,CAAC,CAAC;EAE7C,IAAK,CAAED,oBAAoB,EAAG;IAC7B,OAAO,IAAAE,MAAA,CAAAC,aAAA,EAAAD,MAAA,CAAAE,QAAA,QAAIN,IAAQ,CAAC;EACrB;EAEA,MAAMO,KAAK,GAAG,IAAIC,MAAM,CACtB,IAAI,IAAAC,qBAAY,EAAEP,oBAAqB,CAAG,GAAE,EAC7C,IACD,CAAC;EAED,OAAO,IAAAQ,iCAAwB,EAAEV,IAAI,CAACW,OAAO,CAAEJ,KAAK,EAAE,iBAAkB,CAAC,EAAE;IAC1EK,IAAI,EAAE,IAAAR,MAAA,CAAAC,aAAA,cAAO;EACd,CAAE,CAAC;AACJ,CAAC;AAACQ,OAAA,CAAAf,aAAA,GAAAA,aAAA;AAAA,IAAAgB,QAAA,GAEahB,aAAa;AAAAe,OAAA,CAAAE,OAAA,GAAAD,QAAA"}

View File

@@ -0,0 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["@wordpress/components/src/text-highlight/types.ts"],"sourcesContent":["export type TextHighlightProps = {\n\t/**\n\t * The string to search for and highlight within the `text`. Case\n\t * insensitive. Multiple matches.\n\t *\n\t * @default ''\n\t */\n\thighlight: string;\n\t/**\n\t * The string of text to be tested for occurrences of then given\n\t * `highlight`.\n\t *\n\t * @default ''\n\t */\n\ttext: string;\n};\n"],"mappings":""}