@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 CHANGED
@@ -273,6 +273,7 @@ type KeyValueControlProps = {
273
273
  regexKey?: string;
274
274
  regexValue?: string;
275
275
  validationErrorMessage?: string;
276
+ escapeHtml?: boolean;
276
277
  getHelperText?: (key: string, value: string) => {
277
278
  keyHelper?: string;
278
279
  valueHelper?: string;
package/dist/index.d.ts CHANGED
@@ -273,6 +273,7 @@ type KeyValueControlProps = {
273
273
  regexKey?: string;
274
274
  regexValue?: string;
275
275
  validationErrorMessage?: string;
276
+ escapeHtml?: boolean;
276
277
  getHelperText?: (key: string, value: string) => {
277
278
  keyHelper?: string;
278
279
  valueHelper?: string;
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
+ "<": "&lt;",
4336
+ ">": "&gt;",
4337
+ "'": "&#39;",
4338
+ '"': "&quot;"
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(TextControl, { inputValue: sessionState.key, error: !!keyError, helperText: keyHelper })), !!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(
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