@dotcms/client 0.0.1-alpha.47 → 0.0.1-alpha.49
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/index.cjs.js +23 -0
- package/index.esm.js +23 -1
- package/package.json +1 -1
- package/src/index.d.ts +2 -2
- package/src/lib/editor/models/client.model.d.ts +6 -1
- package/src/lib/editor/models/editor.model.d.ts +13 -0
- package/src/lib/editor/sdk-editor.d.ts +12 -1
- package/src/lib/editor/utils/traditional-vtl.utils.d.ts +5 -0
package/index.cjs.js
CHANGED
|
@@ -1100,6 +1100,7 @@ exports.NOTIFY_CLIENT = void 0;
|
|
|
1100
1100
|
|
|
1101
1101
|
const INITIAL_DOT_UVE = {
|
|
1102
1102
|
editContentlet,
|
|
1103
|
+
reorderMenu,
|
|
1103
1104
|
lastScrollYPosition: 0
|
|
1104
1105
|
};
|
|
1105
1106
|
/**
|
|
@@ -1163,6 +1164,10 @@ exports.CLIENT_ACTIONS = void 0;
|
|
|
1163
1164
|
* Tell the editor to edit a contentlet
|
|
1164
1165
|
*/
|
|
1165
1166
|
CLIENT_ACTIONS["EDIT_CONTENTLET"] = "edit-contentlet";
|
|
1167
|
+
/**
|
|
1168
|
+
* Tell the editor to open the block editor sidebar
|
|
1169
|
+
*/
|
|
1170
|
+
CLIENT_ACTIONS["INIT_BLOCK_EDITOR_INLINE_EDITING"] = "init-editor-inline-editing";
|
|
1166
1171
|
/**
|
|
1167
1172
|
* Tell the editor to do nothing
|
|
1168
1173
|
*/
|
|
@@ -1554,6 +1559,23 @@ function editContentlet(contentlet) {
|
|
|
1554
1559
|
payload: contentlet
|
|
1555
1560
|
});
|
|
1556
1561
|
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Reorders the menu based on the provided configuration.
|
|
1564
|
+
*
|
|
1565
|
+
* @param {ReorderMenuConfig} [config] - Optional configuration for reordering the menu.
|
|
1566
|
+
* @param {number} [config.startLevel=1] - The starting level of the menu to reorder.
|
|
1567
|
+
* @param {number} [config.depth=2] - The depth of the menu to reorder.
|
|
1568
|
+
*
|
|
1569
|
+
* This function constructs a URL for the reorder menu page with the specified
|
|
1570
|
+
* start level and depth, and sends a message to the editor to perform the reorder action.
|
|
1571
|
+
*/
|
|
1572
|
+
function reorderMenu(config) {
|
|
1573
|
+
const { startLevel = 1, depth = 2 } = config || {};
|
|
1574
|
+
postMessageToEditor({
|
|
1575
|
+
action: exports.CLIENT_ACTIONS.REORDER_MENU,
|
|
1576
|
+
payload: { startLevel, depth }
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1557
1579
|
/**
|
|
1558
1580
|
* Checks if the code is running inside an editor.
|
|
1559
1581
|
*
|
|
@@ -1993,4 +2015,5 @@ exports.graphqlToPageEntity = graphqlToPageEntity;
|
|
|
1993
2015
|
exports.initEditor = initEditor;
|
|
1994
2016
|
exports.isInsideEditor = isInsideEditor;
|
|
1995
2017
|
exports.postMessageToEditor = postMessageToEditor;
|
|
2018
|
+
exports.reorderMenu = reorderMenu;
|
|
1996
2019
|
exports.updateNavigation = updateNavigation;
|
package/index.esm.js
CHANGED
|
@@ -1098,6 +1098,7 @@ var NOTIFY_CLIENT;
|
|
|
1098
1098
|
|
|
1099
1099
|
const INITIAL_DOT_UVE = {
|
|
1100
1100
|
editContentlet,
|
|
1101
|
+
reorderMenu,
|
|
1101
1102
|
lastScrollYPosition: 0
|
|
1102
1103
|
};
|
|
1103
1104
|
/**
|
|
@@ -1161,6 +1162,10 @@ var CLIENT_ACTIONS;
|
|
|
1161
1162
|
* Tell the editor to edit a contentlet
|
|
1162
1163
|
*/
|
|
1163
1164
|
CLIENT_ACTIONS["EDIT_CONTENTLET"] = "edit-contentlet";
|
|
1165
|
+
/**
|
|
1166
|
+
* Tell the editor to open the block editor sidebar
|
|
1167
|
+
*/
|
|
1168
|
+
CLIENT_ACTIONS["INIT_BLOCK_EDITOR_INLINE_EDITING"] = "init-editor-inline-editing";
|
|
1164
1169
|
/**
|
|
1165
1170
|
* Tell the editor to do nothing
|
|
1166
1171
|
*/
|
|
@@ -1552,6 +1557,23 @@ function editContentlet(contentlet) {
|
|
|
1552
1557
|
payload: contentlet
|
|
1553
1558
|
});
|
|
1554
1559
|
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Reorders the menu based on the provided configuration.
|
|
1562
|
+
*
|
|
1563
|
+
* @param {ReorderMenuConfig} [config] - Optional configuration for reordering the menu.
|
|
1564
|
+
* @param {number} [config.startLevel=1] - The starting level of the menu to reorder.
|
|
1565
|
+
* @param {number} [config.depth=2] - The depth of the menu to reorder.
|
|
1566
|
+
*
|
|
1567
|
+
* This function constructs a URL for the reorder menu page with the specified
|
|
1568
|
+
* start level and depth, and sends a message to the editor to perform the reorder action.
|
|
1569
|
+
*/
|
|
1570
|
+
function reorderMenu(config) {
|
|
1571
|
+
const { startLevel = 1, depth = 2 } = config || {};
|
|
1572
|
+
postMessageToEditor({
|
|
1573
|
+
action: CLIENT_ACTIONS.REORDER_MENU,
|
|
1574
|
+
payload: { startLevel, depth }
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1555
1577
|
/**
|
|
1556
1578
|
* Checks if the code is running inside an editor.
|
|
1557
1579
|
*
|
|
@@ -1983,4 +2005,4 @@ const getPageRequestParams = ({ path = '', params = {} }) => {
|
|
|
1983
2005
|
};
|
|
1984
2006
|
};
|
|
1985
2007
|
|
|
1986
|
-
export { CLIENT_ACTIONS, DotCmsClient, NOTIFY_CLIENT, destroyEditor, editContentlet, getPageRequestParams, graphqlToPageEntity, initEditor, isInsideEditor, postMessageToEditor, updateNavigation };
|
|
2008
|
+
export { CLIENT_ACTIONS, DotCmsClient, NOTIFY_CLIENT, destroyEditor, editContentlet, getPageRequestParams, graphqlToPageEntity, initEditor, isInsideEditor, postMessageToEditor, reorderMenu, updateNavigation };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { ClientConfig, DotCmsClient } from './lib/client/sdk-js-client';
|
|
|
2
2
|
import { CLIENT_ACTIONS, postMessageToEditor } from './lib/editor/models/client.model';
|
|
3
3
|
import { CustomClientParams, DotCMSPageEditorConfig, EditorConfig } from './lib/editor/models/editor.model';
|
|
4
4
|
import { NOTIFY_CLIENT } from './lib/editor/models/listeners.model';
|
|
5
|
-
import { destroyEditor, editContentlet, initEditor, isInsideEditor, updateNavigation } from './lib/editor/sdk-editor';
|
|
5
|
+
import { destroyEditor, editContentlet, reorderMenu, initEditor, isInsideEditor, updateNavigation } from './lib/editor/sdk-editor';
|
|
6
6
|
import { getPageRequestParams, graphqlToPageEntity } from './lib/utils';
|
|
7
|
-
export { graphqlToPageEntity, getPageRequestParams, isInsideEditor, editContentlet, DotCmsClient, DotCMSPageEditorConfig, CLIENT_ACTIONS, NOTIFY_CLIENT, CustomClientParams, postMessageToEditor, EditorConfig, initEditor, updateNavigation, destroyEditor, ClientConfig };
|
|
7
|
+
export { graphqlToPageEntity, getPageRequestParams, isInsideEditor, editContentlet, reorderMenu, DotCmsClient, DotCMSPageEditorConfig, CLIENT_ACTIONS, NOTIFY_CLIENT, CustomClientParams, postMessageToEditor, EditorConfig, initEditor, updateNavigation, destroyEditor, ClientConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { editContentlet } from '../sdk-editor';
|
|
1
|
+
import { editContentlet, reorderMenu } from '../sdk-editor';
|
|
2
2
|
declare global {
|
|
3
3
|
interface Window {
|
|
4
4
|
dotUVE: DotUVE;
|
|
@@ -65,6 +65,10 @@ export declare enum CLIENT_ACTIONS {
|
|
|
65
65
|
* Tell the editor to edit a contentlet
|
|
66
66
|
*/
|
|
67
67
|
EDIT_CONTENTLET = "edit-contentlet",
|
|
68
|
+
/**
|
|
69
|
+
* Tell the editor to open the block editor sidebar
|
|
70
|
+
*/
|
|
71
|
+
INIT_BLOCK_EDITOR_INLINE_EDITING = "init-editor-inline-editing",
|
|
68
72
|
/**
|
|
69
73
|
* Tell the editor to do nothing
|
|
70
74
|
*/
|
|
@@ -91,6 +95,7 @@ type PostMessageProps<T> = {
|
|
|
91
95
|
export declare function postMessageToEditor<T = unknown>(message: PostMessageProps<T>): void;
|
|
92
96
|
export interface DotUVE {
|
|
93
97
|
editContentlet: typeof editContentlet;
|
|
98
|
+
reorderMenu: typeof reorderMenu;
|
|
94
99
|
lastScrollYPosition: number;
|
|
95
100
|
}
|
|
96
101
|
export {};
|
|
@@ -47,3 +47,16 @@ export interface DotCMSPageEditorConfig {
|
|
|
47
47
|
*/
|
|
48
48
|
onReload?: () => void;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Configuration for reordering a menu.
|
|
52
|
+
*/
|
|
53
|
+
export interface ReorderMenuConfig {
|
|
54
|
+
/**
|
|
55
|
+
* The starting level of the menu to be reordered.
|
|
56
|
+
*/
|
|
57
|
+
startLevel: number;
|
|
58
|
+
/**
|
|
59
|
+
* The depth of the menu levels to be reordered.
|
|
60
|
+
*/
|
|
61
|
+
depth: number;
|
|
62
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DotCMSPageEditorConfig } from './models/editor.model';
|
|
1
|
+
import { DotCMSPageEditorConfig, ReorderMenuConfig } from './models/editor.model';
|
|
2
2
|
import { Contentlet } from '../client/content/shared/types';
|
|
3
3
|
/**
|
|
4
4
|
* Updates the navigation in the editor.
|
|
@@ -19,6 +19,17 @@ export declare function updateNavigation(pathname: string): void;
|
|
|
19
19
|
* @param {Contentlet<T>} contentlet - The contentlet to edit.
|
|
20
20
|
*/
|
|
21
21
|
export declare function editContentlet<T>(contentlet: Contentlet<T>): void;
|
|
22
|
+
/**
|
|
23
|
+
* Reorders the menu based on the provided configuration.
|
|
24
|
+
*
|
|
25
|
+
* @param {ReorderMenuConfig} [config] - Optional configuration for reordering the menu.
|
|
26
|
+
* @param {number} [config.startLevel=1] - The starting level of the menu to reorder.
|
|
27
|
+
* @param {number} [config.depth=2] - The depth of the menu to reorder.
|
|
28
|
+
*
|
|
29
|
+
* This function constructs a URL for the reorder menu page with the specified
|
|
30
|
+
* start level and depth, and sends a message to the editor to perform the reorder action.
|
|
31
|
+
*/
|
|
32
|
+
export declare function reorderMenu(config?: ReorderMenuConfig): void;
|
|
22
33
|
/**
|
|
23
34
|
* Checks if the code is running inside an editor.
|
|
24
35
|
*
|