@elementor/editor-controls 3.33.0-106 → 3.33.0-107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/controls/key-value-control.tsx +8 -2
- package/src/utils/escape-html-attr.ts +11 -0
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4327,6 +4327,20 @@ var import_react37 = require("react");
|
|
|
4327
4327
|
var import_editor_props34 = require("@elementor/editor-props");
|
|
4328
4328
|
var import_ui61 = require("@elementor/ui");
|
|
4329
4329
|
var import_i18n33 = require("@wordpress/i18n");
|
|
4330
|
+
|
|
4331
|
+
// src/utils/escape-html-attr.ts
|
|
4332
|
+
var escapeHtmlAttr = (value) => {
|
|
4333
|
+
const specialChars = {
|
|
4334
|
+
"&": "&",
|
|
4335
|
+
"<": "<",
|
|
4336
|
+
">": ">",
|
|
4337
|
+
"'": "'",
|
|
4338
|
+
'"': """
|
|
4339
|
+
};
|
|
4340
|
+
return value.replace(/[&<>'"]/g, (char) => specialChars[char] || char);
|
|
4341
|
+
};
|
|
4342
|
+
|
|
4343
|
+
// src/controls/key-value-control.tsx
|
|
4330
4344
|
var KeyValueControl = createControl((props = {}) => {
|
|
4331
4345
|
const { value, setValue, ...propContext } = useBoundProp(import_editor_props34.keyValuePropTypeUtil);
|
|
4332
4346
|
const [keyError, setKeyError] = (0, import_react37.useState)("");
|
|
@@ -4394,10 +4408,17 @@ var KeyValueControl = createControl((props = {}) => {
|
|
|
4394
4408
|
});
|
|
4395
4409
|
}
|
|
4396
4410
|
};
|
|
4397
|
-
return /* @__PURE__ */ React73.createElement(PropProvider, { ...propContext, value, setValue: handleChange }, /* @__PURE__ */ React73.createElement(import_ui61.Grid, { container: true, gap: 1.5 }, /* @__PURE__ */ React73.createElement(import_ui61.Grid, { item: true, xs: 12, display: "flex", flexDirection: "column" }, /* @__PURE__ */ React73.createElement(import_ui61.FormLabel, { size: "tiny", sx: { pb: 1 } }, keyLabel), /* @__PURE__ */ React73.createElement(PropKeyProvider, { bind: "key" }, /* @__PURE__ */ React73.createElement(
|
|
4411
|
+
return /* @__PURE__ */ React73.createElement(PropProvider, { ...propContext, value, setValue: handleChange }, /* @__PURE__ */ React73.createElement(import_ui61.Grid, { container: true, gap: 1.5 }, /* @__PURE__ */ React73.createElement(import_ui61.Grid, { item: true, xs: 12, display: "flex", flexDirection: "column" }, /* @__PURE__ */ React73.createElement(import_ui61.FormLabel, { size: "tiny", sx: { pb: 1 } }, keyLabel), /* @__PURE__ */ React73.createElement(PropKeyProvider, { bind: "key" }, /* @__PURE__ */ React73.createElement(
|
|
4412
|
+
TextControl,
|
|
4413
|
+
{
|
|
4414
|
+
inputValue: props.escapeHtml ? escapeHtmlAttr(sessionState.key) : sessionState.key,
|
|
4415
|
+
error: !!keyError,
|
|
4416
|
+
helperText: keyHelper
|
|
4417
|
+
}
|
|
4418
|
+
)), !!keyError && /* @__PURE__ */ React73.createElement(import_ui61.FormHelperText, { error: true }, keyError)), /* @__PURE__ */ React73.createElement(import_ui61.Grid, { item: true, xs: 12, display: "flex", flexDirection: "column" }, /* @__PURE__ */ React73.createElement(import_ui61.FormLabel, { size: "tiny", sx: { pb: 1 } }, valueLabel), /* @__PURE__ */ React73.createElement(PropKeyProvider, { bind: "value" }, /* @__PURE__ */ React73.createElement(
|
|
4398
4419
|
TextControl,
|
|
4399
4420
|
{
|
|
4400
|
-
inputValue: sessionState.value,
|
|
4421
|
+
inputValue: props.escapeHtml ? escapeHtmlAttr(sessionState.value) : sessionState.value,
|
|
4401
4422
|
error: !!valueError,
|
|
4402
4423
|
inputDisabled: !!keyError,
|
|
4403
4424
|
helperText: valueHelper
|