@dotcms/uve 0.0.1-beta.27 → 0.0.1-beta.29

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
@@ -8,8 +8,10 @@ require('@dotcms/types/internal');
8
8
 
9
9
  exports.createUVESubscription = _public.createUVESubscription;
10
10
  exports.editContentlet = _public.editContentlet;
11
+ exports.enableBlockEditorInline = _public.enableBlockEditorInline;
11
12
  exports.getUVEState = _public.getUVEState;
12
13
  exports.initInlineEditing = _public.initInlineEditing;
13
14
  exports.initUVE = _public.initUVE;
14
15
  exports.reorderMenu = _public.reorderMenu;
15
16
  exports.sendMessageToUVE = _public.sendMessageToUVE;
17
+ exports.updateNavigation = _public.updateNavigation;
package/index.esm.js CHANGED
@@ -1,3 +1,3 @@
1
- export { c as createUVESubscription, e as editContentlet, g as getUVEState, i as initInlineEditing, a as initUVE, r as reorderMenu, s as sendMessageToUVE } from './public.esm.js';
1
+ export { c as createUVESubscription, e as editContentlet, a as enableBlockEditorInline, g as getUVEState, i as initInlineEditing, b as initUVE, r as reorderMenu, s as sendMessageToUVE, u as updateNavigation } from './public.esm.js';
2
2
  import '@dotcms/types';
3
3
  import '@dotcms/types/internal';
package/internal.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CUSTOM_NO_COMPONENT, D as DEVELOPMENT_MODE, f as EMPTY_CONTAINER_STYLE_ANGULAR, d as EMPTY_CONTAINER_STYLE_REACT, E as END_CLASS, P as PRODUCTION_MODE, S as START_CLASS, _ as __UVE_EVENTS__, b as __UVE_EVENT_ERROR_FALLBACK__, p as combineClasses, o as computeScrollIsInBottom, m as findDotCMSElement, n as findDotCMSVTLData, l as getClosestDotCMSContainerData, q as getColumnPositionClasses, u as getContainersData, v as getContentletsInContainer, k as getDotCMSContainerData, j as getDotCMSContentletsBound, h as getDotCMSPageBounds, w as getDotContainerAttributes, t as getDotContentletAttributes, y as isValidBlocks, x as setBounds } from './public.esm.js';
1
+ export { C as CUSTOM_NO_COMPONENT, D as DEVELOPMENT_MODE, h as EMPTY_CONTAINER_STYLE_ANGULAR, f as EMPTY_CONTAINER_STYLE_REACT, E as END_CLASS, P as PRODUCTION_MODE, S as START_CLASS, _ as __UVE_EVENTS__, d as __UVE_EVENT_ERROR_FALLBACK__, q as combineClasses, p as computeScrollIsInBottom, n as findDotCMSElement, o as findDotCMSVTLData, m as getClosestDotCMSContainerData, t as getColumnPositionClasses, w as getContainersData, x as getContentletsInContainer, l as getDotCMSContainerData, k as getDotCMSContentletsBound, j as getDotCMSPageBounds, y as getDotContainerAttributes, v as getDotContentletAttributes, A as isValidBlocks, z as setBounds } from './public.esm.js';
2
2
  import '@dotcms/types';
3
3
  import '@dotcms/types/internal';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotcms/uve",
3
- "version": "0.0.1-beta.27",
3
+ "version": "0.0.1-beta.29",
4
4
  "description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
5
5
  "repository": {
6
6
  "type": "git",
package/public.cjs.js CHANGED
@@ -933,6 +933,22 @@ const listenBlockEditorClick = () => {
933
933
  });
934
934
  };
935
935
 
