@elementor/editor-canvas 4.4.0-1088 → 4.4.0-1089
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 +19 -0
- package/dist/index.mjs +19 -0
- package/package.json +20 -20
- package/src/legacy/create-nested-templated-element-type.ts +31 -1
- package/src/legacy/types.ts +1 -0
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3022,6 +3022,7 @@ function createTemplatedElementView({
|
|
|
3022
3022
|
}
|
|
3023
3023
|
|
|
3024
3024
|
// src/legacy/create-nested-templated-element-type.ts
|
|
3025
|
+
var STYLES_REFERENCE_UNTRACKED = /* @__PURE__ */ Symbol("styles-reference-untracked");
|
|
3025
3026
|
function canBeNestedTemplated(element) {
|
|
3026
3027
|
return canBeTemplated(element) && "support_nesting" in element && !!element.support_nesting;
|
|
3027
3028
|
}
|
|
@@ -3081,6 +3082,7 @@ function createNestedTemplatedElementView({
|
|
|
3081
3082
|
return AtomicElementBaseView.extend({
|
|
3082
3083
|
_abortController: null,
|
|
3083
3084
|
_lastResolvedSettingsHash: null,
|
|
3085
|
+
_lastRenderedStyles: STYLES_REFERENCE_UNTRACKED,
|
|
3084
3086
|
_domUpdateWasSkipped: false,
|
|
3085
3087
|
template: false,
|
|
3086
3088
|
attributes() {
|
|
@@ -3117,6 +3119,23 @@ function createNestedTemplatedElementView({
|
|
|
3117
3119
|
this._initAlpine();
|
|
3118
3120
|
});
|
|
3119
3121
|
this.model.trigger("render:complete");
|
|
3122
|
+
this._notifyStylesChanged();
|
|
3123
|
+
},
|
|
3124
|
+
// `document/elements/create` fires before the nested template has fully painted, so the
|
|
3125
|
+
// styles provider rebuilds CSS too early and misses the new local class IDs. Dispatching
|
|
3126
|
+
// ELEMENT_STYLE_CHANGE_EVENT here — after the template and all children are in the DOM —
|
|
3127
|
+
// gives the provider a second chance to regenerate CSS against the live class names.
|
|
3128
|
+
//
|
|
3129
|
+
// The reference-equality guard prevents a parent re-render from emitting one event per
|
|
3130
|
+
// unchanged descendant. Use a sentinel for the initial state — otherwise elements with no
|
|
3131
|
+
// local styles (undefined === undefined) would never notify, and descendants like e-heading
|
|
3132
|
+
// that rely on this post-paint refresh would lose their CSS after detach.
|
|
3133
|
+
_notifyStylesChanged() {
|
|
3134
|
+
const styles = this.model.get("styles");
|
|
3135
|
+
if (this._lastRenderedStyles !== STYLES_REFERENCE_UNTRACKED && styles === this._lastRenderedStyles) {
|
|
3136
|
+
return;
|
|
3137
|
+
}
|
|
3138
|
+
this._lastRenderedStyles = styles;
|
|
3120
3139
|
window.dispatchEvent(new CustomEvent(import_editor_elements6.ELEMENT_STYLE_CHANGE_EVENT));
|
|
3121
3140
|
},
|
|
3122
3141
|
async _renderTemplate() {
|
package/dist/index.mjs
CHANGED
|
@@ -2982,6 +2982,7 @@ function createTemplatedElementView({
|
|
|
2982
2982
|
}
|
|
2983
2983
|
|
|
2984
2984
|
// src/legacy/create-nested-templated-element-type.ts
|
|
2985
|
+
var STYLES_REFERENCE_UNTRACKED = /* @__PURE__ */ Symbol("styles-reference-untracked");
|
|
2985
2986
|
function canBeNestedTemplated(element) {
|
|
2986
2987
|
return canBeTemplated(element) && "support_nesting" in element && !!element.support_nesting;
|
|
2987
2988
|
}
|
|
@@ -3041,6 +3042,7 @@ function createNestedTemplatedElementView({
|
|
|
3041
3042
|
return AtomicElementBaseView.extend({
|
|
3042
3043
|
_abortController: null,
|
|
3043
3044
|
_lastResolvedSettingsHash: null,
|
|
3045
|
+
_lastRenderedStyles: STYLES_REFERENCE_UNTRACKED,
|
|
3044
3046
|
_domUpdateWasSkipped: false,
|
|
3045
3047
|
template: false,
|
|
3046
3048
|
attributes() {
|
|
@@ -3077,6 +3079,23 @@ function createNestedTemplatedElementView({
|
|
|
3077
3079
|
this._initAlpine();
|
|
3078
3080
|
});
|
|
3079
3081
|
this.model.trigger("render:complete");
|
|
3082
|
+
this._notifyStylesChanged();
|
|
3083
|
+
},
|
|
3084
|
+
// `document/elements/create` fires before the nested template has fully painted, so the
|
|
3085
|
+
// styles provider rebuilds CSS too early and misses the new local class IDs. Dispatching
|
|
3086
|
+
// ELEMENT_STYLE_CHANGE_EVENT here — after the template and all children are in the DOM —
|
|
3087
|
+
// gives the provider a second chance to regenerate CSS against the live class names.
|
|
3088
|
+
//
|
|
3089
|
+
// The reference-equality guard prevents a parent re-render from emitting one event per
|
|
3090
|
+
// unchanged descendant. Use a sentinel for the initial state — otherwise elements with no
|
|
3091
|
+
// local styles (undefined === undefined) would never notify, and descendants like e-heading
|
|
3092
|
+
// that rely on this post-paint refresh would lose their CSS after detach.
|
|
3093
|
+
_notifyStylesChanged() {
|
|
3094
|
+
const styles = this.model.get("styles");
|
|
3095
|
+
if (this._lastRenderedStyles !== STYLES_REFERENCE_UNTRACKED && styles === this._lastRenderedStyles) {
|
|
3096
|
+
return;
|
|
3097
|
+
}
|
|
3098
|
+
this._lastRenderedStyles = styles;
|
|
3080
3099
|
window.dispatchEvent(new CustomEvent(ELEMENT_STYLE_CHANGE_EVENT2));
|
|
3081
3100
|
},
|
|
3082
3101
|
async _renderTemplate() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-canvas",
|
|
3
3
|
"description": "Elementor Editor Canvas",
|
|
4
|
-
"version": "4.4.0-
|
|
4
|
+
"version": "4.4.0-1089",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,26 +37,26 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.4.0-
|
|
41
|
-
"@elementor/editor-controls": "4.4.0-
|
|
42
|
-
"@elementor/editor-documents": "4.4.0-
|
|
43
|
-
"@elementor/editor-elements": "4.4.0-
|
|
44
|
-
"@elementor/editor-interactions": "4.4.0-
|
|
45
|
-
"@elementor/editor-mcp": "4.4.0-
|
|
46
|
-
"@elementor/editor-notifications": "4.4.0-
|
|
47
|
-
"@elementor/editor-props": "4.4.0-
|
|
48
|
-
"@elementor/editor-responsive": "4.4.0-
|
|
49
|
-
"@elementor/editor-styles": "4.4.0-
|
|
50
|
-
"@elementor/editor-styles-repository": "4.4.0-
|
|
51
|
-
"@elementor/editor-ui": "4.4.0-
|
|
52
|
-
"@elementor/editor-v1-adapters": "4.4.0-
|
|
53
|
-
"@elementor/events": "4.4.0-
|
|
54
|
-
"@elementor/http-client": "4.4.0-
|
|
55
|
-
"@elementor/schema": "4.4.0-
|
|
56
|
-
"@elementor/twing": "4.4.0-
|
|
40
|
+
"@elementor/editor": "4.4.0-1089",
|
|
41
|
+
"@elementor/editor-controls": "4.4.0-1089",
|
|
42
|
+
"@elementor/editor-documents": "4.4.0-1089",
|
|
43
|
+
"@elementor/editor-elements": "4.4.0-1089",
|
|
44
|
+
"@elementor/editor-interactions": "4.4.0-1089",
|
|
45
|
+
"@elementor/editor-mcp": "4.4.0-1089",
|
|
46
|
+
"@elementor/editor-notifications": "4.4.0-1089",
|
|
47
|
+
"@elementor/editor-props": "4.4.0-1089",
|
|
48
|
+
"@elementor/editor-responsive": "4.4.0-1089",
|
|
49
|
+
"@elementor/editor-styles": "4.4.0-1089",
|
|
50
|
+
"@elementor/editor-styles-repository": "4.4.0-1089",
|
|
51
|
+
"@elementor/editor-ui": "4.4.0-1089",
|
|
52
|
+
"@elementor/editor-v1-adapters": "4.4.0-1089",
|
|
53
|
+
"@elementor/events": "4.4.0-1089",
|
|
54
|
+
"@elementor/http-client": "4.4.0-1089",
|
|
55
|
+
"@elementor/schema": "4.4.0-1089",
|
|
56
|
+
"@elementor/twing": "4.4.0-1089",
|
|
57
57
|
"@elementor/ui": "1.37.5",
|
|
58
|
-
"@elementor/utils": "4.4.0-
|
|
59
|
-
"@elementor/wp-media": "4.4.0-
|
|
58
|
+
"@elementor/utils": "4.4.0-1089",
|
|
59
|
+
"@elementor/wp-media": "4.4.0-1089",
|
|
60
60
|
"@floating-ui/react": "^0.27.5",
|
|
61
61
|
"@wordpress/i18n": "^5.13.0",
|
|
62
62
|
"dompurify": "^3.2.6"
|
|
@@ -12,7 +12,13 @@ import {
|
|
|
12
12
|
setupTwigRenderer,
|
|
13
13
|
waitForChildrenToComplete,
|
|
14
14
|
} from './twig-rendering-utils';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
type ElementModel,
|
|
17
|
+
type ElementType,
|
|
18
|
+
type ElementView,
|
|
19
|
+
type LegacyWindow,
|
|
20
|
+
type NestedTemplatedElementViewClass,
|
|
21
|
+
} from './types';
|
|
16
22
|
|
|
17
23
|
export type NestedTemplatedElementConfig = TemplatedElementConfig & {
|
|
18
24
|
allowed_child_types?: string[];
|
|
@@ -21,6 +27,8 @@ export type NestedTemplatedElementConfig = TemplatedElementConfig & {
|
|
|
21
27
|
|
|
22
28
|
export type ModelExtensions = Record< string, unknown >;
|
|
23
29
|
|
|
30
|
+
const STYLES_REFERENCE_UNTRACKED = Symbol( 'styles-reference-untracked' );
|
|
31
|
+
|
|
24
32
|
export type CreateNestedTemplatedElementTypeOptions = {
|
|
25
33
|
type: string;
|
|
26
34
|
renderer: DomRenderer;
|
|
@@ -108,6 +116,7 @@ export function createNestedTemplatedElementView( {
|
|
|
108
116
|
return AtomicElementBaseView.extend( {
|
|
109
117
|
_abortController: null as AbortController | null,
|
|
110
118
|
_lastResolvedSettingsHash: null as string | null,
|
|
119
|
+
_lastRenderedStyles: STYLES_REFERENCE_UNTRACKED as typeof STYLES_REFERENCE_UNTRACKED | ElementModel[ 'styles' ],
|
|
111
120
|
_domUpdateWasSkipped: false,
|
|
112
121
|
|
|
113
122
|
template: false,
|
|
@@ -164,6 +173,27 @@ export function createNestedTemplatedElementView( {
|
|
|
164
173
|
} );
|
|
165
174
|
|
|
166
175
|
this.model.trigger( 'render:complete' );
|
|
176
|
+
this._notifyStylesChanged();
|
|
177
|
+
},
|
|
178
|
+
|
|
179
|
+
// `document/elements/create` fires before the nested template has fully painted, so the
|
|
180
|
+
// styles provider rebuilds CSS too early and misses the new local class IDs. Dispatching
|
|
181
|
+
// ELEMENT_STYLE_CHANGE_EVENT here — after the template and all children are in the DOM —
|
|
182
|
+
// gives the provider a second chance to regenerate CSS against the live class names.
|
|
183
|
+
//
|
|
184
|
+
// The reference-equality guard prevents a parent re-render from emitting one event per
|
|
185
|
+
// unchanged descendant. Use a sentinel for the initial state — otherwise elements with no
|
|
186
|
+
// local styles (undefined === undefined) would never notify, and descendants like e-heading
|
|
187
|
+
// that rely on this post-paint refresh would lose their CSS after detach.
|
|
188
|
+
_notifyStylesChanged() {
|
|
189
|
+
const styles = this.model.get( 'styles' );
|
|
190
|
+
|
|
191
|
+
if ( this._lastRenderedStyles !== STYLES_REFERENCE_UNTRACKED && styles === this._lastRenderedStyles ) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
this._lastRenderedStyles = styles;
|
|
196
|
+
|
|
167
197
|
window.dispatchEvent( new CustomEvent( ELEMENT_STYLE_CHANGE_EVENT ) );
|
|
168
198
|
},
|
|
169
199
|
|
package/src/legacy/types.ts
CHANGED
|
@@ -229,6 +229,7 @@ export type ElementModel = {
|
|
|
229
229
|
elType: string;
|
|
230
230
|
settings: BackboneModel< Props >;
|
|
231
231
|
editor_settings: Record< string, unknown >;
|
|
232
|
+
styles?: V1ElementModelProps[ 'styles' ];
|
|
232
233
|
widgetType: string;
|
|
233
234
|
editSettings?: BackboneModel< { inactive?: boolean } >;
|
|
234
235
|
elements?: BackboneCollection< ElementModel >;
|