@elementor/editor-controls 4.3.0-1047 → 4.3.0-1049
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.js +29 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/controls/inline-editing-control.tsx +10 -35
- package/src/utils/inline-editing.ts +12 -0
package/dist/index.js
CHANGED
|
@@ -7957,9 +7957,8 @@ var BoundTimeStringControl = ({ bind, ariaLabel }) => {
|
|
|
7957
7957
|
// src/controls/inline-editing-control.tsx
|
|
7958
7958
|
var React115 = __toESM(require("react"));
|
|
7959
7959
|
var import_react68 = require("react");
|
|
7960
|
-
var
|
|
7960
|
+
var import_editor_props64 = require("@elementor/editor-props");
|
|
7961
7961
|
var import_ui99 = require("@elementor/ui");
|
|
7962
|
-
var import_utils8 = require("@elementor/utils");
|
|
7963
7962
|
|
|
7964
7963
|
// src/components/inline-editor.tsx
|
|
7965
7964
|
var React114 = __toESM(require("react"));
|
|
@@ -7980,6 +7979,7 @@ var import_extension_underline = __toESM(require("@tiptap/extension-underline"))
|
|
|
7980
7979
|
var import_react67 = require("@tiptap/react");
|
|
7981
7980
|
|
|
7982
7981
|
// src/utils/inline-editing.ts
|
|
7982
|
+
var import_editor_props63 = require("@elementor/editor-props");
|
|
7983
7983
|
function isEmpty(value = "") {
|
|
7984
7984
|
if (!value) {
|
|
7985
7985
|
return true;
|
|
@@ -7996,6 +7996,13 @@ function htmlToPlainText(html) {
|
|
|
7996
7996
|
const doc = new DOMParser().parseFromString(normalizedHtml, "text/html");
|
|
7997
7997
|
return doc.body.textContent ?? "";
|
|
7998
7998
|
}
|
|
7999
|
+
function extractInlineHtmlContent(propValue) {
|
|
8000
|
+
if (import_editor_props63.escapedHtmlPropTypeUtil.isValid(propValue)) {
|
|
8001
|
+
return import_editor_props63.escapedHtmlPropTypeUtil.extract(propValue) ?? "";
|
|
8002
|
+
}
|
|
8003
|
+
const htmlV3 = import_editor_props63.htmlV3PropTypeUtil.extract(propValue);
|
|
8004
|
+
return import_editor_props63.stringPropTypeUtil.extract(htmlV3?.content ?? null) ?? "";
|
|
8005
|
+
}
|
|
7999
8006
|
|
|
8000
8007
|
// src/components/inline-editor.tsx
|
|
8001
8008
|
var ITALIC_KEYBOARD_SHORTCUT = "i";
|
|
@@ -8126,37 +8133,22 @@ var useOnUpdate = (callback, dependencies) => {
|
|
|
8126
8133
|
};
|
|
8127
8134
|
|
|
8128
8135
|
// src/controls/inline-editing-control.tsx
|
|
8129
|
-
var CHILDREN_PARSE_DEBOUNCE_MS = 300;
|
|
8130
8136
|
var InlineEditingControl = createControl(
|
|
8131
8137
|
({
|
|
8132
8138
|
sx,
|
|
8133
8139
|
attributes,
|
|
8134
8140
|
props
|
|
8135
8141
|
}) => {
|
|
8136
|
-
const {
|
|
8137
|
-
const
|
|
8138
|
-
const
|
|
8139
|
-
() => (0, import_utils8.debounce)((html) => {
|
|
8140
|
-
const parsed = (0, import_editor_props63.parseHtmlChildren)(html);
|
|
8141
|
-
setValue({
|
|
8142
|
-
content: parsed.content ? import_editor_props63.stringPropTypeUtil.create(parsed.content) : null,
|
|
8143
|
-
children: parsed.children
|
|
8144
|
-
});
|
|
8145
|
-
}, CHILDREN_PARSE_DEBOUNCE_MS),
|
|
8146
|
-
[setValue]
|
|
8147
|
-
);
|
|
8142
|
+
const { setValue, placeholder, value } = useBoundProp(import_editor_props64.escapedHtmlPropTypeUtil);
|
|
8143
|
+
const { value: rawValue } = usePropKeyContext();
|
|
8144
|
+
const content = value ?? extractInlineHtmlContent(rawValue);
|
|
8148
8145
|
const handleChange = (0, import_react68.useCallback)(
|
|
8149
8146
|
(newValue) => {
|
|
8150
8147
|
const html = newValue ?? "";
|
|
8151
|
-
setValue(
|
|
8152
|
-
content: html ? import_editor_props63.stringPropTypeUtil.create(html) : null,
|
|
8153
|
-
children: value?.children ?? []
|
|
8154
|
-
});
|
|
8155
|
-
debouncedParse(html);
|
|
8148
|
+
setValue(html);
|
|
8156
8149
|
},
|
|
8157
|
-
[setValue
|
|
8150
|
+
[setValue]
|
|
8158
8151
|
);
|
|
8159
|
-
(0, import_react68.useEffect)(() => () => debouncedParse.cancel(), [debouncedParse]);
|
|
8160
8152
|
return /* @__PURE__ */ React115.createElement(ControlActions, null, /* @__PURE__ */ React115.createElement(
|
|
8161
8153
|
import_ui99.Box,
|
|
8162
8154
|
{
|
|
@@ -8202,21 +8194,14 @@ var InlineEditingControl = createControl(
|
|
|
8202
8194
|
...attributes,
|
|
8203
8195
|
...props
|
|
8204
8196
|
},
|
|
8205
|
-
/* @__PURE__ */ React115.createElement(
|
|
8206
|
-
InlineEditor,
|
|
8207
|
-
{
|
|
8208
|
-
value: content,
|
|
8209
|
-
setValue: handleChange,
|
|
8210
|
-
placeholder: placeholder?.content?.value ?? null
|
|
8211
|
-
}
|
|
8212
|
-
)
|
|
8197
|
+
/* @__PURE__ */ React115.createElement(InlineEditor, { value: content, setValue: handleChange, placeholder: placeholder ?? null })
|
|
8213
8198
|
));
|
|
8214
8199
|
}
|
|
8215
8200
|
);
|
|
8216
8201
|
|
|
8217
8202
|
// src/controls/email-form-action-control/index.tsx
|
|
8218
8203
|
var React119 = __toESM(require("react"));
|
|
8219
|
-
var
|
|
8204
|
+
var import_editor_props67 = require("@elementor/editor-props");
|
|
8220
8205
|
var import_editor_ui16 = require("@elementor/editor-ui");
|
|
8221
8206
|
var import_ui103 = require("@elementor/ui");
|
|
8222
8207
|
var import_i18n58 = require("@wordpress/i18n");
|
|
@@ -8229,7 +8214,7 @@ var import_i18n57 = require("@wordpress/i18n");
|
|
|
8229
8214
|
|
|
8230
8215
|
// src/hooks/use-form-field-suggestions.ts
|
|
8231
8216
|
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
8232
|
-
var
|
|
8217
|
+
var import_editor_props65 = require("@elementor/editor-props");
|
|
8233
8218
|
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
8234
8219
|
var FORM_FIELD_WIDGET_TYPES = [
|
|
8235
8220
|
"e-form-input",
|
|
@@ -8246,7 +8231,7 @@ function isFormFieldWidgetType(widgetType) {
|
|
|
8246
8231
|
return FORM_FIELD_WIDGET_TYPES.includes(widgetType);
|
|
8247
8232
|
}
|
|
8248
8233
|
function extractStringPropValue(value) {
|
|
8249
|
-
return
|
|
8234
|
+
return import_editor_props65.stringPropTypeUtil.extract(value);
|
|
8250
8235
|
}
|
|
8251
8236
|
function getSettingWithDefault(child, widgetType, key) {
|
|
8252
8237
|
const fromGet = child.settings.get(key);
|
|
@@ -8316,12 +8301,12 @@ function useFormFieldSuggestions(options) {
|
|
|
8316
8301
|
// src/controls/email-form-action-control/email-chips-field.tsx
|
|
8317
8302
|
var React116 = __toESM(require("react"));
|
|
8318
8303
|
var import_react69 = require("react");
|
|
8319
|
-
var
|
|
8304
|
+
var import_editor_props66 = require("@elementor/editor-props");
|
|
8320
8305
|
var import_ui100 = require("@elementor/ui");
|
|
8321
8306
|
|
|
8322
8307
|
// src/controls/email-form-action-control/utils.ts
|
|
8323
8308
|
var import_schema = require("@elementor/schema");
|
|
8324
|
-
var
|
|
8309
|
+
var import_utils8 = require("@elementor/utils");
|
|
8325
8310
|
var MIN_PRO_VERSION_FOR_MENTIONS = "4.1.0";
|
|
8326
8311
|
var CHIP_TRIGGER_KEYS = /* @__PURE__ */ new Set([" ", ","]);
|
|
8327
8312
|
function isValidEmail(email) {
|
|
@@ -8332,14 +8317,14 @@ function isFormFieldShortcode(value) {
|
|
|
8332
8317
|
return FORM_FIELD_SHORTCODE_PATTERN.test(value);
|
|
8333
8318
|
}
|
|
8334
8319
|
var shouldShowMentionsInfo = () => {
|
|
8335
|
-
if (!(0,
|
|
8320
|
+
if (!(0, import_utils8.hasProInstalled)()) {
|
|
8336
8321
|
return true;
|
|
8337
8322
|
}
|
|
8338
8323
|
const proVersion = window.elementorPro?.config?.version;
|
|
8339
8324
|
if (!proVersion) {
|
|
8340
8325
|
return false;
|
|
8341
8326
|
}
|
|
8342
|
-
return (0,
|
|
8327
|
+
return (0, import_utils8.isVersionGreaterOrEqual)(proVersion, MIN_PRO_VERSION_FOR_MENTIONS);
|
|
8343
8328
|
};
|
|
8344
8329
|
|
|
8345
8330
|
// src/controls/email-form-action-control/email-chips-field.tsx
|
|
@@ -8352,10 +8337,10 @@ function resolveMention(raw, suggestions) {
|
|
|
8352
8337
|
return match ? `[${match.value}]` : raw;
|
|
8353
8338
|
}
|
|
8354
8339
|
var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
|
|
8355
|
-
const { value, setValue, disabled } = useBoundProp(
|
|
8340
|
+
const { value, setValue, disabled } = useBoundProp(import_editor_props66.stringArrayPropTypeUtil);
|
|
8356
8341
|
const [inputValue, setInputValue] = (0, import_react69.useState)("");
|
|
8357
8342
|
const items2 = value || [];
|
|
8358
|
-
const selectedValues = items2.map((item) =>
|
|
8343
|
+
const selectedValues = items2.map((item) => import_editor_props66.stringPropTypeUtil.extract(item)).filter((val) => val !== null);
|
|
8359
8344
|
const suggestionOptions = (0, import_react69.useMemo)(
|
|
8360
8345
|
() => suggestions.map((suggestion) => `[${suggestion.value}]`),
|
|
8361
8346
|
[suggestions]
|
|
@@ -8365,7 +8350,7 @@ var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
|
|
|
8365
8350
|
if (!address || selectedValues.includes(address) || !isValidRecipient(address)) {
|
|
8366
8351
|
return;
|
|
8367
8352
|
}
|
|
8368
|
-
setValue([...items2,
|
|
8353
|
+
setValue([...items2, import_editor_props66.stringPropTypeUtil.create(address)]);
|
|
8369
8354
|
setInputValue("");
|
|
8370
8355
|
};
|
|
8371
8356
|
const handleChange = (_, newValue) => {
|
|
@@ -8375,7 +8360,7 @@ var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
|
|
|
8375
8360
|
if (!address || !isValidRecipient(address)) {
|
|
8376
8361
|
continue;
|
|
8377
8362
|
}
|
|
8378
|
-
updated.push(
|
|
8363
|
+
updated.push(import_editor_props66.stringPropTypeUtil.create(address));
|
|
8379
8364
|
}
|
|
8380
8365
|
setValue(updated);
|
|
8381
8366
|
setInputValue("");
|
|
@@ -8516,7 +8501,7 @@ var SendAsField = () => /* @__PURE__ */ React118.createElement(PropKeyProvider,
|
|
|
8516
8501
|
// src/controls/email-form-action-control/index.tsx
|
|
8517
8502
|
var EmailFormActionControl = createControl(
|
|
8518
8503
|
({ toPlaceholder, label }) => {
|
|
8519
|
-
const { value, setValue, ...propContext } = useBoundProp(
|
|
8504
|
+
const { value, setValue, ...propContext } = useBoundProp(import_editor_props67.emailsPropTypeUtil);
|
|
8520
8505
|
return /* @__PURE__ */ React119.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React119.createElement(import_ui103.Stack, { gap: 2 }, /* @__PURE__ */ React119.createElement(ControlLabel, null, label ? label + " " + (0, import_i18n58.__)("settings", "elementor") : (0, import_i18n58.__)("Email settings", "elementor")), /* @__PURE__ */ React119.createElement(SendToField, { placeholder: toPlaceholder }), /* @__PURE__ */ React119.createElement(SubjectField, null), /* @__PURE__ */ React119.createElement(MessageField, null), /* @__PURE__ */ React119.createElement(FromEmailField, null), /* @__PURE__ */ React119.createElement(AdvancedSettings, null)));
|
|
8521
8506
|
}
|
|
8522
8507
|
);
|
|
@@ -8536,7 +8521,7 @@ var AttachmentTypeControl = createControl(({ label, options }) => {
|
|
|
8536
8521
|
|
|
8537
8522
|
// src/controls/grid-span-control.tsx
|
|
8538
8523
|
var React121 = __toESM(require("react"));
|
|
8539
|
-
var
|
|
8524
|
+
var import_editor_props68 = require("@elementor/editor-props");
|
|
8540
8525
|
var import_ui105 = require("@elementor/ui");
|
|
8541
8526
|
var GridSpanControl = createControl(
|
|
8542
8527
|
({
|
|
@@ -8548,7 +8533,7 @@ var GridSpanControl = createControl(
|
|
|
8548
8533
|
sx,
|
|
8549
8534
|
ariaLabel
|
|
8550
8535
|
}) => {
|
|
8551
|
-
const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(
|
|
8536
|
+
const { value, setValue, disabled, placeholder: boundPlaceholder } = useBoundProp(import_editor_props68.spanPropTypeUtil);
|
|
8552
8537
|
const handleChange = (event) => {
|
|
8553
8538
|
const next = event.target.value;
|
|
8554
8539
|
setValue(next === "" ? null : next);
|