@orangelogic/design-system 4.2.0 → 4.4.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.CVwjA_yf.js → asset-link-format.DTLA2CFh.js} +435 -415
- package/library/chunks/{button.D1YIxtv-.js → button.cbDkxJHn.js} +3 -3
- package/library/chunks/button.styles.D3GdfF7I.js +5 -0
- package/library/chunks/{color-swatch-group.BPXiMxjh.js → color-swatch-group.CZSeCrot.js} +3279 -2903
- package/library/chunks/color.CIHdfM_a.js +187 -0
- package/library/chunks/{confirm-popover.CJXyEa5A.js → confirm-popover.Dvgoz-oA.js} +4 -4
- package/library/chunks/content-builder.CBBdfVOl.js +55 -0
- package/library/chunks/{dialog.BbQ4Du0M.js → dialog.BvSMV36r.js} +2 -2
- package/library/chunks/{document-viewer.DtBW-p7z.js → document-viewer.BLdEjbza.js} +11 -10
- package/library/chunks/{dom.DL-cNKsj.js → dom.D0lSUoEI.js} +1 -1
- package/library/chunks/{dot-pagination.CJRAtM51.js → dot-pagination.CukHxNBk.js} +1 -1
- package/library/chunks/{folder-select.BAPsI-gg.js → folder-select.DAZQRdLq.js} +5 -5
- package/library/chunks/form-control.styles.CHC7Q08Q.js +5 -0
- package/library/chunks/{form.DN2v7-DH.js → form.LpappO1d.js} +1 -1
- package/library/chunks/{header.BioJzPlg.js → header.2RH_nPmz.js} +132 -90
- package/library/chunks/{i18n.rtxrs1c1.js → i18n.BSPmBQ73.js} +94 -12
- package/library/chunks/{icon-button.CbUddcgI.js → icon-button.DV5Fks8j.js} +1 -1
- package/library/chunks/{iframe.y7iCAVZP.js → iframe.ddX2kGu3.js} +1 -1
- package/library/chunks/{image.A2hE1WoV.js → image.BM7bPTub.js} +407 -276
- package/library/chunks/index.DKKvxBAi.js +1130 -0
- package/library/chunks/{input.D1FFprPl.js → input.7pumTpdu.js} +3 -3
- package/library/chunks/{markdown.Dd_GFJK8.js → markdown.LHSzm035.js} +3 -3
- package/library/chunks/{menu-item.CbqZ66to.js → menu-item.CqPvDGeN.js} +1 -1
- package/library/chunks/{option.CkhHTlpl.js → option.dBUWN4sF.js} +1 -1
- package/library/chunks/{pagination.BlQRt932.js → pagination.C2f8lUVb.js} +6 -6
- package/library/chunks/{position-picker.DjnhxIKF.js → position-picker.qkbJlboF.js} +12 -0
- package/library/chunks/{resizable-component.styles.CAfXABBc.js → resizable-component.styles.kMFDlGgv.js} +2 -2
- package/library/chunks/responsive.BmBJSzC4.js +17 -0
- package/library/chunks/{string.Demn8Xmk.js → string.CfI2ejyR.js} +3 -3
- package/library/chunks/{tab-group.CQfcMVEw.js → tab-group.DOnaT12G.js} +312 -310
- package/library/chunks/toast.D3AW3RWv.js +94 -0
- package/library/chunks/transformation.Dm-pK2ft.js +352 -0
- package/library/chunks/{tree.B7IKBX3n.js → tree.CHQ1WjZV.js} +1 -1
- package/library/chunks/{types.MwUT4xFk.js → types.PdpKNndx.js} +77402 -54714
- 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 +2 -2
- 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 +5 -5
- 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 +5 -4
- package/library/components/input-group.js +1 -1
- package/library/components/input.js +4 -4
- 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 +2 -2
- package/library/components/range.js +3 -3
- package/library/components/rating.js +1 -1
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +5 -5
- 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 +2 -2
- 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 +2 -2
- 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 +496 -487
- package/library/components/typography.js +3 -2
- package/library/components/video.js +5277 -5209
- package/library/css/ol-base.css +1 -0
- package/library/package.json +1 -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 +30 -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/typography/typography.d.ts +31 -0
- package/library/packages/atoms/src/components/video/video.d.ts +24 -0
- package/library/packages/atoms/src/index.d.ts +1 -0
- package/library/packages/events/src/cx-asset-transformation-dialog-confirm.d.ts +2 -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/table.d.ts +10 -1
- 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/icon-picker/icon-picker.d.ts +5 -6
- 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/asset-link-format/asset-link-format.d.ts +6 -0
- package/library/packages/organisms/src/asset-transformation-dialog/asset-transformation-dialog.d.ts +5 -1
- 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/font-kit-advanced/font-kit-advanced.utils.d.ts +85 -0
- package/library/packages/organisms/src/content-builder/blocks/image/image.d.ts +32 -9
- 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 +3 -1
- package/library/packages/organisms/src/content-builder/configs/image.d.ts +4 -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 +168 -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 +27 -0
- package/library/packages/organisms/src/content-builder/content-builder.d.ts +122 -2
- 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 -2
- 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 +11 -5
- package/library/packages/organisms/src/content-builder-viewer/content-builder-viewer.d.ts +1 -0
- package/library/packages/organisms/src/form/control-renderer/control-renderer.d.ts +176 -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/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 +73 -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 -0
- package/library/packages/utils/src/font/font.d.ts +12 -0
- package/library/packages/utils/src/transformation/transformation.d.ts +11 -3
- package/library/react-web-component.d.ts +514 -156
- package/library/utils.js +415 -395
- 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/form-control.styles.CaGWmeAS.js +0 -5
- package/library/chunks/index.BO_sT6SH.js +0 -20123
- package/library/chunks/toast.BOkYwUIj.js +0 -109
- package/library/chunks/transformation.B8m0Nbao.js +0 -384
- 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 {
|
|
@@ -97,6 +103,16 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
97
103
|
* @default undefined
|
|
98
104
|
*/
|
|
99
105
|
containerSelector?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Additional editable sections rendered inside the same canvas document (L-429UPF).
|
|
108
|
+
* Each section owns a host container (`containerSelector`) in the canvas page and its own
|
|
109
|
+
* project data (`initialData`); the builder mounts a fragment node inside the host and edits
|
|
110
|
+
* that node's tree. `container-selector` / `initial-data` remain the implicit `page-content`
|
|
111
|
+
* section, so existing single-region usages are unaffected. Read a section back with
|
|
112
|
+
* `getSectionContent(id)`.
|
|
113
|
+
* @default []
|
|
114
|
+
*/
|
|
115
|
+
sections: ContentBuilderSection[];
|
|
100
116
|
/**
|
|
101
117
|
* This property indicates whether the content builder should initialize automatically.
|
|
102
118
|
* @default false
|
|
@@ -233,7 +249,18 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
233
249
|
private containerDropdowns;
|
|
234
250
|
private containerDropdownStateMap;
|
|
235
251
|
private distance;
|
|
252
|
+
/**
|
|
253
|
+
* How far, in px, the add-block button is pushed below its divider line so it clears the
|
|
254
|
+
* editor header. The line stays on the insertion point; only the button moves.
|
|
255
|
+
*/
|
|
256
|
+
private addBlockButtonOffset;
|
|
236
257
|
private toolbar;
|
|
258
|
+
/** Last toolbar position GrapesJS computed, re-clamped whenever the toolbar changes size. */
|
|
259
|
+
private lastToolbarPos?;
|
|
260
|
+
/** Watches the toolbar's box: its Lit items render after GrapesJS has already measured it. */
|
|
261
|
+
private toolbarResizeObserver?;
|
|
262
|
+
/** `select-comp` commands already wrapped by `patchToolsWrapperBounds`, so a re-init cannot stack wrappers. */
|
|
263
|
+
private toolsBoundsPatchedCommands;
|
|
237
264
|
private toolbarActive;
|
|
238
265
|
private childSelected;
|
|
239
266
|
private mappedSupportedLanguages;
|
|
@@ -334,6 +361,19 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
334
361
|
* @returns HTML string
|
|
335
362
|
*/
|
|
336
363
|
html(): string;
|
|
364
|
+
/**
|
|
365
|
+
* Returns one section's persisted content: its inner HTML (with the default-language
|
|
366
|
+
* translatable texts applied) plus the CSS rules matched by that section, and the section's own
|
|
367
|
+
* project JSON in the same shape a single-section builder produces. `undefined` when the section
|
|
368
|
+
* is not configured or not rendered yet.
|
|
369
|
+
* @param sectionId - `page-content`, `hero`, or any id passed through `sections`
|
|
370
|
+
*/
|
|
371
|
+
getSectionContent(sectionId: string): ContentBuilderSectionContent | undefined;
|
|
372
|
+
/**
|
|
373
|
+
* Replaces each translatable text node's markup with the default-language record stored in the
|
|
374
|
+
* project's translatable-texts data source, so the persisted HTML reads in the space language.
|
|
375
|
+
*/
|
|
376
|
+
private localizeHtml;
|
|
337
377
|
/**
|
|
338
378
|
* This method returns the JSON representation of the content builder's project data.
|
|
339
379
|
* It filters the styles to include only those that have selectors starting with '#',
|
|
@@ -484,6 +524,32 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
484
524
|
deselectAll(): void;
|
|
485
525
|
tryToGetSelectedComponent(): Component | undefined;
|
|
486
526
|
private fetchTeamSpaceRoles;
|
|
527
|
+
/**
|
|
528
|
+
* The sections this builder edits: the implicit page-content section (from `container-selector`)
|
|
529
|
+
* followed by the configured `sections`. Empty when the builder runs in its legacy single-wrapper
|
|
530
|
+
* mode (no container selector, no sections).
|
|
531
|
+
*/
|
|
532
|
+
private get resolvedSections();
|
|
533
|
+
/**
|
|
534
|
+
* Selector list matching every section host container in the canvas document. Falls back to the
|
|
535
|
+
* CMS5 page-content container so canvas hit-testing keeps its historical behaviour without sections.
|
|
536
|
+
*/
|
|
537
|
+
private get sectionHostSelector();
|
|
538
|
+
/**
|
|
539
|
+
* One entry per editable root: each section fragment, or the wrapper itself in single-wrapper mode.
|
|
540
|
+
*/
|
|
541
|
+
private getSectionRoots;
|
|
542
|
+
/**
|
|
543
|
+
* Guarantees the page-content root cell: a locked `BlockCell` directly under the root that receives
|
|
544
|
+
* the top-level blocks, and consistent drag/drop rules on every root-level cell.
|
|
545
|
+
*/
|
|
546
|
+
private ensureRootCell;
|
|
547
|
+
/**
|
|
548
|
+
* Guarantees the hero root (L-429UPF): exactly one column group, fixed in place (no remove / drag /
|
|
549
|
+
* duplicate — the toolbar drops those actions from the flags on selection), holding regular cells
|
|
550
|
+
* authors fill with the same blocks as the page content.
|
|
551
|
+
*/
|
|
552
|
+
private ensureHeroRoot;
|
|
487
553
|
private updateTranslatableTextsDataSourceEntries;
|
|
488
554
|
/**
|
|
489
555
|
* @param generation The load this refresh belongs to. Once `apiGetTemplates`
|
|
@@ -492,6 +558,12 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
492
558
|
*/
|
|
493
559
|
private updateTemplatesDataSourceEntries;
|
|
494
560
|
private getHoveredComponentPlacement;
|
|
561
|
+
/**
|
|
562
|
+
* Model lookup by element id. `Component.find()` walks the wrapper *element*, which the sections
|
|
563
|
+
* plugin parks while the fragments live in their hosts, so a DOM search from the wrapper misses
|
|
564
|
+
* every block.
|
|
565
|
+
*/
|
|
566
|
+
private findComponentById;
|
|
495
567
|
private mapHoveredComponent;
|
|
496
568
|
private handleCanvasMouseMove;
|
|
497
569
|
private handleCanvasScroll;
|
|
@@ -512,6 +584,13 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
512
584
|
* Both `left` and `top` are relative to the tools wrapper, which GrapesJS
|
|
513
585
|
* sizes to the selected element's box — hence the wrapper-to-canvas delta.
|
|
514
586
|
*
|
|
587
|
+
* GrapesJS also measures the toolbar in the same tick it renders it, before
|
|
588
|
+
* the `cx-*` items inside have laid out, so `pos.left` assumes a toolbar
|
|
589
|
+
* narrower than it ends up. Re-deriving the right-aligned offset from the
|
|
590
|
+
* toolbar's current width (the wrapper is exactly the element's box) fixes
|
|
591
|
+
* that; on a full-bleed block the stale offset would otherwise push the
|
|
592
|
+
* toolbar past the canvas edge, where nothing is left to clip against.
|
|
593
|
+
*
|
|
515
594
|
* Values are written with `important` so stylesheet rules on `.gjs-toolbar`
|
|
516
595
|
* cannot override the computed placement.
|
|
517
596
|
*/
|
|
@@ -526,6 +605,39 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
526
605
|
* typings, so the command is narrowed through a local structural type.
|
|
527
606
|
*/
|
|
528
607
|
private patchToolbarPositioning;
|
|
608
|
+
/**
|
|
609
|
+
* Caps the tools wrappers at the bottom of the visible canvas.
|
|
610
|
+
*
|
|
611
|
+
* GrapesJS sizes both wrappers to the target element's whole box — the hover one from
|
|
612
|
+
* `updateToolsLocal` (it carries the badge) and the selection one from `updateToolsGlobal` (it
|
|
613
|
+
* carries the toolbar). Each is `position: absolute` against `.gjs-editor` rather than the
|
|
614
|
+
* canvas, so `.gjs-cv-canvas`'s `overflow: hidden` never clips them: its containing block is an
|
|
615
|
+
* ancestor of the clipping box. Hovering a block that runs past the bottom of the viewport
|
|
616
|
+
* therefore stretches the wrapper past the page panel, the panel grows a scrollbar, and the
|
|
617
|
+
* whole page jumps 16px narrower.
|
|
618
|
+
*
|
|
619
|
+
* Only the wrappers' top edge places anything visible — the badge sits at `top: -30px` and the
|
|
620
|
+
* toolbar at `top: -40px`, both anchored to it — so capping the height leaves them untouched.
|
|
621
|
+
* The height itself only backs the highlighter, which this component hides outright, and the
|
|
622
|
+
* resize handles, which stay correct across the part of the element that is actually on screen.
|
|
623
|
+
* Clipping the wrappers instead would take the badge and the toolbar with them.
|
|
624
|
+
*
|
|
625
|
+
* A wrapper whose top already sits past the canvas bottom is the one case the cap cannot solve:
|
|
626
|
+
* the badge and toolbar hang above that top, so both are off screen anyway, and even at zero
|
|
627
|
+
* height the wrapper's own position keeps stretching the panel. Hiding is what is left. Only
|
|
628
|
+
* `none` is ever written here — GrapesJS clears the inline `display` itself when it shows a
|
|
629
|
+
* wrapper again, so this corrects as soon as the target is back inside the canvas.
|
|
630
|
+
*/
|
|
631
|
+
private clampToolsWrappersToCanvas;
|
|
632
|
+
/**
|
|
633
|
+
* Wraps the two `select-comp` hooks that size the tools wrappers, so the cap in
|
|
634
|
+
* `clampToolsWrappersToCanvas` is re-applied after GrapesJS writes its own inline height.
|
|
635
|
+
*
|
|
636
|
+
* Neither hook is in the published `grapesjs` typings, so the command is narrowed through a
|
|
637
|
+
* local structural type. GrapesJS re-runs both on canvas and frame scroll, so a wrapper that
|
|
638
|
+
* gains room again is re-measured from a fresh height rather than staying capped.
|
|
639
|
+
*/
|
|
640
|
+
private patchToolsWrapperBounds;
|
|
529
641
|
private handleCanvasClick;
|
|
530
642
|
private handleCanvasKeydown;
|
|
531
643
|
private handleTemplateManagerUpdated;
|
|
@@ -597,6 +709,14 @@ export default class CxContentBuilder extends CortexElement {
|
|
|
597
709
|
private toggleBadge;
|
|
598
710
|
private handleToolbarAndBadge;
|
|
599
711
|
private toggleToolbarAndBadge;
|
|
712
|
+
/**
|
|
713
|
+
* The add-block popup draws its divider on the line `distance` above the block's top edge but
|
|
714
|
+
* renders in this document, so the button has to clear the editor header. A block whose top
|
|
715
|
+
* edge is itself scrolled under the header gets no popup; a visible edge that is merely too
|
|
716
|
+
* close (a block starting at the top of the canvas, such as a hero behind the page header)
|
|
717
|
+
* keeps its divider on the insertion line and pushes only the button down.
|
|
718
|
+
*/
|
|
719
|
+
private placeAddBlockPopupBelowEditorHeader;
|
|
600
720
|
private calculateDistance;
|
|
601
721
|
render(): TemplateResult;
|
|
602
722
|
}
|
|
@@ -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;
|
|
@@ -52,10 +53,40 @@ export declare function getFontPickerControlValues({ blockAttributes, keys, type
|
|
|
52
53
|
/** No match: keep the raw stored value (not '') so it renders as unmatched, not Default. */
|
|
53
54
|
styleValue: string;
|
|
54
55
|
};
|
|
55
|
-
export declare function getFontPickerAttributeValues({ clearDefaultFamily, familyValue, styleValue, typefaces, }: {
|
|
56
|
+
export declare function getFontPickerAttributeValues({ clearDefaultFamily, familyValue, spaceFontFamily, styleValue, typefaces, }: {
|
|
56
57
|
clearDefaultFamily?: boolean;
|
|
57
58
|
familyValue: string;
|
|
59
|
+
/**
|
|
60
|
+
* Resolved name of the space's font. When given, the space-default option is
|
|
61
|
+
* stored under that name instead of being cleared, so it still wins inside a
|
|
62
|
+
* container that resolves a font of its own.
|
|
63
|
+
*/
|
|
64
|
+
spaceFontFamily?: string;
|
|
58
65
|
styleValue: string;
|
|
59
66
|
typefaces: FontTypeface[];
|
|
60
67
|
}): FontPickerStoredValues;
|
|
68
|
+
/**
|
|
69
|
+
* grapesjs component flags the block toolbar must honour. Only an explicit `false` locks an action:
|
|
70
|
+
* grapesjs also accepts selector strings / functions for `draggable`, and those keep the action.
|
|
71
|
+
*/
|
|
72
|
+
export type ToolbarComponentFlags = {
|
|
73
|
+
copyable?: unknown;
|
|
74
|
+
draggable?: unknown;
|
|
75
|
+
removable?: unknown;
|
|
76
|
+
};
|
|
77
|
+
/** Drops leading, trailing and consecutive dividers left behind by removed toolbar actions. */
|
|
78
|
+
export declare function collapseToolbarDividers(items: ToolbarItem[]): ToolbarItem[];
|
|
79
|
+
/**
|
|
80
|
+
* Hides the toolbar actions a component's flags forbid — remove for `removable: false`, duplicate
|
|
81
|
+
* for `copyable: false`, move up/down for `draggable: false` — and tidies the dividers around them.
|
|
82
|
+
* The toolbar is rebuilt from the type defaults on every selection, so the flags are the single
|
|
83
|
+
* source of truth for locked blocks such as the hero column group.
|
|
84
|
+
*/
|
|
85
|
+
export declare function applyComponentFlagsToToolbar(items: ToolbarItem[], flags: ToolbarComponentFlags): ToolbarItem[];
|
|
86
|
+
/**
|
|
87
|
+
* Whether any ancestor of the component is a block of the given type. Blocks
|
|
88
|
+
* that only behave a certain way inside a specific container ask this rather
|
|
89
|
+
* than each container stamping its children.
|
|
90
|
+
*/
|
|
91
|
+
export declare function isInsideBlockType(model: Component | null | undefined, blockType: BlockType): boolean;
|
|
61
92
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Editor } from 'grapesjs';
|
|
2
|
+
|
|
3
|
+
/** Model property holding the section id. Serialized with the project, read back on save. */
|
|
4
|
+
export declare const SECTION_ID_PROP = "sectionId";
|
|
5
|
+
/** Model property holding the host container selector the fragment mounts into. */
|
|
6
|
+
export declare const SECTION_SELECTOR_PROP = "containerSelector";
|
|
7
|
+
/** Registers the fragment type once per editor. */
|
|
8
|
+
export declare function registerSectionFragmentType(editor: Editor): void;
|
|
9
|
+
export declare function isSectionFragment(component?: Component | null): boolean;
|
|
10
|
+
/** Section id carried by a fragment. */
|
|
11
|
+
export declare function getSectionId(fragment: Component): string;
|
|
12
|
+
/** Every section fragment under the wrapper, in wrapper order. */
|
|
13
|
+
export declare function getSectionFragments(editor: Editor): Component[];
|
|
14
|
+
export declare function getSectionFragment(editor: Editor, sectionId: string): Component | undefined;
|
|
15
|
+
/** The fragment a component belongs to — itself when it is one — or `undefined` outside any section. */
|
|
16
|
+
export declare function getSectionOf(component?: Component | null): Component | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The cell that receives blocks at the top of a section root: the first `BlockCell` whose parent is
|
|
19
|
+
* the root (page content), falling back to the first cell anywhere below it (hero: cell inside its
|
|
20
|
+
* column group).
|
|
21
|
+
*/
|
|
22
|
+
export declare function getRootCell(root: Component): Component | undefined;
|
package/library/packages/organisms/src/content-builder/plugins/sections/section-host-mounting.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component } from 'grapesjs';
|
|
2
|
+
|
|
3
|
+
/** `querySelector` that never throws on a malformed selector coming from configuration. */
|
|
4
|
+
export declare function resolveHost(doc: Document, selector: string): HTMLElement | null;
|
|
5
|
+
/**
|
|
6
|
+
* Puts the fragment element inside its host container. Returns `true` when the fragment is (now)
|
|
7
|
+
* mounted in its host, `false` when the element or host is not available yet.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mountFragmentIntoHost(fragment: Component): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Re-mounts fragments whose host was replaced by the page (SPA refresh, VForm re-render). The
|
|
12
|
+
* callback is coalesced per task so a burst of mutations — including the ones our own
|
|
13
|
+
* `replaceChildren` produces — triggers one pass, which is a no-op once everything is mounted.
|
|
14
|
+
*/
|
|
15
|
+
export declare function observeHostReplacement(doc: Document, remountAll: () => void): MutationObserver;
|
package/library/packages/organisms/src/content-builder/plugins/sections/sections-canvas-patches.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Editor } from 'grapesjs';
|
|
2
|
+
|
|
3
|
+
/** Hides the wrapper element: its children are mounted in section hosts, it must not take space. */
|
|
4
|
+
export declare function parkWrapperElement(editor: Editor): void;
|
|
5
|
+
/**
|
|
6
|
+
* Block-manager drops are captured on the wrapper element by default; the sections live outside it,
|
|
7
|
+
* so the same `Droppable` is re-bound to the frame body (in-canvas moves already use the body).
|
|
8
|
+
*/
|
|
9
|
+
export declare function rebindBlockDropsToBody(editor: Editor): void;
|
|
10
|
+
/**
|
|
11
|
+
* Drag autoscroll measures the wrapper element's height for its lower bound; with a parked wrapper
|
|
12
|
+
* that is zero. Measure the document instead so authors can autoscroll through every section.
|
|
13
|
+
*/
|
|
14
|
+
export declare function widenAutoscrollToBody(editor: Editor): void;
|
|
15
|
+
/**
|
|
16
|
+
* Restricts grapesjs' `select-comp` click handling to targets inside a section host, so clicking the
|
|
17
|
+
* page chrome around the sections never selects anything. Also skips clicks on a column group while
|
|
18
|
+
* one of its columns is being resized.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scopeSelectClicksToHosts(editor: Editor, hostSelector: string): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ContentBuilderSection } from '../../../../../types/src/content-builder';
|
|
2
|
+
import { Editor } from 'grapesjs';
|
|
3
|
+
|
|
4
|
+
/** Selector list matching every section host container. */
|
|
5
|
+
export declare function buildHostSelector(sections: ContentBuilderSection[]): string;
|
|
6
|
+
declare const SectionsPlugin: (sections: ContentBuilderSection[]) => (editor: Editor) => void;
|
|
7
|
+
export default SectionsPlugin;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { ToolbarItem } from '../../../../types/src/content-builder';
|
|
2
2
|
import { LocalizeController } from '../../../../utils/src/custom-element/i18n';
|
|
3
|
-
import { Editor } from 'grapesjs';
|
|
3
|
+
import { Component, Editor } from 'grapesjs';
|
|
4
4
|
|
|
5
5
|
declare const toolbar: (localize: LocalizeController, toolbarConfigs?: {
|
|
6
6
|
allowDuplicateBlocks?: boolean;
|
|
7
7
|
}) => ToolbarItem[];
|
|
8
|
+
export declare const addColumnItem: (localize: LocalizeController, command: ToolbarItem['command']) => ToolbarItem;
|
|
9
|
+
/** Appends the column with its text block, instead of opening the picker. */
|
|
10
|
+
export declare const fontKitAddColumnItem: (localize: LocalizeController, templateRow: Component) => ToolbarItem;
|
|
11
|
+
/**
|
|
12
|
+
* Reads as a remove but unticks the part's Elements checkbox, leaving the block
|
|
13
|
+
* in place. The id cannot be `remove`: `applyComponentFlagsToToolbar` strips
|
|
14
|
+
* that one for a block with `removable: false`, which these are.
|
|
15
|
+
*/
|
|
16
|
+
export declare const fontKitRemoveElementItems: (localize: LocalizeController, fontKit: Component, toggleAttribute: string) => ToolbarItem[];
|
|
8
17
|
export declare const execCommand: (event: MouseEvent, editor: Editor, command: any) => void;
|
|
9
18
|
export declare const generateToolbar: (items: any[], editor: Editor, dividerIndices?: number[]) => any[];
|
|
10
19
|
export default toolbar;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as CxColumn } from '../../blocks/column/column';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The width a block's percentage `width` should be measured against.
|
|
5
|
+
*
|
|
6
|
+
* Blocks sit inside `cx-column`, so a raw percentage resolves against the column. Once a
|
|
7
|
+
* page sets `--content-builder-viewer-content-max-width`, non-full-bleed blocks are
|
|
8
|
+
* constrained to a narrower content band instead, and a percentage stored against the
|
|
9
|
+
* column would no longer match what renders. Read mode already clamps to the band via
|
|
10
|
+
* CSS; this keeps the editor's px/% conversion on the same reference so the resize
|
|
11
|
+
* handle and the width field agree with the page.
|
|
12
|
+
*
|
|
13
|
+
* Full-bleed blocks span the whole viewer, so they keep measuring the column.
|
|
14
|
+
*
|
|
15
|
+
* @param el - The block being measured.
|
|
16
|
+
* @param column - The `cx-column` the block belongs to.
|
|
17
|
+
* @param canvasWindow - The canvas window, needed for `getComputedStyle`.
|
|
18
|
+
* @returns The reference width in CSS pixels.
|
|
19
|
+
*/
|
|
20
|
+
export default function getBlockReferenceWidth(el: Element, column: CxColumn, canvasWindow: Window): number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropertyConfig } from '../../../types/src/content-builder';
|
|
2
|
-
import { FontTypeface } from '../../../types/src/font-picker';
|
|
2
|
+
import { FontFamily, FontTypeface } from '../../../types/src/font-picker';
|
|
3
3
|
import { LocalizeController } from '../../../utils/src/custom-element/i18n';
|
|
4
4
|
import { STYLE_CONTROL } from './content-builder-constants';
|
|
5
5
|
|
|
@@ -21,8 +21,8 @@ export default class StyleController {
|
|
|
21
21
|
default?: any;
|
|
22
22
|
max?: number | undefined;
|
|
23
23
|
min?: number | undefined;
|
|
24
|
-
placeholder?: string;
|
|
25
24
|
text?: string | undefined;
|
|
25
|
+
placeholder?: string;
|
|
26
26
|
category?: (string | import('grapesjs').BlockCategoryProperties) | undefined;
|
|
27
27
|
command?: string | ((editor: import('grapesjs').Editor, trait: import('grapesjs').Trait) => any) | undefined;
|
|
28
28
|
step?: number | undefined;
|
|
@@ -55,6 +55,7 @@ export default class StyleController {
|
|
|
55
55
|
versionLabelKey?: string;
|
|
56
56
|
};
|
|
57
57
|
assetTransformationConfigs?: {
|
|
58
|
+
aspectRatioKey?: string;
|
|
58
59
|
assetIdKey?: string;
|
|
59
60
|
defaultFormat?: string;
|
|
60
61
|
dialogLabel?: string;
|
|
@@ -98,6 +99,8 @@ export default class StyleController {
|
|
|
98
99
|
fontPickerConfigs?: {
|
|
99
100
|
api: () => Promise<FontTypeface[]>;
|
|
100
101
|
familyKey: string;
|
|
102
|
+
inheritedFamilies?: FontFamily[];
|
|
103
|
+
inheritedOptionLabel?: string;
|
|
101
104
|
styleKey: string;
|
|
102
105
|
weightKey?: string;
|
|
103
106
|
};
|
|
@@ -125,7 +128,7 @@ export default class StyleController {
|
|
|
125
128
|
options: import('../../../types/src/content-builder').Option[];
|
|
126
129
|
type: "unit";
|
|
127
130
|
};
|
|
128
|
-
validation?: (record: Record<string, unknown
|
|
131
|
+
validation?: (record: Record<string, unknown>, siblings?: Array<Record<string, unknown>>) => string;
|
|
129
132
|
};
|
|
130
133
|
itemsPerRow?: number;
|
|
131
134
|
listEditorConfigs?: {
|
|
@@ -135,13 +138,14 @@ export default class StyleController {
|
|
|
135
138
|
displayField?: string;
|
|
136
139
|
editDialogLabel: string;
|
|
137
140
|
noHeader?: boolean;
|
|
138
|
-
sampleItem: Record<string,
|
|
141
|
+
sampleItem: Record<string, unknown>;
|
|
139
142
|
};
|
|
140
143
|
mask?: string;
|
|
141
144
|
maskBlocks?: Record<string, unknown>;
|
|
142
145
|
multiple?: boolean;
|
|
143
146
|
pickerConfigs?: {
|
|
144
147
|
accepts?: string[];
|
|
148
|
+
aspectRatioKey?: string;
|
|
145
149
|
defaultFormat?: string;
|
|
146
150
|
multiple?: boolean;
|
|
147
151
|
nameKey?: string;
|
|
@@ -182,10 +186,12 @@ export default class StyleController {
|
|
|
182
186
|
/**
|
|
183
187
|
* Builds the controls for a font picker.
|
|
184
188
|
*/
|
|
185
|
-
getFontPickerControls<T = Record<string, any>>({ api, familyKey, styleKey, type, weightKey, ...control }: Omit<Partial<PropertyConfig<T>>, 'api' | 'controlType' | 'fontPickerConfigs'> & {
|
|
189
|
+
getFontPickerControls<T = Record<string, any>>({ api, familyKey, inheritedFamilies, inheritedOptionLabel, styleKey, type, weightKey, ...control }: Omit<Partial<PropertyConfig<T>>, 'api' | 'controlType' | 'fontPickerConfigs'> & {
|
|
186
190
|
api: () => Promise<FontTypeface[]>;
|
|
187
191
|
familyKey: string;
|
|
188
192
|
id: string;
|
|
193
|
+
inheritedFamilies?: FontFamily[];
|
|
194
|
+
inheritedOptionLabel?: string;
|
|
189
195
|
name: string;
|
|
190
196
|
styleKey: string;
|
|
191
197
|
weightKey?: string;
|