@elementor/editor-controls 3.35.0-374 → 3.35.0-376
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 +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/inline-editor.tsx +35 -28
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-controls",
|
|
3
3
|
"description": "This package contains the controls model and utils for the Elementor editor",
|
|
4
|
-
"version": "3.35.0-
|
|
4
|
+
"version": "3.35.0-376",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor-current-user": "3.35.0-
|
|
44
|
-
"@elementor/editor-elements": "3.35.0-
|
|
45
|
-
"@elementor/editor-props": "3.35.0-
|
|
46
|
-
"@elementor/editor-responsive": "3.35.0-
|
|
47
|
-
"@elementor/editor-ui": "3.35.0-
|
|
48
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
49
|
-
"@elementor/env": "3.35.0-
|
|
50
|
-
"@elementor/http-client": "3.35.0-
|
|
43
|
+
"@elementor/editor-current-user": "3.35.0-376",
|
|
44
|
+
"@elementor/editor-elements": "3.35.0-376",
|
|
45
|
+
"@elementor/editor-props": "3.35.0-376",
|
|
46
|
+
"@elementor/editor-responsive": "3.35.0-376",
|
|
47
|
+
"@elementor/editor-ui": "3.35.0-376",
|
|
48
|
+
"@elementor/editor-v1-adapters": "3.35.0-376",
|
|
49
|
+
"@elementor/env": "3.35.0-376",
|
|
50
|
+
"@elementor/http-client": "3.35.0-376",
|
|
51
51
|
"@elementor/icons": "^1.63.0",
|
|
52
|
-
"@elementor/locations": "3.35.0-
|
|
53
|
-
"@elementor/mixpanel": "3.35.0-
|
|
54
|
-
"@elementor/query": "3.35.0-
|
|
55
|
-
"@elementor/session": "3.35.0-
|
|
52
|
+
"@elementor/locations": "3.35.0-376",
|
|
53
|
+
"@elementor/mixpanel": "3.35.0-376",
|
|
54
|
+
"@elementor/query": "3.35.0-376",
|
|
55
|
+
"@elementor/session": "3.35.0-376",
|
|
56
56
|
"@elementor/ui": "1.36.17",
|
|
57
|
-
"@elementor/utils": "3.35.0-
|
|
58
|
-
"@elementor/wp-media": "3.35.0-
|
|
57
|
+
"@elementor/utils": "3.35.0-376",
|
|
58
|
+
"@elementor/wp-media": "3.35.0-376",
|
|
59
59
|
"@wordpress/i18n": "^5.13.0",
|
|
60
60
|
"@monaco-editor/react": "^4.7.0",
|
|
61
61
|
"dayjs": "^1.11.18",
|
|
@@ -62,6 +62,40 @@ const calcSelectionCenter = (
|
|
|
62
62
|
return { left, top };
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
type WrapperProps = React.PropsWithChildren< {
|
|
66
|
+
containerRef: React.RefObject< HTMLDivElement >;
|
|
67
|
+
editor: ReturnType< typeof useEditor >;
|
|
68
|
+
sx: SxProps< Theme >;
|
|
69
|
+
onBlur?: ( event: Event ) => void;
|
|
70
|
+
} >;
|
|
71
|
+
|
|
72
|
+
const Wrapper = ( { children, containerRef, editor, sx, onBlur }: WrapperProps ) => {
|
|
73
|
+
const wrappedChildren = (
|
|
74
|
+
<Box ref={ containerRef } { ...sx }>
|
|
75
|
+
{ children }
|
|
76
|
+
</Box>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return onBlur ? (
|
|
80
|
+
<ClickAwayListener
|
|
81
|
+
onClickAway={ ( event: PointerEvent ) => {
|
|
82
|
+
if (
|
|
83
|
+
containerRef.current?.contains( event.target as Node ) ||
|
|
84
|
+
editor.view.dom.contains( event.target as Node )
|
|
85
|
+
) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onBlur?.( event );
|
|
90
|
+
} }
|
|
91
|
+
>
|
|
92
|
+
{ wrappedChildren }
|
|
93
|
+
</ClickAwayListener>
|
|
94
|
+
) : (
|
|
95
|
+
<>{ wrappedChildren }</>
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
|
|
65
99
|
export const InlineEditor = React.forwardRef(
|
|
66
100
|
(
|
|
67
101
|
{
|
|
@@ -202,36 +236,9 @@ export const InlineEditor = React.forwardRef(
|
|
|
202
236
|
};
|
|
203
237
|
};
|
|
204
238
|
|
|
205
|
-
const Wrapper = ( { children }: React.PropsWithChildren ) => {
|
|
206
|
-
const wrappedChildren = (
|
|
207
|
-
<Box ref={ containerRef } { ...sx }>
|
|
208
|
-
{ children }
|
|
209
|
-
</Box>
|
|
210
|
-
);
|
|
211
|
-
|
|
212
|
-
return onBlur ? (
|
|
213
|
-
<ClickAwayListener
|
|
214
|
-
onClickAway={ ( event: PointerEvent ) => {
|
|
215
|
-
if (
|
|
216
|
-
containerRef.current?.contains( event.target as Node ) ||
|
|
217
|
-
editor.view.dom.contains( event.target as Node )
|
|
218
|
-
) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
onBlur?.( event );
|
|
223
|
-
} }
|
|
224
|
-
>
|
|
225
|
-
{ wrappedChildren }
|
|
226
|
-
</ClickAwayListener>
|
|
227
|
-
) : (
|
|
228
|
-
<>{ wrappedChildren }</>
|
|
229
|
-
);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
239
|
return (
|
|
233
240
|
<>
|
|
234
|
-
<Wrapper>
|
|
241
|
+
<Wrapper containerRef={ containerRef } editor={ editor } sx={ sx } onBlur={ onBlur }>
|
|
235
242
|
<EditorContent ref={ ref } editor={ editor } />
|
|
236
243
|
</Wrapper>
|
|
237
244
|
{ showToolbar && containerRef.current && (
|