@dotcms/uve 0.0.1-beta.4 → 0.0.1-beta.41

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.esm.js CHANGED
@@ -1,56 +1,3 @@
1
- import { UVE_MODE } from './types.esm.js';
2
-
3
- /**
4
- * Gets the current state of the Universal Visual Editor (UVE).
5
- *
6
- * This function checks if the code is running inside the DotCMS Universal Visual Editor
7
- * and returns information about its current state, including the editor mode.
8
- *
9
- * @export
10
- * @return {UVEState | undefined} Returns the UVE state object if running inside the editor,
11
- * undefined otherwise.
12
- *
13
- * The state includes:
14
- * - mode: The current editor mode (preview, edit, live)
15
- * - languageId: The language ID of the current page setted on the UVE
16
- * - persona: The persona of the current page setted on the UVE
17
- * - variantName: The name of the current variant
18
- * - experimentId: The ID of the current experiment
19
- * - publishDate: The publish date of the current page setted on the UVE
20
- *
21
- * @note The absence of any of these properties means that the value is the default one.
22
- *
23
- * @example
24
- * ```ts
25
- * const editorState = getUVEState();
26
- * if (editorState?.mode === 'edit') {
27
- * // Enable editing features
28
- * }
29
- * ```
30
- */
31
- function getUVEState() {
32
- if (typeof window === 'undefined' || window.parent === window || !window.location) {
33
- return;
34
- }
35
- const url = new URL(window.location.href);
36
- const possibleModes = Object.values(UVE_MODE);
37
- let mode = url.searchParams.get('mode') ?? UVE_MODE.EDIT;
38
- const languageId = url.searchParams.get('language_id');
39
- const persona = url.searchParams.get('personaId');
40
- const variantName = url.searchParams.get('variantName');
41
- const experimentId = url.searchParams.get('experimentId');
42
- const publishDate = url.searchParams.get('publishDate');
43
- if (!possibleModes.includes(mode)) {
44
- mode = UVE_MODE.EDIT;
45
- }
46
- return {
47
- mode,
48
- languageId,
49
- persona,
50
- variantName,
51
- experimentId,
52
- publishDate
53
- };
54
- }
55
-
56
- export { getUVEState };
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
+ import '@dotcms/types';
3
+ import '@dotcms/types/internal';
@@ -0,0 +1 @@
1
+ export * from "./src/internal";
@@ -0,0 +1 @@
1
+ exports._default = require('./internal.cjs.js').default;
@@ -0,0 +1,103 @@
1
+ 'use strict';
2
+
3
+ var _public = require('./public.cjs.js');
4
+ require('@dotcms/types');
5
+ require('@dotcms/types/internal');
6
+
7
+ /**
8
+ * TinyMCE default config across all versions
9
+ *
10
+ * @internal
11
+ */
12
+ const __DEFAULT_TINYMCE_CONFIG__ = {
13
+ menubar: false,
14
+ inline: true,
15
+ valid_styles: {
16
+ '*': 'font-size,font-family,color,text-decoration,text-align'
17
+ },
18
+ powerpaste_word_import: 'clean',
19
+ powerpaste_html_import: 'clean',
20
+ suffix: '.min' // Suffix to use when loading resources
21
+ };
22
+ /**
23
+ * TinyMCE config to use per mode
24
+ *
25
+ * @internal
26
+ */
27
+ const __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__ = {
28
+ full: {
29
+ plugins: 'link lists autolink charmap',
30
+ toolbar: ['styleselect undo redo | bold italic underline | forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent | hr charmap removeformat | link'],
31
+ style_formats: [{
32
+ title: 'Paragraph',
33
+ format: 'p'
34
+ }, {
35
+ title: 'Header 1',
36
+ format: 'h1'
37
+ }, {
38
+ title: 'Header 2',
39
+ format: 'h2'
40
+ }, {
41
+ title: 'Header 3',
42
+ format: 'h3'
43
+ }, {
44
+ title: 'Header 4',
45
+ format: 'h4'
46
+ }, {
47
+ title: 'Header 5',
48
+ format: 'h5'
49
+ }, {
50
+ title: 'Header 6',
51
+ format: 'h6'
52
+ }, {
53
+ title: 'Pre',
54
+ format: 'pre'
55
+ }, {
56
+ title: 'Code',
57
+ format: 'code'
58
+ }]
59
+ },
60
+ plain: {
61
+ plugins: '',
62
+ toolbar: ''
63
+ },
64
+ minimal: {
65
+ plugins: 'link autolink',
66
+ toolbar: 'bold italic underline | link',
67
+ valid_elements: 'strong,em,span[style],a[href]'
68
+ }
69
+ };
70
+ /**
71
+ * TinyMCE path
72
+ *
73
+ * @internal
74
+ */
75
+ const __TINYMCE_PATH_ON_DOTCMS__ = '/ext/tinymcev7/tinymce.min.js';
76
+
77
+ exports.CUSTOM_NO_COMPONENT = _public.CUSTOM_NO_COMPONENT;
78
+ exports.DEVELOPMENT_MODE = _public.DEVELOPMENT_MODE;
79
+ exports.EMPTY_CONTAINER_STYLE_ANGULAR = _public.EMPTY_CONTAINER_STYLE_ANGULAR;
80
+ exports.EMPTY_CONTAINER_STYLE_REACT = _public.EMPTY_CONTAINER_STYLE_REACT;
81
+ exports.END_CLASS = _public.END_CLASS;
82
+ exports.PRODUCTION_MODE = _public.PRODUCTION_MODE;
83
+ exports.START_CLASS = _public.START_CLASS;
84
+ exports.__UVE_EVENTS__ = _public.__UVE_EVENTS__;
85
+ exports.__UVE_EVENT_ERROR_FALLBACK__ = _public.__UVE_EVENT_ERROR_FALLBACK__;
86
+ exports.combineClasses = _public.combineClasses;
87
+ exports.computeScrollIsInBottom = _public.computeScrollIsInBottom;
88
+ exports.findDotCMSElement = _public.findDotCMSElement;
89
+ exports.findDotCMSVTLData = _public.findDotCMSVTLData;
90
+ exports.getClosestDotCMSContainerData = _public.getClosestDotCMSContainerData;
91
+ exports.getColumnPositionClasses = _public.getColumnPositionClasses;
92
+ exports.getContainersData = _public.getContainersData;
93
+ exports.getContentletsInContainer = _public.getContentletsInContainer;
94
+ exports.getDotCMSContainerData = _public.getDotCMSContainerData;
95
+ exports.getDotCMSContentletsBound = _public.getDotCMSContentletsBound;
96
+ exports.getDotCMSPageBounds = _public.getDotCMSPageBounds;
97
+ exports.getDotContainerAttributes = _public.getDotContainerAttributes;
98
+ exports.getDotContentletAttributes = _public.getDotContentletAttributes;
99
+ exports.isValidBlocks = _public.isValidBlocks;
100
+ exports.setBounds = _public.setBounds;
101
+ exports.__BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__ = __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__;
102
+ exports.__DEFAULT_TINYMCE_CONFIG__ = __DEFAULT_TINYMCE_CONFIG__;
103
+ exports.__TINYMCE_PATH_ON_DOTCMS__ = __TINYMCE_PATH_ON_DOTCMS__;
@@ -0,0 +1,2 @@
1
+ export * from './internal.cjs.js';
2
+ export { _default as default } from './internal.cjs.default.js';
@@ -0,0 +1 @@
1
+ export * from "./src/internal";
@@ -0,0 +1,75 @@
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
+ import '@dotcms/types';
3
+ import '@dotcms/types/internal';
4
+
5
+ /**
6
+ * TinyMCE default config across all versions
7
+ *
8
+ * @internal
9
+ */
10
+ const __DEFAULT_TINYMCE_CONFIG__ = {
11
+ menubar: false,
12
+ inline: true,
13
+ valid_styles: {
14
+ '*': 'font-size,font-family,color,text-decoration,text-align'
15
+ },
16
+ powerpaste_word_import: 'clean',
17
+ powerpaste_html_import: 'clean',
18
+ suffix: '.min' // Suffix to use when loading resources
19
+ };
20
+ /**
21
+ * TinyMCE config to use per mode
22
+ *
23
+ * @internal
24
+ */
25
+ const __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__ = {
26
+ full: {
27
+ plugins: 'link lists autolink charmap',
28
+ toolbar: ['styleselect undo redo | bold italic underline | forecolor backcolor | alignleft aligncenter alignright alignfull | numlist bullist outdent indent | hr charmap removeformat | link'],
29
+ style_formats: [{
30
+ title: 'Paragraph',
31
+ format: 'p'
32
+ }, {
33
+ title: 'Header 1',
34
+ format: 'h1'
35
+ }, {
36
+ title: 'Header 2',
37
+ format: 'h2'
38
+ }, {
39
+ title: 'Header 3',
40
+ format: 'h3'
41
+ }, {
42
+ title: 'Header 4',
43
+ format: 'h4'
44
+ }, {
45
+ title: 'Header 5',
46
+ format: 'h5'
47
+ }, {
48
+ title: 'Header 6',
49
+ format: 'h6'
50
+ }, {
51
+ title: 'Pre',
52
+ format: 'pre'
53
+ }, {
54
+ title: 'Code',
55
+ format: 'code'
56
+ }]
57
+ },
58
+ plain: {
59
+ plugins: '',
60
+ toolbar: ''
61
+ },
62
+ minimal: {
63
+ plugins: 'link autolink',
64
+ toolbar: 'bold italic underline | link',
65
+ valid_elements: 'strong,em,span[style],a[href]'
66
+ }
67
+ };
68
+ /**
69
+ * TinyMCE path
70
+ *
71
+ * @internal
72
+ */
73
+ const __TINYMCE_PATH_ON_DOTCMS__ = '/ext/tinymcev7/tinymce.min.js';
74
+
75
+ export { __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__, __DEFAULT_TINYMCE_CONFIG__, __TINYMCE_PATH_ON_DOTCMS__ };
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@dotcms/uve",
3
- "version": "0.0.1-beta.4",
3
+ "version": "0.0.1-beta.41",
4
4
  "description": "Official JavaScript library for interacting with Universal Visual Editor (UVE)",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/dotCMS/core.git#main"
8
8
  },
9
+ "devDependencies": {
10
+ "@dotcms/types": "next"
11
+ },
9
12
  "keywords": [
10
13
  "dotCMS",
11
14
  "CMS",
@@ -21,11 +24,11 @@
21
24
  "import": "./index.cjs.mjs",
22
25
  "default": "./index.cjs.js"
23
26
  },
24
- "./types": {
25
- "module": "./types.esm.js",
26
- "types": "./types.esm.d.ts",
27
- "import": "./types.cjs.mjs",
28
- "default": "./types.cjs.js"
27
+ "./internal": {
28
+ "module": "./internal.esm.js",
29
+ "types": "./internal.esm.d.ts",
30
+ "import": "./internal.cjs.mjs",
31
+ "default": "./internal.cjs.js"
29
32
  }
30
33
  },
31
34
  "typesVersions": {
@@ -33,8 +36,8 @@
33
36
  ".": [
34
37
  "./src/index.d.ts"
35
38
  ],
36
- "types": [
37
- "./src/types.d.ts"
39
+ "internal": [
40
+ "./src/internal.d.ts"
38
41
  ]
39
42
  }
40
43
  },