@dotcms/client 0.0.1-alpha.48 → 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
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
|
/**
|
|
@@ -1558,6 +1559,23 @@ function editContentlet(contentlet) {
|
|
|
1558
1559
|
payload: contentlet
|
|
1559
1560
|
});
|
|
1560
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
|
+
}
|
|
1561
1579
|
/**
|
|
1562
1580
|
* Checks if the code is running inside an editor.
|
|
1563
1581
|
*
|
|
@@ -1997,4 +2015,5 @@ exports.graphqlToPageEntity = graphqlToPageEntity;
|
|
|
1997
2015
|
exports.initEditor = initEditor;
|
|
1998
2016
|
exports.isInsideEditor = isInsideEditor;
|
|
1999
2017
|
exports.postMessageToEditor = postMessageToEditor;
|
|
2018
|
+
exports.reorderMenu = reorderMenu;
|
|
2000
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
|
/**
|
|
@@ -1556,6 +1557,23 @@ function editContentlet(contentlet) {
|
|
|
1556
1557
|
payload: contentlet
|
|
1557
1558
|
});
|
|
1558
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
|
+
}
|
|
1559
1577
|
/**
|
|
1560
1578
|
* Checks if the code is running inside an editor.
|
|
1561
1579
|
*
|
|
@@ -1987,4 +2005,4 @@ const getPageRequestParams = ({ path = '', params = {} }) => {
|
|
|
1987
2005
|
};
|
|
1988
2006
|
};
|
|
1989
2007
|
|
|
1990
|
-
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;
|
|
@@ -95,6 +95,7 @@ type PostMessageProps<T> = {
|
|
|
95
95
|
export declare function postMessageToEditor<T = unknown>(message: PostMessageProps<T>): void;
|
|
96
96
|
export interface DotUVE {
|
|
97
97
|
editContentlet: typeof editContentlet;
|
|
98
|
+
reorderMenu: typeof reorderMenu;
|
|
98
99
|
lastScrollYPosition: number;
|
|
99
100
|
}
|
|
100
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
|
*
|