@ngstarter-ui/components 22.3.5 → 22.4.1
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/README.md +27 -0
- package/ai/component-registry.json +186 -101
- package/fesm2022/attachment-block-BK9QxVjq.mjs +163 -0
- package/fesm2022/attachment-block-BK9QxVjq.mjs.map +1 -0
- package/fesm2022/callout-block-Bl4GZYz8.mjs +196 -0
- package/fesm2022/callout-block-Bl4GZYz8.mjs.map +1 -0
- package/fesm2022/code-block.component-DCRD-9iP.mjs +393 -0
- package/fesm2022/code-block.component-DCRD-9iP.mjs.map +1 -0
- package/fesm2022/content-builder.store-D622mHxt.mjs +328 -0
- package/fesm2022/content-builder.store-D622mHxt.mjs.map +1 -0
- package/fesm2022/content-editor-content-editable.directive-WzD9_71s.mjs +1110 -0
- package/fesm2022/content-editor-content-editable.directive-WzD9_71s.mjs.map +1 -0
- package/fesm2022/cursor-controller-DKfBII1n.mjs +55 -0
- package/fesm2022/cursor-controller-DKfBII1n.mjs.map +1 -0
- package/fesm2022/default-converters-9oSKDsXP.mjs +140 -0
- package/fesm2022/default-converters-9oSKDsXP.mjs.map +1 -0
- package/fesm2022/divider-block.component-Dvgeq_D0.mjs +148 -0
- package/fesm2022/divider-block.component-Dvgeq_D0.mjs.map +1 -0
- package/fesm2022/embed-block-CYkOv4Wt.mjs +565 -0
- package/fesm2022/embed-block-CYkOv4Wt.mjs.map +1 -0
- package/fesm2022/extra-block-defs-Cn_hfM3c.mjs +122 -0
- package/fesm2022/extra-block-defs-Cn_hfM3c.mjs.map +1 -0
- package/fesm2022/gallery-block-DT3uIURY.mjs +365 -0
- package/fesm2022/gallery-block-DT3uIURY.mjs.map +1 -0
- package/fesm2022/grid-block-ZVDT3m8-.mjs +504 -0
- package/fesm2022/grid-block-ZVDT3m8-.mjs.map +1 -0
- package/fesm2022/heading-block.component-iCpJGTMh.mjs +274 -0
- package/fesm2022/heading-block.component-iCpJGTMh.mjs.map +1 -0
- package/fesm2022/html-utils-DywL8gGa.mjs +24 -0
- package/fesm2022/html-utils-DywL8gGa.mjs.map +1 -0
- package/fesm2022/image-block.component-DJ7-HCR8.mjs +285 -0
- package/fesm2022/image-block.component-DJ7-HCR8.mjs.map +1 -0
- package/fesm2022/list-block.component-qFIebEBO.mjs +312 -0
- package/fesm2022/list-block.component-qFIebEBO.mjs.map +1 -0
- package/fesm2022/nested-blocks-CXhgXJ1H.mjs +345 -0
- package/fesm2022/nested-blocks-CXhgXJ1H.mjs.map +1 -0
- package/fesm2022/ngstarter-ui-components-action-required.mjs +150 -45
- package/fesm2022/ngstarter-ui-components-action-required.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-alert.mjs +318 -133
- package/fesm2022/ngstarter-ui-components-alert.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-announcement.mjs +280 -88
- package/fesm2022/ngstarter-ui-components-announcement.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-autocomplete.mjs +647 -386
- package/fesm2022/ngstarter-ui-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-avatar.mjs +715 -482
- package/fesm2022/ngstarter-ui-components-avatar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-badge.mjs +308 -97
- package/fesm2022/ngstarter-ui-components-badge.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-block-loader.mjs +164 -47
- package/fesm2022/ngstarter-ui-components-block-loader.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-bottom-sheet.mjs +278 -315
- package/fesm2022/ngstarter-ui-components-bottom-sheet.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-breadcrumbs.mjs +707 -205
- package/fesm2022/ngstarter-ui-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-button-toggle.mjs +518 -175
- package/fesm2022/ngstarter-ui-components-button-toggle.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-button.mjs +294 -68
- package/fesm2022/ngstarter-ui-components-button.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-calendar.mjs +442 -250
- package/fesm2022/ngstarter-ui-components-calendar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-card-overlay.mjs +159 -47
- package/fesm2022/ngstarter-ui-components-card-overlay.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-card.mjs +619 -194
- package/fesm2022/ngstarter-ui-components-card.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-carousel.mjs +1012 -634
- package/fesm2022/ngstarter-ui-components-carousel.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-checkbox.mjs +715 -308
- package/fesm2022/ngstarter-ui-components-checkbox.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-chips.mjs +1397 -667
- package/fesm2022/ngstarter-ui-components-chips.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-code-highlighter.mjs +519 -357
- package/fesm2022/ngstarter-ui-components-code-highlighter.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-color-picker.mjs +1218 -604
- package/fesm2022/ngstarter-ui-components-color-picker.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-color-scheme.mjs +265 -134
- package/fesm2022/ngstarter-ui-components-color-scheme.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-color-switcher.mjs +190 -71
- package/fesm2022/ngstarter-ui-components-color-switcher.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-command-bar.mjs +197 -58
- package/fesm2022/ngstarter-ui-components-command-bar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-comment-editor.mjs +2212 -1128
- package/fesm2022/ngstarter-ui-components-comment-editor.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-comparison-slider.mjs +269 -183
- package/fesm2022/ngstarter-ui-components-comparison-slider.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-confirm.mjs +164 -86
- package/fesm2022/ngstarter-ui-components-confirm.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-content-editor.mjs +6240 -2
- package/fesm2022/ngstarter-ui-components-content-editor.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-cookie-popup.mjs +244 -108
- package/fesm2022/ngstarter-ui-components-cookie-popup.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-core.mjs +2110 -1592
- package/fesm2022/ngstarter-ui-components-core.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-country-select.mjs +1970 -588
- package/fesm2022/ngstarter-ui-components-country-select.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-crop.mjs +249 -191
- package/fesm2022/ngstarter-ui-components-crop.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-currency-select.mjs +1658 -452
- package/fesm2022/ngstarter-ui-components-currency-select.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-data-view.mjs +4538 -2497
- package/fesm2022/ngstarter-ui-components-data-view.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-date-format-select.mjs +357 -157
- package/fesm2022/ngstarter-ui-components-date-format-select.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-datepicker.mjs +2587 -1264
- package/fesm2022/ngstarter-ui-components-datepicker.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-dialog.mjs +681 -385
- package/fesm2022/ngstarter-ui-components-dialog.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-digit-roller.mjs +1000 -750
- package/fesm2022/ngstarter-ui-components-digit-roller.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-divider.mjs +164 -41
- package/fesm2022/ngstarter-ui-components-divider.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-drawer.mjs +218 -143
- package/fesm2022/ngstarter-ui-components-drawer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-emoji-picker.mjs +345 -247
- package/fesm2022/ngstarter-ui-components-emoji-picker.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-empty-state.mjs +244 -74
- package/fesm2022/ngstarter-ui-components-empty-state.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-events.mjs +467 -126
- package/fesm2022/ngstarter-ui-components-events.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-expand.mjs +191 -59
- package/fesm2022/ngstarter-ui-components-expand.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-expansion.mjs +529 -193
- package/fesm2022/ngstarter-ui-components-expansion.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-file-type.mjs +270 -171
- package/fesm2022/ngstarter-ui-components-file-type.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-filter-builder.mjs +741 -352
- package/fesm2022/ngstarter-ui-components-filter-builder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-form-builder.mjs +9032 -6964
- package/fesm2022/ngstarter-ui-components-form-builder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-form-field.mjs +741 -276
- package/fesm2022/ngstarter-ui-components-form-field.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-gauge.mjs +155 -43
- package/fesm2022/ngstarter-ui-components-gauge.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-grid.mjs +197 -81
- package/fesm2022/ngstarter-ui-components-grid.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-guided-tour.mjs +881 -740
- package/fesm2022/ngstarter-ui-components-guided-tour.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs +3573 -3656
- package/fesm2022/ngstarter-ui-components-headless-editor.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-headless-stepper.mjs +277 -204
- package/fesm2022/ngstarter-ui-components-headless-stepper.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-icon.mjs +209 -182
- package/fesm2022/ngstarter-ui-components-icon.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-image-designer.mjs +5096 -4066
- package/fesm2022/ngstarter-ui-components-image-designer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-image-placeholder.mjs +45 -19
- package/fesm2022/ngstarter-ui-components-image-placeholder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-image-resizer.mjs +333 -154
- package/fesm2022/ngstarter-ui-components-image-resizer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-image-viewer.mjs +564 -358
- package/fesm2022/ngstarter-ui-components-image-viewer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-image-zoom-viewer.mjs +246 -167
- package/fesm2022/ngstarter-ui-components-image-zoom-viewer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-incidents.mjs +732 -258
- package/fesm2022/ngstarter-ui-components-incidents.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-inline-text-edit.mjs +244 -182
- package/fesm2022/ngstarter-ui-components-inline-text-edit.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-input-mask.mjs +314 -174
- package/fesm2022/ngstarter-ui-components-input-mask.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-input-validator.mjs +45 -69
- package/fesm2022/ngstarter-ui-components-input-validator.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-input.mjs +303 -161
- package/fesm2022/ngstarter-ui-components-input.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-kanban-board.mjs +504 -159
- package/fesm2022/ngstarter-ui-components-kanban-board.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-kbd.mjs +86 -30
- package/fesm2022/ngstarter-ui-components-kbd.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-layout.mjs +681 -220
- package/fesm2022/ngstarter-ui-components-layout.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-list.mjs +968 -281
- package/fesm2022/ngstarter-ui-components-list.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-logo.mjs +181 -51
- package/fesm2022/ngstarter-ui-components-logo.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-marquee.mjs +226 -147
- package/fesm2022/ngstarter-ui-components-marquee.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-menu.mjs +1686 -1091
- package/fesm2022/ngstarter-ui-components-menu.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-micro-chart.mjs +1541 -943
- package/fesm2022/ngstarter-ui-components-micro-chart.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-navigation.mjs +1035 -455
- package/fesm2022/ngstarter-ui-components-navigation.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-notifications.mjs +678 -230
- package/fesm2022/ngstarter-ui-components-notifications.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-number-input.mjs +616 -316
- package/fesm2022/ngstarter-ui-components-number-input.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-option.mjs +405 -163
- package/fesm2022/ngstarter-ui-components-option.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-overlay.mjs +107 -111
- package/fesm2022/ngstarter-ui-components-overlay.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-page-loading-bar.mjs +131 -76
- package/fesm2022/ngstarter-ui-components-page-loading-bar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-paginator.mjs +543 -295
- package/fesm2022/ngstarter-ui-components-paginator.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-password-strength.mjs +785 -340
- package/fesm2022/ngstarter-ui-components-password-strength.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-builder.mjs +3705 -2695
- package/fesm2022/ngstarter-ui-components-pdf-builder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-signer.mjs +1179 -851
- package/fesm2022/ngstarter-ui-components-pdf-signer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pdf-viewer.mjs +2973 -2070
- package/fesm2022/ngstarter-ui-components-pdf-viewer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-phone-input.mjs +2081 -770
- package/fesm2022/ngstarter-ui-components-phone-input.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-pin-input.mjs +366 -198
- package/fesm2022/ngstarter-ui-components-pin-input.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-popover.mjs +558 -308
- package/fesm2022/ngstarter-ui-components-popover.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-progress-bar.mjs +178 -73
- package/fesm2022/ngstarter-ui-components-progress-bar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-radio-card.mjs +301 -105
- package/fesm2022/ngstarter-ui-components-radio-card.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-radio.mjs +417 -157
- package/fesm2022/ngstarter-ui-components-radio.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-rail-nav.mjs +208 -88
- package/fesm2022/ngstarter-ui-components-rail-nav.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-resizable-container.mjs +123 -74
- package/fesm2022/ngstarter-ui-components-resizable-container.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-screen-loader.mjs +197 -95
- package/fesm2022/ngstarter-ui-components-screen-loader.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-scroll-spy.mjs +383 -245
- package/fesm2022/ngstarter-ui-components-scroll-spy.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-scrollbar-area.mjs +705 -581
- package/fesm2022/ngstarter-ui-components-scrollbar-area.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-segmented.mjs +422 -220
- package/fesm2022/ngstarter-ui-components-segmented.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-select.mjs +1862 -1159
- package/fesm2022/ngstarter-ui-components-select.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-side-panel.mjs +313 -118
- package/fesm2022/ngstarter-ui-components-side-panel.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-sidebar.mjs +1239 -470
- package/fesm2022/ngstarter-ui-components-sidebar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-sidenav.mjs +664 -354
- package/fesm2022/ngstarter-ui-components-sidenav.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-signature-pad.mjs +1092 -643
- package/fesm2022/ngstarter-ui-components-signature-pad.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-skeleton.mjs +153 -43
- package/fesm2022/ngstarter-ui-components-skeleton.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-slide-toggle.mjs +425 -108
- package/fesm2022/ngstarter-ui-components-slide-toggle.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-slider.mjs +645 -487
- package/fesm2022/ngstarter-ui-components-slider.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-snack-bar.mjs +372 -354
- package/fesm2022/ngstarter-ui-components-snack-bar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-sort.mjs +378 -147
- package/fesm2022/ngstarter-ui-components-sort.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-spinner.mjs +242 -76
- package/fesm2022/ngstarter-ui-components-spinner.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-splash-screen.mjs +142 -91
- package/fesm2022/ngstarter-ui-components-splash-screen.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-split.mjs +1067 -929
- package/fesm2022/ngstarter-ui-components-split.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-step-tracker.mjs +617 -331
- package/fesm2022/ngstarter-ui-components-step-tracker.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-stepper.mjs +357 -126
- package/fesm2022/ngstarter-ui-components-stepper.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-suggestions.mjs +259 -72
- package/fesm2022/ngstarter-ui-components-suggestions.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-tab-panel.mjs +674 -267
- package/fesm2022/ngstarter-ui-components-tab-panel.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-table.mjs +1144 -662
- package/fesm2022/ngstarter-ui-components-table.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-tabs.mjs +1236 -615
- package/fesm2022/ngstarter-ui-components-tabs.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-thumbnail-maker.mjs +414 -216
- package/fesm2022/ngstarter-ui-components-thumbnail-maker.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-tiles.mjs +939 -647
- package/fesm2022/ngstarter-ui-components-tiles.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-timeline.mjs +418 -122
- package/fesm2022/ngstarter-ui-components-timeline.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-timepicker.mjs +870 -508
- package/fesm2022/ngstarter-ui-components-timepicker.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-timezone-select.mjs +651 -371
- package/fesm2022/ngstarter-ui-components-timezone-select.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-toolbar.mjs +727 -320
- package/fesm2022/ngstarter-ui-components-toolbar.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-tooltip.mjs +601 -521
- package/fesm2022/ngstarter-ui-components-tooltip.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-tree-select.mjs +1197 -434
- package/fesm2022/ngstarter-ui-components-tree-select.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-tree.mjs +1821 -1262
- package/fesm2022/ngstarter-ui-components-tree.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-upload.mjs +1059 -345
- package/fesm2022/ngstarter-ui-components-upload.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-video-player.mjs +763 -533
- package/fesm2022/ngstarter-ui-components-video-player.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-video-viewer.mjs +630 -229
- package/fesm2022/ngstarter-ui-components-video-viewer.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-visual-builder.mjs +40 -17
- package/fesm2022/ngstarter-ui-components-visual-builder.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components-whiteboard.mjs +3039 -1803
- package/fesm2022/ngstarter-ui-components-whiteboard.mjs.map +1 -1
- package/fesm2022/ngstarter-ui-components.mjs +3 -5
- package/fesm2022/ngstarter-ui-components.mjs.map +1 -1
- package/fesm2022/paragraph-block.component-Csk8Gu3x.mjs +264 -0
- package/fesm2022/paragraph-block.component-Csk8Gu3x.mjs.map +1 -0
- package/fesm2022/plain-text-settings-BnxCxLhA.mjs +354 -0
- package/fesm2022/plain-text-settings-BnxCxLhA.mjs.map +1 -0
- package/fesm2022/quote-block.component-tRmrU97F.mjs +309 -0
- package/fesm2022/quote-block.component-tRmrU97F.mjs.map +1 -0
- package/fesm2022/table-block.component-BuzRRggv.mjs +1859 -0
- package/fesm2022/table-block.component-BuzRRggv.mjs.map +1 -0
- package/fesm2022/toggle-block-C5Jo2YDf.mjs +150 -0
- package/fesm2022/toggle-block-C5Jo2YDf.mjs.map +1 -0
- package/fesm2022/upload-status-tZ0x0BUB.mjs +107 -0
- package/fesm2022/upload-status-tZ0x0BUB.mjs.map +1 -0
- package/fesm2022/video-block.component-CpAXibm6.mjs +312 -0
- package/fesm2022/video-block.component-CpAXibm6.mjs.map +1 -0
- package/package.json +11 -10
- package/styles/_tokens.scss +1 -0
- package/types/ngstarter-ui-components-action-required.d.ts +34 -14
- package/types/ngstarter-ui-components-alert.d.ts +53 -44
- package/types/ngstarter-ui-components-announcement.d.ts +74 -53
- package/types/ngstarter-ui-components-autocomplete.d.ts +141 -84
- package/types/ngstarter-ui-components-avatar.d.ts +113 -66
- package/types/ngstarter-ui-components-badge.d.ts +73 -37
- package/types/ngstarter-ui-components-block-loader.d.ts +32 -20
- package/types/ngstarter-ui-components-bottom-sheet.d.ts +125 -132
- package/types/ngstarter-ui-components-breadcrumbs.d.ts +93 -88
- package/types/ngstarter-ui-components-button-toggle.d.ts +124 -54
- package/types/ngstarter-ui-components-button.d.ts +69 -27
- package/types/ngstarter-ui-components-calendar.d.ts +123 -71
- package/types/ngstarter-ui-components-card-overlay.d.ts +31 -19
- package/types/ngstarter-ui-components-card.d.ts +75 -71
- package/types/ngstarter-ui-components-carousel.d.ts +115 -69
- package/types/ngstarter-ui-components-checkbox.d.ts +183 -86
- package/types/ngstarter-ui-components-chips.d.ts +288 -195
- package/types/ngstarter-ui-components-code-highlighter.d.ts +71 -28
- package/types/ngstarter-ui-components-color-picker.d.ts +140 -89
- package/types/ngstarter-ui-components-color-scheme.d.ts +43 -52
- package/types/ngstarter-ui-components-color-switcher.d.ts +46 -26
- package/types/ngstarter-ui-components-command-bar.d.ts +40 -26
- package/types/ngstarter-ui-components-comment-editor.d.ts +311 -235
- package/types/ngstarter-ui-components-comparison-slider.d.ts +41 -40
- package/types/ngstarter-ui-components-confirm.d.ts +24 -29
- package/types/ngstarter-ui-components-content-editor.d.ts +1482 -998
- package/types/ngstarter-ui-components-cookie-popup.d.ts +43 -38
- package/types/ngstarter-ui-components-core.d.ts +513 -467
- package/types/ngstarter-ui-components-country-select.d.ts +170 -97
- package/types/ngstarter-ui-components-crop.d.ts +67 -52
- package/types/ngstarter-ui-components-currency-select.d.ts +127 -90
- package/types/ngstarter-ui-components-data-view.d.ts +811 -567
- package/types/ngstarter-ui-components-date-format-select.d.ts +90 -58
- package/types/ngstarter-ui-components-datepicker.d.ts +589 -373
- package/types/ngstarter-ui-components-dialog.d.ts +138 -116
- package/types/ngstarter-ui-components-digit-roller.d.ts +228 -131
- package/types/ngstarter-ui-components-divider.d.ts +29 -17
- package/types/ngstarter-ui-components-drawer.d.ts +39 -30
- package/types/ngstarter-ui-components-emoji-picker.d.ts +69 -47
- package/types/ngstarter-ui-components-empty-state.d.ts +20 -28
- package/types/ngstarter-ui-components-events.d.ts +73 -57
- package/types/ngstarter-ui-components-expand.d.ts +55 -25
- package/types/ngstarter-ui-components-expansion.d.ts +93 -64
- package/types/ngstarter-ui-components-file-type.d.ts +53 -27
- package/types/ngstarter-ui-components-filter-builder.d.ts +131 -100
- package/types/ngstarter-ui-components-form-builder.d.ts +1094 -881
- package/types/ngstarter-ui-components-form-field.d.ts +116 -105
- package/types/ngstarter-ui-components-gauge.d.ts +32 -20
- package/types/ngstarter-ui-components-grid.d.ts +66 -50
- package/types/ngstarter-ui-components-guided-tour.d.ts +250 -222
- package/types/ngstarter-ui-components-headless-editor.d.ts +708 -658
- package/types/ngstarter-ui-components-headless-stepper.d.ts +84 -64
- package/types/ngstarter-ui-components-icon.d.ts +39 -38
- package/types/ngstarter-ui-components-image-designer.d.ts +422 -341
- package/types/ngstarter-ui-components-image-placeholder.d.ts +5 -8
- package/types/ngstarter-ui-components-image-resizer.d.ts +40 -33
- package/types/ngstarter-ui-components-image-viewer.d.ts +67 -54
- package/types/ngstarter-ui-components-image-zoom-viewer.d.ts +29 -33
- package/types/ngstarter-ui-components-incidents.d.ts +97 -104
- package/types/ngstarter-ui-components-inline-text-edit.d.ts +54 -39
- package/types/ngstarter-ui-components-input-mask.d.ts +54 -34
- package/types/ngstarter-ui-components-input-validator.d.ts +7 -11
- package/types/ngstarter-ui-components-input.d.ts +82 -54
- package/types/ngstarter-ui-components-kanban-board.d.ts +76 -63
- package/types/ngstarter-ui-components-kbd.d.ts +8 -12
- package/types/ngstarter-ui-components-layout.d.ts +131 -87
- package/types/ngstarter-ui-components-list.d.ts +123 -88
- package/types/ngstarter-ui-components-logo.d.ts +21 -21
- package/types/ngstarter-ui-components-marquee.d.ts +41 -34
- package/types/ngstarter-ui-components-menu.d.ts +329 -221
- package/types/ngstarter-ui-components-micro-chart.d.ts +385 -186
- package/types/ngstarter-ui-components-navigation.d.ts +186 -125
- package/types/ngstarter-ui-components-notifications.d.ts +104 -89
- package/types/ngstarter-ui-components-number-input.d.ts +138 -96
- package/types/ngstarter-ui-components-option.d.ts +102 -68
- package/types/ngstarter-ui-components-overlay.d.ts +7 -12
- package/types/ngstarter-ui-components-page-loading-bar.d.ts +23 -20
- package/types/ngstarter-ui-components-paginator.d.ts +171 -129
- package/types/ngstarter-ui-components-password-strength.d.ts +217 -102
- package/types/ngstarter-ui-components-pdf-builder.d.ts +717 -649
- package/types/ngstarter-ui-components-pdf-signer.d.ts +202 -142
- package/types/ngstarter-ui-components-pdf-viewer.d.ts +544 -385
- package/types/ngstarter-ui-components-phone-input.d.ts +175 -115
- package/types/ngstarter-ui-components-pin-input.d.ts +83 -45
- package/types/ngstarter-ui-components-popover.d.ts +128 -89
- package/types/ngstarter-ui-components-progress-bar.d.ts +49 -30
- package/types/ngstarter-ui-components-radio-card.d.ts +50 -34
- package/types/ngstarter-ui-components-radio.d.ts +100 -47
- package/types/ngstarter-ui-components-rail-nav.d.ts +36 -29
- package/types/ngstarter-ui-components-resizable-container.d.ts +30 -25
- package/types/ngstarter-ui-components-screen-loader.d.ts +38 -32
- package/types/ngstarter-ui-components-scroll-spy.d.ts +56 -60
- package/types/ngstarter-ui-components-scrollbar-area.d.ts +116 -86
- package/types/ngstarter-ui-components-segmented.d.ts +93 -61
- package/types/ngstarter-ui-components-select.d.ts +366 -266
- package/types/ngstarter-ui-components-side-panel.d.ts +59 -40
- package/types/ngstarter-ui-components-sidebar.d.ts +208 -154
- package/types/ngstarter-ui-components-sidenav.d.ts +136 -78
- package/types/ngstarter-ui-components-signature-pad.d.ts +165 -92
- package/types/ngstarter-ui-components-skeleton.d.ts +18 -17
- package/types/ngstarter-ui-components-slide-toggle.d.ts +113 -44
- package/types/ngstarter-ui-components-slider.d.ts +123 -82
- package/types/ngstarter-ui-components-snack-bar.d.ts +126 -134
- package/types/ngstarter-ui-components-sort.d.ts +99 -63
- package/types/ngstarter-ui-components-spinner.d.ts +49 -27
- package/types/ngstarter-ui-components-splash-screen.d.ts +34 -29
- package/types/ngstarter-ui-components-split.d.ts +276 -195
- package/types/ngstarter-ui-components-step-tracker.d.ts +102 -83
- package/types/ngstarter-ui-components-stepper.d.ts +57 -43
- package/types/ngstarter-ui-components-suggestions.d.ts +41 -28
- package/types/ngstarter-ui-components-tab-panel.d.ts +110 -83
- package/types/ngstarter-ui-components-table.d.ts +256 -228
- package/types/ngstarter-ui-components-tabs.d.ts +231 -138
- package/types/ngstarter-ui-components-thumbnail-maker.d.ts +40 -34
- package/types/ngstarter-ui-components-tiles.d.ts +166 -104
- package/types/ngstarter-ui-components-timeline.d.ts +45 -57
- package/types/ngstarter-ui-components-timepicker.d.ts +166 -111
- package/types/ngstarter-ui-components-timezone-select.d.ts +110 -70
- package/types/ngstarter-ui-components-toolbar.d.ts +89 -72
- package/types/ngstarter-ui-components-tooltip.d.ts +89 -52
- package/types/ngstarter-ui-components-tree-select.d.ts +182 -105
- package/types/ngstarter-ui-components-tree.d.ts +355 -229
- package/types/ngstarter-ui-components-upload.d.ts +216 -131
- package/types/ngstarter-ui-components-video-player.d.ts +130 -67
- package/types/ngstarter-ui-components-video-viewer.d.ts +140 -91
- package/types/ngstarter-ui-components-visual-builder.d.ts +5 -8
- package/types/ngstarter-ui-components-whiteboard.d.ts +412 -339
- package/types/ngstarter-ui-components.d.ts +2 -2
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-8OmuepvH.mjs +0 -35
- package/fesm2022/ngstarter-ui-components-content-editor-attachment-block-8OmuepvH.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-callout-block-Dp5tISk3.mjs +0 -26
- package/fesm2022/ngstarter-ui-components-content-editor-callout-block-Dp5tISk3.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-code-block.component-BbBs-R_y.mjs +0 -220
- package/fesm2022/ngstarter-ui-components-content-editor-code-block.component-BbBs-R_y.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-cursor-controller-4Ak8VqGX.mjs +0 -99
- package/fesm2022/ngstarter-ui-components-content-editor-cursor-controller-4Ak8VqGX.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-divider-block.component-D1nXMRXD.mjs +0 -40
- package/fesm2022/ngstarter-ui-components-content-editor-divider-block.component-D1nXMRXD.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-embed-block-DGCCeU-Y.mjs +0 -375
- package/fesm2022/ngstarter-ui-components-content-editor-embed-block-DGCCeU-Y.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-BJfRgtaA.mjs +0 -80
- package/fesm2022/ngstarter-ui-components-content-editor-gallery-block-BJfRgtaA.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-grid-block-C_L7hF2G.mjs +0 -65
- package/fesm2022/ngstarter-ui-components-content-editor-grid-block-C_L7hF2G.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-heading-block.component-durrPUhm.mjs +0 -137
- package/fesm2022/ngstarter-ui-components-content-editor-heading-block.component-durrPUhm.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-BoL1jZpT.mjs +0 -113
- package/fesm2022/ngstarter-ui-components-content-editor-image-block.component-BoL1jZpT.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-list-block.component-ChZpgXO5.mjs +0 -235
- package/fesm2022/ngstarter-ui-components-content-editor-list-block.component-ChZpgXO5.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-DwyNFnII.mjs +0 -117
- package/fesm2022/ngstarter-ui-components-content-editor-nested-blocks-DwyNFnII.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-BWpJv6CO.mjs +0 -4464
- package/fesm2022/ngstarter-ui-components-content-editor-ngstarter-ui-components-content-editor-BWpJv6CO.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-paragraph-block.component-BvNvkqTO.mjs +0 -132
- package/fesm2022/ngstarter-ui-components-content-editor-paragraph-block.component-BvNvkqTO.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-quote-block.component-tgNKltfK.mjs +0 -171
- package/fesm2022/ngstarter-ui-components-content-editor-quote-block.component-tgNKltfK.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-BcAlqmh8.mjs +0 -1653
- package/fesm2022/ngstarter-ui-components-content-editor-table-block.component-BcAlqmh8.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-toggle-block-S474I51r.mjs +0 -20
- package/fesm2022/ngstarter-ui-components-content-editor-toggle-block-S474I51r.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs +0 -19
- package/fesm2022/ngstarter-ui-components-content-editor-upload-status-QnKI_Rfz.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-Dj82fxTI.mjs +0 -134
- package/fesm2022/ngstarter-ui-components-content-editor-video-block.component-Dj82fxTI.mjs.map +0 -1
- package/fesm2022/ngstarter-ui-components-form-builder-plain-text-settings-GNXKGonc.mjs +0 -159
- package/fesm2022/ngstarter-ui-components-form-builder-plain-text-settings-GNXKGonc.mjs.map +0 -1
|
@@ -0,0 +1,1110 @@
|
|
|
1
|
+
import { n as CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS } from "./default-converters-9oSKDsXP.mjs";
|
|
2
|
+
import { n as safeContentEditorHtmlUrl, t as escapeContentEditorHtml } from "./html-utils-DywL8gGa.mjs";
|
|
3
|
+
import { n as CONTENT_BUILDER, t as ContentBuilderStore } from "./content-builder.store-D622mHxt.mjs";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { Directive, ElementRef, Injectable, InjectionToken, afterNextRender, afterRenderEffect, effect, inject, input, makeEnvironmentProviders, output, untracked } from "@angular/core";
|
|
6
|
+
import { DOCUMENT as DOCUMENT$1 } from "@angular/common";
|
|
7
|
+
import * as i1 from "@ngstarter-ui/components/headless-editor";
|
|
8
|
+
import { NgsHeadlessEditorInlineRegion, NgsHeadlessEditorSurface, basicTextEditorPlugin, colorEditorPlugin, createNgsHeadlessEditorId, createNgsHeadlessEditorText, isNgsHeadlessEditorTextContent, linkEditorPlugin, normalizeNgsHeadlessEditorColor, normalizeNgsHeadlessEditorTextContent, provideNgsHeadlessEditorInlineRegion } from "@ngstarter-ui/components/headless-editor";
|
|
9
|
+
const MARK_TAGS = {
|
|
10
|
+
bold: "strong",
|
|
11
|
+
italic: "em",
|
|
12
|
+
strike: "s",
|
|
13
|
+
underline: "u",
|
|
14
|
+
code: "code",
|
|
15
|
+
superscript: "sup",
|
|
16
|
+
subscript: "sub"
|
|
17
|
+
};
|
|
18
|
+
function contentEditorToHtml(document, config = {}) {
|
|
19
|
+
return serialize(document.blocks, config);
|
|
20
|
+
}
|
|
21
|
+
function contentEditorBlockToHtml(block, config = {}) {
|
|
22
|
+
return serialize([block], config);
|
|
23
|
+
}
|
|
24
|
+
function serialize(blocks, config) {
|
|
25
|
+
const styles = /* @__PURE__ */ new Set();
|
|
26
|
+
const context = {
|
|
27
|
+
escape: escapeContentEditorHtml,
|
|
28
|
+
safeUrl: safeContentEditorHtmlUrl,
|
|
29
|
+
addStyles: (css) => {
|
|
30
|
+
if (config.includeStyles !== false) styles.add(css);
|
|
31
|
+
},
|
|
32
|
+
renderBlock: (block) => {
|
|
33
|
+
const converter = config.blocks?.[block.type]?.toHtml ?? defaultConverter(block.type) ?? config.unknownBlockToHtml;
|
|
34
|
+
if (!converter) throw new Error(`No HTML converter for Content Editor block "${block.type}".`);
|
|
35
|
+
return converter(block, context);
|
|
36
|
+
},
|
|
37
|
+
renderBlocks: (children) => children.map(context.renderBlock).join(""),
|
|
38
|
+
defaultToHtml: (block) => {
|
|
39
|
+
const converter = defaultConverter(block.type);
|
|
40
|
+
if (!converter) throw new Error(`No default HTML converter for Content Editor block "${block.type}".`);
|
|
41
|
+
return converter(block, context);
|
|
42
|
+
},
|
|
43
|
+
renderText: (text) => renderText(text, context, config)
|
|
44
|
+
};
|
|
45
|
+
const html = context.renderBlocks(blocks);
|
|
46
|
+
return [...styles].map((css) => `<style>${css}</style>`).join("") + html;
|
|
47
|
+
}
|
|
48
|
+
function renderText(text, ctx, config) {
|
|
49
|
+
if (!isNgsHeadlessEditorTextContent(text)) return "";
|
|
50
|
+
return text.map((run) => run.marks.reduce((html, mark) => {
|
|
51
|
+
const override = config.marks && Object.hasOwn(config.marks, mark.type) ? config.marks[mark.type] : void 0;
|
|
52
|
+
return override ? override(html, mark, ctx) : renderMark(html, mark, ctx);
|
|
53
|
+
}, ctx.escape(run.text).replace(/\r\n|\r|\n/g, "<br>"))).join("");
|
|
54
|
+
}
|
|
55
|
+
function renderMark(html, mark, ctx) {
|
|
56
|
+
const tag = Object.hasOwn(MARK_TAGS, mark.type) ? MARK_TAGS[mark.type] : void 0;
|
|
57
|
+
if (tag) return `<${tag}>${html}</${tag}>`;
|
|
58
|
+
if (mark.type === "link") {
|
|
59
|
+
const href = ctx.safeUrl(mark.attrs?.["href"]);
|
|
60
|
+
if (!href) return html;
|
|
61
|
+
const target = mark.attrs?.["target"] === "_blank" ? "_blank" : "_self";
|
|
62
|
+
return `<a href="${ctx.escape(href)}" target="${target}" rel="noopener noreferrer">${html}</a>`;
|
|
63
|
+
}
|
|
64
|
+
if (mark.type === "textColor" || mark.type === "backgroundColor") {
|
|
65
|
+
const color = normalizeNgsHeadlessEditorColor(String(mark.attrs?.["color"] ?? ""));
|
|
66
|
+
return color ? `<span style="${mark.type === "textColor" ? "color" : "background-color"}:${ctx.escape(color)}">${html}</span>` : html;
|
|
67
|
+
}
|
|
68
|
+
return html;
|
|
69
|
+
}
|
|
70
|
+
function defaultConverter(type) {
|
|
71
|
+
return Object.hasOwn(CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS, type) ? CONTENT_EDITOR_DEFAULT_HTML_CONVERTERS[type] : void 0;
|
|
72
|
+
}
|
|
73
|
+
var ContentEditorHtmlSerializer = class ContentEditorHtmlSerializer {
|
|
74
|
+
config = inject(CONTENT_EDITOR_CONFIG);
|
|
75
|
+
toHtml(document, config = {}) {
|
|
76
|
+
return contentEditorToHtml(document, mergeContentEditorConfig(this.config, config));
|
|
77
|
+
}
|
|
78
|
+
blockToHtml(block, config = {}) {
|
|
79
|
+
return contentEditorBlockToHtml(block, mergeContentEditorConfig(this.config, config));
|
|
80
|
+
}
|
|
81
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
82
|
+
minVersion: "12.0.0",
|
|
83
|
+
version: "22.3.0",
|
|
84
|
+
ngImport: i0,
|
|
85
|
+
type: ContentEditorHtmlSerializer,
|
|
86
|
+
deps: [],
|
|
87
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
88
|
+
});
|
|
89
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
90
|
+
minVersion: "12.0.0",
|
|
91
|
+
version: "22.3.0",
|
|
92
|
+
ngImport: i0,
|
|
93
|
+
type: ContentEditorHtmlSerializer,
|
|
94
|
+
providedIn: "root"
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
98
|
+
minVersion: "12.0.0",
|
|
99
|
+
version: "22.3.0",
|
|
100
|
+
ngImport: i0,
|
|
101
|
+
type: ContentEditorHtmlSerializer,
|
|
102
|
+
decorators: [{
|
|
103
|
+
type: Injectable,
|
|
104
|
+
args: [{ providedIn: "root" }]
|
|
105
|
+
}]
|
|
106
|
+
});
|
|
107
|
+
const CONTENT_EDITOR_RENDER_CONFIG = new InjectionToken("CONTENT_EDITOR_RENDER_CONFIG");
|
|
108
|
+
const CONTENT_EDITOR_CONFIG = new InjectionToken("CONTENT_EDITOR_CONFIG", {
|
|
109
|
+
providedIn: "root",
|
|
110
|
+
factory: () => ({})
|
|
111
|
+
});
|
|
112
|
+
function mergeContentEditorConfig(...configs) {
|
|
113
|
+
const result = {
|
|
114
|
+
blocks: Object.create(null),
|
|
115
|
+
marks: {}
|
|
116
|
+
};
|
|
117
|
+
for (const config of configs) {
|
|
118
|
+
for (const [type, block] of Object.entries(config.blocks ?? {})) {
|
|
119
|
+
const previous = result.blocks[type];
|
|
120
|
+
result.blocks[type] = {
|
|
121
|
+
...previous,
|
|
122
|
+
...block,
|
|
123
|
+
options: {
|
|
124
|
+
...previous?.options,
|
|
125
|
+
...block.options
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
result.marks = {
|
|
130
|
+
...result.marks,
|
|
131
|
+
...config.marks
|
|
132
|
+
};
|
|
133
|
+
if (config.draft !== void 0) result.draft = {
|
|
134
|
+
...result.draft,
|
|
135
|
+
...config.draft
|
|
136
|
+
};
|
|
137
|
+
if (config.includeStyles !== void 0) result.includeStyles = config.includeStyles;
|
|
138
|
+
if (config.importMarks !== void 0) result.importMarks = config.importMarks;
|
|
139
|
+
if (config.unknownBlockToHtml !== void 0) result.unknownBlockToHtml = config.unknownBlockToHtml;
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
function provideContentEditorConfig(config = {}) {
|
|
144
|
+
return makeEnvironmentProviders([
|
|
145
|
+
{
|
|
146
|
+
provide: CONTENT_EDITOR_CONFIG,
|
|
147
|
+
useFactory: () => mergeContentEditorConfig(inject(CONTENT_EDITOR_CONFIG, {
|
|
148
|
+
skipSelf: true,
|
|
149
|
+
optional: true
|
|
150
|
+
}) ?? {}, config)
|
|
151
|
+
},
|
|
152
|
+
ContentEditorHtmlSerializer,
|
|
153
|
+
ContentEditorImporter
|
|
154
|
+
]);
|
|
155
|
+
}
|
|
156
|
+
var ContentEditorImportError = class extends Error {
|
|
157
|
+
path;
|
|
158
|
+
constructor(path, message) {
|
|
159
|
+
super(`${path}: ${message}`);
|
|
160
|
+
this.path = path;
|
|
161
|
+
this.name = "ContentEditorImportError";
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
function contentEditorFromJson(source, config = {}, options = {}) {
|
|
165
|
+
const maxDepth = options.maxDepth ?? 64;
|
|
166
|
+
const maxBlocks = options.maxBlocks ?? 1e4;
|
|
167
|
+
if (!Number.isInteger(maxDepth) || maxDepth < 1 || !Number.isInteger(maxBlocks) || maxBlocks < 1) throw new ContentEditorImportError("$options", "maxDepth and maxBlocks must be positive integers");
|
|
168
|
+
let value = source;
|
|
169
|
+
if (typeof source === "string") try {
|
|
170
|
+
value = JSON.parse(source);
|
|
171
|
+
} catch {
|
|
172
|
+
throw new ContentEditorImportError("$", "Invalid JSON");
|
|
173
|
+
}
|
|
174
|
+
const fail = (path, message) => {
|
|
175
|
+
throw new ContentEditorImportError(path, message);
|
|
176
|
+
};
|
|
177
|
+
const ancestors = /* @__PURE__ */ new Set();
|
|
178
|
+
const copy = (input, path, depth) => {
|
|
179
|
+
if (depth > maxDepth) fail(path, `Maximum nesting depth (${maxDepth}) exceeded`);
|
|
180
|
+
if (input === null || typeof input === "string" || typeof input === "boolean") return input;
|
|
181
|
+
if (typeof input === "number" && Number.isFinite(input)) return input;
|
|
182
|
+
if (!input || typeof input !== "object") return fail(path, "Expected a JSON-compatible value");
|
|
183
|
+
if (ancestors.has(input)) fail(path, "Cyclic data is not supported");
|
|
184
|
+
if (!Array.isArray(input) && ![Object.prototype, null].includes(Object.getPrototypeOf(input))) fail(path, "Expected a plain JSON object");
|
|
185
|
+
ancestors.add(input);
|
|
186
|
+
const output = Array.isArray(input) ? Array.from(input, (item, i) => copy(item, `${path}[${i}]`, depth + 1)) : Object.fromEntries(Object.entries(input).filter(([, item]) => item !== void 0).map(([key, item]) => [key, copy(item, `${path}.${key}`, depth + 1)]));
|
|
187
|
+
ancestors.delete(input);
|
|
188
|
+
return output;
|
|
189
|
+
};
|
|
190
|
+
const object = (input, path) => {
|
|
191
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) fail(path, "Expected an object");
|
|
192
|
+
return input;
|
|
193
|
+
};
|
|
194
|
+
const array = (input, path) => {
|
|
195
|
+
if (!Array.isArray(input)) fail(path, "Expected an array");
|
|
196
|
+
return input;
|
|
197
|
+
};
|
|
198
|
+
const string = (input, path, nonempty = false) => {
|
|
199
|
+
if (typeof input !== "string" || nonempty && !input.trim()) fail(path, nonempty ? "Expected a non-empty string" : "Expected a string");
|
|
200
|
+
};
|
|
201
|
+
const props = (input, path) => {
|
|
202
|
+
if (input === void 0) return;
|
|
203
|
+
array(input, path).forEach((prop, i) => {
|
|
204
|
+
object(prop, `${path}[${i}]`);
|
|
205
|
+
string(prop.name, `${path}[${i}].name`, true);
|
|
206
|
+
string(prop.value, `${path}[${i}].value`);
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
const runs = (input, path) => {
|
|
210
|
+
array(input, path).forEach((run, i) => {
|
|
211
|
+
const p = `${path}[${i}]`;
|
|
212
|
+
object(run, p);
|
|
213
|
+
if (run.type !== "text") fail(`${p}.type`, "Expected \"text\"");
|
|
214
|
+
string(run.text, `${p}.text`);
|
|
215
|
+
array(run.marks, `${p}.marks`).forEach((mark, j) => {
|
|
216
|
+
const m = `${p}.marks[${j}]`;
|
|
217
|
+
object(mark, m);
|
|
218
|
+
string(mark.type, `${m}.type`, true);
|
|
219
|
+
if (mark.attrs !== void 0) {
|
|
220
|
+
for (const [key, attr] of Object.entries(object(mark.attrs, `${m}.attrs`))) if (attr !== null && ![
|
|
221
|
+
"string",
|
|
222
|
+
"number",
|
|
223
|
+
"boolean"
|
|
224
|
+
].includes(typeof attr)) fail(`${m}.attrs.${key}`, "Expected a scalar mark attribute");
|
|
225
|
+
}
|
|
226
|
+
if (mark.type === "link" && !safeContentEditorHtmlUrl(mark.attrs?.href)) fail(`${m}.attrs.href`, "Expected a supported non-empty link URL");
|
|
227
|
+
if (mark.type === "link") enumValue(mark.attrs?.target, ["_blank", "_self"], `${m}.attrs.target`);
|
|
228
|
+
if (["textColor", "backgroundColor"].includes(mark.type) && (typeof mark.attrs?.color !== "string" || !normalizeNgsHeadlessEditorColor(mark.attrs.color))) fail(`${m}.attrs.color`, "Expected a supported CSS color");
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
const enumValue = (input, allowed, path) => {
|
|
233
|
+
if (input !== void 0 && !allowed.includes(input)) fail(path, `Expected one of: ${allowed.join(", ")}`);
|
|
234
|
+
};
|
|
235
|
+
const dimension = (input, path) => {
|
|
236
|
+
if (input !== void 0 && input !== null && input !== "auto" && !(typeof input === "number" && Number.isFinite(input) && input > 0)) fail(path, "Expected a positive pixel dimension, \"auto\", or null");
|
|
237
|
+
};
|
|
238
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
239
|
+
let count = 0;
|
|
240
|
+
const list = (input, path) => {
|
|
241
|
+
array(input, path).forEach((item, i) => {
|
|
242
|
+
const p = `${path}[${i}]`;
|
|
243
|
+
object(item, p);
|
|
244
|
+
runs(item.content, `${p}.content`);
|
|
245
|
+
props(item.props, `${p}.props`);
|
|
246
|
+
list(item.children, `${p}.children`);
|
|
247
|
+
});
|
|
248
|
+
};
|
|
249
|
+
const blocks = (input, path) => {
|
|
250
|
+
array(input, path).forEach((block, i) => {
|
|
251
|
+
const p = `${path}[${i}]`;
|
|
252
|
+
object(block, p);
|
|
253
|
+
if (++count > maxBlocks) fail(p, `Maximum block count (${maxBlocks}) exceeded`);
|
|
254
|
+
string(block.id, `${p}.id`, true);
|
|
255
|
+
string(block.type, `${p}.type`, true);
|
|
256
|
+
if (usedIds.has(block.id)) fail(`${p}.id`, `Duplicate block ID "${block.id}"`);
|
|
257
|
+
usedIds.add(block.id);
|
|
258
|
+
if (!Object.hasOwn(block, "content")) fail(`${p}.content`, "Required field");
|
|
259
|
+
const attrs = block.attrs === void 0 ? {} : object(block.attrs, `${p}.attrs`);
|
|
260
|
+
const settings = attrs["settings"] === void 0 ? {} : object(attrs["settings"], `${p}.attrs.settings`);
|
|
261
|
+
props(attrs["props"], `${p}.attrs.props`);
|
|
262
|
+
const c = block.content;
|
|
263
|
+
const cp = `${p}.content`;
|
|
264
|
+
const sp = `${p}.attrs.settings`;
|
|
265
|
+
switch (block.type) {
|
|
266
|
+
case "paragraph":
|
|
267
|
+
case "heading":
|
|
268
|
+
case "code":
|
|
269
|
+
case "callout":
|
|
270
|
+
runs(c, cp);
|
|
271
|
+
if (block.type === "heading") enumValue(settings["level"], [
|
|
272
|
+
1,
|
|
273
|
+
2,
|
|
274
|
+
3,
|
|
275
|
+
4,
|
|
276
|
+
5,
|
|
277
|
+
6
|
|
278
|
+
], `${sp}.level`);
|
|
279
|
+
if (block.type === "code" && settings["language"] !== void 0) string(settings["language"], `${sp}.language`);
|
|
280
|
+
if (block.type === "callout") enumValue(settings["variant"], [
|
|
281
|
+
"note",
|
|
282
|
+
"tip",
|
|
283
|
+
"warning",
|
|
284
|
+
"danger"
|
|
285
|
+
], `${sp}.variant`);
|
|
286
|
+
break;
|
|
287
|
+
case "divider":
|
|
288
|
+
if (c !== null) fail(cp, "Divider content must be null");
|
|
289
|
+
break;
|
|
290
|
+
case "bulletList":
|
|
291
|
+
case "orderedList":
|
|
292
|
+
list(c, cp);
|
|
293
|
+
enumValue(settings["listStyle"], ["bullet", "ordered"], `${sp}.listStyle`);
|
|
294
|
+
break;
|
|
295
|
+
case "quote":
|
|
296
|
+
object(c, cp);
|
|
297
|
+
for (const name of ["cite", "caption"]) {
|
|
298
|
+
object(c[name], `${cp}.${name}`);
|
|
299
|
+
runs(c[name].content, `${cp}.${name}.content`);
|
|
300
|
+
props(c[name].props, `${cp}.${name}.props`);
|
|
301
|
+
}
|
|
302
|
+
break;
|
|
303
|
+
case "table":
|
|
304
|
+
if (c !== null) fail(cp, "Native table content must be null; use attrs.rows");
|
|
305
|
+
if (array(attrs["rows"], `${p}.attrs.rows`).length > 500) fail(`${p}.attrs.rows`, "Tables support at most 500 rows");
|
|
306
|
+
attrs["rows"].forEach((row, r) => {
|
|
307
|
+
if (array(row, `${p}.attrs.rows[${r}]`).length > 50) fail(`${p}.attrs.rows[${r}]`, "Tables support at most 50 columns");
|
|
308
|
+
row.forEach((cell, col) => runs(cell, `${p}.attrs.rows[${r}][${col}]`));
|
|
309
|
+
});
|
|
310
|
+
enumValue(attrs["header"], [true, false], `${p}.attrs.header`);
|
|
311
|
+
enumValue(settings["fullWidth"], [true, false], `${sp}.fullWidth`);
|
|
312
|
+
if (attrs["cellMetadata"] !== void 0) array(attrs["cellMetadata"], `${p}.attrs.cellMetadata`).forEach((row, r) => array(row, `${p}.attrs.cellMetadata[${r}]`).forEach((cell, col) => {
|
|
313
|
+
const mp = `${p}.attrs.cellMetadata[${r}][${col}]`;
|
|
314
|
+
object(cell, mp);
|
|
315
|
+
props(cell.props, `${mp}.props`);
|
|
316
|
+
if (cell.options !== void 0) {
|
|
317
|
+
const opts = object(cell.options, `${mp}.options`);
|
|
318
|
+
for (const key of ["colspan", "rowspan"]) if (opts[key] !== void 0 && !(Number.isInteger(opts[key]) && opts[key] > 0)) fail(`${mp}.options.${key}`, "Expected a positive integer");
|
|
319
|
+
dimension(opts["width"], `${mp}.options.width`);
|
|
320
|
+
}
|
|
321
|
+
}));
|
|
322
|
+
break;
|
|
323
|
+
case "image":
|
|
324
|
+
case "video":
|
|
325
|
+
case "embed":
|
|
326
|
+
case "attachment":
|
|
327
|
+
object(c, cp);
|
|
328
|
+
for (const key of block.type === "image" ? ["src", "alt"] : block.type === "video" ? ["src", "caption"] : block.type === "embed" ? ["url", "type"] : [
|
|
329
|
+
"url",
|
|
330
|
+
"name",
|
|
331
|
+
"mimeType"
|
|
332
|
+
]) string(c[key], `${cp}.${key}`);
|
|
333
|
+
{
|
|
334
|
+
const key = ["image", "video"].includes(block.type) ? "src" : "url";
|
|
335
|
+
const kind = block.type === "video" ? "media" : block.type === "image" ? "image" : block.type === "embed" ? "embed" : "attachment";
|
|
336
|
+
if (c[key] && !safeContentEditorHtmlUrl(c[key], kind)) fail(`${cp}.${key}`, "Unsupported resource URL");
|
|
337
|
+
}
|
|
338
|
+
if (block.type === "attachment" && !(Number.isInteger(c.size) && c.size >= 0)) fail(`${cp}.size`, "Expected a non-negative integer byte count");
|
|
339
|
+
if (block.type === "video") enumValue(c.orientation, ["portrait", "landscape"], `${cp}.orientation`);
|
|
340
|
+
for (const key of [
|
|
341
|
+
"width",
|
|
342
|
+
"height",
|
|
343
|
+
"actualWidth",
|
|
344
|
+
"actualHeight"
|
|
345
|
+
]) dimension(settings[key], `${sp}.${key}`);
|
|
346
|
+
break;
|
|
347
|
+
case "gallery": {
|
|
348
|
+
object(c, cp);
|
|
349
|
+
const ids = /* @__PURE__ */ new Set();
|
|
350
|
+
array(c.images, `${cp}.images`).forEach((image, j) => {
|
|
351
|
+
const ip = `${cp}.images[${j}]`;
|
|
352
|
+
object(image, ip);
|
|
353
|
+
string(image.id, `${ip}.id`, true);
|
|
354
|
+
if (ids.has(image.id)) fail(`${ip}.id`, "Duplicate image ID");
|
|
355
|
+
ids.add(image.id);
|
|
356
|
+
string(image.src, `${ip}.src`);
|
|
357
|
+
string(image.alt, `${ip}.alt`);
|
|
358
|
+
runs(image.caption, `${ip}.caption`);
|
|
359
|
+
if (image.src && !safeContentEditorHtmlUrl(image.src, "image")) fail(`${ip}.src`, "Unsupported image URL");
|
|
360
|
+
});
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
case "toggle":
|
|
364
|
+
object(c, cp);
|
|
365
|
+
runs(c.title, `${cp}.title`);
|
|
366
|
+
blocks(c.blocks, `${cp}.blocks`);
|
|
367
|
+
enumValue(settings["expanded"], [true, false], `${sp}.expanded`);
|
|
368
|
+
break;
|
|
369
|
+
case "grid": {
|
|
370
|
+
object(c, cp);
|
|
371
|
+
const ids = /* @__PURE__ */ new Set();
|
|
372
|
+
array(c.cells, `${cp}.cells`).forEach((cell, j) => {
|
|
373
|
+
const gp = `${cp}.cells[${j}]`;
|
|
374
|
+
object(cell, gp);
|
|
375
|
+
string(cell.id, `${gp}.id`, true);
|
|
376
|
+
if (ids.has(cell.id)) fail(`${gp}.id`, "Duplicate grid cell ID");
|
|
377
|
+
ids.add(cell.id);
|
|
378
|
+
blocks(cell.blocks, `${gp}.blocks`);
|
|
379
|
+
});
|
|
380
|
+
enumValue(settings["columns"], [
|
|
381
|
+
2,
|
|
382
|
+
3,
|
|
383
|
+
4
|
|
384
|
+
], `${sp}.columns`);
|
|
385
|
+
enumValue(settings["gap"], [
|
|
386
|
+
"small",
|
|
387
|
+
"medium",
|
|
388
|
+
"large"
|
|
389
|
+
], `${sp}.gap`);
|
|
390
|
+
enumValue(settings["stackOnMobile"], [true, false], `${sp}.stackOnMobile`);
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
default: if (!options.allowUnknownBlocks && !Object.hasOwn(config.blocks ?? {}, block.type)) fail(`${p}.type`, `Unknown block type "${block.type}"`);
|
|
394
|
+
}
|
|
395
|
+
const validation = config.blocks?.[block.type]?.validateImport?.(block);
|
|
396
|
+
if (validation !== void 0) fail(p, validation);
|
|
397
|
+
});
|
|
398
|
+
};
|
|
399
|
+
const document = object(copy(value, "$", 0), "$");
|
|
400
|
+
if (document["version"] !== 1) fail("$.version", "Only document version 1 is supported");
|
|
401
|
+
blocks(document["blocks"], "$.blocks");
|
|
402
|
+
return {
|
|
403
|
+
version: 1,
|
|
404
|
+
blocks: document["blocks"]
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
const ignoredTags = /* @__PURE__ */ new Set([
|
|
408
|
+
"script",
|
|
409
|
+
"style",
|
|
410
|
+
"noscript",
|
|
411
|
+
"template",
|
|
412
|
+
"object",
|
|
413
|
+
"embed",
|
|
414
|
+
"head",
|
|
415
|
+
"meta",
|
|
416
|
+
"link"
|
|
417
|
+
]);
|
|
418
|
+
const blockTags = /* @__PURE__ */ new Set([
|
|
419
|
+
"p",
|
|
420
|
+
"div",
|
|
421
|
+
"section",
|
|
422
|
+
"article",
|
|
423
|
+
"header",
|
|
424
|
+
"footer",
|
|
425
|
+
"main",
|
|
426
|
+
"aside",
|
|
427
|
+
"h1",
|
|
428
|
+
"h2",
|
|
429
|
+
"h3",
|
|
430
|
+
"h4",
|
|
431
|
+
"h5",
|
|
432
|
+
"h6",
|
|
433
|
+
"pre",
|
|
434
|
+
"blockquote",
|
|
435
|
+
"figure",
|
|
436
|
+
"ul",
|
|
437
|
+
"ol",
|
|
438
|
+
"table",
|
|
439
|
+
"details",
|
|
440
|
+
"hr"
|
|
441
|
+
]);
|
|
442
|
+
function contentEditorFromHtml(html, config = {}, options = {}) {
|
|
443
|
+
if (typeof html !== "string") throw new ContentEditorImportError("$html", "Expected an HTML string");
|
|
444
|
+
const owner = options.document ?? globalThis.document;
|
|
445
|
+
if (!owner?.implementation?.createHTMLDocument) throw new ContentEditorImportError("$html", "HTML import requires a DOM document; supply options.document when running on the server");
|
|
446
|
+
const inert = owner.implementation.createHTMLDocument("");
|
|
447
|
+
inert.body.innerHTML = html;
|
|
448
|
+
const maxDepth = options.maxDepth ?? 64;
|
|
449
|
+
const maxBlocks = options.maxBlocks ?? 1e4;
|
|
450
|
+
if (!Number.isInteger(maxDepth) || maxDepth < 1 || !Number.isInteger(maxBlocks) || maxBlocks < 1) throw new ContentEditorImportError("$options", "maxDepth and maxBlocks must be positive integers");
|
|
451
|
+
const definitions = [...new Map([
|
|
452
|
+
...basicTextEditorPlugin().marks,
|
|
453
|
+
...colorEditorPlugin().marks,
|
|
454
|
+
...linkEditorPlugin().marks,
|
|
455
|
+
...config.importMarks ?? []
|
|
456
|
+
].map((mark) => [mark.type, mark])).values()];
|
|
457
|
+
const overrides = Object.values(config.blocks ?? {}).flatMap((block) => block.fromHtml ? [block.fromHtml] : []);
|
|
458
|
+
let depth = 0;
|
|
459
|
+
let count = 0;
|
|
460
|
+
const guarded = (read) => {
|
|
461
|
+
if (++depth > maxDepth) throw new ContentEditorImportError("$html", `Maximum nesting depth (${maxDepth}) exceeded`);
|
|
462
|
+
try {
|
|
463
|
+
return read();
|
|
464
|
+
} finally {
|
|
465
|
+
depth--;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
const tag = (element) => element.tagName.toLowerCase();
|
|
469
|
+
const children = (element) => Array.from(element.children);
|
|
470
|
+
const direct = (element, selector) => children(element).find((child) => child.matches(selector));
|
|
471
|
+
const alignment = (element) => {
|
|
472
|
+
const value = element.style?.textAlign || element.getAttribute("align");
|
|
473
|
+
return value && [
|
|
474
|
+
"left",
|
|
475
|
+
"center",
|
|
476
|
+
"right",
|
|
477
|
+
"justify"
|
|
478
|
+
].includes(value) ? [{
|
|
479
|
+
name: "text-alignment",
|
|
480
|
+
value
|
|
481
|
+
}] : [];
|
|
482
|
+
};
|
|
483
|
+
const dimension = (element, name) => {
|
|
484
|
+
const raw = element.getAttribute(name);
|
|
485
|
+
if (!raw || !/^\d+(?:\.\d+)?$/.test(raw)) return null;
|
|
486
|
+
const value = Number(raw);
|
|
487
|
+
return value > 0 && Number.isFinite(value) ? value : null;
|
|
488
|
+
};
|
|
489
|
+
const createBlock = (type, content, attrs) => {
|
|
490
|
+
if (++count > maxBlocks) throw new ContentEditorImportError("$html", `Maximum block count (${maxBlocks}) exceeded`);
|
|
491
|
+
return {
|
|
492
|
+
id: createNgsHeadlessEditorId(type),
|
|
493
|
+
type,
|
|
494
|
+
content,
|
|
495
|
+
...attrs ? { attrs } : {}
|
|
496
|
+
};
|
|
497
|
+
};
|
|
498
|
+
const parseText = (element) => {
|
|
499
|
+
const runs = [];
|
|
500
|
+
const newline = () => {
|
|
501
|
+
if (runs.length && !runs.at(-1).text.endsWith("\n")) runs.push(createNgsHeadlessEditorText("\n"));
|
|
502
|
+
};
|
|
503
|
+
const visit = (node, marks) => guarded(() => {
|
|
504
|
+
if (node.nodeType === 3) {
|
|
505
|
+
const text = (node.textContent ?? "").replace(/[\t\r\n ]+/g, " ");
|
|
506
|
+
if (text) runs.push(createNgsHeadlessEditorText(text, marks));
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
if (node.nodeType !== 1) return;
|
|
510
|
+
const el = node;
|
|
511
|
+
const name = tag(el);
|
|
512
|
+
if (ignoredTags.has(name) || [
|
|
513
|
+
"iframe",
|
|
514
|
+
"img",
|
|
515
|
+
"video",
|
|
516
|
+
"audio",
|
|
517
|
+
"ul",
|
|
518
|
+
"ol"
|
|
519
|
+
].includes(name)) return;
|
|
520
|
+
if (name === "br") {
|
|
521
|
+
runs.push(createNgsHeadlessEditorText("\n", marks));
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
const next = [...marks];
|
|
525
|
+
for (const definition of definitions) {
|
|
526
|
+
const explicit = el.getAttribute("data-ngs-headless-editor-mark");
|
|
527
|
+
const styleMark = ["textColor", "backgroundColor"].includes(definition.type) && !!el.style;
|
|
528
|
+
if (explicit ? explicit !== definition.type : name !== definition.tagName && !definition.parseTags?.includes(name) && !styleMark) continue;
|
|
529
|
+
const attrs = definition.readAttributes?.(el);
|
|
530
|
+
if (!definition.readAttributes || attrs) next.push({
|
|
531
|
+
type: definition.type,
|
|
532
|
+
...attrs ? { attrs } : {}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
const css = el.style;
|
|
536
|
+
if (css?.fontWeight === "bold" || Number(css?.fontWeight) >= 600) next.push({ type: "bold" });
|
|
537
|
+
if (css?.fontStyle === "italic") next.push({ type: "italic" });
|
|
538
|
+
if (css?.textDecoration.includes("underline")) next.push({ type: "underline" });
|
|
539
|
+
if (css?.textDecoration.includes("line-through")) next.push({ type: "strike" });
|
|
540
|
+
if (blockTags.has(name)) newline();
|
|
541
|
+
Array.from(node.childNodes).forEach((child) => visit(child, next));
|
|
542
|
+
if (blockTags.has(name)) newline();
|
|
543
|
+
});
|
|
544
|
+
visit(element, []);
|
|
545
|
+
while (runs.length && !runs[0].text.trim()) runs.shift();
|
|
546
|
+
while (runs.length && !runs.at(-1).text.trim()) runs.pop();
|
|
547
|
+
if (runs.length) {
|
|
548
|
+
runs[0] = {
|
|
549
|
+
...runs[0],
|
|
550
|
+
text: runs[0].text.replace(/^\s+/, "")
|
|
551
|
+
};
|
|
552
|
+
const last = runs.length - 1;
|
|
553
|
+
runs[last] = {
|
|
554
|
+
...runs[last],
|
|
555
|
+
text: runs[last].text.replace(/\s+$/, "")
|
|
556
|
+
};
|
|
557
|
+
}
|
|
558
|
+
return [...normalizeNgsHeadlessEditorTextContent(runs)];
|
|
559
|
+
};
|
|
560
|
+
const listItems = (element) => guarded(() => children(element).filter((el) => tag(el) === "li").map((li) => {
|
|
561
|
+
const text = li.cloneNode(true);
|
|
562
|
+
children(text).filter((el) => ["ul", "ol"].includes(tag(el))).forEach((el) => el.remove());
|
|
563
|
+
return {
|
|
564
|
+
content: parseText(text),
|
|
565
|
+
props: alignment(li),
|
|
566
|
+
children: children(li).filter((el) => ["ul", "ol"].includes(tag(el))).flatMap(listItems)
|
|
567
|
+
};
|
|
568
|
+
}));
|
|
569
|
+
const media = (element, figure) => {
|
|
570
|
+
const name = tag(element);
|
|
571
|
+
const kind = name === "img" ? "image" : name === "video" ? "media" : "embed";
|
|
572
|
+
const src = safeContentEditorHtmlUrl(element.getAttribute("src") || element.querySelector("source")?.getAttribute("src"), kind);
|
|
573
|
+
if (!src) return [];
|
|
574
|
+
const caption = figure ? direct(figure, "figcaption") : void 0;
|
|
575
|
+
const settings = Object.fromEntries(["width", "height"].flatMap((key) => {
|
|
576
|
+
const n = dimension(element, key);
|
|
577
|
+
return n ? [[key, n]] : [];
|
|
578
|
+
}));
|
|
579
|
+
const content = name === "img" ? {
|
|
580
|
+
src,
|
|
581
|
+
alt: element.getAttribute("alt") ?? ""
|
|
582
|
+
} : name === "video" ? {
|
|
583
|
+
src,
|
|
584
|
+
caption: caption?.textContent ?? "",
|
|
585
|
+
orientation: "landscape"
|
|
586
|
+
} : {
|
|
587
|
+
url: src,
|
|
588
|
+
type: element.getAttribute("title") ?? ""
|
|
589
|
+
};
|
|
590
|
+
return [createBlock(name === "img" ? "image" : name === "video" ? "video" : "embed", content, { settings })];
|
|
591
|
+
};
|
|
592
|
+
const builtin = (element) => {
|
|
593
|
+
const name = tag(element);
|
|
594
|
+
const attrs = { props: alignment(element) };
|
|
595
|
+
if (ignoredTags.has(name)) return [];
|
|
596
|
+
if (element.matches("[data-content-editor=\"gallery\"], .ngs-content-editor-html-gallery")) {
|
|
597
|
+
const images = children(element).flatMap((figure) => {
|
|
598
|
+
const image = tag(figure) === "img" ? figure : direct(figure, "img");
|
|
599
|
+
const src = safeContentEditorHtmlUrl(image?.getAttribute("src"), "image");
|
|
600
|
+
if (!image || !src) return [];
|
|
601
|
+
const caption = direct(figure, "figcaption");
|
|
602
|
+
return [{
|
|
603
|
+
id: createNgsHeadlessEditorId("image"),
|
|
604
|
+
src,
|
|
605
|
+
alt: image.getAttribute("alt") ?? "",
|
|
606
|
+
caption: caption ? parseText(caption) : []
|
|
607
|
+
}];
|
|
608
|
+
});
|
|
609
|
+
return [createBlock("gallery", { images })];
|
|
610
|
+
}
|
|
611
|
+
if (element.matches(".ngs-content-editor-html-grid")) {
|
|
612
|
+
const container = direct(element, ".ngs-content-editor-html-grid-cells") ?? element;
|
|
613
|
+
const css = element.style;
|
|
614
|
+
const columnValue = Number(element.getAttribute("data-columns") || css?.getPropertyValue("--ngs-html-grid-columns"));
|
|
615
|
+
const gapValue = css?.getPropertyValue("--ngs-html-grid-gap").trim();
|
|
616
|
+
const settings = {
|
|
617
|
+
columns: [
|
|
618
|
+
2,
|
|
619
|
+
3,
|
|
620
|
+
4
|
|
621
|
+
].includes(columnValue) ? columnValue : 2,
|
|
622
|
+
gap: gapValue === "12px" ? "small" : gapValue === "36px" ? "large" : "medium",
|
|
623
|
+
stackOnMobile: container.classList.contains("ngs-content-editor-html-grid-stack")
|
|
624
|
+
};
|
|
625
|
+
const cells = children(container).filter((cell) => cell.matches(".ngs-content-editor-html-grid-cell")).map((cell) => ({
|
|
626
|
+
id: createNgsHeadlessEditorId("cell"),
|
|
627
|
+
blocks: parseBlocks(cell)
|
|
628
|
+
}));
|
|
629
|
+
return [createBlock("grid", { cells }, { settings })];
|
|
630
|
+
}
|
|
631
|
+
if (name === "p" || /^h[1-6]$/.test(name)) {
|
|
632
|
+
if (element.querySelector("img, video, iframe, a[download]")) return parseBlocks(element);
|
|
633
|
+
return [createBlock(name === "p" ? "paragraph" : "heading", parseText(element), {
|
|
634
|
+
...attrs,
|
|
635
|
+
...name !== "p" ? { settings: { level: Number(name[1]) } } : {}
|
|
636
|
+
})];
|
|
637
|
+
}
|
|
638
|
+
if (name === "hr") return [createBlock("divider", null)];
|
|
639
|
+
if (name === "pre") {
|
|
640
|
+
const code = direct(element, "code") ?? element;
|
|
641
|
+
const language = code.getAttribute("data-language") ?? Array.from(code.classList).find((cls) => cls.startsWith("language-"))?.slice(9) ?? "none";
|
|
642
|
+
return [createBlock("code", [createNgsHeadlessEditorText(code.textContent ?? "")], { settings: { language } })];
|
|
643
|
+
}
|
|
644
|
+
if (name === "ul" || name === "ol") return [createBlock(name === "ol" ? "orderedList" : "bulletList", listItems(element), { settings: { listStyle: name === "ol" ? "ordered" : "bullet" } })];
|
|
645
|
+
if (name === "details") {
|
|
646
|
+
const summary = direct(element, "summary");
|
|
647
|
+
const body = element.cloneNode(true);
|
|
648
|
+
direct(body, "summary")?.remove();
|
|
649
|
+
return [createBlock("toggle", {
|
|
650
|
+
title: summary ? parseText(summary) : [],
|
|
651
|
+
blocks: parseBlocks(body)
|
|
652
|
+
}, { settings: { expanded: element.hasAttribute("open") } })];
|
|
653
|
+
}
|
|
654
|
+
if (name === "aside" && (element.hasAttribute("data-callout") || element.classList.contains("ngs-content-editor-html-callout"))) {
|
|
655
|
+
const value = element.getAttribute("data-callout");
|
|
656
|
+
return [createBlock("callout", parseText(element), {
|
|
657
|
+
...attrs,
|
|
658
|
+
settings: { variant: [
|
|
659
|
+
"note",
|
|
660
|
+
"tip",
|
|
661
|
+
"warning",
|
|
662
|
+
"danger"
|
|
663
|
+
].includes(value ?? "") ? value : "note" }
|
|
664
|
+
})];
|
|
665
|
+
}
|
|
666
|
+
if (name === "blockquote" || name === "figure" && direct(element, "blockquote")) {
|
|
667
|
+
const quote = name === "blockquote" ? element : direct(element, "blockquote");
|
|
668
|
+
const caption = name === "figure" ? direct(element, "figcaption") : void 0;
|
|
669
|
+
return [createBlock("quote", {
|
|
670
|
+
cite: {
|
|
671
|
+
content: parseText(quote),
|
|
672
|
+
props: alignment(quote)
|
|
673
|
+
},
|
|
674
|
+
caption: {
|
|
675
|
+
content: caption ? parseText(caption) : [],
|
|
676
|
+
props: caption ? alignment(caption) : []
|
|
677
|
+
}
|
|
678
|
+
})];
|
|
679
|
+
}
|
|
680
|
+
if (name === "table") {
|
|
681
|
+
const cells = Array.from(element.querySelectorAll("tr")).filter((row) => row.closest("table") === element).map((row) => children(row).filter((cell) => ["td", "th"].includes(tag(cell))));
|
|
682
|
+
const manualWidth = element.getAttribute("data-content-editor-table-width") === "manual";
|
|
683
|
+
return [createBlock("table", null, {
|
|
684
|
+
rows: cells.map((row) => row.map(parseText)),
|
|
685
|
+
header: !!cells[0]?.some((cell) => tag(cell) === "th"),
|
|
686
|
+
...manualWidth ? { settings: { fullWidth: false } } : {},
|
|
687
|
+
cellMetadata: cells.map((row) => row.map((cell) => {
|
|
688
|
+
const width = dimension(cell, "width") ?? dimension(cell, "data-content-editor-cell-width");
|
|
689
|
+
return {
|
|
690
|
+
props: alignment(cell),
|
|
691
|
+
options: {
|
|
692
|
+
colspan: Math.max(1, Math.floor(dimension(cell, "colspan") ?? 1)),
|
|
693
|
+
rowspan: Math.max(1, Math.floor(dimension(cell, "rowspan") ?? 1)),
|
|
694
|
+
...width !== null ? { width } : {}
|
|
695
|
+
}
|
|
696
|
+
};
|
|
697
|
+
}))
|
|
698
|
+
})];
|
|
699
|
+
}
|
|
700
|
+
if (name === "figure") {
|
|
701
|
+
const child = direct(element, "img, video, iframe");
|
|
702
|
+
if (child) return media(child, element);
|
|
703
|
+
}
|
|
704
|
+
if ([
|
|
705
|
+
"img",
|
|
706
|
+
"video",
|
|
707
|
+
"iframe"
|
|
708
|
+
].includes(name)) return media(element);
|
|
709
|
+
if (name === "a" && element.hasAttribute("download")) {
|
|
710
|
+
const url = safeContentEditorHtmlUrl(element.getAttribute("href"), "attachment");
|
|
711
|
+
return url ? [createBlock("attachment", {
|
|
712
|
+
url,
|
|
713
|
+
name: element.getAttribute("download") || element.textContent?.trim() || "Download",
|
|
714
|
+
size: 0,
|
|
715
|
+
mimeType: ""
|
|
716
|
+
})] : [];
|
|
717
|
+
}
|
|
718
|
+
return parseBlocks(element);
|
|
719
|
+
};
|
|
720
|
+
const context = {
|
|
721
|
+
createBlock,
|
|
722
|
+
createId: createNgsHeadlessEditorId,
|
|
723
|
+
parseText,
|
|
724
|
+
parseBlocks: (element) => parseBlocks(element),
|
|
725
|
+
defaultFromHtml: builtin,
|
|
726
|
+
safeUrl: safeContentEditorHtmlUrl
|
|
727
|
+
};
|
|
728
|
+
const parseElement = (element) => guarded(() => {
|
|
729
|
+
if (ignoredTags.has(tag(element))) return [];
|
|
730
|
+
for (const override of overrides) if (element.matches(override.selector)) {
|
|
731
|
+
const result = override.parse(element, context);
|
|
732
|
+
return result === null ? [] : Array.isArray(result) ? [...result] : [result];
|
|
733
|
+
}
|
|
734
|
+
return builtin(element);
|
|
735
|
+
});
|
|
736
|
+
const parseBlocks = (element) => guarded(() => {
|
|
737
|
+
const output = [];
|
|
738
|
+
let inline = inert.createElement("div");
|
|
739
|
+
const flush = () => {
|
|
740
|
+
const runs = parseText(inline);
|
|
741
|
+
if (runs.some((run) => run.text.trim())) output.push(createBlock("paragraph", runs, { props: alignment(element) }));
|
|
742
|
+
inline = inert.createElement("div");
|
|
743
|
+
};
|
|
744
|
+
for (const node of Array.from(element.childNodes)) {
|
|
745
|
+
if (node.nodeType === 1) {
|
|
746
|
+
const child = node;
|
|
747
|
+
if (ignoredTags.has(tag(child))) continue;
|
|
748
|
+
if (blockTags.has(tag(child)) || [
|
|
749
|
+
"img",
|
|
750
|
+
"video",
|
|
751
|
+
"iframe"
|
|
752
|
+
].includes(tag(child)) || child.matches("a[download]") || overrides.some((override) => child.matches(override.selector))) {
|
|
753
|
+
flush();
|
|
754
|
+
output.push(...parseElement(child));
|
|
755
|
+
continue;
|
|
756
|
+
}
|
|
757
|
+
if (child.querySelector([
|
|
758
|
+
...blockTags,
|
|
759
|
+
"img",
|
|
760
|
+
"video",
|
|
761
|
+
"iframe",
|
|
762
|
+
"a[download]"
|
|
763
|
+
].join(",")) || overrides.some((override) => child.querySelector(override.selector))) {
|
|
764
|
+
flush();
|
|
765
|
+
output.push(...parseElement(child));
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
inline.appendChild(node.cloneNode(true));
|
|
770
|
+
}
|
|
771
|
+
flush();
|
|
772
|
+
return output;
|
|
773
|
+
});
|
|
774
|
+
return contentEditorFromJson({
|
|
775
|
+
version: 1,
|
|
776
|
+
blocks: parseBlocks(inert.body)
|
|
777
|
+
}, config, options);
|
|
778
|
+
}
|
|
779
|
+
var ContentEditorImporter = class ContentEditorImporter {
|
|
780
|
+
config = inject(CONTENT_EDITOR_CONFIG);
|
|
781
|
+
document = inject(DOCUMENT$1);
|
|
782
|
+
fromJson(source, config = {}, options = {}) {
|
|
783
|
+
return contentEditorFromJson(source, mergeContentEditorConfig(this.config, config), options);
|
|
784
|
+
}
|
|
785
|
+
fromHtml(html, config = {}, options = {}) {
|
|
786
|
+
return contentEditorFromHtml(html, mergeContentEditorConfig(this.config, config), {
|
|
787
|
+
document: this.document,
|
|
788
|
+
...options
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
792
|
+
minVersion: "12.0.0",
|
|
793
|
+
version: "22.3.0",
|
|
794
|
+
ngImport: i0,
|
|
795
|
+
type: ContentEditorImporter,
|
|
796
|
+
deps: [],
|
|
797
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
798
|
+
});
|
|
799
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
800
|
+
minVersion: "12.0.0",
|
|
801
|
+
version: "22.3.0",
|
|
802
|
+
ngImport: i0,
|
|
803
|
+
type: ContentEditorImporter,
|
|
804
|
+
providedIn: "root"
|
|
805
|
+
});
|
|
806
|
+
};
|
|
807
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
808
|
+
minVersion: "12.0.0",
|
|
809
|
+
version: "22.3.0",
|
|
810
|
+
ngImport: i0,
|
|
811
|
+
type: ContentEditorImporter,
|
|
812
|
+
decorators: [{
|
|
813
|
+
type: Injectable,
|
|
814
|
+
args: [{ providedIn: "root" }]
|
|
815
|
+
}]
|
|
816
|
+
});
|
|
817
|
+
function contentEditorImportedText(blocks) {
|
|
818
|
+
const parts = [];
|
|
819
|
+
const read = (block) => {
|
|
820
|
+
const content = block.content;
|
|
821
|
+
if (isNgsHeadlessEditorTextContent(content)) parts.push(content);
|
|
822
|
+
else if (block.type === "quote") parts.push(content.cite.content, content.caption.content);
|
|
823
|
+
else if (block.type === "bulletList" || block.type === "orderedList") {
|
|
824
|
+
const item = (value) => {
|
|
825
|
+
parts.push(value.content);
|
|
826
|
+
value.children?.forEach(item);
|
|
827
|
+
};
|
|
828
|
+
content.forEach(item);
|
|
829
|
+
} else if (block.type === "table") for (const row of block.attrs?.["rows"] ?? []) parts.push(row.flatMap((cell, i) => i ? [createNgsHeadlessEditorText(" "), ...cell] : cell));
|
|
830
|
+
else if (block.type === "toggle") {
|
|
831
|
+
parts.push(content.title);
|
|
832
|
+
content.blocks.forEach(read);
|
|
833
|
+
} else if (block.type === "grid") content.cells.forEach((cell) => cell.blocks.forEach(read));
|
|
834
|
+
else if (block.type === "image" || block.type === "gallery") parts.push([createNgsHeadlessEditorText(content.alt ?? "")]);
|
|
835
|
+
};
|
|
836
|
+
blocks.forEach(read);
|
|
837
|
+
return normalizeNgsHeadlessEditorTextContent(parts.filter((part) => part.some((run) => run.text)).flatMap((part, i) => i ? [createNgsHeadlessEditorText("\n"), ...part] : part));
|
|
838
|
+
}
|
|
839
|
+
const regions = /* @__PURE__ */ new WeakMap();
|
|
840
|
+
var ContentEditorContentEditableDirective = class ContentEditorContentEditableDirective {
|
|
841
|
+
region = inject(NgsHeadlessEditorInlineRegion);
|
|
842
|
+
surface = inject(NgsHeadlessEditorSurface);
|
|
843
|
+
importer = inject(ContentEditorImporter);
|
|
844
|
+
builder = inject(CONTENT_BUILDER, { optional: true });
|
|
845
|
+
store = inject(ContentBuilderStore, { optional: true });
|
|
846
|
+
historyGroup = createNgsHeadlessEditorId("content-region");
|
|
847
|
+
element = inject(ElementRef).nativeElement;
|
|
848
|
+
content = input([], {
|
|
849
|
+
...ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {},
|
|
850
|
+
alias: "ngsContentEditorContentEditable"
|
|
851
|
+
});
|
|
852
|
+
settings = input({}, ...ngDevMode ? [{ debugName: "settings" }] : /* istanbul ignore next */ []);
|
|
853
|
+
props = input([], ...ngDevMode ? [{ debugName: "props" }] : /* istanbul ignore next */ []);
|
|
854
|
+
singleLine = input(false, ...ngDevMode ? [{ debugName: "singleLine" }] : /* istanbul ignore next */ []);
|
|
855
|
+
contentChanged = output();
|
|
856
|
+
propsChanged = output();
|
|
857
|
+
pressedEnter = output();
|
|
858
|
+
initialized = output();
|
|
859
|
+
static forElement(element) {
|
|
860
|
+
return element ? regions.get(element) : void 0;
|
|
861
|
+
}
|
|
862
|
+
constructor() {
|
|
863
|
+
regions.set(this.element, this);
|
|
864
|
+
effect(() => {
|
|
865
|
+
const content = this.content();
|
|
866
|
+
untracked(() => this.region.load(content));
|
|
867
|
+
});
|
|
868
|
+
effect(() => {
|
|
869
|
+
const content = this.region.content();
|
|
870
|
+
const origin = this.region.editor.origin();
|
|
871
|
+
if (origin !== "external" && origin !== "history") untracked(() => {
|
|
872
|
+
if (this.store) this.store.withTextEdit(origin, this.historyGroup, () => this.contentChanged.emit(content));
|
|
873
|
+
else this.contentChanged.emit(content);
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
this.element.addEventListener("paste", this.onPaste, true);
|
|
877
|
+
this.element.addEventListener("keydown", this.onKeydown, true);
|
|
878
|
+
this.element.addEventListener("beforeinput", this.onBeforeInput, true);
|
|
879
|
+
afterNextRender(() => this.initialized.emit());
|
|
880
|
+
afterRenderEffect(() => {
|
|
881
|
+
const pending = this.store?.restoreTextSelection();
|
|
882
|
+
const wrapper = this.element.closest("[data-block-id]");
|
|
883
|
+
if (pending && wrapper?.getAttribute("data-block-id") === pending.blockId && wrapper.querySelector(".ngs-content-editor-content-editable") === this.element) {
|
|
884
|
+
this.activate();
|
|
885
|
+
this.region.editor.setSelection(pending.selection);
|
|
886
|
+
this.surface.focus();
|
|
887
|
+
this.store.restoreTextSelection.set(null);
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
}
|
|
891
|
+
activate() {
|
|
892
|
+
this.region.activate();
|
|
893
|
+
const id = this.element.closest("[data-block-id]")?.getAttribute("data-block-id");
|
|
894
|
+
if (id && this.store) {
|
|
895
|
+
const scope = this.builder && "scope" in this.builder ? this.builder.scope() : {};
|
|
896
|
+
this.store.insertionTarget.set({
|
|
897
|
+
scope,
|
|
898
|
+
afterId: id
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
focus() {
|
|
903
|
+
this.activate();
|
|
904
|
+
this.surface.focus();
|
|
905
|
+
}
|
|
906
|
+
getContent() {
|
|
907
|
+
return this.region.content();
|
|
908
|
+
}
|
|
909
|
+
alignment() {
|
|
910
|
+
return this.props().find((prop) => prop.name === "text-alignment")?.value ?? "left";
|
|
911
|
+
}
|
|
912
|
+
setAlignment(value) {
|
|
913
|
+
this.propsChanged.emit([...this.props().filter((prop) => prop.name !== "text-alignment"), {
|
|
914
|
+
name: "text-alignment",
|
|
915
|
+
value
|
|
916
|
+
}]);
|
|
917
|
+
}
|
|
918
|
+
onPaste = (event) => {
|
|
919
|
+
if (event.defaultPrevented || this.region.editor.readOnly()) return;
|
|
920
|
+
const html = event.clipboardData?.getData("text/html");
|
|
921
|
+
if (!html) return;
|
|
922
|
+
try {
|
|
923
|
+
const config = this.builder?.rootBuilder.config() ?? {};
|
|
924
|
+
const parsed = this.importer.fromHtml(html, config);
|
|
925
|
+
this.activate();
|
|
926
|
+
this.surface.syncSelectionFromDom();
|
|
927
|
+
const id = this.element.closest("[data-block-id]")?.getAttribute("data-block-id");
|
|
928
|
+
const structural = parsed.blocks.length > 1 || parsed.blocks.some((block) => block.type !== "paragraph");
|
|
929
|
+
const selection = this.region.editor.selection();
|
|
930
|
+
if (structural && id && this.builder && selection) {
|
|
931
|
+
const lines = this.region.editor.document().blocks;
|
|
932
|
+
const offset = (point) => lines.slice(0, lines.findIndex((line) => line.id === point.blockId)).reduce((sum, line) => sum + line.content.reduce((total, run) => total + run.text.length, 0) + 1, 0) + point.offset;
|
|
933
|
+
if (this.builder.rootBuilder.pasteBlocksAtSelection(id, parsed, offset(selection.anchor), offset(selection.focus))) {
|
|
934
|
+
event.preventDefault();
|
|
935
|
+
event.stopImmediatePropagation();
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
const content = contentEditorImportedText(parsed.blocks);
|
|
940
|
+
if (!content.some((run) => run.text)) return;
|
|
941
|
+
this.activate();
|
|
942
|
+
this.surface.syncSelectionFromDom();
|
|
943
|
+
event.preventDefault();
|
|
944
|
+
event.stopImmediatePropagation();
|
|
945
|
+
this.region.editor.insertTextContent(content);
|
|
946
|
+
} catch {}
|
|
947
|
+
};
|
|
948
|
+
onKeydown = (event) => {
|
|
949
|
+
if (event.key === "Enter" && this.singleLine() && !event.shiftKey && !event.isComposing) {
|
|
950
|
+
event.preventDefault();
|
|
951
|
+
event.stopImmediatePropagation();
|
|
952
|
+
this.pressedEnter.emit(event);
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
onBeforeInput = (event) => {
|
|
956
|
+
if (event.inputType === "insertParagraph" && this.singleLine() && !event.isComposing) {
|
|
957
|
+
event.preventDefault();
|
|
958
|
+
event.stopImmediatePropagation();
|
|
959
|
+
this.pressedEnter.emit(new KeyboardEvent("keydown", { key: "Enter" }));
|
|
960
|
+
}
|
|
961
|
+
};
|
|
962
|
+
ngOnDestroy() {
|
|
963
|
+
regions.delete(this.element);
|
|
964
|
+
this.element.removeEventListener("paste", this.onPaste, true);
|
|
965
|
+
this.element.removeEventListener("keydown", this.onKeydown, true);
|
|
966
|
+
this.element.removeEventListener("beforeinput", this.onBeforeInput, true);
|
|
967
|
+
}
|
|
968
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
969
|
+
minVersion: "12.0.0",
|
|
970
|
+
version: "22.3.0",
|
|
971
|
+
ngImport: i0,
|
|
972
|
+
type: ContentEditorContentEditableDirective,
|
|
973
|
+
deps: [],
|
|
974
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
975
|
+
});
|
|
976
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
977
|
+
minVersion: "17.1.0",
|
|
978
|
+
version: "22.3.0",
|
|
979
|
+
type: ContentEditorContentEditableDirective,
|
|
980
|
+
isStandalone: true,
|
|
981
|
+
selector: "[ngsContentEditorContentEditable]",
|
|
982
|
+
inputs: {
|
|
983
|
+
content: {
|
|
984
|
+
classPropertyName: "content",
|
|
985
|
+
publicName: "ngsContentEditorContentEditable",
|
|
986
|
+
isSignal: true,
|
|
987
|
+
isRequired: false,
|
|
988
|
+
transformFunction: null
|
|
989
|
+
},
|
|
990
|
+
settings: {
|
|
991
|
+
classPropertyName: "settings",
|
|
992
|
+
publicName: "settings",
|
|
993
|
+
isSignal: true,
|
|
994
|
+
isRequired: false,
|
|
995
|
+
transformFunction: null
|
|
996
|
+
},
|
|
997
|
+
props: {
|
|
998
|
+
classPropertyName: "props",
|
|
999
|
+
publicName: "props",
|
|
1000
|
+
isSignal: true,
|
|
1001
|
+
isRequired: false,
|
|
1002
|
+
transformFunction: null
|
|
1003
|
+
},
|
|
1004
|
+
singleLine: {
|
|
1005
|
+
classPropertyName: "singleLine",
|
|
1006
|
+
publicName: "singleLine",
|
|
1007
|
+
isSignal: true,
|
|
1008
|
+
isRequired: false,
|
|
1009
|
+
transformFunction: null
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
outputs: {
|
|
1013
|
+
contentChanged: "contentChanged",
|
|
1014
|
+
propsChanged: "propsChanged",
|
|
1015
|
+
pressedEnter: "pressedEnter",
|
|
1016
|
+
initialized: "initialized"
|
|
1017
|
+
},
|
|
1018
|
+
host: {
|
|
1019
|
+
listeners: { "focus": "activate()" },
|
|
1020
|
+
properties: {
|
|
1021
|
+
"class.align-left": "alignment() === \"left\"",
|
|
1022
|
+
"class.align-center": "alignment() === \"center\"",
|
|
1023
|
+
"class.align-right": "alignment() === \"right\"",
|
|
1024
|
+
"class.align-justify": "alignment() === \"justify\""
|
|
1025
|
+
},
|
|
1026
|
+
classAttribute: "ngs-content-editor-content-editable"
|
|
1027
|
+
},
|
|
1028
|
+
providers: [provideNgsHeadlessEditorInlineRegion()],
|
|
1029
|
+
exportAs: ["ngsContentEditorContentEditable"],
|
|
1030
|
+
hostDirectives: [{ directive: i1.NgsHeadlessEditorSurface }],
|
|
1031
|
+
ngImport: i0
|
|
1032
|
+
});
|
|
1033
|
+
};
|
|
1034
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1035
|
+
minVersion: "12.0.0",
|
|
1036
|
+
version: "22.3.0",
|
|
1037
|
+
ngImport: i0,
|
|
1038
|
+
type: ContentEditorContentEditableDirective,
|
|
1039
|
+
decorators: [{
|
|
1040
|
+
type: Directive,
|
|
1041
|
+
args: [{
|
|
1042
|
+
selector: "[ngsContentEditorContentEditable]",
|
|
1043
|
+
exportAs: "ngsContentEditorContentEditable",
|
|
1044
|
+
providers: [provideNgsHeadlessEditorInlineRegion()],
|
|
1045
|
+
hostDirectives: [NgsHeadlessEditorSurface],
|
|
1046
|
+
host: {
|
|
1047
|
+
"class": "ngs-content-editor-content-editable",
|
|
1048
|
+
"[class.align-left]": "alignment() === \"left\"",
|
|
1049
|
+
"[class.align-center]": "alignment() === \"center\"",
|
|
1050
|
+
"[class.align-right]": "alignment() === \"right\"",
|
|
1051
|
+
"[class.align-justify]": "alignment() === \"justify\"",
|
|
1052
|
+
"(focus)": "activate()"
|
|
1053
|
+
}
|
|
1054
|
+
}]
|
|
1055
|
+
}],
|
|
1056
|
+
ctorParameters: () => [],
|
|
1057
|
+
propDecorators: {
|
|
1058
|
+
content: [{
|
|
1059
|
+
type: i0.Input,
|
|
1060
|
+
args: [{
|
|
1061
|
+
isSignal: true,
|
|
1062
|
+
alias: "ngsContentEditorContentEditable",
|
|
1063
|
+
required: false
|
|
1064
|
+
}]
|
|
1065
|
+
}],
|
|
1066
|
+
settings: [{
|
|
1067
|
+
type: i0.Input,
|
|
1068
|
+
args: [{
|
|
1069
|
+
isSignal: true,
|
|
1070
|
+
alias: "settings",
|
|
1071
|
+
required: false
|
|
1072
|
+
}]
|
|
1073
|
+
}],
|
|
1074
|
+
props: [{
|
|
1075
|
+
type: i0.Input,
|
|
1076
|
+
args: [{
|
|
1077
|
+
isSignal: true,
|
|
1078
|
+
alias: "props",
|
|
1079
|
+
required: false
|
|
1080
|
+
}]
|
|
1081
|
+
}],
|
|
1082
|
+
singleLine: [{
|
|
1083
|
+
type: i0.Input,
|
|
1084
|
+
args: [{
|
|
1085
|
+
isSignal: true,
|
|
1086
|
+
alias: "singleLine",
|
|
1087
|
+
required: false
|
|
1088
|
+
}]
|
|
1089
|
+
}],
|
|
1090
|
+
contentChanged: [{
|
|
1091
|
+
type: i0.Output,
|
|
1092
|
+
args: ["contentChanged"]
|
|
1093
|
+
}],
|
|
1094
|
+
propsChanged: [{
|
|
1095
|
+
type: i0.Output,
|
|
1096
|
+
args: ["propsChanged"]
|
|
1097
|
+
}],
|
|
1098
|
+
pressedEnter: [{
|
|
1099
|
+
type: i0.Output,
|
|
1100
|
+
args: ["pressedEnter"]
|
|
1101
|
+
}],
|
|
1102
|
+
initialized: [{
|
|
1103
|
+
type: i0.Output,
|
|
1104
|
+
args: ["initialized"]
|
|
1105
|
+
}]
|
|
1106
|
+
}
|
|
1107
|
+
});
|
|
1108
|
+
export { ContentEditorImportError as a, mergeContentEditorConfig as c, contentEditorBlockToHtml as d, contentEditorToHtml as f, contentEditorFromJson as i, provideContentEditorConfig as l, ContentEditorImporter as n, CONTENT_EDITOR_CONFIG as o, contentEditorFromHtml as r, CONTENT_EDITOR_RENDER_CONFIG as s, ContentEditorContentEditableDirective as t, ContentEditorHtmlSerializer as u };
|
|
1109
|
+
|
|
1110
|
+
//# sourceMappingURL=content-editor-content-editable.directive-WzD9_71s.mjs.map
|