@elementor/editor-canvas 4.0.0-573 → 4.0.0-591
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 +162 -154
- package/dist/index.mjs +165 -157
- package/package.json +18 -18
- package/src/init-settings-transformers.ts +2 -0
- package/src/legacy/replacements/inline-editing/__tests__/inline-editing-eligibility.test.ts +7 -7
- package/src/legacy/replacements/inline-editing/canvas-inline-editor.tsx +31 -125
- package/src/legacy/replacements/inline-editing/inline-editing-elements.tsx +6 -5
- package/src/legacy/replacements/inline-editing/inline-editing-eligibility.ts +3 -3
- package/src/legacy/replacements/inline-editing/inline-editing-utils.ts +137 -39
- package/src/legacy/tabs-model-extensions.ts +5 -2
- package/src/mcp/tools/build-composition/schema.ts +14 -0
- package/src/mcp/tools/build-composition/tool.ts +10 -11
- package/src/transformers/settings/html-v3-transformer.ts +10 -0
package/dist/index.js
CHANGED
|
@@ -1243,6 +1243,11 @@ var htmlV2Transformer = createTransformer((value) => {
|
|
|
1243
1243
|
return value?.content ?? "";
|
|
1244
1244
|
});
|
|
1245
1245
|
|
|
1246
|
+
// src/transformers/settings/html-v3-transformer.ts
|
|
1247
|
+
var htmlV3Transformer = createTransformer((value) => {
|
|
1248
|
+
return value?.content ?? "";
|
|
1249
|
+
});
|
|
1250
|
+
|
|
1246
1251
|
// src/transformers/settings/link-transformer.ts
|
|
1247
1252
|
var linkTransformer = createTransformer(({ destination, isTargetBlank, tag }) => {
|
|
1248
1253
|
return {
|
|
@@ -1297,7 +1302,7 @@ var plainTransformer = createTransformer((value) => {
|
|
|
1297
1302
|
|
|
1298
1303
|
// src/init-settings-transformers.ts
|
|
1299
1304
|
function initSettingsTransformers() {
|
|
1300
|
-
settingsTransformersRegistry.register("classes", createClassesTransformer()).register("link", linkTransformer).register("query", queryTransformer).register("image", imageTransformer).register("image-src", imageSrcTransformer).register("attributes", attributesTransformer).register("date-time", dateTimeTransformer).register("html-v2", htmlV2Transformer).registerFallback(plainTransformer);
|
|
1305
|
+
settingsTransformersRegistry.register("classes", createClassesTransformer()).register("link", linkTransformer).register("query", queryTransformer).register("image", imageTransformer).register("image-src", imageSrcTransformer).register("attributes", attributesTransformer).register("date-time", dateTimeTransformer).register("html-v2", htmlV2Transformer).register("html-v3", htmlV3Transformer).registerFallback(plainTransformer);
|
|
1301
1306
|
}
|
|
1302
1307
|
|
|
1303
1308
|
// src/transformers/styles/background-color-overlay-transformer.ts
|
|
@@ -2206,67 +2211,130 @@ var ReplacementBase = class {
|
|
|
2206
2211
|
|
|
2207
2212
|
// src/legacy/replacements/inline-editing/canvas-inline-editor.tsx
|
|
2208
2213
|
var React5 = __toESM(require("react"));
|
|
2209
|
-
var
|
|
2214
|
+
var import_react12 = require("react");
|
|
2210
2215
|
var import_editor_controls2 = require("@elementor/editor-controls");
|
|
2211
2216
|
var import_ui4 = require("@elementor/ui");
|
|
2212
|
-
var
|
|
2217
|
+
var import_react13 = require("@floating-ui/react");
|
|
2213
2218
|
|
|
2214
2219
|
// src/legacy/replacements/inline-editing/inline-editing-utils.ts
|
|
2220
|
+
var import_react11 = require("react");
|
|
2221
|
+
var TOP_BAR_SELECTOR = "#elementor-editor-wrapper-v2";
|
|
2222
|
+
var NAVIGATOR_SELECTOR = "#elementor-navigator";
|
|
2223
|
+
var EDITING_PANEL = "#elementor-panel";
|
|
2224
|
+
var EDITOR_ELEMENTS_OUT_OF_IFRAME = [TOP_BAR_SELECTOR, NAVIGATOR_SELECTOR, EDITING_PANEL];
|
|
2225
|
+
var TOOLBAR_ANCHOR_ID_PREFIX = "inline-editing-toolbar-anchor";
|
|
2226
|
+
var TOOLBAR_ANCHOR_STATIC_STYLES = {
|
|
2227
|
+
backgroundColor: "transparent",
|
|
2228
|
+
border: "none",
|
|
2229
|
+
outline: "none",
|
|
2230
|
+
boxShadow: "none",
|
|
2231
|
+
padding: "0",
|
|
2232
|
+
margin: "0",
|
|
2233
|
+
borderRadius: "0",
|
|
2234
|
+
overflow: "hidden",
|
|
2235
|
+
opacity: "0",
|
|
2236
|
+
pointerEvents: "none",
|
|
2237
|
+
position: "absolute",
|
|
2238
|
+
display: "block"
|
|
2239
|
+
};
|
|
2215
2240
|
var INLINE_EDITING_PROPERTY_PER_TYPE = {
|
|
2216
2241
|
"e-button": "text",
|
|
2217
2242
|
"e-form-label": "text",
|
|
2218
2243
|
"e-heading": "title",
|
|
2219
2244
|
"e-paragraph": "paragraph"
|
|
2220
2245
|
};
|
|
2221
|
-
var
|
|
2222
|
-
|
|
2246
|
+
var getInlineEditorElement = (elementWrapper, expectedTag) => {
|
|
2247
|
+
return !expectedTag ? null : elementWrapper.querySelector(expectedTag);
|
|
2248
|
+
};
|
|
2249
|
+
var useOnClickOutsideIframe = (handleUnmount) => {
|
|
2250
|
+
const asyncUnmountInlineEditor = (0, import_react11.useCallback)(() => queueMicrotask(handleUnmount), [handleUnmount]);
|
|
2251
|
+
(0, import_react11.useEffect)(() => {
|
|
2252
|
+
EDITOR_ELEMENTS_OUT_OF_IFRAME.forEach(
|
|
2253
|
+
(selector) => document?.querySelector(selector)?.addEventListener("mousedown", asyncUnmountInlineEditor)
|
|
2254
|
+
);
|
|
2255
|
+
return () => EDITOR_ELEMENTS_OUT_OF_IFRAME.forEach(
|
|
2256
|
+
(selector) => document?.querySelector(selector)?.removeEventListener("mousedown", asyncUnmountInlineEditor)
|
|
2257
|
+
);
|
|
2258
|
+
}, []);
|
|
2259
|
+
};
|
|
2260
|
+
var useRenderToolbar = (ownerDocument, id) => {
|
|
2261
|
+
const [anchor, setAnchor] = (0, import_react11.useState)(null);
|
|
2262
|
+
const onSelectionEnd = (view) => {
|
|
2263
|
+
const hasSelection = !view.state.selection.empty;
|
|
2264
|
+
removeToolbarAnchor(ownerDocument, id);
|
|
2265
|
+
if (hasSelection) {
|
|
2266
|
+
setAnchor(createAnchorBasedOnSelection(ownerDocument, id));
|
|
2267
|
+
} else {
|
|
2268
|
+
setAnchor(null);
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
return { onSelectionEnd, anchor };
|
|
2272
|
+
};
|
|
2273
|
+
var createAnchorBasedOnSelection = (ownerDocument, id) => {
|
|
2274
|
+
const frameWindow = ownerDocument.defaultView;
|
|
2223
2275
|
const selection = frameWindow?.getSelection();
|
|
2224
|
-
|
|
2225
|
-
if (!selection || !editorContainer) {
|
|
2276
|
+
if (!selection) {
|
|
2226
2277
|
return null;
|
|
2227
2278
|
}
|
|
2228
2279
|
const range = selection.getRangeAt(0);
|
|
2229
2280
|
const selectionRect = range.getBoundingClientRect();
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2232
|
-
|
|
2281
|
+
const bodyRect = ownerDocument.body.getBoundingClientRect();
|
|
2282
|
+
const toolbarAnchor = ownerDocument.createElement("span");
|
|
2283
|
+
styleToolbarAnchor(toolbarAnchor, selectionRect, bodyRect);
|
|
2284
|
+
toolbarAnchor.setAttribute("id", getToolbarAnchorId(id));
|
|
2285
|
+
ownerDocument.body.appendChild(toolbarAnchor);
|
|
2286
|
+
return toolbarAnchor;
|
|
2287
|
+
};
|
|
2288
|
+
var removeToolbarAnchor = (ownerDocument, id) => {
|
|
2289
|
+
const toolbarAnchor = getToolbarAnchor(ownerDocument, id);
|
|
2290
|
+
if (toolbarAnchor) {
|
|
2291
|
+
ownerDocument.body.removeChild(toolbarAnchor);
|
|
2233
2292
|
}
|
|
2234
|
-
const verticalOffset = selectionRect.top - editorContainerRect.top;
|
|
2235
|
-
const selectionCenter = selectionRect?.left + selectionRect?.width / 2;
|
|
2236
|
-
const horizontalOffset = selectionCenter - editorContainerRect.left;
|
|
2237
|
-
return { left: horizontalOffset, top: verticalOffset };
|
|
2238
2293
|
};
|
|
2239
|
-
var
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2294
|
+
var getToolbarAnchorId = (id) => `${TOOLBAR_ANCHOR_ID_PREFIX}-${id}`;
|
|
2295
|
+
var getToolbarAnchor = (ownerDocument, id) => ownerDocument.getElementById(getToolbarAnchorId(id));
|
|
2296
|
+
var styleToolbarAnchor = (anchor, selectionRect, bodyRect) => {
|
|
2297
|
+
const { width, height } = selectionRect;
|
|
2298
|
+
Object.assign(anchor.style, {
|
|
2299
|
+
...TOOLBAR_ANCHOR_STATIC_STYLES,
|
|
2300
|
+
top: `${selectionRect.top - bodyRect.top}px`,
|
|
2301
|
+
left: `${selectionRect.left - bodyRect.left}px`,
|
|
2302
|
+
width: `${width}px`,
|
|
2303
|
+
height: `${height}px`
|
|
2304
|
+
});
|
|
2249
2305
|
};
|
|
2250
|
-
var
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2306
|
+
var horizontalShifterMiddleware = {
|
|
2307
|
+
name: "horizontalShifter",
|
|
2308
|
+
fn(state) {
|
|
2309
|
+
const {
|
|
2310
|
+
x: left,
|
|
2311
|
+
y: top,
|
|
2312
|
+
elements: { reference: anchor, floating }
|
|
2313
|
+
} = state;
|
|
2314
|
+
const newState = {
|
|
2315
|
+
...state,
|
|
2316
|
+
x: left,
|
|
2317
|
+
y: top
|
|
2318
|
+
};
|
|
2319
|
+
const isLeftOverflown = left < 0;
|
|
2320
|
+
if (isLeftOverflown) {
|
|
2321
|
+
newState.x = 0;
|
|
2322
|
+
return newState;
|
|
2323
|
+
}
|
|
2324
|
+
const anchorRect = anchor.getBoundingClientRect();
|
|
2325
|
+
const right = left + floating.offsetWidth;
|
|
2326
|
+
const documentWidth = anchor.ownerDocument.body.offsetWidth;
|
|
2327
|
+
const isRightOverflown = right > documentWidth && anchorRect.right < right;
|
|
2328
|
+
if (isRightOverflown) {
|
|
2329
|
+
const diff = right - documentWidth;
|
|
2330
|
+
newState.x = left - diff;
|
|
2331
|
+
return newState;
|
|
2332
|
+
}
|
|
2333
|
+
return newState;
|
|
2261
2334
|
}
|
|
2262
|
-
return styles.transform;
|
|
2263
2335
|
};
|
|
2264
2336
|
|
|
2265
2337
|
// src/legacy/replacements/inline-editing/canvas-inline-editor.tsx
|
|
2266
|
-
var TOP_BAR_SELECTOR = "#elementor-editor-wrapper-v2";
|
|
2267
|
-
var NAVIGATOR_SELECTOR = "#elementor-navigator";
|
|
2268
|
-
var EDITING_PANEL = "#elementor-panel";
|
|
2269
|
-
var EDITOR_ELEMENTS_OUT_OF_IFRAME = [TOP_BAR_SELECTOR, NAVIGATOR_SELECTOR, EDITING_PANEL];
|
|
2270
2338
|
var EDITOR_WRAPPER_SELECTOR = "inline-editor-wrapper";
|
|
2271
2339
|
var CanvasInlineEditor = ({
|
|
2272
2340
|
elementClasses,
|
|
@@ -2275,23 +2343,23 @@ var CanvasInlineEditor = ({
|
|
|
2275
2343
|
rootElement,
|
|
2276
2344
|
id,
|
|
2277
2345
|
setValue,
|
|
2278
|
-
|
|
2346
|
+
...props
|
|
2279
2347
|
}) => {
|
|
2280
|
-
const [
|
|
2281
|
-
const
|
|
2282
|
-
const
|
|
2283
|
-
|
|
2284
|
-
|
|
2348
|
+
const [editor, setEditor] = (0, import_react12.useState)(null);
|
|
2349
|
+
const { onSelectionEnd, anchor: toolbarAnchor } = useRenderToolbar(rootElement.ownerDocument, id);
|
|
2350
|
+
const onBlur = () => {
|
|
2351
|
+
removeToolbarAnchor(rootElement.ownerDocument, id);
|
|
2352
|
+
props.onBlur();
|
|
2285
2353
|
};
|
|
2286
2354
|
useOnClickOutsideIframe(onBlur);
|
|
2287
2355
|
return /* @__PURE__ */ React5.createElement(import_ui4.ThemeProvider, null, /* @__PURE__ */ React5.createElement(InlineEditingOverlay, { expectedTag, rootElement, id }), /* @__PURE__ */ React5.createElement("style", null, `
|
|
2288
2356
|
.ProseMirror > * {
|
|
2289
2357
|
height: 100%;
|
|
2290
2358
|
}
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2359
|
+
.${EDITOR_WRAPPER_SELECTOR} .ProseMirror > button[contenteditable="true"] {
|
|
2360
|
+
height: auto;
|
|
2361
|
+
cursor: text;
|
|
2362
|
+
}
|
|
2295
2363
|
`), /* @__PURE__ */ React5.createElement(
|
|
2296
2364
|
import_editor_controls2.InlineEditor,
|
|
2297
2365
|
{
|
|
@@ -2307,19 +2375,9 @@ var CanvasInlineEditor = ({
|
|
|
2307
2375
|
onBlur,
|
|
2308
2376
|
autofocus: true,
|
|
2309
2377
|
expectedTag,
|
|
2310
|
-
wrapperClassName: EDITOR_WRAPPER_SELECTOR,
|
|
2311
2378
|
onSelectionEnd
|
|
2312
2379
|
}
|
|
2313
|
-
),
|
|
2314
|
-
InlineEditingToolbarWrapper,
|
|
2315
|
-
{
|
|
2316
|
-
expectedTag,
|
|
2317
|
-
editor,
|
|
2318
|
-
rootElement,
|
|
2319
|
-
id,
|
|
2320
|
-
selectionOffsets
|
|
2321
|
-
}
|
|
2322
|
-
));
|
|
2380
|
+
), toolbarAnchor && editor && /* @__PURE__ */ React5.createElement(InlineEditingToolbar, { anchor: toolbarAnchor, editor, id }));
|
|
2323
2381
|
};
|
|
2324
2382
|
var InlineEditingOverlay = ({
|
|
2325
2383
|
expectedTag,
|
|
@@ -2327,84 +2385,25 @@ var InlineEditingOverlay = ({
|
|
|
2327
2385
|
id
|
|
2328
2386
|
}) => {
|
|
2329
2387
|
const inlineEditedElement = getInlineEditorElement(rootElement, expectedTag);
|
|
2330
|
-
const [overlayRefElement, setOverlayElement] = (0,
|
|
2331
|
-
(0,
|
|
2388
|
+
const [overlayRefElement, setOverlayElement] = (0, import_react12.useState)(inlineEditedElement);
|
|
2389
|
+
(0, import_react12.useEffect)(() => {
|
|
2332
2390
|
setOverlayElement(getInlineEditorElement(rootElement, expectedTag));
|
|
2333
2391
|
}, [expectedTag, rootElement]);
|
|
2334
2392
|
return overlayRefElement ? /* @__PURE__ */ React5.createElement(OutlineOverlay, { element: overlayRefElement, id, isSelected: true }) : null;
|
|
2335
2393
|
};
|
|
2336
|
-
var
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
const [element, setElement] = (0, import_react11.useState)(null);
|
|
2344
|
-
(0, import_react11.useEffect)(() => {
|
|
2345
|
-
setElement(getInlineEditorElement(rootElement, expectedTag));
|
|
2346
|
-
}, [expectedTag, rootElement]);
|
|
2347
|
-
return element ? /* @__PURE__ */ React5.createElement(InlineEditingToolbar, { element, editor, id, selectionOffsets }) : null;
|
|
2348
|
-
};
|
|
2349
|
-
var InlineEditingToolbar = ({
|
|
2350
|
-
element,
|
|
2351
|
-
editor,
|
|
2352
|
-
id,
|
|
2353
|
-
selectionOffsets
|
|
2354
|
-
}) => {
|
|
2355
|
-
const { floating } = useFloatingOnElement({
|
|
2356
|
-
element,
|
|
2357
|
-
isSelected: true
|
|
2394
|
+
var InlineEditingToolbar = ({ anchor, editor, id }) => {
|
|
2395
|
+
const { refs, floatingStyles } = (0, import_react13.useFloating)({
|
|
2396
|
+
placement: "top",
|
|
2397
|
+
strategy: "fixed",
|
|
2398
|
+
transform: false,
|
|
2399
|
+
whileElementsMounted: import_react13.autoUpdate,
|
|
2400
|
+
middleware: [horizontalShifterMiddleware, (0, import_react13.flip)()]
|
|
2358
2401
|
});
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
{
|
|
2365
|
-
ref: floating.setRef,
|
|
2366
|
-
style: {
|
|
2367
|
-
...floating.styles,
|
|
2368
|
-
pointerEvents: "none"
|
|
2369
|
-
},
|
|
2370
|
-
role: "presentation",
|
|
2371
|
-
...getFloatingProps({ style })
|
|
2372
|
-
},
|
|
2373
|
-
floating.styles.transform && /* @__PURE__ */ React5.createElement(
|
|
2374
|
-
import_ui4.Box,
|
|
2375
|
-
{
|
|
2376
|
-
sx: {
|
|
2377
|
-
position: "relative",
|
|
2378
|
-
transform: "translateY(-100%)",
|
|
2379
|
-
height: "max-content"
|
|
2380
|
-
}
|
|
2381
|
-
},
|
|
2382
|
-
/* @__PURE__ */ React5.createElement(
|
|
2383
|
-
import_editor_controls2.InlineEditorToolbar,
|
|
2384
|
-
{
|
|
2385
|
-
editor,
|
|
2386
|
-
elementId: id,
|
|
2387
|
-
sx: {
|
|
2388
|
-
transform: "translateX(-50%)"
|
|
2389
|
-
}
|
|
2390
|
-
}
|
|
2391
|
-
)
|
|
2392
|
-
)
|
|
2393
|
-
));
|
|
2394
|
-
};
|
|
2395
|
-
var getInlineEditorElement = (elementWrapper, expectedTag) => {
|
|
2396
|
-
return !expectedTag ? null : elementWrapper.querySelector(expectedTag);
|
|
2397
|
-
};
|
|
2398
|
-
var useOnClickOutsideIframe = (handleUnmount) => {
|
|
2399
|
-
const asyncUnmountInlineEditor = React5.useCallback(() => queueMicrotask(handleUnmount), [handleUnmount]);
|
|
2400
|
-
(0, import_react11.useEffect)(() => {
|
|
2401
|
-
EDITOR_ELEMENTS_OUT_OF_IFRAME.forEach(
|
|
2402
|
-
(selector) => document?.querySelector(selector)?.addEventListener("mousedown", asyncUnmountInlineEditor)
|
|
2403
|
-
);
|
|
2404
|
-
return () => EDITOR_ELEMENTS_OUT_OF_IFRAME.forEach(
|
|
2405
|
-
(selector) => document?.querySelector(selector)?.removeEventListener("mousedown", asyncUnmountInlineEditor)
|
|
2406
|
-
);
|
|
2407
|
-
}, []);
|
|
2402
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
2403
|
+
refs.setReference(anchor);
|
|
2404
|
+
return () => refs.setReference(null);
|
|
2405
|
+
}, [anchor, refs]);
|
|
2406
|
+
return /* @__PURE__ */ React5.createElement(import_react13.FloatingPortal, { id: CANVAS_WRAPPER_ID }, /* @__PURE__ */ React5.createElement(import_ui4.Box, { ref: refs.setFloating, role: "presentation", style: { ...floatingStyles, pointerEvents: "none" } }, /* @__PURE__ */ React5.createElement(import_editor_controls2.InlineEditorToolbar, { editor, elementId: id })));
|
|
2408
2407
|
};
|
|
2409
2408
|
|
|
2410
2409
|
// src/legacy/replacements/inline-editing/inline-editing-eligibility.ts
|
|
@@ -2412,7 +2411,7 @@ var import_editor_props3 = require("@elementor/editor-props");
|
|
|
2412
2411
|
var hasKey = (propType) => {
|
|
2413
2412
|
return "key" in propType;
|
|
2414
2413
|
};
|
|
2415
|
-
var TEXT_PROP_TYPE_KEYS = /* @__PURE__ */ new Set([import_editor_props3.
|
|
2414
|
+
var TEXT_PROP_TYPE_KEYS = /* @__PURE__ */ new Set([import_editor_props3.htmlV3PropTypeUtil.key, import_editor_props3.stringPropTypeUtil.key]);
|
|
2416
2415
|
var isCoreTextPropTypeKey = (key) => {
|
|
2417
2416
|
return TEXT_PROP_TYPE_KEYS.has(key);
|
|
2418
2417
|
};
|
|
@@ -2432,7 +2431,7 @@ var isInlineEditingAllowed = ({ rawValue, propTypeFromSchema }) => {
|
|
|
2432
2431
|
if (rawValue === null || rawValue === void 0) {
|
|
2433
2432
|
return isAllowedBySchema(propTypeFromSchema);
|
|
2434
2433
|
}
|
|
2435
|
-
return import_editor_props3.
|
|
2434
|
+
return import_editor_props3.htmlV3PropTypeUtil.isValid(rawValue) || import_editor_props3.stringPropTypeUtil.isValid(rawValue);
|
|
2436
2435
|
};
|
|
2437
2436
|
|
|
2438
2437
|
// src/legacy/replacements/inline-editing/inline-editing-elements.tsx
|
|
@@ -2517,14 +2516,15 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2517
2516
|
}
|
|
2518
2517
|
getExtractedContentValue() {
|
|
2519
2518
|
const propValue = this.getInlineEditablePropValue();
|
|
2520
|
-
|
|
2519
|
+
const extracted = import_editor_props4.htmlV3PropTypeUtil.extract(propValue);
|
|
2520
|
+
return import_editor_props4.stringPropTypeUtil.extract(extracted?.content ?? null) ?? "";
|
|
2521
2521
|
}
|
|
2522
2522
|
setContentValue(value) {
|
|
2523
2523
|
const settingKey = this.getInlineEditablePropertyName();
|
|
2524
2524
|
const html = value || "";
|
|
2525
2525
|
const parsed = (0, import_editor_props4.parseHtmlChildren)(html);
|
|
2526
|
-
const valueToSave = import_editor_props4.
|
|
2527
|
-
content: parsed.content
|
|
2526
|
+
const valueToSave = import_editor_props4.htmlV3PropTypeUtil.create({
|
|
2527
|
+
content: parsed.content ? import_editor_props4.stringPropTypeUtil.create(parsed.content) : null,
|
|
2528
2528
|
children: parsed.children
|
|
2529
2529
|
});
|
|
2530
2530
|
(0, import_editor_v1_adapters11.undoable)(
|
|
@@ -2555,7 +2555,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2555
2555
|
return null;
|
|
2556
2556
|
}
|
|
2557
2557
|
if (propType.kind === "union") {
|
|
2558
|
-
const textKeys = [import_editor_props4.
|
|
2558
|
+
const textKeys = [import_editor_props4.htmlV3PropTypeUtil.key, import_editor_props4.stringPropTypeUtil.key];
|
|
2559
2559
|
for (const key of textKeys) {
|
|
2560
2560
|
if (propType.prop_types[key]) {
|
|
2561
2561
|
return key;
|
|
@@ -2796,7 +2796,10 @@ var tabModelExtensions = {
|
|
|
2796
2796
|
...paragraphElement,
|
|
2797
2797
|
settings: {
|
|
2798
2798
|
...paragraphElement.settings,
|
|
2799
|
-
paragraph: import_editor_props5.
|
|
2799
|
+
paragraph: import_editor_props5.htmlV3PropTypeUtil.create({
|
|
2800
|
+
content: import_editor_props5.stringPropTypeUtil.create(`Tab ${position}`),
|
|
2801
|
+
children: []
|
|
2802
|
+
})
|
|
2800
2803
|
}
|
|
2801
2804
|
};
|
|
2802
2805
|
return [updatedParagraph, ...elements.slice(1)];
|
|
@@ -3449,6 +3452,13 @@ var inputSchema = {
|
|
|
3449
3452
|
`A record mapping element IDs to their styles configuration objects. Use the actual styles schema from [${STYLE_SCHEMA_URI}].`
|
|
3450
3453
|
).default({})
|
|
3451
3454
|
};
|
|
3455
|
+
var outputSchema = {
|
|
3456
|
+
errors: import_schema.z.string().describe("Error message if the composition building failed").optional(),
|
|
3457
|
+
xmlStructure: import_schema.z.string().describe(
|
|
3458
|
+
"The built XML structure as a string. Must use this XML after completion of building the composition, it contains real IDs."
|
|
3459
|
+
).optional(),
|
|
3460
|
+
llm_instructions: import_schema.z.string().describe("Instructions what to do next, Important to follow these instructions!").optional()
|
|
3461
|
+
};
|
|
3452
3462
|
|
|
3453
3463
|
// src/mcp/tools/build-composition/tool.ts
|
|
3454
3464
|
var initBuildCompositionsTool = (reg) => {
|
|
@@ -3464,7 +3474,7 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
3464
3474
|
{ description: "Global Variables", uri: "elementor://global-variables" },
|
|
3465
3475
|
{ description: "Styles best practices", uri: BEST_PRACTICES_URI }
|
|
3466
3476
|
],
|
|
3467
|
-
|
|
3477
|
+
outputSchema,
|
|
3468
3478
|
modelPreferences: {
|
|
3469
3479
|
hints: [{ name: "claude-sonnet-4-5" }]
|
|
3470
3480
|
},
|
|
@@ -3546,10 +3556,10 @@ ${errorMessages.join(
|
|
|
3546
3556
|
Now that you have these errors, fix them and try again. Errors regarding configuration objects, please check against the PropType schemas`;
|
|
3547
3557
|
throw new Error(errorText);
|
|
3548
3558
|
}
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3559
|
+
return {
|
|
3560
|
+
xmlStructure: generatedXML,
|
|
3561
|
+
errors: errors?.length ? errors.map((e) => typeof e === "string" ? e : e.message).join("\n\n") : void 0,
|
|
3562
|
+
llm_instructions: `The composition was built successfully with element IDs embedded in the XML.
|
|
3553
3563
|
|
|
3554
3564
|
**CRITICAL NEXT STEPS** (Follow in order):
|
|
3555
3565
|
1. **Apply Global Classes**: Use "apply-global-class" tool to apply the global classes you created BEFORE building this composition
|
|
@@ -3559,10 +3569,8 @@ Now that you have these errors, fix them and try again. Errors regarding configu
|
|
|
3559
3569
|
2. **Fine-tune if needed**: Use "configure-element" tool only for element-specific adjustments that don't warrant global classes
|
|
3560
3570
|
|
|
3561
3571
|
Remember: Global classes ensure design consistency and reusability. Don't skip applying them!
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
${generatedXML}
|
|
3565
|
-
`;
|
|
3572
|
+
`
|
|
3573
|
+
};
|
|
3566
3574
|
}
|
|
3567
3575
|
});
|
|
3568
3576
|
};
|
|
@@ -3681,7 +3689,7 @@ var inputSchema2 = {
|
|
|
3681
3689
|
elementType: import_schema3.z.string().describe("The type of the element to retreive the schema"),
|
|
3682
3690
|
elementId: import_schema3.z.string().describe("The unique id of the element to configure")
|
|
3683
3691
|
};
|
|
3684
|
-
var
|
|
3692
|
+
var outputSchema2 = {
|
|
3685
3693
|
success: import_schema3.z.boolean().describe(
|
|
3686
3694
|
"Whether the configuration change was successful, only if propertyName and propertyValue are provided"
|
|
3687
3695
|
)
|
|
@@ -3694,7 +3702,7 @@ var initConfigureElementTool = (reg) => {
|
|
|
3694
3702
|
name: "configure-element",
|
|
3695
3703
|
description: configureElementToolPrompt,
|
|
3696
3704
|
schema: inputSchema2,
|
|
3697
|
-
outputSchema,
|
|
3705
|
+
outputSchema: outputSchema2,
|
|
3698
3706
|
requiredResources: [
|
|
3699
3707
|
{ description: "Widgets schema", uri: WIDGET_SCHEMA_URI },
|
|
3700
3708
|
{ description: "Styles schema", uri: STYLE_SCHEMA_URI }
|
|
@@ -3792,7 +3800,7 @@ var import_schema5 = require("@elementor/schema");
|
|
|
3792
3800
|
var schema = {
|
|
3793
3801
|
elementId: import_schema5.z.string()
|
|
3794
3802
|
};
|
|
3795
|
-
var
|
|
3803
|
+
var outputSchema3 = {
|
|
3796
3804
|
properties: import_schema5.z.record(import_schema5.z.string(), import_schema5.z.any()).describe("A record mapping PropTypes to their corresponding PropValues"),
|
|
3797
3805
|
style: import_schema5.z.record(import_schema5.z.string(), import_schema5.z.any()).describe("A record mapping StyleSchema properties to their corresponding PropValues"),
|
|
3798
3806
|
childElements: import_schema5.z.array(
|
|
@@ -3819,7 +3827,7 @@ var initGetElementConfigTool = (reg) => {
|
|
|
3819
3827
|
name: "get-element-configuration-values",
|
|
3820
3828
|
description: "Retrieve the element's configuration PropValues for a specific element by unique ID.",
|
|
3821
3829
|
schema,
|
|
3822
|
-
outputSchema:
|
|
3830
|
+
outputSchema: outputSchema3,
|
|
3823
3831
|
modelPreferences: {
|
|
3824
3832
|
intelligencePriority: 0.6,
|
|
3825
3833
|
speedPriority: 0.9
|