@servicetitan/dte-unlayer 0.47.0 → 0.49.0
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/editor-core-source.d.ts +1 -1
- package/dist/editor-core-source.d.ts.map +1 -1
- package/dist/editor-core-source.js +1 -1
- package/dist/editor-core-source.js.map +1 -1
- package/dist/shared/const.d.ts +4 -0
- package/dist/shared/const.d.ts.map +1 -1
- package/dist/tools.d.ts +1 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +12 -0
- package/dist/tools.js.map +1 -1
- package/dist/unlayer-interface.d.ts +1 -0
- package/dist/unlayer-interface.d.ts.map +1 -1
- package/dist/unlayer.d.ts.map +1 -1
- package/dist/unlayer.js +2 -1
- package/dist/unlayer.js.map +1 -1
- package/package.json +1 -1
- package/src/editor-core-source.ts +1 -1
- package/src/shared/const.ts +5 -0
- package/src/tools.ts +15 -1
- package/src/unlayer-interface.tsx +1 -0
- package/src/unlayer.tsx +2 -1
package/src/shared/const.ts
CHANGED
package/src/tools.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { constGenericsEditor } from './shared/const';
|
|
1
|
+
import { constGenericsEditor, UnlayerToolMetaData } from './shared/const';
|
|
2
2
|
import { unlayerToolsParseUnitKey } from './shared/tools';
|
|
3
3
|
import { versions } from './unlayer';
|
|
4
4
|
import {
|
|
@@ -221,3 +221,17 @@ export const unlayerCustomToolsGetRegisterUrls = (tools: UnlayerEditorCustomTool
|
|
|
221
221
|
Array.from(
|
|
222
222
|
new Set(tools.map(tool => (tool.groupUrl ? `${tool.groupUrl}/index.js` : tool.url)))
|
|
223
223
|
);
|
|
224
|
+
|
|
225
|
+
export const unlayerCustomToolMetaData = (tools: UnlayerEditorCustomTool[]): string => {
|
|
226
|
+
const toolMetaData = tools.reduce((acc: Record<string, UnlayerToolMetaData>, tool) => {
|
|
227
|
+
acc[tool.key] = {
|
|
228
|
+
title: tool.title,
|
|
229
|
+
description: tool.description,
|
|
230
|
+
};
|
|
231
|
+
return acc;
|
|
232
|
+
}, {});
|
|
233
|
+
|
|
234
|
+
return `
|
|
235
|
+
window.dteStore.setToolMetaData(${JSON.stringify(toolMetaData)});
|
|
236
|
+
`;
|
|
237
|
+
};
|
package/src/unlayer.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { editorCoreScript, editorCoreStyles, editorCoreTools } from './editor-core';
|
|
2
2
|
import { constGenericsEditor } from './shared/const';
|
|
3
3
|
import { unlayerSupportedFonts } from './shared/fonts';
|
|
4
|
-
import { unlayerCustomToolsGetRegisterUrls } from './tools';
|
|
4
|
+
import { unlayerCustomToolMetaData, unlayerCustomToolsGetRegisterUrls } from './tools';
|
|
5
5
|
import { CreateUnlayerEditorProps } from './unlayer-interface';
|
|
6
6
|
|
|
7
7
|
export interface UnlayerExport {
|
|
@@ -96,6 +96,7 @@ export const createUnlayerEditor = (
|
|
|
96
96
|
editorCoreTools,
|
|
97
97
|
'window.dteStore.sendData("--core-loaded")',
|
|
98
98
|
...unlayerCustomToolsGetRegisterUrls(tools),
|
|
99
|
+
unlayerCustomToolMetaData(tools),
|
|
99
100
|
...(customJS ? (Array.isArray(customJS) ? customJS : [customJS]) : []),
|
|
100
101
|
'window.dteStore.sendData("--data-loaded")',
|
|
101
102
|
].filter(js => !!js?.trim());
|