936
+ /**
937
+ * Updates the navigation in the editor.
938
+ *
939
+ * @param {string} pathname - The pathname to update the navigation with.
940
+ * @memberof DotCMSPageEditor
941
+ * @example
942
+ * updateNavigation('/home'); // Sends a message to the editor to update the navigation to '/home'
943
+ */
944
+ function updateNavigation(pathname) {
945
+ sendMessageToUVE({
946
+ action: types.DotCMSUVEAction.NAVIGATION_UPDATE,
947
+ payload: {
948
+ url: pathname || '/'
949
+ }
950
+ });
951
+ }
936
952
  /**
937
953
  * Post message to dotcms page editor
938
954
  *
@@ -1005,6 +1021,35 @@ function initInlineEditing(type, data) {
1005
1021
  }
1006
1022
  });
1007
1023
  }
1024
+ /**
1025
+ * Initializes the block editor inline editing for a contentlet field.
1026
+ *
1027
+ * @example
1028
+ * ```html
1029
+ * <div onclick="enableBlockEditorInline(contentlet, 'MY_BLOCK_EDITOR_FIELD_VARIABLE')">
1030
+ * ${My Content}
1031
+ * </div>
1032
+ * ```
1033
+ *
1034
+ * @export
1035
+ * @param {DotCMSBasicContentlet} contentlet
1036
+ * @param {string} fieldName
1037
+ * @return {*} {void}
1038
+ */
1039
+ function enableBlockEditorInline(contentlet, fieldName) {
1040
+ if (!contentlet?.[fieldName]) {
1041
+ console.error(`Contentlet ${contentlet?.identifier} does not have field ${fieldName}`);
1042
+ return;
1043
+ }
1044
+ const data = {
1045
+ fieldName,
1046
+ inode: contentlet.inode,
1047
+ language: contentlet.languageId,
1048
+ contentType: contentlet.contentType,
1049
+ content: contentlet[fieldName]
1050
+ };
1051
+ initInlineEditing('BLOCK_EDITOR', data);
1052
+ }
1008
1053
  /**
1009
1054
  * Initializes the Universal Visual Editor (UVE) with required handlers and event listeners.
1010
1055
  *
@@ -1060,6 +1105,7 @@ exports.combineClasses = combineClasses;
1060
1105
  exports.computeScrollIsInBottom = computeScrollIsInBottom;
1061
1106
  exports.createUVESubscription = createUVESubscription;
1062
1107
  exports.editContentlet = editContentlet;
1108
+ exports.enableBlockEditorInline = enableBlockEditorInline;
1063
1109
  exports.findDotCMSElement = findDotCMSElement;
1064
1110
  exports.findDotCMSVTLData = findDotCMSVTLData;
1065
1111
  exports.getClosestDotCMSContainerData = getClosestDotCMSContainerData;
@@ -1078,3 +1124,4 @@ exports.isValidBlocks = isValidBlocks;
1078
1124
  exports.reorderMenu = reorderMenu;
1079
1125
  exports.sendMessageToUVE = sendMessageToUVE;
1080
1126
  exports.setBounds = setBounds;
1127
+ exports.updateNavigation = updateNavigation;
package/public.esm.js CHANGED
@@ -931,6 +931,22 @@ const listenBlockEditorClick = () => {
931
931
  });
932
932
  };
933
933
 
934
+ /**
935
+ * Updates the navigation in the editor.
936
+ *
937
+ * @param {string} pathname - The pathname to update the navigation with.
938
+ * @memberof DotCMSPageEditor
939
+ * @example
940
+ * updateNavigation('/home'); // Sends a message to the editor to update the navigation to '/home'
941
+ */
942
+ function updateNavigation(pathname) {
943
+ sendMessageToUVE({
944
+ action: DotCMSUVEAction.NAVIGATION_UPDATE,
945
+ payload: {
946
+ url: pathname || '/'
947
+ }
948
+ });
949
+ }
934
950
  /**
935
951
  * Post message to dotcms page editor
936
952
  *
@@ -1003,6 +1019,35 @@ function initInlineEditing(type, data) {
1003
1019
  }
1004
1020
  });
1005
1021
  }
1022
+ /**
1023
+ * Initializes the block editor inline editing for a contentlet field.
1024
+ *
1025
+ * @example
1026
+ * ```html
1027
+ * <div onclick="enableBlockEditorInline(contentlet, 'MY_BLOCK_EDITOR_FIELD_VARIABLE')">
1028
+ * ${My Content}
1029
+ * </div>
1030
+ * ```
1031
+ *
1032
+ * @export
1033
+ * @param {DotCMSBasicContentlet} contentlet
1034
+ * @param {string} fieldName
1035
+ * @return {*} {void}
1036
+ */
1037
+ function enableBlockEditorInline(contentlet, fieldName) {
1038
+ if (!contentlet?.[fieldName]) {
1039
+ console.error(`Contentlet ${contentlet?.identifier} does not have field ${fieldName}`);
1040
+ return;
1041
+ }
1042
+ const data = {
1043
+ fieldName,
1044
+ inode: contentlet.inode,
1045
+ language: contentlet.languageId,
1046
+ contentType: contentlet.contentType,
1047
+ content: contentlet[fieldName]
1048
+ };
1049
+ initInlineEditing('BLOCK_EDITOR', data);
1050
+ }
1006
1051
  /**
1007
1052
  * Initializes the Universal Visual Editor (UVE) with required handlers and event listeners.
1008
1053
  *
@@ -1045,4 +1090,4 @@ function initUVE(config = {}) {
1045
1090
  };
1046
1091
  }
1047
1092
 
1048
- export { CUSTOM_NO_COMPONENT as C, DEVELOPMENT_MODE as D, END_CLASS as E, PRODUCTION_MODE as P, START_CLASS as S, __UVE_EVENTS__ as _, initUVE as a, __UVE_EVENT_ERROR_FALLBACK__ as b, createUVESubscription as c, EMPTY_CONTAINER_STYLE_REACT as d, editContentlet as e, EMPTY_CONTAINER_STYLE_ANGULAR as f, getUVEState as g, getDotCMSPageBounds as h, initInlineEditing as i, getDotCMSContentletsBound as j, getDotCMSContainerData as k, getClosestDotCMSContainerData as l, findDotCMSElement as m, findDotCMSVTLData as n, computeScrollIsInBottom as o, combineClasses as p, getColumnPositionClasses as q, reorderMenu as r, sendMessageToUVE as s, getDotContentletAttributes as t, getContainersData as u, getContentletsInContainer as v, getDotContainerAttributes as w, setBounds as x, isValidBlocks as y };
1093
+ export { isValidBlocks as A, CUSTOM_NO_COMPONENT as C, DEVELOPMENT_MODE as D, END_CLASS as E, PRODUCTION_MODE as P, START_CLASS as S, __UVE_EVENTS__ as _, enableBlockEditorInline as a, initUVE as b, createUVESubscription as c, __UVE_EVENT_ERROR_FALLBACK__ as d, editContentlet as e, EMPTY_CONTAINER_STYLE_REACT as f, getUVEState as g, EMPTY_CONTAINER_STYLE_ANGULAR as h, initInlineEditing as i, getDotCMSPageBounds as j, getDotCMSContentletsBound as k, getDotCMSContainerData as l, getClosestDotCMSContainerData as m, findDotCMSElement as n, findDotCMSVTLData as o, computeScrollIsInBottom as p, combineClasses as q, reorderMenu as r, sendMessageToUVE as s, getColumnPositionClasses as t, updateNavigation as u, getDotContentletAttributes as v, getContainersData as w, getContentletsInContainer as x, getDotContainerAttributes as y, setBounds as z };
@@ -1,5 +1,14 @@
1
- import { Contentlet, DotCMSUVEConfig, DotCMSInlineEditingPayload, DotCMSInlineEditingType } from '@dotcms/types';
1
+ import { Contentlet, DotCMSUVEConfig, DotCMSInlineEditingPayload, DotCMSInlineEditingType, DotCMSBasicContentlet } from '@dotcms/types';
2
2
  import { DotCMSReorderMenuConfig, DotCMSUVEMessage } from '@dotcms/types/internal';
3
+ /**
4
+ * Updates the navigation in the editor.
5
+ *
6
+ * @param {string} pathname - The pathname to update the navigation with.
7
+ * @memberof DotCMSPageEditor
8
+ * @example
9
+ * updateNavigation('/home'); // Sends a message to the editor to update the navigation to '/home'
10
+ */
11
+ export declare function updateNavigation(pathname: string): void;
3
12
  /**
4
13
  * Post message to dotcms page editor
5
14
  *
@@ -35,6 +44,22 @@ export declare function reorderMenu(config?: DotCMSReorderMenuConfig): void;
35
44
  * ```
36
45
  */
37
46
  export declare function initInlineEditing(type: DotCMSInlineEditingType, data?: DotCMSInlineEditingPayload): void;
47
+ /**
48
+ * Initializes the block editor inline editing for a contentlet field.
49
+ *
50
+ * @example
51
+ * ```html
52
+ * <div onclick="enableBlockEditorInline(contentlet, 'MY_BLOCK_EDITOR_FIELD_VARIABLE')">
53
+ * ${My Content}
54
+ * </div>
55
+ * ```
56
+ *
57
+ * @export
58
+ * @param {DotCMSBasicContentlet} contentlet
59
+ * @param {string} fieldName
60
+ * @return {*} {void}
61
+ */
62
+ export declare function enableBlockEditorInline(contentlet: DotCMSBasicContentlet, fieldName: string): void;
38
63
  /**
39
64
  * Initializes the Universal Visual Editor (UVE) with required handlers and event listeners.
40
65
  *