@elementor/editor-canvas 4.0.2 → 4.0.3
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 +23 -1
- package/dist/index.mjs +23 -1
- package/package.json +18 -18
- package/src/legacy/create-templated-element-type.ts +33 -1
package/dist/index.js
CHANGED
|
@@ -2119,7 +2119,7 @@ function createTemplatedElementView({
|
|
|
2119
2119
|
this.triggerMethod("render:template");
|
|
2120
2120
|
}
|
|
2121
2121
|
afterSettingsResolve(settings) {
|
|
2122
|
-
return settings;
|
|
2122
|
+
return this._getLinkAttributes(settings);
|
|
2123
2123
|
}
|
|
2124
2124
|
_beforeRender() {
|
|
2125
2125
|
createBeforeRender(this);
|
|
@@ -2142,6 +2142,28 @@ function createTemplatedElementView({
|
|
|
2142
2142
|
const id = this.model.get("id");
|
|
2143
2143
|
return originId ?? id;
|
|
2144
2144
|
}
|
|
2145
|
+
_getLinkAttributes(settings) {
|
|
2146
|
+
const linkAttributes = Object.entries(this._handleActionLinkAttributes(settings)).map(([key, value]) => `${key}="${value}"`).join(" ");
|
|
2147
|
+
return {
|
|
2148
|
+
...settings,
|
|
2149
|
+
link: linkAttributes ? {
|
|
2150
|
+
tag: settings?.link?.tag,
|
|
2151
|
+
attributes: linkAttributes
|
|
2152
|
+
} : null
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
_handleActionLinkAttributes(settings) {
|
|
2156
|
+
const link = settings.link;
|
|
2157
|
+
if (!link || typeof link !== "object" || !("href" in link) || !link.href) {
|
|
2158
|
+
return {};
|
|
2159
|
+
}
|
|
2160
|
+
const isActionLink = "tag" in link && link.tag === "button";
|
|
2161
|
+
const urlAttrKey = isActionLink ? "data-action-link" : "href";
|
|
2162
|
+
return {
|
|
2163
|
+
[urlAttrKey]: link.href,
|
|
2164
|
+
target: ("target" in link && link.target) ?? "_self"
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2145
2167
|
};
|
|
2146
2168
|
}
|
|
2147
2169
|
|
package/dist/index.mjs
CHANGED
|
@@ -2085,7 +2085,7 @@ function createTemplatedElementView({
|
|
|
2085
2085
|
this.triggerMethod("render:template");
|
|
2086
2086
|
}
|
|
2087
2087
|
afterSettingsResolve(settings) {
|
|
2088
|
-
return settings;
|
|
2088
|
+
return this._getLinkAttributes(settings);
|
|
2089
2089
|
}
|
|
2090
2090
|
_beforeRender() {
|
|
2091
2091
|
createBeforeRender(this);
|
|
@@ -2108,6 +2108,28 @@ function createTemplatedElementView({
|
|
|
2108
2108
|
const id = this.model.get("id");
|
|
2109
2109
|
return originId ?? id;
|
|
2110
2110
|
}
|
|
2111
|
+
_getLinkAttributes(settings) {
|
|
2112
|
+
const linkAttributes = Object.entries(this._handleActionLinkAttributes(settings)).map(([key, value]) => `${key}="${value}"`).join(" ");
|
|
2113
|
+
return {
|
|
2114
|
+
...settings,
|
|
2115
|
+
link: linkAttributes ? {
|
|
2116
|
+
tag: settings?.link?.tag,
|
|
2117
|
+
attributes: linkAttributes
|
|
2118
|
+
} : null
|
|
2119
|
+
};
|
|
2120
|
+
}
|
|
2121
|
+
_handleActionLinkAttributes(settings) {
|
|
2122
|
+
const link = settings.link;
|
|
2123
|
+
if (!link || typeof link !== "object" || !("href" in link) || !link.href) {
|
|
2124
|
+
return {};
|
|
2125
|
+
}
|
|
2126
|
+
const isActionLink = "tag" in link && link.tag === "button";
|
|
2127
|
+
const urlAttrKey = isActionLink ? "data-action-link" : "href";
|
|
2128
|
+
return {
|
|
2129
|
+
[urlAttrKey]: link.href,
|
|
2130
|
+
target: ("target" in link && link.target) ?? "_self"
|
|
2131
|
+
};
|
|
2132
|
+
}
|
|
2111
2133
|
};
|
|
2112
2134
|
}
|
|
2113
2135
|
|
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.0.
|
|
4
|
+
"version": "4.0.3",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -37,25 +37,25 @@
|
|
|
37
37
|
"react-dom": "^18.3.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@elementor/editor": "4.0.
|
|
40
|
+
"@elementor/editor": "4.0.3",
|
|
41
41
|
"dompurify": "^3.2.6",
|
|
42
|
-
"@elementor/editor-controls": "4.0.
|
|
43
|
-
"@elementor/editor-documents": "4.0.
|
|
44
|
-
"@elementor/editor-elements": "4.0.
|
|
45
|
-
"@elementor/editor-interactions": "4.0.
|
|
46
|
-
"@elementor/editor-mcp": "4.0.
|
|
47
|
-
"@elementor/editor-notifications": "4.0.
|
|
48
|
-
"@elementor/editor-props": "4.0.
|
|
49
|
-
"@elementor/editor-responsive": "4.0.
|
|
50
|
-
"@elementor/editor-styles": "4.0.
|
|
51
|
-
"@elementor/editor-styles-repository": "4.0.
|
|
52
|
-
"@elementor/editor-ui": "4.0.
|
|
53
|
-
"@elementor/editor-v1-adapters": "4.0.
|
|
54
|
-
"@elementor/schema": "4.0.
|
|
55
|
-
"@elementor/twing": "4.0.
|
|
42
|
+
"@elementor/editor-controls": "4.0.3",
|
|
43
|
+
"@elementor/editor-documents": "4.0.3",
|
|
44
|
+
"@elementor/editor-elements": "4.0.3",
|
|
45
|
+
"@elementor/editor-interactions": "4.0.3",
|
|
46
|
+
"@elementor/editor-mcp": "4.0.3",
|
|
47
|
+
"@elementor/editor-notifications": "4.0.3",
|
|
48
|
+
"@elementor/editor-props": "4.0.3",
|
|
49
|
+
"@elementor/editor-responsive": "4.0.3",
|
|
50
|
+
"@elementor/editor-styles": "4.0.3",
|
|
51
|
+
"@elementor/editor-styles-repository": "4.0.3",
|
|
52
|
+
"@elementor/editor-ui": "4.0.3",
|
|
53
|
+
"@elementor/editor-v1-adapters": "4.0.3",
|
|
54
|
+
"@elementor/schema": "4.0.3",
|
|
55
|
+
"@elementor/twing": "4.0.3",
|
|
56
56
|
"@elementor/ui": "1.36.17",
|
|
57
|
-
"@elementor/utils": "4.0.
|
|
58
|
-
"@elementor/wp-media": "4.0.
|
|
57
|
+
"@elementor/utils": "4.0.3",
|
|
58
|
+
"@elementor/wp-media": "4.0.3",
|
|
59
59
|
"@floating-ui/react": "^0.27.5",
|
|
60
60
|
"@wordpress/i18n": "^5.13.0"
|
|
61
61
|
},
|
|
@@ -186,7 +186,7 @@ export function createTemplatedElementView( {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
afterSettingsResolve( settings: { [ key: string ]: unknown } ) {
|
|
189
|
-
return settings;
|
|
189
|
+
return this._getLinkAttributes( settings );
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
_beforeRender() {
|
|
@@ -214,5 +214,37 @@ export function createTemplatedElementView( {
|
|
|
214
214
|
|
|
215
215
|
return originId ?? id;
|
|
216
216
|
}
|
|
217
|
+
|
|
218
|
+
_getLinkAttributes( settings: { [ key: string ]: unknown } ) {
|
|
219
|
+
const linkAttributes = Object.entries( this._handleActionLinkAttributes( settings ) )
|
|
220
|
+
.map( ( [ key, value ] ) => `${ key }="${ value }"` )
|
|
221
|
+
.join( ' ' );
|
|
222
|
+
|
|
223
|
+
return {
|
|
224
|
+
...settings,
|
|
225
|
+
link: linkAttributes
|
|
226
|
+
? {
|
|
227
|
+
tag: ( settings?.link as { tag?: string } )?.tag,
|
|
228
|
+
attributes: linkAttributes,
|
|
229
|
+
}
|
|
230
|
+
: null,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
_handleActionLinkAttributes( settings: { [ key: string ]: unknown } ) {
|
|
235
|
+
const link = settings.link;
|
|
236
|
+
|
|
237
|
+
if ( ! link || typeof link !== 'object' || ! ( 'href' in link ) || ! link.href ) {
|
|
238
|
+
return {};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const isActionLink = 'tag' in link && link.tag === 'button';
|
|
242
|
+
const urlAttrKey = isActionLink ? 'data-action-link' : 'href';
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
[ urlAttrKey ]: link.href,
|
|
246
|
+
target: ( 'target' in link && link.target ) ?? '_self',
|
|
247
|
+
};
|
|
248
|
+
}
|
|
217
249
|
};
|
|
218
250
|
}
|