@orangelogic/design-system 3.19.0 → 3.21.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/library/chunks/{_baseXor.DixEm6JQ.js → _baseXor.BCxbgizO.js} +2 -2
- package/library/chunks/{asset-link-format.ttcRQgDc.js → asset-link-format.DjxLUjGN.js} +619 -611
- package/library/chunks/{button.D1YIxtv-.js → button.CklW2xIt.js} +3 -3
- package/library/chunks/button.styles.D3GdfF7I.js +5 -0
- package/library/chunks/{color-swatch-group.Bumfw-G2.js → color-swatch-group.B_eqaBlU.js} +3354 -2925
- package/library/chunks/color.CIHdfM_a.js +187 -0
- package/library/chunks/{confirm-popover.CJXyEa5A.js → confirm-popover.T7M1IynK.js} +4 -4
- package/library/chunks/content-builder.CBBdfVOl.js +55 -0
- package/library/chunks/{dialog.BbQ4Du0M.js → dialog.ATeOYqwC.js} +2 -2
- package/library/chunks/{document-viewer.C9tM2Gc7.js → document-viewer.DcR3RRh7.js} +10 -9
- package/library/chunks/{dom.DL-cNKsj.js → dom.D0lSUoEI.js} +1 -1
- package/library/chunks/{dot-pagination.CJRAtM51.js → dot-pagination.BrDTro_E.js} +1 -1
- package/library/chunks/{folder-select.BAPsI-gg.js → folder-select.ChVr6nVx.js} +5 -5
- package/library/chunks/{form.DN2v7-DH.js → form.LpappO1d.js} +1 -1
- package/library/chunks/{header.BioJzPlg.js → header.BeRkHwrR.js} +132 -90
- package/library/chunks/{i18n.rtxrs1c1.js → i18n.CcvOGKg6.js} +85 -5
- package/library/chunks/{icon-button.CbUddcgI.js → icon-button.CXELPgXm.js} +1 -1
- package/library/chunks/{iframe.y7iCAVZP.js → iframe.CT5jmGYk.js} +1 -1
- package/library/chunks/{image.A2hE1WoV.js → image.CqTbFbtg.js} +322 -222
- package/library/chunks/index.DgCcXGmO.js +1126 -0
- package/library/chunks/{input.D1FFprPl.js → input.DRdoQJOD.js} +2 -2
- package/library/chunks/{markdown.Dd_GFJK8.js → markdown.BF9bqmMv.js} +3 -3
- package/library/chunks/{menu-item.0TbnDEDp.js → menu-item.C0sQ8KjF.js} +1 -1
- package/library/chunks/{option.CyorNG0S.js → option.mXqrZbpB.js} +1 -1
- package/library/chunks/{pagination.D0BeaEIi.js → pagination.C5DtaMQU.js} +36 -32
- package/library/chunks/{position-picker.DjnhxIKF.js → position-picker.qkbJlboF.js} +12 -0
- package/library/chunks/responsive.BmBJSzC4.js +17 -0
- package/library/chunks/{string.Demn8Xmk.js → string.CfI2ejyR.js} +3 -3
- package/library/chunks/{tab-group.C98CWzEH.js → tab-group.OEwvRv7m.js} +312 -310
- package/library/chunks/toast.D3AW3RWv.js +94 -0
- package/library/chunks/transformation.BwQ_H-4q.js +351 -0
- package/library/chunks/{tree.B7IKBX3n.js → tree.DlO3BFjn.js} +4 -7
- package/library/chunks/{types.DVZ_cbKn.js → types.VFIFor5z.js} +58039 -35788
- package/library/chunks/typography.BLYdTF0n.js +102 -0
- package/library/components/alert.js +2 -2
- package/library/components/asset-link-format.js +6 -6
- package/library/components/atoms.js +161 -159
- package/library/components/audio.js +4 -4
- package/library/components/bicolor-picker.js +2 -2
- package/library/components/border-input-group.js +2 -2
- package/library/components/box.d.ts +3 -0
- package/library/components/box.js +22 -0
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +4 -4
- package/library/components/card.js +7 -7
- package/library/components/checkbox.js +1 -1
- package/library/components/color-picker.js +36 -32
- package/library/components/color-swatch-group.js +8 -7
- package/library/components/color-swatch.js +246 -22
- package/library/components/confirm-popover.js +5 -5
- package/library/components/copy-button.js +2 -2
- package/library/components/corner-position-input-group.js +3 -3
- package/library/components/date-calendar.js +1 -1
- package/library/components/details.js +19 -19
- package/library/components/dialog.js +3 -3
- package/library/components/diff.js +1 -1
- package/library/components/document-viewer.js +4 -4
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +2 -2
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +95 -92
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +12 -12
- package/library/components/folder-select.js +5 -5
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +1 -1
- package/library/components/header.js +6 -3
- package/library/components/icon-button.js +2 -2
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +1 -1
- package/library/components/image.js +4 -3
- package/library/components/input.js +3 -3
- package/library/components/line-clamp.js +1 -1
- package/library/components/markdown.js +4 -4
- package/library/components/masonry.js +70 -56
- package/library/components/menu-item.js +2 -2
- package/library/components/menu.js +2 -2
- package/library/components/molecules.js +4 -4
- package/library/components/mutation-observer.js +25 -23
- package/library/components/option.js +2 -2
- package/library/components/organisms.js +2 -2
- package/library/components/padding-input-group.js +1 -1
- package/library/components/pagination.js +7 -7
- package/library/components/popup.js +1 -1
- package/library/components/position-picker.js +2 -2
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/radio-button.js +1 -1
- package/library/components/radio-card.js +1 -1
- package/library/components/radio-group.js +1 -1
- package/library/components/range.js +2 -2
- package/library/components/rating.js +1 -1
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +4 -4
- package/library/components/shadow-input-group.js +1 -1
- package/library/components/share-option-list.js +3 -3
- package/library/components/sidebar.js +1 -1
- package/library/components/size-input-group.js +3 -3
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +1 -1
- package/library/components/switch.js +1 -1
- package/library/components/tab-group.js +6 -6
- package/library/components/tab-panel.js +1 -1
- package/library/components/tab.js +16 -16
- package/library/components/tag.js +2 -2
- package/library/components/textarea.js +1 -1
- package/library/components/timecode.js +2 -2
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +2 -2
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +3 -3
- package/library/components/types.js +495 -487
- package/library/components/typography.js +3 -2
- package/library/components/video.js +4232 -4211
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/audio/audio.d.ts +0 -1
- package/library/packages/atoms/src/components/box/box.d.ts +26 -0
- package/library/packages/atoms/src/components/box/box.styles.d.ts +7 -0
- package/library/packages/atoms/src/components/button/button.d.ts +4 -0
- package/library/packages/atoms/src/components/card/card.d.ts +1 -0
- package/library/packages/atoms/src/components/color-picker/color-picker.d.ts +11 -0
- package/library/packages/atoms/src/components/copy-button/copy-button.d.ts +1 -0
- package/library/packages/atoms/src/components/details/details.d.ts +6 -1
- package/library/packages/atoms/src/components/header/header.d.ts +38 -2
- package/library/packages/atoms/src/components/image/image.d.ts +14 -0
- package/library/packages/atoms/src/components/mutation-observer/mutation-observer.d.ts +1 -1
- package/library/packages/atoms/src/components/radio-card/radio-card.d.ts +1 -0
- package/library/packages/atoms/src/components/tab/tab.d.ts +17 -0
- package/library/packages/atoms/src/components/tree/tree.d.ts +2 -2
- package/library/packages/atoms/src/components/typography/typography.d.ts +31 -0
- package/library/packages/atoms/src/components/video/video.d.ts +18 -1
- package/library/packages/atoms/src/index.d.ts +1 -0
- package/library/packages/events/src/cx-color-swatch-picker-columns-change.d.ts +15 -0
- package/library/packages/events/src/events.d.ts +1 -0
- package/library/packages/hybrid/table-core/src/table/components/table-toolbar/table-dropdown-filter.d.ts +2 -0
- package/library/packages/hybrid/table-core/src/table/table.d.ts +45 -5
- package/library/packages/molecules/src/color-swatch/color-swatch.d.ts +35 -1
- package/library/packages/molecules/src/data-tab-group/data-tab-group.d.ts +30 -1
- package/library/packages/molecules/src/details-group/details-group.d.ts +105 -3
- package/library/packages/molecules/src/dynamic-select/dynamic-select.d.ts +5 -0
- package/library/packages/molecules/src/font-picker/font-picker.d.ts +3 -0
- package/library/packages/molecules/src/gallery-item/gallery-item.d.ts +10 -0
- package/library/packages/molecules/src/index.d.ts +0 -1
- package/library/packages/molecules/src/masonry/masonry.d.ts +5 -0
- package/library/packages/organisms/src/color-swatch-group/color-swatch-group.constants.d.ts +37 -45
- package/library/packages/organisms/src/color-swatch-group/color-swatch-group.d.ts +210 -10
- package/library/packages/organisms/src/content-builder/blocks/audio/audio.d.ts +0 -1
- package/library/packages/organisms/src/content-builder/blocks/font-kit-advanced/font-kit-advanced.utils.d.ts +85 -0
- package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +26 -33
- package/library/packages/organisms/src/content-builder/components/block-picker/block-picker.d.ts +24 -8
- package/library/packages/organisms/src/content-builder/components/color-swatch-picker/color-swatch-picker.d.ts +70 -1
- package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +1 -22
- package/library/packages/organisms/src/content-builder/components/config-manager/config-manager.d.ts +7 -0
- package/library/packages/organisms/src/content-builder/components/gallery-config/gallery-config.d.ts +6 -0
- package/library/packages/organisms/src/content-builder/components/gallery-picker/gallery-picker.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/accordion.d.ts +7 -0
- package/library/packages/organisms/src/content-builder/configs/audio.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/button.d.ts +2 -1
- package/library/packages/organisms/src/content-builder/configs/carousel.d.ts +11 -1
- package/library/packages/organisms/src/content-builder/configs/color-swatches.d.ts +19 -1
- package/library/packages/organisms/src/content-builder/configs/column-group.d.ts +11 -2
- package/library/packages/organisms/src/content-builder/configs/column.d.ts +13 -3
- package/library/packages/organisms/src/content-builder/configs/dam-view.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/divider.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/document-viewer.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/font-kit-advanced.d.ts +19 -0
- package/library/packages/organisms/src/content-builder/configs/font-kit.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/gallery.d.ts +15 -1
- package/library/packages/organisms/src/content-builder/configs/header.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/image.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/configs/index.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/search-box.d.ts +5 -1
- package/library/packages/organisms/src/content-builder/configs/tab-group.d.ts +7 -4
- package/library/packages/organisms/src/content-builder/configs/timeline.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/configs/video.d.ts +3 -0
- package/library/packages/organisms/src/content-builder/configs-controller.d.ts +155 -13
- package/library/packages/organisms/src/content-builder/content-builder-config.d.ts +60 -0
- package/library/packages/organisms/src/content-builder/content-builder-constants.d.ts +24 -9
- package/library/packages/organisms/src/content-builder/content-builder.d.ts +121 -151
- package/library/packages/organisms/src/content-builder/content-builder.sections.utils.d.ts +78 -0
- package/library/packages/organisms/src/content-builder/content-builder.utils.d.ts +33 -22
- package/library/packages/organisms/src/content-builder/plugins/font-kit-advanced.d.ts +5 -0
- package/library/packages/organisms/src/content-builder/plugins/gallery.d.ts +6 -0
- package/library/packages/organisms/src/content-builder/plugins/header.d.ts +7 -1
- package/library/packages/organisms/src/content-builder/plugins/index.d.ts +2 -1
- package/library/packages/organisms/src/content-builder/plugins/rich-text-editor/components/rte-bubble-menu/rte-bubble-menu.d.ts +21 -1
- package/library/packages/organisms/src/content-builder/plugins/rich-text-editor/extensions/index.d.ts +2 -0
- package/library/packages/organisms/src/content-builder/plugins/rich-text-editor/rte-configs.d.ts +14 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/section-fragment-component.d.ts +22 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/section-host-mounting.d.ts +15 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/sections-canvas-patches.d.ts +20 -0
- package/library/packages/organisms/src/content-builder/plugins/sections/sections-plugin.d.ts +7 -0
- package/library/packages/organisms/src/content-builder/plugins/toolbar.d.ts +10 -1
- package/library/packages/organisms/src/content-builder/plugins/utils/block-width.d.ts +20 -0
- package/library/packages/organisms/src/content-builder/styleController.d.ts +9 -5
- package/library/packages/organisms/src/content-builder-viewer/content-builder-viewer.d.ts +3 -10
- package/library/packages/organisms/src/form/control-renderer/control-renderer.d.ts +170 -0
- package/library/packages/organisms/src/form/control-renderer/control-renderer.styles.d.ts +9 -0
- package/library/packages/organisms/src/list-editor/list-editor.d.ts +181 -6
- package/library/packages/tools/src/fetch-image/fetch-image.d.ts +12 -0
- package/library/packages/tools/src/tiptap/extensions/metafield/index.d.ts +12 -0
- package/library/packages/tools/src/tiptap/utils/md/schema.d.ts +1 -1
- package/library/packages/types/src/asset-link-format.d.ts +0 -1
- package/library/packages/types/src/button.d.ts +1 -1
- package/library/packages/types/src/color-swatch-group.d.ts +56 -0
- package/library/packages/types/src/color-swatch.d.ts +22 -0
- package/library/packages/types/src/column.d.ts +13 -0
- package/library/packages/types/src/content-builder.d.ts +69 -4
- package/library/packages/types/src/details-group.d.ts +80 -0
- package/library/packages/types/src/font-kit-advanced.d.ts +28 -0
- package/library/packages/types/src/font-kit.d.ts +19 -0
- package/library/packages/types/src/font-picker.d.ts +2 -0
- package/library/packages/types/src/gallery-item.d.ts +3 -1
- package/library/packages/types/src/gallery.d.ts +2 -1
- package/library/packages/types/src/index.d.ts +1 -0
- package/library/packages/types/src/masonry.d.ts +1 -0
- package/library/packages/types/src/position-picker.d.ts +6 -0
- package/library/packages/types/src/sb-button.d.ts +7 -0
- package/library/packages/types/src/search-box.d.ts +4 -0
- package/library/packages/utils/src/color/color.d.ts +27 -3
- package/library/packages/utils/src/custom-element/i18n.d.ts +86 -2
- package/library/packages/utils/src/font/font.d.ts +12 -0
- package/library/packages/utils/src/transformation/transformation.d.ts +11 -5
- package/library/react-web-component.d.ts +510 -160
- package/library/utils.js +418 -399
- package/package.json +1 -1
- package/library/chunks/button.styles.BWgHrfLD.js +0 -5
- package/library/chunks/color-swatch.DdsUysbF.js +0 -223
- package/library/chunks/color.LzSGBy7o.js +0 -164
- package/library/chunks/index.Coy2OPB4.js +0 -20122
- package/library/chunks/toast.BxiewnAG.js +0 -109
- package/library/chunks/transformation.CjWnFhab.js +0 -386
- package/library/chunks/typography.T72DuoCa.js +0 -52
- package/library/packages/molecules/src/search-box/search-box.d.ts +0 -114
- package/library/packages/organisms/src/content-builder/plugins/wrapper-container.d.ts +0 -15
- /package/library/packages/{molecules/src/search-box/search-box.styles.d.ts → organisms/src/content-builder-viewer/content-builder-viewer.styles.d.ts} +0 -0
|
@@ -4,7 +4,7 @@ import { default as CxPopup } from '../../../atoms/src/components/popup/popup.ts
|
|
|
4
4
|
import { default as CxSpinner } from '../../../atoms/src/components/spinner/spinner.ts';
|
|
5
5
|
import { default as CortexElement } from '../../../base/src/cortex-element.ts';
|
|
6
6
|
import { AssetFormatValue } from '../../../types/src/asset-format-picker';
|
|
7
|
-
import { Asset, AssetTypeString, Device, EditorMode, TeamSpaceRole } from '../../../types/src/content-builder';
|
|
7
|
+
import { Asset, AssetTypeString, ContentBuilderSection, ContentBuilderSectionContent, Device, EditorMode, TeamSpaceRole } from '../../../types/src/content-builder';
|
|
8
8
|
import { Component, Editor } from 'grapesjs';
|
|
9
9
|
import { TemplateResult } from 'lit';
|
|
10
10
|
import { CxBlockPicker } from './components/block-picker';
|
|
@@ -16,13 +16,19 @@ import { CxRTEBubbleMenu, CxRTETableGenerator } from './plugins';
|
|
|
16
16
|
*
|
|
17
17
|
* Set `enable-asset-format-controls` to expose the asset format, transformation,
|
|
18
18
|
* download-format, and asset-format-picker controls on image, video, gallery,
|
|
19
|
-
* carousel, and timeline blocks. Off by default.
|
|
19
|
+
* carousel, column-group, and timeline blocks. Off by default.
|
|
20
20
|
*
|
|
21
21
|
* `default-image-format`, `default-video-poster-format`, `default-timeline-format`,
|
|
22
22
|
* `default-gallery-format` and `default-carousel-format` are retained for backward
|
|
23
23
|
* compatibility but no longer do anything: every block type now starts in `Auto` and
|
|
24
24
|
* derives its proxy from the asset's own file extension.
|
|
25
25
|
*
|
|
26
|
+
* Several regions of one canvas page can be edited at once: `container-selector` /
|
|
27
|
+
* `initial-data` describe the implicit `page-content` section and `sections` adds more
|
|
28
|
+
* (for CMS5, the `hero` masthead). Each section is mounted inside its own host container
|
|
29
|
+
* of the canvas document and read back with `getSectionContent(id)`; `html()` / `json()`
|
|
30
|
+
* keep returning the page content.
|
|
31
|
+
*
|
|
26
32
|
* @event cx-change - Emitted when the content builder changes.
|
|
27
33
|
*/
|
|
28
34
|
export default class CxContentBuilder extends CortexElement {
|
|
@@ -60,16 +66,6 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
60
66
|
* @default ''
|
|
61
67
|
*/
|
|
62
68
|
initialData: string;
|
|
63
|
-
/**
|
|
64
|
-
* Published HTML of the page, used as the content source when it holds more
|
|
65
|
-
* content blocks than `initial-data` (a page whose JSON was never produced by
|
|
66
|
-
* this editor, e.g. published through the API with HTML only or with a
|
|
67
|
-
* partial JSON). Parsed through the registered block types, so every block
|
|
68
|
-
* the editor knows is recovered. Ignored when `initial-data` has at least as
|
|
69
|
-
* many blocks.
|
|
70
|
-
* @default ''
|
|
71
|
-
*/
|
|
72
|
-
initialHtml: string;
|
|
73
69
|
/**
|
|
74
70
|
* This property reflects the current device type being used in the content builder.
|
|
75
71
|
* It can be one of the predefined device types such as 'desktop', 'tablet', or 'mobile'.
|
|
@@ -97,6 +93,16 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
97
93
|
* @default undefined
|
|
98
94
|
*/
|
|
99
95
|
containerSelector?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Additional editable sections rendered inside the same canvas document (L-429UPF).
|
|
98
|
+
* Each section owns a host container (`containerSelector`) in the canvas page and its own
|
|
99
|
+
* project data (`initialData`); the builder mounts a fragment node inside the host and edits
|
|
100
|
+
* that node's tree. `container-selector` / `initial-data` remain the implicit `page-content`
|
|
101
|
+
* section, so existing single-region usages are unaffected. Read a section back with
|
|
102
|
+
* `getSectionContent(id)`.
|
|
103
|
+
* @default []
|
|
104
|
+
*/
|
|
105
|
+
sections: ContentBuilderSection[];
|
|
100
106
|
/**
|
|
101
107
|
* This property indicates whether the content builder should initialize automatically.
|
|
102
108
|
* @default false
|
|
@@ -233,7 +239,18 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
233
239
|
private containerDropdowns;
|
|
234
240
|
private containerDropdownStateMap;
|
|
235
241
|
private distance;
|
|
242
|
+
/**
|
|
243
|
+
* How far, in px, the add-block button is pushed below its divider line so it clears the
|
|
244
|
+
* editor header. The line stays on the insertion point; only the button moves.
|
|
245
|
+
*/
|
|
246
|
+
private addBlockButtonOffset;
|
|
236
247
|
private toolbar;
|
|
248
|
+
/** Last toolbar position GrapesJS computed, re-clamped whenever the toolbar changes size. */
|
|
249
|
+
private lastToolbarPos?;
|
|
250
|
+
/** Watches the toolbar's box: its Lit items render after GrapesJS has already measured it. */
|
|
251
|
+
private toolbarResizeObserver?;
|
|
252
|
+
/** `select-comp` commands already wrapped by `patchToolsWrapperBounds`, so a re-init cannot stack wrappers. */
|
|
253
|
+
private toolsBoundsPatchedCommands;
|
|
237
254
|
private toolbarActive;
|
|
238
255
|
private childSelected;
|
|
239
256
|
private mappedSupportedLanguages;
|
|
@@ -250,17 +267,6 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
250
267
|
private _dsm;
|
|
251
268
|
private get dsm();
|
|
252
269
|
private hasBoundUpdate;
|
|
253
|
-
/**
|
|
254
|
-
* True while `loadPage` swaps project data into the running editor, so the
|
|
255
|
-
* swap is never mistaken for an authoring change (no `cx-change`, no
|
|
256
|
-
* builder re-init from the property watch).
|
|
257
|
-
*/
|
|
258
|
-
private softLoading;
|
|
259
|
-
/**
|
|
260
|
-
* True when the last project load took its content from `initial-html`
|
|
261
|
-
* rather than `initial-data`; such content settles later than a JSON load.
|
|
262
|
-
*/
|
|
263
|
-
private adoptedInitialHtml;
|
|
264
270
|
/**
|
|
265
271
|
* In-flight/resolved block-types fetch, kept as a promise (not the awaited value) so the
|
|
266
272
|
* `component:open-picker` handler can share it even if it fires before the prefetch below
|
|
@@ -270,24 +276,6 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
270
276
|
private blockTypesPromise;
|
|
271
277
|
private prefetchBlockTypes;
|
|
272
278
|
private newlyAddedComponentTimeout;
|
|
273
|
-
/**
|
|
274
|
-
* Pending tail of a `loadPage` soft switch: lifts the change suppression and
|
|
275
|
-
* wipes the undo/dirty bookkeeping once GrapesJS has settled.
|
|
276
|
-
*/
|
|
277
|
-
private loadPageSettleTimeout;
|
|
278
|
-
/**
|
|
279
|
-
* The one-shot `update` listener the settle waits on, kept so it can be detached
|
|
280
|
-
* along with the timer whenever the editor is torn down or a new load starts.
|
|
281
|
-
*/
|
|
282
|
-
private loadPageSettleUpdateHandler;
|
|
283
|
-
/**
|
|
284
|
-
* Bumped on every project load. Async work started by a load compares against it
|
|
285
|
-
* so a response belonging to a superseded page is dropped instead of written to
|
|
286
|
-
* the editor the newer page now owns.
|
|
287
|
-
*/
|
|
288
|
-
private loadGeneration;
|
|
289
|
-
/** The templates refresh started by the current load, awaited before settling. */
|
|
290
|
-
private templatesRefreshPromise;
|
|
291
279
|
private readonly initializeCustomFrame;
|
|
292
280
|
private containerDropdownObservers;
|
|
293
281
|
private nextMapHoveredBadgeState;
|
|
@@ -334,6 +322,19 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
334
322
|
* @returns HTML string
|
|
335
323
|
*/
|
|
336
324
|
html(): string;
|
|
325
|
+
/**
|
|
326
|
+
* Returns one section's persisted content: its inner HTML (with the default-language
|
|
327
|
+
* translatable texts applied) plus the CSS rules matched by that section, and the section's own
|
|
328
|
+
* project JSON in the same shape a single-section builder produces. `undefined` when the section
|
|
329
|
+
* is not configured or not rendered yet.
|
|
330
|
+
* @param sectionId - `page-content`, `hero`, or any id passed through `sections`
|
|
331
|
+
*/
|
|
332
|
+
getSectionContent(sectionId: string): ContentBuilderSectionContent | undefined;
|
|
333
|
+
/**
|
|
334
|
+
* Replaces each translatable text node's markup with the default-language record stored in the
|
|
335
|
+
* project's translatable-texts data source, so the persisted HTML reads in the space language.
|
|
336
|
+
*/
|
|
337
|
+
private localizeHtml;
|
|
337
338
|
/**
|
|
338
339
|
* This method returns the JSON representation of the content builder's project data.
|
|
339
340
|
* It filters the styles to include only those that have selectors starting with '#',
|
|
@@ -353,112 +354,6 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
353
354
|
* effectively resetting the count of changes made since the last reset.
|
|
354
355
|
*/
|
|
355
356
|
resetDirtyCount(): void;
|
|
356
|
-
/**
|
|
357
|
-
* Load another page's content into the running editor without recreating the
|
|
358
|
-
* GrapesJS instance or reloading the canvas frame document (a soft page
|
|
359
|
-
* switch). Only the project data is swapped here - the canvas document's own
|
|
360
|
-
* chrome (header, navigation, per-page styles) is the host's responsibility,
|
|
361
|
-
* typically by asking the frame to re-render itself in place.
|
|
362
|
-
*
|
|
363
|
-
* The switch resets selection, undo history and the dirty count, and never
|
|
364
|
-
* emits `cx-change`, so it cannot trigger an auto-save of the incoming page.
|
|
365
|
-
*
|
|
366
|
-
* @param options New page's `canvas-src`, `initial-data` JSON string,
|
|
367
|
-
* `initial-html` fallback and `page-id`. Omitted fields keep their current
|
|
368
|
-
* values, except `initial-html`, which belongs to one page and is cleared.
|
|
369
|
-
* @returns `true` when the switch was applied to a running editor; `false`
|
|
370
|
-
* when the editor has not booted yet - the caller must then fall back to a
|
|
371
|
-
* full render/init cycle.
|
|
372
|
-
*/
|
|
373
|
-
loadPage(options: {
|
|
374
|
-
canvasSrc?: string;
|
|
375
|
-
initialData?: string;
|
|
376
|
-
initialHtml?: string;
|
|
377
|
-
pageId?: string;
|
|
378
|
-
}): Promise<boolean>;
|
|
379
|
-
/**
|
|
380
|
-
* Drop any pending load settle: both its timer and the `update` listener it is
|
|
381
|
-
* waiting on.
|
|
382
|
-
*
|
|
383
|
-
* Must run before every `contentBuilder.destroy()`. The scheduled callback closes
|
|
384
|
-
* over the editor it was armed for, and destroying does not null the field, so a
|
|
385
|
-
* surviving callback would clear the undo history of - and reset the dirty count
|
|
386
|
-
* of - whichever editor replaced it.
|
|
387
|
-
*/
|
|
388
|
-
private cancelLoadPageSettle;
|
|
389
|
-
/**
|
|
390
|
-
* Run `finish` once GrapesJS has flushed the load, at the earliest after `delay`.
|
|
391
|
-
*
|
|
392
|
-
* GrapesJS chains two zero-delay timers on its way to `update`
|
|
393
|
-
* (`handleUpdates` -> `changesCount` -> `updateChanges` -> `update`), so a bare
|
|
394
|
-
* timer here fires before the swap's own `update` and would lift the change
|
|
395
|
-
* suppression while the load is still counted as authoring - emitting `cx-change`
|
|
396
|
-
* for the page that was just loaded. Waiting for both the delay and that event
|
|
397
|
-
* closes the gap; a swap that produced no countable change never fires it at all,
|
|
398
|
-
* so `SETTLE_UPDATE_GRACE` gives up rather than latching the suppression.
|
|
399
|
-
*/
|
|
400
|
-
private scheduleSettle;
|
|
401
|
-
/**
|
|
402
|
-
* Parse the current `initial-data` JSON string into project data, treating a
|
|
403
|
-
* missing or malformed payload as an empty project.
|
|
404
|
-
*/
|
|
405
|
-
private parseInitialProjectData;
|
|
406
|
-
/**
|
|
407
|
-
* Swap the project in place rather than via `loadProjectData`: that clears
|
|
408
|
-
* every module including pages/frames, and recreating the frame reloads the
|
|
409
|
-
* canvas iframe - the very reload this method exists to avoid. Pages and
|
|
410
|
-
* frames are kept; data sources, styles and the wrapper's component tree
|
|
411
|
-
* are what actually differ between pages.
|
|
412
|
-
*/
|
|
413
|
-
private swapProjectData;
|
|
414
|
-
/**
|
|
415
|
-
* Number of blocks an author would see under `root`: every component other
|
|
416
|
-
* than the layout scaffolding (wrapper, cells, column groups), nested ones
|
|
417
|
-
* included.
|
|
418
|
-
*/
|
|
419
|
-
private countComponentBlocks;
|
|
420
|
-
/**
|
|
421
|
-
* Whether `initial-html` carries blocks the loaded JSON does not. The
|
|
422
|
-
* published HTML is what readers see, so it wins whenever it holds strictly
|
|
423
|
-
* more blocks than the project JSON: a page whose JSON was never produced by
|
|
424
|
-
* this editor (published through the API) may carry only the blocks the
|
|
425
|
-
* server needs. Both sides are always counted, and after the same block-type
|
|
426
|
-
* resolution, so JSON that the editor saved itself always matches its HTML
|
|
427
|
-
* and keeps precedence - and markup with no recognized blocks is never
|
|
428
|
-
* adopted over JSON that has none either.
|
|
429
|
-
*/
|
|
430
|
-
private initialHtmlHasMoreBlocks;
|
|
431
|
-
/**
|
|
432
|
-
* Fill a project from `initial-html` when the JSON lacks blocks the HTML
|
|
433
|
-
* has. GrapesJS parses the markup through the block types' `isComponent`
|
|
434
|
-
* recognizers, so each element comes back as its block with the plugin
|
|
435
|
-
* defaults merged in - the same component the picker would create. The one
|
|
436
|
-
* shape the parser cannot produce is the rich-text `content` string: it
|
|
437
|
-
* yields bare text nodes instead, which the host rejects as an empty block,
|
|
438
|
-
* so those are folded back into `content`.
|
|
439
|
-
*/
|
|
440
|
-
private adoptInitialHtml;
|
|
441
|
-
/**
|
|
442
|
-
* The page viewer's `--row-gap`, as both the raw CSS value written back into
|
|
443
|
-
* the root column's style and its parsed pixel value (used for add-block
|
|
444
|
-
* popup spacing). Falls back to `12px` when the viewer or the property is
|
|
445
|
-
* missing.
|
|
446
|
-
*/
|
|
447
|
-
private measureDefaultRowGap;
|
|
448
|
-
/**
|
|
449
|
-
* Guarantee the wrapper's root BlockCell: add a locked one when the body has
|
|
450
|
-
* none, otherwise re-apply that cell's locked settings and keep every
|
|
451
|
-
* column's drag/drop targets in sync.
|
|
452
|
-
*/
|
|
453
|
-
private normalizeRootColumn;
|
|
454
|
-
/**
|
|
455
|
-
* Normalize a freshly loaded project: fall back to `initial-html` when the
|
|
456
|
-
* JSON lacks its blocks, lock the wrapper, guarantee the root BlockCell, rebind
|
|
457
|
-
* the templates data source, and reset the dirty count. Runs on the editor
|
|
458
|
-
* `load` event and again after every `loadPage` soft switch, outside the
|
|
459
|
-
* undo history in both cases.
|
|
460
|
-
*/
|
|
461
|
-
private initializeProjectContent;
|
|
462
357
|
/**
|
|
463
358
|
* This method undoes the last change made in the content builder.
|
|
464
359
|
*/
|
|
@@ -484,14 +379,41 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
484
379
|
deselectAll(): void;
|
|
485
380
|
tryToGetSelectedComponent(): Component | undefined;
|
|
486
381
|
private fetchTeamSpaceRoles;
|
|
487
|
-
private updateTranslatableTextsDataSourceEntries;
|
|
488
382
|
/**
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
383
|
+
* The sections this builder edits: the implicit page-content section (from `container-selector`)
|
|
384
|
+
* followed by the configured `sections`. Empty when the builder runs in its legacy single-wrapper
|
|
385
|
+
* mode (no container selector, no sections).
|
|
386
|
+
*/
|
|
387
|
+
private get resolvedSections();
|
|
388
|
+
/**
|
|
389
|
+
* Selector list matching every section host container in the canvas document. Falls back to the
|
|
390
|
+
* CMS5 page-content container so canvas hit-testing keeps its historical behaviour without sections.
|
|
391
|
+
*/
|
|
392
|
+
private get sectionHostSelector();
|
|
393
|
+
/**
|
|
394
|
+
* One entry per editable root: each section fragment, or the wrapper itself in single-wrapper mode.
|
|
395
|
+
*/
|
|
396
|
+
private getSectionRoots;
|
|
397
|
+
/**
|
|
398
|
+
* Guarantees the page-content root cell: a locked `BlockCell` directly under the root that receives
|
|
399
|
+
* the top-level blocks, and consistent drag/drop rules on every root-level cell.
|
|
400
|
+
*/
|
|
401
|
+
private ensureRootCell;
|
|
402
|
+
/**
|
|
403
|
+
* Guarantees the hero root (L-429UPF): exactly one column group, fixed in place (no remove / drag /
|
|
404
|
+
* duplicate — the toolbar drops those actions from the flags on selection), holding regular cells
|
|
405
|
+
* authors fill with the same blocks as the page content.
|
|
492
406
|
*/
|
|
407
|
+
private ensureHeroRoot;
|
|
408
|
+
private updateTranslatableTextsDataSourceEntries;
|
|
493
409
|
private updateTemplatesDataSourceEntries;
|
|
494
410
|
private getHoveredComponentPlacement;
|
|
411
|
+
/**
|
|
412
|
+
* Model lookup by element id. `Component.find()` walks the wrapper *element*, which the sections
|
|
413
|
+
* plugin parks while the fragments live in their hosts, so a DOM search from the wrapper misses
|
|
414
|
+
* every block.
|
|
415
|
+
*/
|
|
416
|
+
private findComponentById;
|
|
495
417
|
private mapHoveredComponent;
|
|
496
418
|
private handleCanvasMouseMove;
|
|
497
419
|
private handleCanvasScroll;
|
|
@@ -512,6 +434,13 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
512
434
|
* Both `left` and `top` are relative to the tools wrapper, which GrapesJS
|
|
513
435
|
* sizes to the selected element's box — hence the wrapper-to-canvas delta.
|
|
514
436
|
*
|
|
437
|
+
* GrapesJS also measures the toolbar in the same tick it renders it, before
|
|
438
|
+
* the `cx-*` items inside have laid out, so `pos.left` assumes a toolbar
|
|
439
|
+
* narrower than it ends up. Re-deriving the right-aligned offset from the
|
|
440
|
+
* toolbar's current width (the wrapper is exactly the element's box) fixes
|
|
441
|
+
* that; on a full-bleed block the stale offset would otherwise push the
|
|
442
|
+
* toolbar past the canvas edge, where nothing is left to clip against.
|
|
443
|
+
*
|
|
515
444
|
* Values are written with `important` so stylesheet rules on `.gjs-toolbar`
|
|
516
445
|
* cannot override the computed placement.
|
|
517
446
|
*/
|
|
@@ -526,6 +455,39 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
526
455
|
* typings, so the command is narrowed through a local structural type.
|
|
527
456
|
*/
|
|
528
457
|
private patchToolbarPositioning;
|
|
458
|
+
/**
|
|
459
|
+
* Caps the tools wrappers at the bottom of the visible canvas.
|
|
460
|
+
*
|
|
461
|
+
* GrapesJS sizes both wrappers to the target element's whole box — the hover one from
|
|
462
|
+
* `updateToolsLocal` (it carries the badge) and the selection one from `updateToolsGlobal` (it
|
|
463
|
+
* carries the toolbar). Each is `position: absolute` against `.gjs-editor` rather than the
|
|
464
|
+
* canvas, so `.gjs-cv-canvas`'s `overflow: hidden` never clips them: its containing block is an
|
|
465
|
+
* ancestor of the clipping box. Hovering a block that runs past the bottom of the viewport
|
|
466
|
+
* therefore stretches the wrapper past the page panel, the panel grows a scrollbar, and the
|
|
467
|
+
* whole page jumps 16px narrower.
|
|
468
|
+
*
|
|
469
|
+
* Only the wrappers' top edge places anything visible — the badge sits at `top: -30px` and the
|
|
470
|
+
* toolbar at `top: -40px`, both anchored to it — so capping the height leaves them untouched.
|
|
471
|
+
* The height itself only backs the highlighter, which this component hides outright, and the
|
|
472
|
+
* resize handles, which stay correct across the part of the element that is actually on screen.
|
|
473
|
+
* Clipping the wrappers instead would take the badge and the toolbar with them.
|
|
474
|
+
*
|
|
475
|
+
* A wrapper whose top already sits past the canvas bottom is the one case the cap cannot solve:
|
|
476
|
+
* the badge and toolbar hang above that top, so both are off screen anyway, and even at zero
|
|
477
|
+
* height the wrapper's own position keeps stretching the panel. Hiding is what is left. Only
|
|
478
|
+
* `none` is ever written here — GrapesJS clears the inline `display` itself when it shows a
|
|
479
|
+
* wrapper again, so this corrects as soon as the target is back inside the canvas.
|
|
480
|
+
*/
|
|
481
|
+
private clampToolsWrappersToCanvas;
|
|
482
|
+
/**
|
|
483
|
+
* Wraps the two `select-comp` hooks that size the tools wrappers, so the cap in
|
|
484
|
+
* `clampToolsWrappersToCanvas` is re-applied after GrapesJS writes its own inline height.
|
|
485
|
+
*
|
|
486
|
+
* Neither hook is in the published `grapesjs` typings, so the command is narrowed through a
|
|
487
|
+
* local structural type. GrapesJS re-runs both on canvas and frame scroll, so a wrapper that
|
|
488
|
+
* gains room again is re-measured from a fresh height rather than staying capped.
|
|
489
|
+
*/
|
|
490
|
+
private patchToolsWrapperBounds;
|
|
529
491
|
private handleCanvasClick;
|
|
530
492
|
private handleCanvasKeydown;
|
|
531
493
|
private handleTemplateManagerUpdated;
|
|
@@ -597,6 +559,14 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
597
559
|
private toggleBadge;
|
|
598
560
|
private handleToolbarAndBadge;
|
|
599
561
|
private toggleToolbarAndBadge;
|
|
562
|
+
/**
|
|
563
|
+
* The add-block popup draws its divider on the line `distance` above the block's top edge but
|
|
564
|
+
* renders in this document, so the button has to clear the editor header. A block whose top
|
|
565
|
+
* edge is itself scrolled under the header gets no popup; a visible edge that is merely too
|
|
566
|
+
* close (a block starting at the top of the canvas, such as a hero behind the page header)
|
|
567
|
+
* keeps its divider on the insertion line and pushes only the button down.
|
|
568
|
+
*/
|
|
569
|
+
private placeAddBlockPopupBelowEditorHeader;
|
|
600
570
|
private calculateDistance;
|
|
601
571
|
render(): TemplateResult;
|
|
602
572
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ContentBuilderSection } from '../../../types/src/content-builder';
|
|
2
|
+
|
|
3
|
+
/** Minimal view of a grapesjs component definition — only what the section helpers touch. */
|
|
4
|
+
export type ComponentDefinitionLike = {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
attributes?: Record<string, unknown>;
|
|
7
|
+
components?: ComponentDefinitionLike[];
|
|
8
|
+
};
|
|
9
|
+
/** Minimal view of grapesjs project data — only what the section helpers touch. */
|
|
10
|
+
export type ProjectDataLike = {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
assets?: unknown[];
|
|
13
|
+
dataSources?: DataSourceLike[];
|
|
14
|
+
pages?: Array<{
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
frames?: Array<{
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
component?: ComponentDefinitionLike;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
styles?: StyleRuleLike[];
|
|
22
|
+
symbols?: unknown[];
|
|
23
|
+
};
|
|
24
|
+
export type StyleRuleLike = {
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
selectors?: unknown[];
|
|
27
|
+
};
|
|
28
|
+
export type DataSourceLike = {
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
id?: string;
|
|
31
|
+
records?: Array<{
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
id?: string | number;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Builds the ordered section list the engine works with: the implicit page-content section first
|
|
38
|
+
* (only when a container selector is set), then the extra sections that are well-formed. Duplicate
|
|
39
|
+
* ids keep the first occurrence; an extra section must not reuse the page-content id.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveSections(input: {
|
|
42
|
+
containerSelector?: string;
|
|
43
|
+
initialData?: string;
|
|
44
|
+
sections?: ContentBuilderSection[];
|
|
45
|
+
}): ContentBuilderSection[];
|
|
46
|
+
/** Parses stored project data; anything that is not a JSON object yields `undefined`. */
|
|
47
|
+
export declare function parseProjectData(json?: string): ProjectDataLike | undefined;
|
|
48
|
+
/** The wrapper's direct children of the first frame of the first page. */
|
|
49
|
+
export declare function getRootComponents(data?: ProjectDataLike): ComponentDefinitionLike[];
|
|
50
|
+
/** The section-fragment definition that wraps one section's components inside the shared wrapper. */
|
|
51
|
+
export declare function buildFragmentDefinition(section: ContentBuilderSection, components: ComponentDefinitionLike[]): ComponentDefinitionLike;
|
|
52
|
+
/**
|
|
53
|
+
* Merges the stored project of every section into the single project the editor loads: one
|
|
54
|
+
* fragment per section under the wrapper, styles/assets/symbols concatenated, data sources
|
|
55
|
+
* merged by id (records concatenated). The page-content project, when present, is the base so
|
|
56
|
+
* page-level settings it carries survive.
|
|
57
|
+
*/
|
|
58
|
+
export declare function mergeSectionsProjectData(sections: ContentBuilderSection[]): ProjectDataLike;
|
|
59
|
+
/** The fragment definition of one section among the wrapper's children of a (live or stored) project. */
|
|
60
|
+
export declare function findFragmentDefinition(data: ProjectDataLike, sectionId: string): ComponentDefinitionLike | undefined;
|
|
61
|
+
/** Every `attributes.id` in a component subtree, the root included. */
|
|
62
|
+
export declare function collectComponentIds(components: ComponentDefinitionLike[]): Set<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Keeps the `#id` rules that target the given component ids — the same "id rules only" filter the
|
|
65
|
+
* builder has always applied on save, narrowed to one section.
|
|
66
|
+
*/
|
|
67
|
+
export declare function partitionStyleRules(styles: StyleRuleLike[] | undefined, ids: Set<string>): StyleRuleLike[];
|
|
68
|
+
/**
|
|
69
|
+
* Keeps, for component-keyed data sources (translatable texts / attributes), only the records whose
|
|
70
|
+
* component id belongs to the section. Other data sources (templates) are shared and kept intact.
|
|
71
|
+
*/
|
|
72
|
+
export declare function partitionDataSources(dataSources: DataSourceLike[] | undefined, ids: Set<string>): DataSourceLike[];
|
|
73
|
+
/**
|
|
74
|
+
* Extracts one section's own project from the live merged project: the fragment's children become
|
|
75
|
+
* the wrapper's children again (the legacy stored shape), styles and data-source records are
|
|
76
|
+
* narrowed to that subtree. Everything else on the project is carried over unchanged.
|
|
77
|
+
*/
|
|
78
|
+
export declare function buildSectionProjectData(full: ProjectDataLike, fragment: ComponentDefinitionLike | undefined): ProjectDataLike;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BlockType, PropertyConfig } from '../../../types/src/content-builder';
|
|
1
|
+
import { BlockType, PropertyConfig, ToolbarItem } from '../../../types/src/content-builder';
|
|
2
2
|
import { FontTypeface } from '../../../types/src/font-picker';
|
|
3
|
+
import { Component } from 'grapesjs';
|
|
3
4
|
|
|
4
5
|
export type FontPickerKeys = {
|
|
5
6
|
familyKey: string;
|
|
@@ -14,26 +15,6 @@ type FontPickerStoredValues = {
|
|
|
14
15
|
export declare function getTemplateClass(templateId: string): string;
|
|
15
16
|
export declare function getContentConfigs(traits: PropertyConfig[], adHocProperties: string[]): string[];
|
|
16
17
|
export declare function getLimitedBlocks(blockType: BlockType): BlockType[];
|
|
17
|
-
/**
|
|
18
|
-
* Whether a GrapesJS component type is a block an author would see - any
|
|
19
|
-
* registered block type except the layout scaffolding (cells, column groups).
|
|
20
|
-
*/
|
|
21
|
-
export declare function isContentBlockType(type: string | undefined): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* A component tree in the shape GrapesJS parsers and `toJSON` produce: one
|
|
24
|
-
* definition, a list of them, or a text string.
|
|
25
|
-
*/
|
|
26
|
-
export type ParsedComponentTree = string | ParsedComponentDefinition | ParsedComponentTree[] | undefined;
|
|
27
|
-
export type ParsedComponentDefinition = {
|
|
28
|
-
[key: string]: unknown;
|
|
29
|
-
components?: ParsedComponentTree;
|
|
30
|
-
type?: string;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Number of content blocks (see {@link isContentBlockType}) in a parsed
|
|
34
|
-
* component tree, nested ones included.
|
|
35
|
-
*/
|
|
36
|
-
export declare function countContentBlocks(tree: ParsedComponentTree): number;
|
|
37
18
|
/**
|
|
38
19
|
* The `space-default` typeface inherits the team space's current font, so the
|
|
39
20
|
* backend returns it with no variants of its own. Populate its `families` from
|
|
@@ -52,10 +33,40 @@ export declare function getFontPickerControlValues({ blockAttributes, keys, type
|
|
|
52
33
|
/** No match: keep the raw stored value (not '') so it renders as unmatched, not Default. */
|
|
53
34
|
styleValue: string;
|
|
54
35
|
};
|
|
55
|
-
export declare function getFontPickerAttributeValues({ clearDefaultFamily, familyValue, styleValue, typefaces, }: {
|
|
36
|
+
export declare function getFontPickerAttributeValues({ clearDefaultFamily, familyValue, spaceFontFamily, styleValue, typefaces, }: {
|
|
56
37
|
clearDefaultFamily?: boolean;
|
|
57
38
|
familyValue: string;
|
|
39
|
+
/**
|
|
40
|
+
* Resolved name of the space's font. When given, the space-default option is
|
|
41
|
+
* stored under that name instead of being cleared, so it still wins inside a
|
|
42
|
+
* container that resolves a font of its own.
|
|
43
|
+
*/
|
|
44
|
+
spaceFontFamily?: string;
|
|
58
45
|
styleValue: string;
|
|
59
46
|
typefaces: FontTypeface[];
|
|
60
47
|
}): FontPickerStoredValues;
|
|
48
|
+
/**
|
|
49
|
+
* grapesjs component flags the block toolbar must honour. Only an explicit `false` locks an action:
|
|
50
|
+
* grapesjs also accepts selector strings / functions for `draggable`, and those keep the action.
|
|
51
|
+
*/
|
|
52
|
+
export type ToolbarComponentFlags = {
|
|
53
|
+
copyable?: unknown;
|
|
54
|
+
draggable?: unknown;
|
|
55
|
+
removable?: unknown;
|
|
56
|
+
};
|
|
57
|
+
/** Drops leading, trailing and consecutive dividers left behind by removed toolbar actions. */
|
|
58
|
+
export declare function collapseToolbarDividers(items: ToolbarItem[]): ToolbarItem[];
|
|
59
|
+
/**
|
|
60
|
+
* Hides the toolbar actions a component's flags forbid — remove for `removable: false`, duplicate
|
|
61
|
+
* for `copyable: false`, move up/down for `draggable: false` — and tidies the dividers around them.
|
|
62
|
+
* The toolbar is rebuilt from the type defaults on every selection, so the flags are the single
|
|
63
|
+
* source of truth for locked blocks such as the hero column group.
|
|
64
|
+
*/
|
|
65
|
+
export declare function applyComponentFlagsToToolbar(items: ToolbarItem[], flags: ToolbarComponentFlags): ToolbarItem[];
|
|
66
|
+
/**
|
|
67
|
+
* Whether any ancestor of the component is a block of the given type. Blocks
|
|
68
|
+
* that only behave a certain way inside a specific container ask this rather
|
|
69
|
+
* than each container stamping its children.
|
|
70
|
+
*/
|
|
71
|
+
export declare function isInsideBlockType(model: Component | null | undefined, blockType: BlockType): boolean;
|
|
61
72
|
export {};
|
|
@@ -11,6 +11,12 @@ type GalleryViewThis = ComponentViewDefinition & ComponentView<Component>;
|
|
|
11
11
|
* interaction needs a different cleanup path.
|
|
12
12
|
*/
|
|
13
13
|
export declare function createBlockHoverEvent(editor: Editor, clearHover?: () => void): (event: MouseEvent) => void;
|
|
14
|
+
/**
|
|
15
|
+
* `max-rows` used to drive every breakpoint. Content saved before the mobile
|
|
16
|
+
* value existed inherits that value, so the mobile grid keeps its current
|
|
17
|
+
* height and the control never opens empty.
|
|
18
|
+
*/
|
|
19
|
+
export declare function backfillMaxRowsMobile(model: Component): void;
|
|
14
20
|
export declare function handleOnRequestAsset(model: Component): void;
|
|
15
21
|
export declare function createHandleComponentChange(timerId: GalleryTimerMap, options?: {
|
|
16
22
|
columnStyle?: ComponentDefinition['style'];
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { Editor } from 'grapesjs';
|
|
1
|
+
import { Component, Editor } from 'grapesjs';
|
|
2
2
|
import { EditorPluginOptions } from './plugin-factory';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* `font-size` used to drive every breakpoint and now only drives mobile.
|
|
6
|
+
* Content saved before the tablet/desktop sizes existed inherits it, so those
|
|
7
|
+
* headings keep the size they already had and their controls never open empty.
|
|
8
|
+
*/
|
|
9
|
+
export declare function backfillResponsiveFontSizes(model: Component): void;
|
|
4
10
|
declare const HeaderPlugin: (editor: Editor, editorOptions: EditorPluginOptions) => void;
|
|
5
11
|
export default HeaderPlugin;
|
|
@@ -11,6 +11,7 @@ export { default as DamViewPlugin } from './dam-view';
|
|
|
11
11
|
export { default as DividerPlugin } from './divider';
|
|
12
12
|
export { default as DocumentViewerPlugin } from './document-viewer';
|
|
13
13
|
export { default as FontKitPlugin } from './font-kit';
|
|
14
|
+
export { default as FontKitAdvancedPlugin } from './font-kit-advanced';
|
|
14
15
|
export { default as GalleryPlugin } from './gallery';
|
|
15
16
|
export { default as HeaderPlugin } from './header';
|
|
16
17
|
export { default as AnalyticsPlugin } from './analytics';
|
|
@@ -18,9 +19,9 @@ export { default as ImagePlugin } from './image';
|
|
|
18
19
|
export { default as RichTextEditorPlugin } from './rich-text-editor';
|
|
19
20
|
export * from './rich-text-editor/components';
|
|
20
21
|
export { default as SearchBoxPlugin } from './search-box';
|
|
22
|
+
export { default as SectionsPlugin } from './sections/sections-plugin';
|
|
21
23
|
export { default as TabsPlugin } from './tab-group';
|
|
22
24
|
export { default as TelemetryPlugin } from './telemetry';
|
|
23
25
|
export { default as TextPlugin } from './text';
|
|
24
26
|
export { default as TimelinePlugin } from './timeline';
|
|
25
27
|
export { default as VideoPlugin } from './video';
|
|
26
|
-
export { default as WrapperContainerPlugin } from './wrapper-container';
|
|
@@ -17,7 +17,7 @@ import { default as CxSpace } from '../../../../../../../atoms/src/components/sp
|
|
|
17
17
|
import { default as CxTypography } from '../../../../../../../atoms/src/components/typography/typography.ts';
|
|
18
18
|
import { default as CortexElement } from '../../../../../../../base/src/cortex-element.ts';
|
|
19
19
|
import { default as CxSpecialCharactersDialog } from '../../../../../special-characters-dialog/special-characters-dialog.ts';
|
|
20
|
-
import { Asset, AssetTypeString } from '../../../../../../../types/src/content-builder';
|
|
20
|
+
import { Asset, AssetTypeString, RteMetafieldOption } from '../../../../../../../types/src/content-builder';
|
|
21
21
|
import { Component } from 'grapesjs';
|
|
22
22
|
import { TemplateResult } from 'lit';
|
|
23
23
|
import { default as CxAnchorDialog } from './anchor-dialog';
|
|
@@ -124,6 +124,19 @@ export default class CxRTEBubbleMenu extends CortexElement {
|
|
|
124
124
|
* @default false
|
|
125
125
|
* */
|
|
126
126
|
highlight: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Keeps the menu visible with a collapsed caret, for controls that insert
|
|
129
|
+
* content at the cursor instead of formatting a selection.
|
|
130
|
+
* @type {boolean}
|
|
131
|
+
* @default false
|
|
132
|
+
* */
|
|
133
|
+
alwaysShowBubbleMenu: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Placeholder tokens offered by the metafield dropdown. Empty hides it.
|
|
136
|
+
* @type {RteMetafieldOption[]}
|
|
137
|
+
* @default []
|
|
138
|
+
* */
|
|
139
|
+
metafield: RteMetafieldOption[];
|
|
127
140
|
/**
|
|
128
141
|
* The boundary property of the confirm popover's dropdown/dialog popup.
|
|
129
142
|
*/
|
|
@@ -147,6 +160,7 @@ export default class CxRTEBubbleMenu extends CortexElement {
|
|
|
147
160
|
runConnectedCallback(): void;
|
|
148
161
|
disconnectedCallback(): void;
|
|
149
162
|
onFontSizeChange(value: string | string[]): void;
|
|
163
|
+
onMetafieldChange(value: string | string[]): void;
|
|
150
164
|
onBlockFormatChange(value: string | string[]): void;
|
|
151
165
|
onLineHeightChange(value: string | string[]): void;
|
|
152
166
|
private onKeydown;
|
|
@@ -174,6 +188,12 @@ export default class CxRTEBubbleMenu extends CortexElement {
|
|
|
174
188
|
renderTextAlignment(): TemplateResult<1>;
|
|
175
189
|
renderList(): TemplateResult<1>;
|
|
176
190
|
renderFontSize(): TemplateResult<1> | null;
|
|
191
|
+
/**
|
|
192
|
+
* Dropdown that inserts a placeholder token at the caret. It is an action,
|
|
193
|
+
* not a value, so it keeps its own template instead of reusing
|
|
194
|
+
* `renderDropdown`, whose placeholder mirrors the selected value.
|
|
195
|
+
*/
|
|
196
|
+
renderMetafield(): TemplateResult<1>;
|
|
177
197
|
private renderBlockFormatOption;
|
|
178
198
|
renderBlockFormatting(): TemplateResult<1>;
|
|
179
199
|
renderLineHeight(): TemplateResult<1> | null;
|
|
@@ -25,6 +25,8 @@ export declare const lineHeightExtensions: import('@tiptap/core').Extension<{
|
|
|
25
25
|
types: string[];
|
|
26
26
|
}, any>[];
|
|
27
27
|
export declare const blockFormatExtensions: import('@tiptap/core').Node<any, any>[];
|
|
28
|
+
/** Loaded only for blocks that configure placeholder tokens (RTE_CONFIG.metafield). */
|
|
29
|
+
export declare const metafieldExtensions: import('@tiptap/core').Node<any, any>[];
|
|
28
30
|
export declare const listExtensions: import('@tiptap/core').Node<any, any>[];
|
|
29
31
|
export declare const customNodes: import('@tiptap/core').Node<any, any>[];
|
|
30
32
|
/**
|
package/library/packages/organisms/src/content-builder/plugins/rich-text-editor/rte-configs.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RTE_CONFIG } from '../../../../../types/src/content-builder';
|
|
2
|
+
import { Component } from 'grapesjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resolves the RTE config for a block, merging in the `childRteConfigs` of its
|
|
6
|
+
* nearest ancestor that declares one.
|
|
7
|
+
*
|
|
8
|
+
* Rich-text blocks are registered once with a shared defaults object, so a
|
|
9
|
+
* container block cannot enable extra controls for the copies of that block it
|
|
10
|
+
* owns. Declaring the extra config on the container and reading it from here
|
|
11
|
+
* scopes those controls to that container without touching the shared
|
|
12
|
+
* defaults, and resolves late enough that the component tree is complete.
|
|
13
|
+
*/
|
|
14
|
+
export declare const resolveRteConfigs: (model?: Component) => RTE_CONFIG | undefined;
|