@blaze-cms/nextjs-tools 0.146.0-node18-core-styles-tooltips.8 → 0.146.0-node18-core-styles-tooltips.11
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/CHANGELOG.md +12 -0
- package/README.md +6 -0
- package/build/next.base.config.js +7 -0
- package/lib/blaze.config.js +2 -0
- package/lib/blaze.config.js.map +1 -1
- package/lib/components/DebugSidebar/index.js +13 -8
- package/lib/components/DebugSidebar/index.js.map +1 -1
- package/lib/constants.js +5 -1
- package/lib/constants.js.map +1 -1
- package/lib/containers/ContentContainer.js +4 -5
- package/lib/containers/ContentContainer.js.map +1 -1
- package/lib/helpers/check-url.js +74 -35
- package/lib/helpers/check-url.js.map +1 -1
- package/lib-es/blaze.config.js +2 -0
- package/lib-es/blaze.config.js.map +1 -1
- package/lib-es/components/DebugSidebar/index.js +13 -8
- package/lib-es/components/DebugSidebar/index.js.map +1 -1
- package/lib-es/constants.js +5 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/containers/ContentContainer.js +4 -8
- package/lib-es/containers/ContentContainer.js.map +1 -1
- package/lib-es/helpers/check-url.js +77 -30
- package/lib-es/helpers/check-url.js.map +1 -1
- package/package.json +8 -7
- package/src/blaze.config.js +2 -0
- package/src/components/DebugSidebar/index.js +10 -4
- package/src/constants.js +5 -1
- package/src/containers/ContentContainer.js +4 -7
- package/src/helpers/check-url.js +59 -24
- package/tests/unit/src/__snapshots__/constants.test.js.snap +3 -0
- package/tests/unit/src/helpers/check-url.test.js +37 -12
- package/lib/components/EditorMode/BlazeLogo.js +0 -21
- package/lib/components/EditorMode/BlazeLogo.js.map +0 -1
- package/lib/components/EditorMode/EditorMode.js +0 -72
- package/lib/components/EditorMode/EditorMode.js.map +0 -1
- package/lib/components/EditorMode/constants.js +0 -9
- package/lib/components/EditorMode/constants.js.map +0 -1
- package/lib/components/EditorMode/index.js +0 -11
- package/lib/components/EditorMode/index.js.map +0 -1
- package/lib-es/components/EditorMode/BlazeLogo.js +0 -12
- package/lib-es/components/EditorMode/BlazeLogo.js.map +0 -1
- package/lib-es/components/EditorMode/EditorMode.js +0 -62
- package/lib-es/components/EditorMode/EditorMode.js.map +0 -1
- package/lib-es/components/EditorMode/constants.js +0 -2
- package/lib-es/components/EditorMode/constants.js.map +0 -1
- package/lib-es/components/EditorMode/index.js +0 -3
- package/lib-es/components/EditorMode/index.js.map +0 -1
- package/src/components/EditorMode/BlazeLogo.js +0 -12
- package/src/components/EditorMode/EditorMode.js +0 -59
- package/src/components/EditorMode/constants.js +0 -1
- package/src/components/EditorMode/index.js +0 -3
|
@@ -3,9 +3,8 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { buildPBComponents, getLightboxImages } from '@blaze-cms/plugin-page-builder-fe';
|
|
4
4
|
import { Header, MainContextProvider } from '@blaze-cms/nextjs-components';
|
|
5
5
|
import { getSearchFilter, checkForGtm } from '../helpers';
|
|
6
|
-
import {
|
|
6
|
+
import { PREVIEW_MODE } from '../constants';
|
|
7
7
|
import { DebugSidebar } from '../components';
|
|
8
|
-
import getFromLocal from '../helpers/get-from-local';
|
|
9
8
|
|
|
10
9
|
const ContentContainer = ({ fullUrl, pageData, isPreview, itemId, itemEntity }) => {
|
|
11
10
|
const [open, setOpen] = useState(false);
|
|
@@ -15,8 +14,6 @@ const ContentContainer = ({ fullUrl, pageData, isPreview, itemId, itemEntity })
|
|
|
15
14
|
|
|
16
15
|
useEffect(
|
|
17
16
|
() => {
|
|
18
|
-
const isEditorModeEnabled = getFromLocal(BLAZE_PB_EDITOR_MODE);
|
|
19
|
-
updatedDebugOptions('editorModeEnabled', isEditorModeEnabled);
|
|
20
17
|
if (open) setOpen(false);
|
|
21
18
|
},
|
|
22
19
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -51,15 +48,15 @@ const ContentContainer = ({ fullUrl, pageData, isPreview, itemId, itemEntity })
|
|
|
51
48
|
hasGTM
|
|
52
49
|
};
|
|
53
50
|
|
|
54
|
-
const updatedDebugOptions = (
|
|
51
|
+
const updatedDebugOptions = (newOptions = {}) => {
|
|
55
52
|
setDebugOptions({
|
|
56
53
|
...debugOptions,
|
|
57
|
-
|
|
54
|
+
...newOptions
|
|
58
55
|
});
|
|
59
56
|
};
|
|
60
57
|
|
|
61
58
|
return (
|
|
62
|
-
<MainContextProvider value={{ fullUrl, isPreview, itemId, hasGTM, debugOptions }}>
|
|
59
|
+
<MainContextProvider value={{ fullUrl, isPreview, itemId, itemEntity, hasGTM, debugOptions }}>
|
|
63
60
|
<Header {...metaProps} />
|
|
64
61
|
<DebugSidebar
|
|
65
62
|
itemId={itemId}
|
package/src/helpers/check-url.js
CHANGED
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
COLON,
|
|
8
8
|
NOT_FOUND_STATUS_CODE,
|
|
9
9
|
BLAZE_X_FRAME_OPTIONS_DEFAULT,
|
|
10
|
-
ROUTE_REGEX
|
|
10
|
+
ROUTE_REGEX,
|
|
11
|
+
ERROR_URLS
|
|
11
12
|
} from '../constants';
|
|
12
13
|
import { checkUrlQuery } from '../application/query';
|
|
13
14
|
import checkParent from './check-parent';
|
|
@@ -88,7 +89,8 @@ const getFullUrl = (req, asPath) => {
|
|
|
88
89
|
return `${protocol}${DOUBLE_SLASH}${hostname}${urlPort}${asPath}`;
|
|
89
90
|
};
|
|
90
91
|
|
|
91
|
-
const doUrlCheck = async
|
|
92
|
+
const doUrlCheck = async args => {
|
|
93
|
+
const { asPath, url, apolloClient, res, blazeApp, errorCheckCode = false } = args;
|
|
92
94
|
try {
|
|
93
95
|
if (!ROUTE_REGEX.test(url)) {
|
|
94
96
|
throw Error('Invalid URL');
|
|
@@ -99,22 +101,18 @@ const doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blaz
|
|
|
99
101
|
variables: { url }
|
|
100
102
|
});
|
|
101
103
|
|
|
102
|
-
|
|
104
|
+
setCustomCacheControlHeaders(pageData, res);
|
|
103
105
|
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
+
if (urlTo && (urlTo !== url || errorCheckCode)) {
|
|
107
|
+
return handleRedirect({ errorCheckCode, url, urlTo, asPath, res });
|
|
106
108
|
}
|
|
109
|
+
const rootSelectorClasses = getRootSelectorClasses(url, getRootClassesLimit());
|
|
107
110
|
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
const queryString = asPath.split('?')[1];
|
|
112
|
-
redirectUrl = queryString ? `${urlTo}?${queryString}` : urlTo;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return doRedirect(res, redirectUrl);
|
|
111
|
+
if (errorCheckCode) {
|
|
112
|
+
blazeApp.events.emit('monitor:log', { message: `Serving custom ${errorCheckCode} page` });
|
|
113
|
+
if (res) res.statusCode = errorCheckCode;
|
|
116
114
|
}
|
|
117
|
-
|
|
115
|
+
|
|
118
116
|
return {
|
|
119
117
|
pageData,
|
|
120
118
|
rootSelectorClasses,
|
|
@@ -122,16 +120,7 @@ const doUrlCheck = async ({ asPath, url, apolloClient, res, handle404Error, blaz
|
|
|
122
120
|
itemEntity: getUnpublishedEntityName(itemEntity)
|
|
123
121
|
};
|
|
124
122
|
} catch (err) {
|
|
125
|
-
|
|
126
|
-
return handleError(err, res, handle404Error, blazeApp);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const parentPATH = checkParent(url);
|
|
130
|
-
if (handle404Error && parentPATH) {
|
|
131
|
-
return doRedirect(res, parentPATH);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return handleError(err, res, handle404Error, blazeApp);
|
|
123
|
+
return handleUrlError(err, args);
|
|
135
124
|
}
|
|
136
125
|
};
|
|
137
126
|
|
|
@@ -150,6 +139,30 @@ const handleError = (err, res, handle404Error, blazeApp) => {
|
|
|
150
139
|
return {};
|
|
151
140
|
};
|
|
152
141
|
|
|
142
|
+
function handleRedirect({ errorCheckCode, url, urlTo, asPath, res }) {
|
|
143
|
+
if (errorCheckCode) {
|
|
144
|
+
const errorMessage = `Cannot redirect ${url}`;
|
|
145
|
+
const customError = new Error(errorMessage);
|
|
146
|
+
customError.graphQLErrors = [errorMessage];
|
|
147
|
+
throw customError;
|
|
148
|
+
}
|
|
149
|
+
let redirectUrl = urlTo;
|
|
150
|
+
if (process.env.BLAZE_DISABLE_REDIRECT_WITH_QUERY !== 'true') {
|
|
151
|
+
const queryString = asPath.split('?')[1];
|
|
152
|
+
redirectUrl = queryString ? `${urlTo}?${queryString}` : urlTo;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return doRedirect(res, redirectUrl);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function setCustomCacheControlHeaders(pageData, res) {
|
|
159
|
+
const { cacheControlMaxAge = null } = pageData || {};
|
|
160
|
+
|
|
161
|
+
if (res && cacheControlMaxAge !== null && cacheControlMaxAge >= 0) {
|
|
162
|
+
res.setHeader('Cache-Control', `max-age=${cacheControlMaxAge}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
153
166
|
function doRedirect(res, redirectUrl) {
|
|
154
167
|
if (res) {
|
|
155
168
|
res.writeHead(301, { Location: redirectUrl });
|
|
@@ -161,4 +174,26 @@ function doRedirect(res, redirectUrl) {
|
|
|
161
174
|
return { redirecting: true };
|
|
162
175
|
}
|
|
163
176
|
|
|
177
|
+
function handleUrlError(err, args) {
|
|
178
|
+
const { asPath, res, handle404Error, blazeApp, errorCheckCode } = args;
|
|
179
|
+
if (!err.graphQLErrors || !err.graphQLErrors.length) {
|
|
180
|
+
return handleError(err, res, handle404Error, blazeApp);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (!errorCheckCode) {
|
|
184
|
+
return doUrlCheck({
|
|
185
|
+
...args,
|
|
186
|
+
url: ERROR_URLS.custom404,
|
|
187
|
+
errorCheckCode: NOT_FOUND_STATUS_CODE
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const parentPATH = checkParent(asPath);
|
|
192
|
+
if (handle404Error && parentPATH) {
|
|
193
|
+
return doRedirect(res, parentPATH);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return handleError(err, res, handle404Error, blazeApp);
|
|
197
|
+
}
|
|
198
|
+
|
|
164
199
|
export default checkUrl;
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
6
|
|
|
7
7
|
import checkUrl from '../../../../src/helpers/check-url';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ROUTE_PATTERN_SITEMAP,
|
|
10
|
+
NOT_FOUND_STATUS_CODE,
|
|
11
|
+
ERROR_URLS
|
|
12
|
+
} from '../../../../src/constants';
|
|
9
13
|
import { checkUrlQuery } from '../../../../src/application/query';
|
|
10
14
|
|
|
11
15
|
import handleStaticRoutes from '../../../../src/helpers/handle-static-routes';
|
|
@@ -82,6 +86,11 @@ describe('Check url', () => {
|
|
|
82
86
|
|
|
83
87
|
const queryString = '?query=string';
|
|
84
88
|
const asPathWithQuery = `${asPath}${queryString}`;
|
|
89
|
+
const notFoundQueryMock = async () => {
|
|
90
|
+
const error = new Error('Not found');
|
|
91
|
+
error.graphQLErrors = ['error'];
|
|
92
|
+
throw error;
|
|
93
|
+
};
|
|
85
94
|
|
|
86
95
|
beforeAll(() => {
|
|
87
96
|
setEnvs(envs);
|
|
@@ -228,11 +237,9 @@ describe('Check url', () => {
|
|
|
228
237
|
});
|
|
229
238
|
|
|
230
239
|
it('should handle redirect to parent on not found', async () => {
|
|
231
|
-
apolloClient.query
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
throw error;
|
|
235
|
-
});
|
|
240
|
+
apolloClient.query
|
|
241
|
+
.mockImplementationOnce(notFoundQueryMock)
|
|
242
|
+
.mockImplementationOnce(notFoundQueryMock);
|
|
236
243
|
const parentChildAsPath = '/parent/child';
|
|
237
244
|
const result = await checkUrl({ ...props, asPath: parentChildAsPath });
|
|
238
245
|
expect(res.writeHead).toHaveBeenCalledWith(301, { Location: '/parent' });
|
|
@@ -241,12 +248,14 @@ describe('Check url', () => {
|
|
|
241
248
|
apolloQueryCheck(apolloClient, parentChildAsPath);
|
|
242
249
|
});
|
|
243
250
|
|
|
244
|
-
it('should handle redirect to parent on not found', async () => {
|
|
245
|
-
apolloClient.query
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
it('should handle redirect to parent on not found where custom 404 is redirect is returned', async () => {
|
|
252
|
+
apolloClient.query
|
|
253
|
+
.mockImplementationOnce(notFoundQueryMock)
|
|
254
|
+
.mockImplementationOnce(async () => ({
|
|
255
|
+
data: {
|
|
256
|
+
checkUrl: { urlTo: ERROR_URLS.custom404 }
|
|
257
|
+
}
|
|
258
|
+
}));
|
|
250
259
|
const result = await checkUrl({ ...props });
|
|
251
260
|
expect(result).toHaveProperty('errorCode', NOT_FOUND_STATUS_CODE);
|
|
252
261
|
expect(res.statusCode).toEqual(NOT_FOUND_STATUS_CODE);
|
|
@@ -257,6 +266,22 @@ describe('Check url', () => {
|
|
|
257
266
|
apolloQueryCheck(apolloClient, asPath);
|
|
258
267
|
});
|
|
259
268
|
|
|
269
|
+
it('should fetch custom-error-404 page when original URL is not found', async () => {
|
|
270
|
+
apolloClient.query.mockImplementationOnce(notFoundQueryMock);
|
|
271
|
+
const notFoundPageUrl = '/non-existent-page';
|
|
272
|
+
const result = await checkUrl({ ...props, asPath: notFoundPageUrl });
|
|
273
|
+
|
|
274
|
+
expect(result).toMatchObject({
|
|
275
|
+
itemEntity: 'page',
|
|
276
|
+
itemId: 'RECORD_ID',
|
|
277
|
+
rootSelectorClasses: rootClassesMockValue,
|
|
278
|
+
pageData: { pageData: true },
|
|
279
|
+
fullUrl: `https://localhost${notFoundPageUrl}`
|
|
280
|
+
});
|
|
281
|
+
expect(result.fullUrl.endsWith('/non-existent-page')).toBe(true);
|
|
282
|
+
expect(blazeApp.events.emit).toHaveBeenCalled();
|
|
283
|
+
});
|
|
284
|
+
|
|
260
285
|
it('should handle network error', async () => {
|
|
261
286
|
apolloClient.query.mockImplementationOnce(async () => {
|
|
262
287
|
const err = new Error('Network error');
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var BlazeLogo = function BlazeLogo() {
|
|
9
|
-
return /*#__PURE__*/React.createElement("svg", {
|
|
10
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
-
width: "22",
|
|
12
|
-
height: "33"
|
|
13
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
14
|
-
fill: "currentColor",
|
|
15
|
-
transform: "translate(1.0415 1.85962)",
|
|
16
|
-
d: "M7.0214715 6.2017469C7.0214715 6.2017469 4.6948299 13.380771 5.2965479 15.065234C5.6174636 15.947572 6.3796396 16.18821 7.3022733 15.386085C9.1074257 13.781834 13.078762 6.3621721 9.949831 0.42644304C8.7463951 -1.8596147 18.293648 5.1589837 16.328037 18.755013C16.087351 20.559793 16.809412 19.998306 17.250671 19.236286C19.176168 15.947572 17.972733 11.616095 17.972733 10.894181C17.972733 10.172268 19.657541 12.939602 19.777885 18.353949C19.89823 23.768295 17.050098 29.022219 11.393953 29.98477C10.03006 30.225407 13.199106 27.578392 13.640366 24.610529C13.68048 24.329784 10.39109 28.300306 9.5888004 27.738817C9.2277699 27.49818 15.36529 19.877987 13.199106 13.300558C13.158992 13.140133 11.754984 24.409996 6.3796396 27.097116C3.3309369 28.621155 0.60315031 25.051697 0.12177619 21.963514C-1.0415446 13.862046 6.4999828 8.7284422 7.0214715 6.2017469Z",
|
|
17
|
-
fillRule: "evenodd"
|
|
18
|
-
}));
|
|
19
|
-
};
|
|
20
|
-
var _default = exports["default"] = BlazeLogo;
|
|
21
|
-
//# sourceMappingURL=BlazeLogo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlazeLogo.js","names":["BlazeLogo","React","createElement","xmlns","width","height","fill","transform","d","fillRule","_default","exports"],"sources":["../../../src/components/EditorMode/BlazeLogo.js"],"sourcesContent":["const BlazeLogo = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"33\">\n <path\n fill=\"currentColor\"\n transform=\"translate(1.0415 1.85962)\"\n d=\"M7.0214715 6.2017469C7.0214715 6.2017469 4.6948299 13.380771 5.2965479 15.065234C5.6174636 15.947572 6.3796396 16.18821 7.3022733 15.386085C9.1074257 13.781834 13.078762 6.3621721 9.949831 0.42644304C8.7463951 -1.8596147 18.293648 5.1589837 16.328037 18.755013C16.087351 20.559793 16.809412 19.998306 17.250671 19.236286C19.176168 15.947572 17.972733 11.616095 17.972733 10.894181C17.972733 10.172268 19.657541 12.939602 19.777885 18.353949C19.89823 23.768295 17.050098 29.022219 11.393953 29.98477C10.03006 30.225407 13.199106 27.578392 13.640366 24.610529C13.68048 24.329784 10.39109 28.300306 9.5888004 27.738817C9.2277699 27.49818 15.36529 19.877987 13.199106 13.300558C13.158992 13.140133 11.754984 24.409996 6.3796396 27.097116C3.3309369 28.621155 0.60315031 25.051697 0.12177619 21.963514C-1.0415446 13.862046 6.4999828 8.7284422 7.0214715 6.2017469Z\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n\nexport default BlazeLogo;\n"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAASA,CAAA;EAAA,oBACbC,KAAA,CAAAC,aAAA;IAAKC,KAAK,EAAC,4BAA4B;IAACC,KAAK,EAAC,IAAI;IAACC,MAAM,EAAC;EAAI,gBAC5DJ,KAAA,CAAAC,aAAA;IACEI,IAAI,EAAC,cAAc;IACnBC,SAAS,EAAC,2BAA2B;IACrCC,CAAC,EAAC,21BAA21B;IAC71BC,QAAQ,EAAC;EAAS,CACnB,CACE,CAAC;AAAA,CACP;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEaX,SAAS","ignoreList":[]}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
require("core-js/modules/es.array.concat.js");
|
|
9
|
-
require("core-js/modules/es.array.for-each.js");
|
|
10
|
-
require("core-js/modules/es.array.join.js");
|
|
11
|
-
require("core-js/modules/es.object.keys.js");
|
|
12
|
-
require("core-js/modules/es.object.to-string.js");
|
|
13
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
-
var _react = require("react");
|
|
15
|
-
var _reactPageBuilder = require("@blaze-cms/react-page-builder");
|
|
16
|
-
var _constants = require("./constants");
|
|
17
|
-
// todo: get it working in same tab
|
|
18
|
-
|
|
19
|
-
var EditorMode = function EditorMode(_ref) {
|
|
20
|
-
var adminHref = _ref.adminHref,
|
|
21
|
-
itemEntity = _ref.itemEntity,
|
|
22
|
-
itemId = _ref.itemId;
|
|
23
|
-
(0, _react.useEffect)(function () {
|
|
24
|
-
var pbStarts = document.querySelectorAll('pb-wrapper-start');
|
|
25
|
-
var allComponentNodes = [];
|
|
26
|
-
pbStarts.forEach(function (pbStart) {
|
|
27
|
-
var parentNode = pbStart.parentNode;
|
|
28
|
-
var componentName = pbStart.getAttribute('pb-component-name');
|
|
29
|
-
if (!parentNode || !parentNode.children || !componentName) return;
|
|
30
|
-
var parentChildren = parentNode.children;
|
|
31
|
-
var childMatch = false;
|
|
32
|
-
var childNode = null;
|
|
33
|
-
Object.keys(parentChildren).forEach(function (key) {
|
|
34
|
-
var child = parentChildren[key];
|
|
35
|
-
if (childMatch) {
|
|
36
|
-
if (childNode) return;
|
|
37
|
-
childNode = child;
|
|
38
|
-
}
|
|
39
|
-
var tagName = child.tagName.toLowerCase();
|
|
40
|
-
var currentComponentName = child.getAttribute('pb-component-name');
|
|
41
|
-
if (currentComponentName === componentName && tagName === 'pb-wrapper-start') {
|
|
42
|
-
childMatch = true;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
if (childNode) {
|
|
46
|
-
allComponentNodes.push({
|
|
47
|
-
componentName: componentName,
|
|
48
|
-
componentNode: childNode
|
|
49
|
-
});
|
|
50
|
-
childNode.onclick = function (e) {
|
|
51
|
-
e.stopPropagation();
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
window.open("".concat(adminHref, "#").concat((0, _reactPageBuilder.getComponentId)(componentName)), [_constants.BLAZE_WINDOW_ID, itemEntity, itemId].join(':'));
|
|
54
|
-
};
|
|
55
|
-
childNode.onmouseenter = function (e) {
|
|
56
|
-
allComponentNodes.forEach(function (_ref2) {
|
|
57
|
-
var cn = _ref2.componentName,
|
|
58
|
-
componentNode = _ref2.componentNode;
|
|
59
|
-
componentNode.classList.remove('blaze-pb-editor-highlight');
|
|
60
|
-
});
|
|
61
|
-
childNode.classList.add('blaze-pb-editor-highlight');
|
|
62
|
-
};
|
|
63
|
-
childNode.onmouseleave = function (e) {
|
|
64
|
-
childNode.classList.remove('blaze-pb-editor-highlight');
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}, [adminHref, itemEntity, itemId]);
|
|
69
|
-
return null;
|
|
70
|
-
};
|
|
71
|
-
var _default = exports["default"] = EditorMode;
|
|
72
|
-
//# sourceMappingURL=EditorMode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorMode.js","names":["_react","require","_reactPageBuilder","_constants","EditorMode","_ref","adminHref","itemEntity","itemId","useEffect","pbStarts","document","querySelectorAll","allComponentNodes","forEach","pbStart","parentNode","componentName","getAttribute","children","parentChildren","childMatch","childNode","Object","keys","key","child","tagName","toLowerCase","currentComponentName","push","componentNode","onclick","e","stopPropagation","preventDefault","window","open","concat","getComponentId","BLAZE_WINDOW_ID","join","onmouseenter","_ref2","cn","classList","remove","add","onmouseleave","_default","exports"],"sources":["../../../src/components/EditorMode/EditorMode.js"],"sourcesContent":["import { useEffect } from 'react';\nimport { getComponentId } from '@blaze-cms/react-page-builder';\nimport { BLAZE_WINDOW_ID } from './constants'; // todo: get it working in same tab\n\nconst EditorMode = ({ adminHref, itemEntity, itemId }) => {\n useEffect(\n () => {\n const pbStarts = document.querySelectorAll('pb-wrapper-start');\n const allComponentNodes = [];\n pbStarts.forEach(pbStart => {\n const { parentNode } = pbStart;\n const componentName = pbStart.getAttribute('pb-component-name');\n if (!parentNode || !parentNode.children || !componentName) return;\n const parentChildren = parentNode.children;\n let childMatch = false;\n let childNode = null;\n\n Object.keys(parentChildren).forEach(key => {\n const child = parentChildren[key];\n if (childMatch) {\n if (childNode) return;\n childNode = child;\n }\n const tagName = child.tagName.toLowerCase();\n const currentComponentName = child.getAttribute('pb-component-name');\n if (currentComponentName === componentName && tagName === 'pb-wrapper-start') {\n childMatch = true;\n }\n });\n\n if (childNode) {\n allComponentNodes.push({ componentName, componentNode: childNode });\n childNode.onclick = e => {\n e.stopPropagation();\n e.preventDefault();\n window.open(\n `${adminHref}#${getComponentId(componentName)}`,\n [BLAZE_WINDOW_ID, itemEntity, itemId].join(':')\n );\n };\n childNode.onmouseenter = e => {\n allComponentNodes.forEach(({ componentName: cn, componentNode }) => {\n componentNode.classList.remove('blaze-pb-editor-highlight');\n });\n childNode.classList.add('blaze-pb-editor-highlight');\n };\n childNode.onmouseleave = e => {\n childNode.classList.remove('blaze-pb-editor-highlight');\n };\n }\n });\n },\n [adminHref, itemEntity, itemId]\n );\n\n return null;\n};\n\nexport default EditorMode;\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.BLAZE_WINDOW_ID = void 0;
|
|
8
|
-
var BLAZE_WINDOW_ID = exports.BLAZE_WINDOW_ID = 'blaze';
|
|
9
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["BLAZE_WINDOW_ID","exports"],"sources":["../../../src/components/EditorMode/constants.js"],"sourcesContent":["export const BLAZE_WINDOW_ID = 'blaze';\n"],"mappings":";;;;;;;AAAO,IAAMA,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,OAAO","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _EditorMode = _interopRequireDefault(require("./EditorMode"));
|
|
10
|
-
var _default = exports["default"] = _EditorMode["default"];
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_EditorMode","_interopRequireDefault","require","_default","exports","EditorMode"],"sources":["../../../src/components/EditorMode/index.js"],"sourcesContent":["import EditorMode from './EditorMode';\n\nexport default EditorMode;\n"],"mappings":";;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAsC,IAAAC,QAAA,GAAAC,OAAA,cAEvBC,sBAAU","ignoreList":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const BlazeLogo = () => /*#__PURE__*/React.createElement("svg", {
|
|
2
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3
|
-
width: "22",
|
|
4
|
-
height: "33"
|
|
5
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
6
|
-
fill: "currentColor",
|
|
7
|
-
transform: "translate(1.0415 1.85962)",
|
|
8
|
-
d: "M7.0214715 6.2017469C7.0214715 6.2017469 4.6948299 13.380771 5.2965479 15.065234C5.6174636 15.947572 6.3796396 16.18821 7.3022733 15.386085C9.1074257 13.781834 13.078762 6.3621721 9.949831 0.42644304C8.7463951 -1.8596147 18.293648 5.1589837 16.328037 18.755013C16.087351 20.559793 16.809412 19.998306 17.250671 19.236286C19.176168 15.947572 17.972733 11.616095 17.972733 10.894181C17.972733 10.172268 19.657541 12.939602 19.777885 18.353949C19.89823 23.768295 17.050098 29.022219 11.393953 29.98477C10.03006 30.225407 13.199106 27.578392 13.640366 24.610529C13.68048 24.329784 10.39109 28.300306 9.5888004 27.738817C9.2277699 27.49818 15.36529 19.877987 13.199106 13.300558C13.158992 13.140133 11.754984 24.409996 6.3796396 27.097116C3.3309369 28.621155 0.60315031 25.051697 0.12177619 21.963514C-1.0415446 13.862046 6.4999828 8.7284422 7.0214715 6.2017469Z",
|
|
9
|
-
fillRule: "evenodd"
|
|
10
|
-
}));
|
|
11
|
-
export default BlazeLogo;
|
|
12
|
-
//# sourceMappingURL=BlazeLogo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlazeLogo.js","names":["BlazeLogo","React","createElement","xmlns","width","height","fill","transform","d","fillRule"],"sources":["../../../src/components/EditorMode/BlazeLogo.js"],"sourcesContent":["const BlazeLogo = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"22\" height=\"33\">\n <path\n fill=\"currentColor\"\n transform=\"translate(1.0415 1.85962)\"\n d=\"M7.0214715 6.2017469C7.0214715 6.2017469 4.6948299 13.380771 5.2965479 15.065234C5.6174636 15.947572 6.3796396 16.18821 7.3022733 15.386085C9.1074257 13.781834 13.078762 6.3621721 9.949831 0.42644304C8.7463951 -1.8596147 18.293648 5.1589837 16.328037 18.755013C16.087351 20.559793 16.809412 19.998306 17.250671 19.236286C19.176168 15.947572 17.972733 11.616095 17.972733 10.894181C17.972733 10.172268 19.657541 12.939602 19.777885 18.353949C19.89823 23.768295 17.050098 29.022219 11.393953 29.98477C10.03006 30.225407 13.199106 27.578392 13.640366 24.610529C13.68048 24.329784 10.39109 28.300306 9.5888004 27.738817C9.2277699 27.49818 15.36529 19.877987 13.199106 13.300558C13.158992 13.140133 11.754984 24.409996 6.3796396 27.097116C3.3309369 28.621155 0.60315031 25.051697 0.12177619 21.963514C-1.0415446 13.862046 6.4999828 8.7284422 7.0214715 6.2017469Z\"\n fillRule=\"evenodd\"\n />\n </svg>\n);\n\nexport default BlazeLogo;\n"],"mappings":"AAAA,MAAMA,SAAS,GAAGA,CAAA,kBAChBC,KAAA,CAAAC,aAAA;EAAKC,KAAK,EAAC,4BAA4B;EAACC,KAAK,EAAC,IAAI;EAACC,MAAM,EAAC;AAAI,gBAC5DJ,KAAA,CAAAC,aAAA;EACEI,IAAI,EAAC,cAAc;EACnBC,SAAS,EAAC,2BAA2B;EACrCC,CAAC,EAAC,21BAA21B;EAC71BC,QAAQ,EAAC;AAAS,CACnB,CACE,CACN;AAED,eAAeT,SAAS","ignoreList":[]}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { getComponentId } from '@blaze-cms/react-page-builder';
|
|
3
|
-
import { BLAZE_WINDOW_ID } from './constants'; // todo: get it working in same tab
|
|
4
|
-
|
|
5
|
-
const EditorMode = ({
|
|
6
|
-
adminHref,
|
|
7
|
-
itemEntity,
|
|
8
|
-
itemId
|
|
9
|
-
}) => {
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const pbStarts = document.querySelectorAll('pb-wrapper-start');
|
|
12
|
-
const allComponentNodes = [];
|
|
13
|
-
pbStarts.forEach(pbStart => {
|
|
14
|
-
const {
|
|
15
|
-
parentNode
|
|
16
|
-
} = pbStart;
|
|
17
|
-
const componentName = pbStart.getAttribute('pb-component-name');
|
|
18
|
-
if (!parentNode || !parentNode.children || !componentName) return;
|
|
19
|
-
const parentChildren = parentNode.children;
|
|
20
|
-
let childMatch = false;
|
|
21
|
-
let childNode = null;
|
|
22
|
-
Object.keys(parentChildren).forEach(key => {
|
|
23
|
-
const child = parentChildren[key];
|
|
24
|
-
if (childMatch) {
|
|
25
|
-
if (childNode) return;
|
|
26
|
-
childNode = child;
|
|
27
|
-
}
|
|
28
|
-
const tagName = child.tagName.toLowerCase();
|
|
29
|
-
const currentComponentName = child.getAttribute('pb-component-name');
|
|
30
|
-
if (currentComponentName === componentName && tagName === 'pb-wrapper-start') {
|
|
31
|
-
childMatch = true;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
if (childNode) {
|
|
35
|
-
allComponentNodes.push({
|
|
36
|
-
componentName,
|
|
37
|
-
componentNode: childNode
|
|
38
|
-
});
|
|
39
|
-
childNode.onclick = e => {
|
|
40
|
-
e.stopPropagation();
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
window.open(`${adminHref}#${getComponentId(componentName)}`, [BLAZE_WINDOW_ID, itemEntity, itemId].join(':'));
|
|
43
|
-
};
|
|
44
|
-
childNode.onmouseenter = e => {
|
|
45
|
-
allComponentNodes.forEach(({
|
|
46
|
-
componentName: cn,
|
|
47
|
-
componentNode
|
|
48
|
-
}) => {
|
|
49
|
-
componentNode.classList.remove('blaze-pb-editor-highlight');
|
|
50
|
-
});
|
|
51
|
-
childNode.classList.add('blaze-pb-editor-highlight');
|
|
52
|
-
};
|
|
53
|
-
childNode.onmouseleave = e => {
|
|
54
|
-
childNode.classList.remove('blaze-pb-editor-highlight');
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}, [adminHref, itemEntity, itemId]);
|
|
59
|
-
return null;
|
|
60
|
-
};
|
|
61
|
-
export default EditorMode;
|
|
62
|
-
//# sourceMappingURL=EditorMode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorMode.js","names":["useEffect","getComponentId","BLAZE_WINDOW_ID","EditorMode","adminHref","itemEntity","itemId","pbStarts","document","querySelectorAll","allComponentNodes","forEach","pbStart","parentNode","componentName","getAttribute","children","parentChildren","childMatch","childNode","Object","keys","key","child","tagName","toLowerCase","currentComponentName","push","componentNode","onclick","e","stopPropagation","preventDefault","window","open","join","onmouseenter","cn","classList","remove","add","onmouseleave"],"sources":["../../../src/components/EditorMode/EditorMode.js"],"sourcesContent":["import { useEffect } from 'react';\nimport { getComponentId } from '@blaze-cms/react-page-builder';\nimport { BLAZE_WINDOW_ID } from './constants'; // todo: get it working in same tab\n\nconst EditorMode = ({ adminHref, itemEntity, itemId }) => {\n useEffect(\n () => {\n const pbStarts = document.querySelectorAll('pb-wrapper-start');\n const allComponentNodes = [];\n pbStarts.forEach(pbStart => {\n const { parentNode } = pbStart;\n const componentName = pbStart.getAttribute('pb-component-name');\n if (!parentNode || !parentNode.children || !componentName) return;\n const parentChildren = parentNode.children;\n let childMatch = false;\n let childNode = null;\n\n Object.keys(parentChildren).forEach(key => {\n const child = parentChildren[key];\n if (childMatch) {\n if (childNode) return;\n childNode = child;\n }\n const tagName = child.tagName.toLowerCase();\n const currentComponentName = child.getAttribute('pb-component-name');\n if (currentComponentName === componentName && tagName === 'pb-wrapper-start') {\n childMatch = true;\n }\n });\n\n if (childNode) {\n allComponentNodes.push({ componentName, componentNode: childNode });\n childNode.onclick = e => {\n e.stopPropagation();\n e.preventDefault();\n window.open(\n `${adminHref}#${getComponentId(componentName)}`,\n [BLAZE_WINDOW_ID, itemEntity, itemId].join(':')\n );\n };\n childNode.onmouseenter = e => {\n allComponentNodes.forEach(({ componentName: cn, componentNode }) => {\n componentNode.classList.remove('blaze-pb-editor-highlight');\n });\n childNode.classList.add('blaze-pb-editor-highlight');\n };\n childNode.onmouseleave = e => {\n childNode.classList.remove('blaze-pb-editor-highlight');\n };\n }\n });\n },\n [adminHref, itemEntity, itemId]\n );\n\n return null;\n};\n\nexport default EditorMode;\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,eAAe,QAAQ,aAAa,CAAC,CAAC;;AAE/C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,SAAS;EAAEC,UAAU;EAAEC;AAAO,CAAC,KAAK;EACxDN,SAAS,CACP,MAAM;IACJ,MAAMO,QAAQ,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,kBAAkB,CAAC;IAC9D,MAAMC,iBAAiB,GAAG,EAAE;IAC5BH,QAAQ,CAACI,OAAO,CAACC,OAAO,IAAI;MAC1B,MAAM;QAAEC;MAAW,CAAC,GAAGD,OAAO;MAC9B,MAAME,aAAa,GAAGF,OAAO,CAACG,YAAY,CAAC,mBAAmB,CAAC;MAC/D,IAAI,CAACF,UAAU,IAAI,CAACA,UAAU,CAACG,QAAQ,IAAI,CAACF,aAAa,EAAE;MAC3D,MAAMG,cAAc,GAAGJ,UAAU,CAACG,QAAQ;MAC1C,IAAIE,UAAU,GAAG,KAAK;MACtB,IAAIC,SAAS,GAAG,IAAI;MAEpBC,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAACN,OAAO,CAACW,GAAG,IAAI;QACzC,MAAMC,KAAK,GAAGN,cAAc,CAACK,GAAG,CAAC;QACjC,IAAIJ,UAAU,EAAE;UACd,IAAIC,SAAS,EAAE;UACfA,SAAS,GAAGI,KAAK;QACnB;QACA,MAAMC,OAAO,GAAGD,KAAK,CAACC,OAAO,CAACC,WAAW,CAAC,CAAC;QAC3C,MAAMC,oBAAoB,GAAGH,KAAK,CAACR,YAAY,CAAC,mBAAmB,CAAC;QACpE,IAAIW,oBAAoB,KAAKZ,aAAa,IAAIU,OAAO,KAAK,kBAAkB,EAAE;UAC5EN,UAAU,GAAG,IAAI;QACnB;MACF,CAAC,CAAC;MAEF,IAAIC,SAAS,EAAE;QACbT,iBAAiB,CAACiB,IAAI,CAAC;UAAEb,aAAa;UAAEc,aAAa,EAAET;QAAU,CAAC,CAAC;QACnEA,SAAS,CAACU,OAAO,GAAGC,CAAC,IAAI;UACvBA,CAAC,CAACC,eAAe,CAAC,CAAC;UACnBD,CAAC,CAACE,cAAc,CAAC,CAAC;UAClBC,MAAM,CAACC,IAAI,CACT,GAAG9B,SAAS,IAAIH,cAAc,CAACa,aAAa,CAAC,EAAE,EAC/C,CAACZ,eAAe,EAAEG,UAAU,EAAEC,MAAM,CAAC,CAAC6B,IAAI,CAAC,GAAG,CAChD,CAAC;QACH,CAAC;QACDhB,SAAS,CAACiB,YAAY,GAAGN,CAAC,IAAI;UAC5BpB,iBAAiB,CAACC,OAAO,CAAC,CAAC;YAAEG,aAAa,EAAEuB,EAAE;YAAET;UAAc,CAAC,KAAK;YAClEA,aAAa,CAACU,SAAS,CAACC,MAAM,CAAC,2BAA2B,CAAC;UAC7D,CAAC,CAAC;UACFpB,SAAS,CAACmB,SAAS,CAACE,GAAG,CAAC,2BAA2B,CAAC;QACtD,CAAC;QACDrB,SAAS,CAACsB,YAAY,GAAGX,CAAC,IAAI;UAC5BX,SAAS,CAACmB,SAAS,CAACC,MAAM,CAAC,2BAA2B,CAAC;QACzD,CAAC;MACH;IACF,CAAC,CAAC;EACJ,CAAC,EACD,CAACnC,SAAS,EAAEC,UAAU,EAAEC,MAAM,CAChC,CAAC;EAED,OAAO,IAAI;AACb,CAAC;AAED,eAAeH,UAAU","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["BLAZE_WINDOW_ID"],"sources":["../../../src/components/EditorMode/constants.js"],"sourcesContent":["export const BLAZE_WINDOW_ID = 'blaze';\n"],"mappings":"AAAA,OAAO,MAAMA,eAAe,GAAG,OAAO","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["EditorMode"],"sources":["../../../src/components/EditorMode/index.js"],"sourcesContent":["import EditorMode from './EditorMode';\n\nexport default EditorMode;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,cAAc;AAErC,eAAeA,UAAU","ignoreList":[]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const BlazeLogo = () => (
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="33">
|
|
3
|
-
<path
|
|
4
|
-
fill="currentColor"
|
|
5
|
-
transform="translate(1.0415 1.85962)"
|
|
6
|
-
d="M7.0214715 6.2017469C7.0214715 6.2017469 4.6948299 13.380771 5.2965479 15.065234C5.6174636 15.947572 6.3796396 16.18821 7.3022733 15.386085C9.1074257 13.781834 13.078762 6.3621721 9.949831 0.42644304C8.7463951 -1.8596147 18.293648 5.1589837 16.328037 18.755013C16.087351 20.559793 16.809412 19.998306 17.250671 19.236286C19.176168 15.947572 17.972733 11.616095 17.972733 10.894181C17.972733 10.172268 19.657541 12.939602 19.777885 18.353949C19.89823 23.768295 17.050098 29.022219 11.393953 29.98477C10.03006 30.225407 13.199106 27.578392 13.640366 24.610529C13.68048 24.329784 10.39109 28.300306 9.5888004 27.738817C9.2277699 27.49818 15.36529 19.877987 13.199106 13.300558C13.158992 13.140133 11.754984 24.409996 6.3796396 27.097116C3.3309369 28.621155 0.60315031 25.051697 0.12177619 21.963514C-1.0415446 13.862046 6.4999828 8.7284422 7.0214715 6.2017469Z"
|
|
7
|
-
fillRule="evenodd"
|
|
8
|
-
/>
|
|
9
|
-
</svg>
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export default BlazeLogo;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { getComponentId } from '@blaze-cms/react-page-builder';
|
|
3
|
-
import { BLAZE_WINDOW_ID } from './constants'; // todo: get it working in same tab
|
|
4
|
-
|
|
5
|
-
const EditorMode = ({ adminHref, itemEntity, itemId }) => {
|
|
6
|
-
useEffect(
|
|
7
|
-
() => {
|
|
8
|
-
const pbStarts = document.querySelectorAll('pb-wrapper-start');
|
|
9
|
-
const allComponentNodes = [];
|
|
10
|
-
pbStarts.forEach(pbStart => {
|
|
11
|
-
const { parentNode } = pbStart;
|
|
12
|
-
const componentName = pbStart.getAttribute('pb-component-name');
|
|
13
|
-
if (!parentNode || !parentNode.children || !componentName) return;
|
|
14
|
-
const parentChildren = parentNode.children;
|
|
15
|
-
let childMatch = false;
|
|
16
|
-
let childNode = null;
|
|
17
|
-
|
|
18
|
-
Object.keys(parentChildren).forEach(key => {
|
|
19
|
-
const child = parentChildren[key];
|
|
20
|
-
if (childMatch) {
|
|
21
|
-
if (childNode) return;
|
|
22
|
-
childNode = child;
|
|
23
|
-
}
|
|
24
|
-
const tagName = child.tagName.toLowerCase();
|
|
25
|
-
const currentComponentName = child.getAttribute('pb-component-name');
|
|
26
|
-
if (currentComponentName === componentName && tagName === 'pb-wrapper-start') {
|
|
27
|
-
childMatch = true;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (childNode) {
|
|
32
|
-
allComponentNodes.push({ componentName, componentNode: childNode });
|
|
33
|
-
childNode.onclick = e => {
|
|
34
|
-
e.stopPropagation();
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
window.open(
|
|
37
|
-
`${adminHref}#${getComponentId(componentName)}`,
|
|
38
|
-
[BLAZE_WINDOW_ID, itemEntity, itemId].join(':')
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
childNode.onmouseenter = e => {
|
|
42
|
-
allComponentNodes.forEach(({ componentName: cn, componentNode }) => {
|
|
43
|
-
componentNode.classList.remove('blaze-pb-editor-highlight');
|
|
44
|
-
});
|
|
45
|
-
childNode.classList.add('blaze-pb-editor-highlight');
|
|
46
|
-
};
|
|
47
|
-
childNode.onmouseleave = e => {
|
|
48
|
-
childNode.classList.remove('blaze-pb-editor-highlight');
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
},
|
|
53
|
-
[adminHref, itemEntity, itemId]
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
return null;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default EditorMode;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const BLAZE_WINDOW_ID = 'blaze';
|