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>
48 lines
1.8 KiB
JavaScript
48 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.useDefaultStyle = useDefaultStyle;
|
|
var _element = require("@wordpress/element");
|
|
/**
|
|
* WordPress dependencies
|
|
*/
|
|
|
|
/**
|
|
* In HTML, leading and trailing spaces are not visible, and multiple spaces
|
|
* elsewhere are visually reduced to one space. This rule prevents spaces from
|
|
* collapsing so all space is visible in the editor and can be removed. It also
|
|
* prevents some browsers from inserting non-breaking spaces at the end of a
|
|
* line to prevent the space from visually disappearing. Sometimes these non
|
|
* breaking spaces can linger in the editor causing unwanted non breaking spaces
|
|
* in between words. If also prevent Firefox from inserting a trailing `br` node
|
|
* to visualise any trailing space, causing the element to be saved.
|
|
*
|
|
* > Authors are encouraged to set the 'white-space' property on editing hosts
|
|
* > and on markup that was originally created through these editing mechanisms
|
|
* > to the value 'pre-wrap'. Default HTML whitespace handling is not well
|
|
* > suited to WYSIWYG editing, and line wrapping will not work correctly in
|
|
* > some corner cases if 'white-space' is left at its default value.
|
|
*
|
|
* https://html.spec.whatwg.org/multipage/interaction.html#best-practices-for-in-page-editors
|
|
*
|
|
* @type {string}
|
|
*/
|
|
const whiteSpace = 'pre-wrap';
|
|
|
|
/**
|
|
* A minimum width of 1px will prevent the rich text container from collapsing
|
|
* to 0 width and hiding the caret. This is useful for inline containers.
|
|
*/
|
|
const minWidth = '1px';
|
|
function useDefaultStyle() {
|
|
return (0, _element.useCallback)(element => {
|
|
if (!element) {
|
|
return;
|
|
}
|
|
element.style.whiteSpace = whiteSpace;
|
|
element.style.minWidth = minWidth;
|
|
}, []);
|
|
}
|
|
//# sourceMappingURL=use-default-style.js.map
|