@prolibu-suite/cobalt-core 0.1.2 → 0.3.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/custom-elements.json +21351 -7087
- package/dist/cjs/co-accordion.cjs.entry.js +19 -4
- package/dist/cjs/co-app-shell.cjs.entry.js +4 -4
- package/dist/cjs/co-autocomplete.cjs.entry.js +54 -6
- package/dist/cjs/co-avatar-group.cjs.entry.js +77 -0
- package/dist/cjs/co-avatar.cjs.entry.js +42 -7
- package/dist/cjs/co-badge.cjs.entry.js +2 -2
- package/dist/cjs/co-bottom-sheet.cjs.entry.js +325 -0
- package/dist/cjs/co-button-group.cjs.entry.js +3 -3
- package/dist/cjs/co-button.cjs.entry.js +12 -7
- package/dist/cjs/co-calendar-month.cjs.entry.js +381 -0
- package/dist/cjs/co-calendar_3.cjs.entry.js +692 -0
- package/dist/cjs/co-card.cjs.entry.js +21 -4
- package/dist/cjs/co-checkbox-group.cjs.entry.js +7 -5
- package/dist/cjs/co-checkbox.cjs.entry.js +5 -5
- package/dist/cjs/co-chip.cjs.entry.js +11 -8
- package/dist/cjs/co-color-picker.cjs.entry.js +111 -0
- package/dist/cjs/co-column-picker.cjs.entry.js +443 -0
- package/dist/cjs/co-combobox.cjs.entry.js +51 -15
- package/dist/cjs/co-command-search.cjs.entry.js +159 -13
- package/dist/cjs/co-data-table-pagination.cjs.entry.js +5 -5
- package/dist/cjs/co-data-table.cjs.entry.js +38 -12
- package/dist/cjs/co-date-picker.cjs.entry.js +177 -0
- package/dist/cjs/co-date-range-picker.cjs.entry.js +378 -0
- package/dist/cjs/co-date-range.cjs.entry.js +13 -259
- package/dist/cjs/co-empty-state.cjs.entry.js +2 -2
- package/dist/cjs/co-event-calendar.cjs.entry.js +318 -0
- package/dist/cjs/co-fab.cjs.entry.js +3 -3
- package/dist/cjs/co-file-field.cjs.entry.js +498 -0
- package/dist/cjs/co-helper-text.cjs.entry.js +3 -3
- package/dist/cjs/co-icon-button.cjs.entry.js +6 -6
- package/dist/cjs/co-icon.cjs.entry.js +36 -25
- package/dist/cjs/co-input.cjs.entry.js +13 -8
- package/dist/cjs/co-json-field.cjs.entry.js +113 -0
- package/dist/cjs/co-lightbox.cjs.entry.js +344 -0
- package/dist/cjs/co-list-footer.cjs.entry.js +25 -0
- package/dist/cjs/co-list-item.cjs.entry.js +70 -4
- package/dist/cjs/co-loader_2.cjs.entry.js +293 -0
- package/dist/cjs/co-menu-divider.cjs.entry.js +2 -2
- package/dist/cjs/co-menu-item.cjs.entry.js +17 -10
- package/dist/cjs/co-menu.cjs.entry.js +2 -2
- package/dist/cjs/co-modal.cjs.entry.js +25 -3
- package/dist/cjs/co-navbar.cjs.entry.js +4 -4
- package/dist/cjs/co-number-field.cjs.entry.js +60 -12
- package/dist/cjs/co-page-header.cjs.entry.js +2 -2
- package/dist/cjs/co-phone-field.cjs.entry.js +378 -0
- package/dist/cjs/co-popover.cjs.entry.js +46 -15
- package/dist/cjs/co-progress-bar.cjs.entry.js +8 -4
- package/dist/cjs/co-progress-circle.cjs.entry.js +38 -0
- package/dist/cjs/co-radio-group.cjs.entry.js +7 -5
- package/dist/cjs/co-radio.cjs.entry.js +4 -4
- package/dist/cjs/co-rating.cjs.entry.js +4 -4
- package/dist/cjs/co-ref-field.cjs.entry.js +214 -21
- package/dist/cjs/co-rich-text-editor.cjs.entry.js +2081 -0
- package/dist/cjs/co-rich-text-toolbar.cjs.entry.js +1108 -0
- package/dist/cjs/co-rich-text-viewer.cjs.entry.js +118 -0
- package/dist/cjs/co-row.cjs.entry.js +3 -3
- package/dist/cjs/co-select.cjs.entry.js +119 -18
- package/dist/cjs/co-separator.cjs.entry.js +2 -2
- package/dist/cjs/co-sidebar-nav.cjs.entry.js +55 -10
- package/dist/cjs/co-sidebar.cjs.entry.js +3 -3
- package/dist/cjs/co-skeleton.cjs.entry.js +26 -0
- package/dist/cjs/co-slider.cjs.entry.js +3 -3
- package/dist/cjs/co-switch.cjs.entry.js +9 -6
- package/dist/cjs/co-tab-group.cjs.entry.js +2 -2
- package/dist/cjs/co-tab.cjs.entry.js +3 -3
- package/dist/cjs/co-tags-field.cjs.entry.js +211 -0
- package/dist/cjs/co-textarea.cjs.entry.js +96 -0
- package/dist/cjs/co-toast.cjs.entry.js +2 -2
- package/dist/cjs/co-toggle-button-group.cjs.entry.js +7 -4
- package/dist/cjs/co-toggle-button.cjs.entry.js +4 -4
- package/dist/cjs/co-tooltip.cjs.entry.js +56 -15
- package/dist/cjs/co-transfer-list.cjs.entry.js +20 -6
- package/dist/cjs/co-video.cjs.entry.js +839 -0
- package/dist/cjs/cobalt.cjs.js +2 -2
- package/dist/cjs/dateI18n-BdiNAl0_.js +106 -0
- package/dist/cjs/dates-D8D-aS5d.js +432 -0
- package/dist/cjs/fieldChip-CDIMz_Y6.js +7 -0
- package/dist/cjs/index-5NdsiFjZ.js +35405 -0
- package/dist/cjs/{index-BEovErzl.js → index-BumlM92r.js} +115 -23
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/normalizeText-B-v-XPKf.js +96 -0
- package/dist/cjs/overlayAfterClose-BdeXrhVY.js +12 -0
- package/dist/cjs/overlayScroll-ifzDNeyb.js +25 -0
- package/dist/cjs/overlayscrollbars-BlBHo2Xx.js +2842 -0
- package/dist/cjs/{positioning-DozpXyBd.js → positioning-DwHW399W.js} +40 -25
- package/dist/cjs/purify.es-DX41ZWS2.js +1776 -0
- package/dist/cjs/requiredMark-CqMGt1H1.js +16 -0
- package/dist/cjs/richTextI18n-B7ktXg3M.js +382 -0
- package/dist/cjs/toolbar-config-3PlT-3zm.js +216 -0
- package/dist/cjs/tz-Dgom0W69.js +127 -0
- package/dist/cobalt/cobalt.css +1 -1
- package/dist/cobalt/cobalt.esm.js +1 -1
- package/dist/cobalt/p-0a506c9d.entry.js +1 -0
- package/dist/cobalt/p-0bb55163.entry.js +1 -0
- package/dist/cobalt/{p-fb047df8.entry.js → p-0e8c0d87.entry.js} +1 -1
- package/dist/cobalt/p-12e2c2c4.entry.js +1 -0
- package/dist/cobalt/p-136ad468.entry.js +1 -0
- package/dist/cobalt/p-14b59277.entry.js +1 -0
- package/dist/cobalt/p-1531d3c9.entry.js +1 -0
- package/dist/cobalt/p-1774d211.entry.js +1 -0
- package/dist/cobalt/{p-c7517f86.entry.js → p-180e1106.entry.js} +1 -1
- package/dist/cobalt/p-1a07c23c.entry.js +1 -0
- package/dist/cobalt/p-1dc9c49e.entry.js +1 -0
- package/dist/cobalt/p-1f747e45.entry.js +1 -0
- package/dist/cobalt/{p-d29c77cb.entry.js → p-201eaf35.entry.js} +1 -1
- package/dist/cobalt/p-260101ab.entry.js +1 -0
- package/dist/cobalt/p-279bf91c.entry.js +1 -0
- package/dist/cobalt/p-29be61a9.entry.js +1 -0
- package/dist/cobalt/p-2d2ce434.entry.js +1 -0
- package/dist/cobalt/{p-416bb5ae.entry.js → p-2f86e1e0.entry.js} +1 -1
- package/dist/cobalt/{p-4cf6d1f4.entry.js → p-31ab9a46.entry.js} +1 -1
- package/dist/cobalt/{p-319937c3.entry.js → p-37595103.entry.js} +1 -1
- package/dist/cobalt/p-377c2ccc.entry.js +1 -0
- package/dist/cobalt/p-3863ea91.entry.js +1 -0
- package/dist/cobalt/p-3a257cb0.entry.js +1 -0
- package/dist/cobalt/p-3e187456.entry.js +1 -0
- package/dist/cobalt/p-4431faac.entry.js +1 -0
- package/dist/cobalt/{p-4d8ff00a.entry.js → p-4504f7b0.entry.js} +1 -1
- package/dist/cobalt/p-456fa86f.entry.js +1 -0
- package/dist/cobalt/p-4871690e.entry.js +1 -0
- package/dist/cobalt/p-4c01d984.entry.js +1 -0
- package/dist/cobalt/p-51a53177.entry.js +1 -0
- package/dist/cobalt/p-52de17da.entry.js +1 -0
- package/dist/cobalt/p-5890e4d1.entry.js +1 -0
- package/dist/cobalt/{p-e50c4c6f.entry.js → p-58a53421.entry.js} +1 -1
- package/dist/cobalt/p-62274eba.entry.js +1 -0
- package/dist/cobalt/p-635b03d5.entry.js +1 -0
- package/dist/cobalt/p-64ddee92.entry.js +1 -0
- package/dist/cobalt/p-65af5017.entry.js +1 -0
- package/dist/cobalt/p-69d4c0c8.entry.js +1 -0
- package/dist/cobalt/p-6c480916.entry.js +1 -0
- package/dist/cobalt/p-6d1217c3.entry.js +1 -0
- package/dist/cobalt/p-6e808b3a.entry.js +1 -0
- package/dist/cobalt/{p-697df797.entry.js → p-70b14b05.entry.js} +1 -1
- package/dist/cobalt/{p-1d7da33f.entry.js → p-790d384e.entry.js} +1 -1
- package/dist/cobalt/p-8012e152.entry.js +1 -0
- package/dist/cobalt/p-80b27203.entry.js +1 -0
- package/dist/cobalt/p-867c1465.entry.js +1 -0
- package/dist/cobalt/p-86a143d7.entry.js +1 -0
- package/dist/cobalt/{p-3b2f7959.entry.js → p-8d59f5ad.entry.js} +1 -1
- package/dist/cobalt/p-8d7fdb9d.entry.js +1 -0
- package/dist/cobalt/p-8dc1dab8.entry.js +1 -0
- package/dist/cobalt/p-8e1dc062.entry.js +1 -0
- package/dist/cobalt/p-929e647f.entry.js +1 -0
- package/dist/cobalt/p-92bd9b29.entry.js +1 -0
- package/dist/cobalt/p-93046365.entry.js +1 -0
- package/dist/cobalt/p-98ab5f3f.entry.js +1 -0
- package/dist/cobalt/p-9a04ca90.entry.js +1 -0
- package/dist/cobalt/{p-ebd1555e.entry.js → p-9a088515.entry.js} +1 -1
- package/dist/cobalt/p-9abbd436.entry.js +1 -0
- package/dist/cobalt/p-9d69c067.entry.js +1 -0
- package/dist/cobalt/p-B-ckjCUA.js +1 -0
- package/dist/cobalt/p-B2QLgWrz.js +2 -0
- package/dist/cobalt/p-B6JZk8fL.js +1 -0
- package/dist/cobalt/p-BZJ7NCm5.js +1 -0
- package/dist/cobalt/p-C1DCLOEl.js +1 -0
- package/dist/cobalt/p-C2mZ7x_Y.js +1 -0
- package/dist/cobalt/p-CQY6Ul7q.js +1 -0
- package/dist/cobalt/p-CYsftTKf.js +2 -0
- package/dist/cobalt/p-CegCk7FL.js +1 -0
- package/dist/cobalt/p-Ch1jfwZ2.js +1 -0
- package/dist/cobalt/p-ChibIpZv.js +1 -0
- package/dist/cobalt/p-DqyWGweA.js +1 -0
- package/dist/cobalt/p-afb7e19e.entry.js +1 -0
- package/dist/cobalt/p-b6f20268.entry.js +1 -0
- package/dist/cobalt/p-ba90e871.entry.js +1 -0
- package/dist/cobalt/p-c10697e1.entry.js +1 -0
- package/dist/cobalt/p-c4f59532.entry.js +1 -0
- package/dist/cobalt/{p-1b5c723a.entry.js → p-cb235aa7.entry.js} +1 -1
- package/dist/cobalt/p-cfb36943.entry.js +1 -0
- package/dist/cobalt/p-d809bd44.entry.js +1 -0
- package/dist/cobalt/p-e53861e4.entry.js +1 -0
- package/dist/cobalt/p-e54dd404.entry.js +1 -0
- package/dist/cobalt/{p-1021f612.entry.js → p-eb18fdbf.entry.js} +1 -1
- package/dist/cobalt/{p-a7fa4484.entry.js → p-eb73052a.entry.js} +1 -1
- package/dist/cobalt/p-ef7d4ae3.entry.js +1 -0
- package/dist/cobalt/p-f4063c41.entry.js +1 -0
- package/dist/cobalt/p-oImf-7fN.js +1 -0
- package/dist/cobalt/p-ox7HzCZn.js +10 -0
- package/dist/cobalt/p-tPYikBRJ.js +1 -0
- package/dist/collection/collection-manifest.json +27 -4
- package/dist/collection/components/co-accordion/co-accordion.css +19 -1
- package/dist/collection/components/co-accordion/co-accordion.js +46 -4
- package/dist/collection/components/co-app-shell/co-app-shell.css +79 -6
- package/dist/collection/components/co-app-shell/co-app-shell.js +2 -2
- package/dist/collection/components/co-autocomplete/co-autocomplete.css +753 -8
- package/dist/collection/components/co-autocomplete/co-autocomplete.js +111 -4
- package/dist/collection/components/co-avatar/co-avatar.css +45 -1
- package/dist/collection/components/co-avatar/co-avatar.js +56 -6
- package/dist/collection/components/co-avatar-group/co-avatar-group.css +86 -0
- package/dist/collection/components/co-avatar-group/co-avatar-group.js +224 -0
- package/dist/collection/components/co-badge/co-badge.js +1 -1
- package/dist/collection/components/co-bottom-sheet/co-bottom-sheet.css +136 -0
- package/dist/collection/components/co-bottom-sheet/co-bottom-sheet.js +507 -0
- package/dist/collection/components/co-button/co-button.css +48 -12
- package/dist/collection/components/co-button/co-button.js +70 -8
- package/dist/collection/components/co-button-group/co-button-group.js +2 -2
- package/dist/collection/components/co-calendar/co-calendar.css +236 -0
- package/dist/collection/components/co-calendar/co-calendar.js +728 -0
- package/dist/collection/components/co-calendar-month/co-calendar-month.css +231 -0
- package/dist/collection/components/co-calendar-month/co-calendar-month.js +594 -0
- package/dist/collection/components/co-card/co-card.css +28 -5
- package/dist/collection/components/co-card/co-card.js +47 -4
- package/dist/collection/components/co-checkbox/co-checkbox.css +7 -1
- package/dist/collection/components/co-checkbox/co-checkbox.js +3 -3
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.css +33 -1
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +25 -3
- package/dist/collection/components/co-chip/co-chip.css +27 -7
- package/dist/collection/components/co-chip/co-chip.js +52 -10
- package/dist/collection/components/co-color-picker/co-color-picker.css +258 -0
- package/dist/collection/components/co-color-picker/co-color-picker.js +355 -0
- package/dist/collection/components/co-color-picker/presets.js +19 -0
- package/dist/collection/components/co-column-picker/co-column-picker.css +490 -0
- package/dist/collection/components/co-column-picker/co-column-picker.js +675 -0
- package/dist/collection/components/co-column-picker/column-picker-node.js +34 -0
- package/dist/collection/components/co-column-picker/utils/column-picker-tree.js +221 -0
- package/dist/collection/components/co-combobox/co-combobox.css +778 -51
- package/dist/collection/components/co-combobox/co-combobox.js +130 -15
- package/dist/collection/components/co-command-search/co-command-search.css +167 -1
- package/dist/collection/components/co-command-search/co-command-search.js +362 -14
- package/dist/collection/components/co-command-search/commandSearchGroup.js +17 -0
- package/dist/collection/components/co-command-search/commandSearchLogic.js +27 -0
- package/dist/collection/components/co-data-table/co-data-table.css +37 -1
- package/dist/collection/components/co-data-table/co-data-table.js +38 -12
- package/dist/collection/components/co-data-table-pagination/co-data-table-pagination.js +4 -4
- package/dist/collection/components/co-date-field/co-date-field.css +245 -0
- package/dist/collection/components/co-date-field/co-date-field.js +746 -0
- package/dist/collection/components/co-date-picker/co-date-picker.css +112 -0
- package/dist/collection/components/co-date-picker/co-date-picker.js +801 -0
- package/dist/collection/components/co-date-range/co-date-range.css +3 -254
- package/dist/collection/components/co-date-range/co-date-range.js +29 -433
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.css +257 -0
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.js +1142 -0
- package/dist/collection/components/co-drawer/co-drawer.css +20 -0
- package/dist/collection/components/co-drawer/co-drawer.js +46 -2
- package/dist/collection/components/co-empty-state/co-empty-state.js +1 -1
- package/dist/collection/components/co-event-calendar/co-event-calendar.css +146 -0
- package/dist/collection/components/co-event-calendar/co-event-calendar.js +620 -0
- package/dist/collection/components/co-fab/co-fab.js +2 -2
- package/dist/collection/components/co-file-field/co-file-field.css +395 -0
- package/dist/collection/components/co-file-field/co-file-field.js +841 -0
- package/dist/collection/components/co-file-field/co-file-field.utils.js +47 -0
- package/dist/collection/components/co-helper-text/co-helper-text.js +2 -2
- package/dist/collection/components/co-icon/co-icon.js +7 -34
- package/dist/collection/components/co-icon/iconLoader.js +39 -0
- package/dist/collection/components/co-icon-button/co-icon-button.css +27 -6
- package/dist/collection/components/co-icon-button/co-icon-button.js +26 -7
- package/dist/collection/components/co-input/co-input.css +63 -11
- package/dist/collection/components/co-input/co-input.js +34 -9
- package/dist/collection/components/co-json-field/co-json-field.css +193 -0
- package/dist/collection/components/co-json-field/co-json-field.js +477 -0
- package/dist/collection/components/co-lightbox/co-lightbox.css +164 -0
- package/dist/collection/components/co-lightbox/co-lightbox.js +451 -0
- package/dist/collection/components/co-list-footer/co-list-footer.css +50 -0
- package/dist/collection/components/co-list-footer/co-list-footer.js +149 -0
- package/dist/collection/components/co-list-item/co-list-item.css +12 -0
- package/dist/collection/components/co-list-item/co-list-item.js +75 -2
- package/dist/collection/components/co-loader/co-loader.css +9 -0
- package/dist/collection/components/co-menu/co-menu.js +1 -1
- package/dist/collection/components/co-menu-divider/co-menu-divider.js +1 -1
- package/dist/collection/components/co-menu-item/co-menu-item.css +18 -0
- package/dist/collection/components/co-menu-item/co-menu-item.js +15 -8
- package/dist/collection/components/co-modal/co-modal.css +59 -5
- package/dist/collection/components/co-modal/co-modal.js +91 -1
- package/dist/collection/components/co-navbar/co-navbar.css +1 -1
- package/dist/collection/components/co-navbar/co-navbar.js +2 -2
- package/dist/collection/components/co-number-field/co-number-field.css +89 -1
- package/dist/collection/components/co-number-field/co-number-field.js +175 -14
- package/dist/collection/components/co-overlay/co-overlay.css +15 -1
- package/dist/collection/components/co-overlay/co-overlay.js +266 -1
- package/dist/collection/components/co-overlay/focusTrap.js +53 -0
- package/dist/collection/components/co-overlay/overlayAfterClose.js +8 -0
- package/dist/collection/components/co-page-header/co-page-header.js +1 -1
- package/dist/collection/components/co-phone-field/co-phone-field.css +293 -0
- package/dist/collection/components/co-phone-field/co-phone-field.js +414 -0
- package/dist/collection/components/co-phone-field/dial-codes.js +208 -0
- package/dist/collection/components/co-popover/co-popover.css +9 -0
- package/dist/collection/components/co-popover/co-popover.js +43 -12
- package/dist/collection/components/co-progress-bar/co-progress-bar.css +22 -0
- package/dist/collection/components/co-progress-bar/co-progress-bar.js +26 -2
- package/dist/collection/components/co-progress-circle/co-progress-circle.css +50 -0
- package/dist/collection/components/co-progress-circle/co-progress-circle.js +148 -0
- package/dist/collection/components/co-radio/co-radio.js +3 -3
- package/dist/collection/components/co-radio-group/co-radio-group.css +26 -0
- package/dist/collection/components/co-radio-group/co-radio-group.js +25 -3
- package/dist/collection/components/co-rating/co-rating.js +3 -3
- package/dist/collection/components/co-ref-field/co-ref-field.css +876 -56
- package/dist/collection/components/co-ref-field/co-ref-field.js +0 -0
- package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.css +1322 -0
- package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.js +2823 -0
- package/dist/collection/components/co-rich-text-toolbar/co-rich-text-toolbar.css +837 -0
- package/dist/collection/components/co-rich-text-toolbar/co-rich-text-toolbar.js +1289 -0
- package/dist/collection/components/co-rich-text-viewer/co-rich-text-viewer.css +156 -0
- package/dist/collection/components/co-rich-text-viewer/co-rich-text-viewer.js +237 -0
- package/dist/collection/components/co-row/co-row.js +2 -2
- package/dist/collection/components/co-select/co-select.css +852 -8
- package/dist/collection/components/co-select/co-select.js +240 -17
- package/dist/collection/components/co-separator/co-separator.js +1 -1
- package/dist/collection/components/co-sidebar/co-sidebar.js +2 -2
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.css +99 -12
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +54 -9
- package/dist/collection/components/co-skeleton/co-skeleton.css +28 -0
- package/dist/collection/components/co-skeleton/co-skeleton.js +97 -0
- package/dist/collection/components/co-slider/co-slider.js +2 -2
- package/dist/collection/components/co-switch/co-switch.css +26 -1
- package/dist/collection/components/co-switch/co-switch.js +27 -4
- package/dist/collection/components/co-tab/co-tab.js +2 -2
- package/dist/collection/components/co-tab-group/co-tab-group.js +1 -1
- package/dist/collection/components/co-tags-field/co-tags-field.css +310 -0
- package/dist/collection/components/co-tags-field/co-tags-field.js +616 -0
- package/dist/collection/components/co-textarea/co-textarea.css +286 -0
- package/dist/collection/components/co-textarea/co-textarea.js +508 -0
- package/dist/collection/components/co-toast/co-toast.js +1 -1
- package/dist/collection/components/co-toggle-button/co-toggle-button.css +30 -6
- package/dist/collection/components/co-toggle-button/co-toggle-button.js +3 -3
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.css +32 -12
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.js +25 -2
- package/dist/collection/components/co-tooltip/co-tooltip.css +24 -0
- package/dist/collection/components/co-tooltip/co-tooltip.js +73 -12
- package/dist/collection/components/co-transfer-list/co-transfer-list.css +683 -7
- package/dist/collection/components/co-transfer-list/co-transfer-list.js +17 -4
- package/dist/collection/components/co-video/co-video.css +497 -0
- package/dist/collection/components/co-video/co-video.js +1772 -0
- package/dist/collection/utils/dateI18n.js +101 -0
- package/dist/collection/utils/fieldChip.js +2 -0
- package/dist/collection/utils/fileI18n.js +76 -0
- package/dist/collection/utils/icon-config.js +34 -0
- package/dist/collection/utils/lightboxI18n.js +42 -0
- package/dist/collection/utils/normalizeText.js +94 -0
- package/dist/collection/utils/overlayScroll.js +20 -0
- package/dist/collection/utils/positioning.js +40 -25
- package/dist/collection/utils/requiredMark.js +11 -0
- package/dist/collection/utils/richTextI18n.js +378 -0
- package/dist/collection/utils/sheetGesture.js +53 -0
- package/dist/components/co-accordion.js +1 -1
- package/dist/components/co-app-shell.js +1 -1
- package/dist/components/co-autocomplete.js +1 -1
- package/dist/components/co-avatar-group.d.ts +11 -0
- package/dist/components/co-avatar-group.js +1 -0
- package/dist/components/co-avatar.js +1 -1
- package/dist/components/co-badge.js +1 -1
- package/dist/components/co-bottom-sheet.d.ts +11 -0
- package/dist/components/co-bottom-sheet.js +1 -0
- package/dist/components/co-button-group.js +1 -1
- package/dist/components/co-button.js +1 -1
- package/dist/components/co-calendar-month.d.ts +11 -0
- package/dist/components/co-calendar-month.js +1 -0
- package/dist/components/co-calendar.d.ts +11 -0
- package/dist/components/co-calendar.js +1 -0
- package/dist/components/co-card.js +1 -1
- package/dist/components/co-checkbox-group.js +1 -1
- package/dist/components/co-checkbox.js +1 -1
- package/dist/components/co-chip.js +1 -1
- package/dist/components/co-color-picker.d.ts +11 -0
- package/dist/components/co-color-picker.js +1 -0
- package/dist/components/co-column-picker.d.ts +11 -0
- package/dist/components/co-column-picker.js +1 -0
- package/dist/components/co-combobox.js +1 -1
- package/dist/components/co-command-search.js +1 -1
- package/dist/components/co-data-table-pagination.js +1 -1
- package/dist/components/co-data-table.js +1 -1
- package/dist/components/co-date-field.d.ts +11 -0
- package/dist/components/co-date-field.js +1 -0
- package/dist/components/co-date-picker.d.ts +11 -0
- package/dist/components/co-date-picker.js +1 -0
- package/dist/components/co-date-range-picker.d.ts +11 -0
- package/dist/components/co-date-range-picker.js +1 -0
- package/dist/components/co-date-range.js +1 -1
- package/dist/components/co-drawer.js +1 -1
- package/dist/components/co-empty-state.js +1 -1
- package/dist/components/co-event-calendar.d.ts +11 -0
- package/dist/components/co-event-calendar.js +1 -0
- package/dist/components/co-fab.js +1 -1
- package/dist/components/co-file-field.d.ts +11 -0
- package/dist/components/co-file-field.js +1 -0
- package/dist/components/co-helper-text.js +1 -1
- package/dist/components/co-icon-button.js +1 -1
- package/dist/components/co-icon.js +1 -1
- package/dist/components/co-input.js +1 -1
- package/dist/components/co-json-field.d.ts +11 -0
- package/dist/components/co-json-field.js +1 -0
- package/dist/components/co-lightbox.d.ts +11 -0
- package/dist/components/co-lightbox.js +1 -0
- package/dist/components/co-list-footer.d.ts +11 -0
- package/dist/components/co-list-footer.js +1 -0
- package/dist/components/co-list-item.js +1 -1
- package/dist/components/co-loader.js +1 -1
- package/dist/components/co-menu-divider.js +1 -1
- package/dist/components/co-menu-item.js +1 -1
- package/dist/components/co-menu.js +1 -1
- package/dist/components/co-modal.js +1 -1
- package/dist/components/co-navbar.js +1 -1
- package/dist/components/co-number-field.js +1 -1
- package/dist/components/co-overlay.js +1 -1
- package/dist/components/co-page-header.js +1 -1
- package/dist/components/co-phone-field.d.ts +11 -0
- package/dist/components/co-phone-field.js +1 -0
- package/dist/components/co-popover.js +1 -1
- package/dist/components/co-progress-bar.js +1 -1
- package/dist/components/co-progress-circle.d.ts +11 -0
- package/dist/components/co-progress-circle.js +1 -0
- package/dist/components/co-radio-group.js +1 -1
- package/dist/components/co-radio.js +1 -1
- package/dist/components/co-rating.js +1 -1
- package/dist/components/co-ref-field.js +1 -1
- package/dist/components/co-rich-text-editor.d.ts +11 -0
- package/dist/components/co-rich-text-editor.js +1 -0
- package/dist/components/co-rich-text-toolbar.d.ts +11 -0
- package/dist/components/co-rich-text-toolbar.js +1 -0
- package/dist/components/co-rich-text-viewer.d.ts +11 -0
- package/dist/components/co-rich-text-viewer.js +1 -0
- package/dist/components/co-row.js +1 -1
- package/dist/components/co-select.js +1 -1
- package/dist/components/co-separator.js +1 -1
- package/dist/components/co-sidebar-nav.js +1 -1
- package/dist/components/co-sidebar.js +1 -1
- package/dist/components/co-skeleton.d.ts +11 -0
- package/dist/components/co-skeleton.js +1 -0
- package/dist/components/co-slider.js +1 -1
- package/dist/components/co-switch.js +1 -1
- package/dist/components/co-tab-group.js +1 -1
- package/dist/components/co-tab.js +1 -1
- package/dist/components/co-tags-field.d.ts +11 -0
- package/dist/components/co-tags-field.js +1 -0
- package/dist/components/co-textarea.d.ts +11 -0
- package/dist/components/co-textarea.js +1 -0
- package/dist/components/co-toast.js +1 -1
- package/dist/components/co-toggle-button-group.js +1 -1
- package/dist/components/co-toggle-button.js +1 -1
- package/dist/components/co-tooltip.js +1 -1
- package/dist/components/co-transfer-list.js +1 -1
- package/dist/components/co-video.d.ts +11 -0
- package/dist/components/co-video.js +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-B2QLgWrz.js +2 -0
- package/dist/components/p-B7vGYFbO.js +1 -0
- package/dist/components/p-BB2OaYKF.js +1 -0
- package/dist/components/p-BFeE_fiq.js +1 -0
- package/dist/components/p-BNKz39GA.js +1 -0
- package/dist/components/p-Ba4v1NXo.js +1 -0
- package/dist/components/p-C1DCLOEl.js +1 -0
- package/dist/components/p-C2mZ7x_Y.js +1 -0
- package/dist/components/p-CQY6Ul7q.js +1 -0
- package/dist/components/p-CWneqh4n.js +1 -0
- package/dist/components/p-C_ULDaks.js +1 -0
- package/dist/components/p-CegCk7FL.js +1 -0
- package/dist/components/p-ChibIpZv.js +1 -0
- package/dist/components/p-CyYF8IJE.js +1 -0
- package/dist/components/p-D3Y_ti3Q.js +1 -0
- package/dist/components/p-DKh8ZK4U.js +1 -0
- package/dist/components/p-DeZxp9vb.js +1 -0
- package/dist/components/p-DqyWGweA.js +1 -0
- package/dist/components/p-DvhR3H61.js +1 -0
- package/dist/components/p-DxCFMMfY.js +1 -0
- package/dist/components/{p-OGpfa9Yd.js → p-DzoNGEDU.js} +1 -1
- package/dist/components/p-EPZfLt5l.js +1 -0
- package/dist/components/p-FMnqPWcM.js +1 -0
- package/dist/components/p-Hzh9U2cM.js +1 -0
- package/dist/components/p-WZ06pT2Y.js +1 -0
- package/dist/components/p-ox7HzCZn.js +10 -0
- package/dist/components/p-tloAgDin.js +1 -0
- package/dist/esm/co-accordion.entry.js +19 -4
- package/dist/esm/co-app-shell.entry.js +4 -4
- package/dist/esm/co-autocomplete.entry.js +54 -6
- package/dist/esm/co-avatar-group.entry.js +75 -0
- package/dist/esm/co-avatar.entry.js +41 -6
- package/dist/esm/co-badge.entry.js +2 -2
- package/dist/esm/co-bottom-sheet.entry.js +323 -0
- package/dist/esm/co-button-group.entry.js +3 -3
- package/dist/esm/co-button.entry.js +12 -7
- package/dist/esm/co-calendar-month.entry.js +379 -0
- package/dist/esm/co-calendar_3.entry.js +688 -0
- package/dist/esm/co-card.entry.js +21 -4
- package/dist/esm/co-checkbox-group.entry.js +7 -5
- package/dist/esm/co-checkbox.entry.js +5 -5
- package/dist/esm/co-chip.entry.js +11 -8
- package/dist/esm/co-color-picker.entry.js +109 -0
- package/dist/esm/co-column-picker.entry.js +441 -0
- package/dist/esm/co-combobox.entry.js +51 -15
- package/dist/esm/co-command-search.entry.js +159 -13
- package/dist/esm/co-data-table-pagination.entry.js +5 -5
- package/dist/esm/co-data-table.entry.js +38 -12
- package/dist/esm/co-date-picker.entry.js +175 -0
- package/dist/esm/co-date-range-picker.entry.js +376 -0
- package/dist/esm/co-date-range.entry.js +13 -259
- package/dist/esm/co-empty-state.entry.js +2 -2
- package/dist/esm/co-event-calendar.entry.js +316 -0
- package/dist/esm/co-fab.entry.js +3 -3
- package/dist/esm/co-file-field.entry.js +496 -0
- package/dist/esm/co-helper-text.entry.js +3 -3
- package/dist/esm/co-icon-button.entry.js +6 -6
- package/dist/esm/co-icon.entry.js +36 -25
- package/dist/esm/co-input.entry.js +13 -8
- package/dist/esm/co-json-field.entry.js +111 -0
- package/dist/esm/co-lightbox.entry.js +342 -0
- package/dist/esm/co-list-footer.entry.js +23 -0
- package/dist/esm/co-list-item.entry.js +70 -4
- package/dist/esm/co-loader_2.entry.js +290 -0
- package/dist/esm/co-menu-divider.entry.js +2 -2
- package/dist/esm/co-menu-item.entry.js +17 -10
- package/dist/esm/co-menu.entry.js +2 -2
- package/dist/esm/co-modal.entry.js +25 -3
- package/dist/esm/co-navbar.entry.js +4 -4
- package/dist/esm/co-number-field.entry.js +60 -12
- package/dist/esm/co-page-header.entry.js +2 -2
- package/dist/esm/co-phone-field.entry.js +376 -0
- package/dist/esm/co-popover.entry.js +46 -15
- package/dist/esm/co-progress-bar.entry.js +8 -4
- package/dist/esm/co-progress-circle.entry.js +36 -0
- package/dist/esm/co-radio-group.entry.js +7 -5
- package/dist/esm/co-radio.entry.js +4 -4
- package/dist/esm/co-rating.entry.js +4 -4
- package/dist/esm/co-ref-field.entry.js +214 -21
- package/dist/esm/co-rich-text-editor.entry.js +2079 -0
- package/dist/esm/co-rich-text-toolbar.entry.js +1106 -0
- package/dist/esm/co-rich-text-viewer.entry.js +116 -0
- package/dist/esm/co-row.entry.js +3 -3
- package/dist/esm/co-select.entry.js +119 -18
- package/dist/esm/co-separator.entry.js +2 -2
- package/dist/esm/co-sidebar-nav.entry.js +55 -10
- package/dist/esm/co-sidebar.entry.js +3 -3
- package/dist/esm/co-skeleton.entry.js +24 -0
- package/dist/esm/co-slider.entry.js +3 -3
- package/dist/esm/co-switch.entry.js +9 -6
- package/dist/esm/co-tab-group.entry.js +2 -2
- package/dist/esm/co-tab.entry.js +3 -3
- package/dist/esm/co-tags-field.entry.js +209 -0
- package/dist/esm/co-textarea.entry.js +94 -0
- package/dist/esm/co-toast.entry.js +2 -2
- package/dist/esm/co-toggle-button-group.entry.js +7 -4
- package/dist/esm/co-toggle-button.entry.js +4 -4
- package/dist/esm/co-tooltip.entry.js +56 -15
- package/dist/esm/co-transfer-list.entry.js +20 -6
- package/dist/esm/co-video.entry.js +837 -0
- package/dist/esm/cobalt.js +3 -3
- package/dist/esm/dateI18n-C1DCLOEl.js +103 -0
- package/dist/esm/dates-tPYikBRJ.js +416 -0
- package/dist/esm/fieldChip-GPikjpYw.js +5 -0
- package/dist/esm/{index-B0lqrhFo.js → index-CYsftTKf.js} +115 -23
- package/dist/esm/index-w_Wxgclf.js +35403 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/normalizeText-CQY6Ul7q.js +92 -0
- package/dist/esm/overlayAfterClose-Ch1jfwZ2.js +10 -0
- package/dist/esm/overlayScroll-Bpv882_z.js +23 -0
- package/dist/esm/overlayscrollbars-ox7HzCZn.js +2840 -0
- package/dist/esm/{positioning-Am-OlB8h.js → positioning-C2mZ7x_Y.js} +40 -25
- package/dist/esm/purify.es-B2QLgWrz.js +1774 -0
- package/dist/esm/requiredMark-CEbXKHcU.js +14 -0
- package/dist/esm/richTextI18n-B-ckjCUA.js +380 -0
- package/dist/esm/toolbar-config-ChibIpZv.js +212 -0
- package/dist/esm/tz-B6JZk8fL.js +119 -0
- package/dist/types/components/co-accordion/co-accordion.d.ts +12 -2
- package/dist/types/components/co-autocomplete/co-autocomplete.d.ts +13 -0
- package/dist/types/components/co-avatar/co-avatar.d.ts +8 -2
- package/dist/types/components/co-avatar-group/co-avatar-group.d.ts +33 -0
- package/dist/types/components/co-bottom-sheet/co-bottom-sheet.d.ts +81 -0
- package/dist/types/components/co-button/co-button.d.ts +7 -1
- package/dist/types/components/co-calendar/co-calendar.d.ts +108 -0
- package/dist/types/components/co-calendar-month/co-calendar-month.d.ts +83 -0
- package/dist/types/components/co-card/co-card.d.ts +10 -2
- package/dist/types/components/co-checkbox-group/co-checkbox-group.d.ts +2 -0
- package/dist/types/components/co-chip/co-chip.d.ts +7 -2
- package/dist/types/components/co-color-picker/co-color-picker.d.ts +50 -0
- package/dist/types/components/co-color-picker/presets.d.ts +10 -0
- package/dist/types/components/co-column-picker/co-column-picker.d.ts +60 -0
- package/dist/types/components/co-column-picker/column-picker-node.d.ts +18 -0
- package/dist/types/components/co-column-picker/utils/column-picker-tree.d.ts +37 -0
- package/dist/types/components/co-combobox/co-combobox.d.ts +14 -1
- package/dist/types/components/co-command-search/co-command-search.d.ts +41 -6
- package/dist/types/components/co-command-search/commandSearchGroup.d.ts +20 -0
- package/dist/types/components/co-command-search/commandSearchLogic.d.ts +17 -0
- package/dist/types/components/co-data-table/co-data-table.d.ts +3 -1
- package/dist/types/components/co-date-field/co-date-field.d.ts +96 -0
- package/dist/types/components/co-date-picker/co-date-picker.d.ts +92 -0
- package/dist/types/components/co-date-range/co-date-range.d.ts +12 -50
- package/dist/types/components/co-date-range-picker/co-date-range-picker.d.ts +112 -0
- package/dist/types/components/co-drawer/co-drawer.d.ts +4 -0
- package/dist/types/components/co-event-calendar/co-event-calendar.d.ts +110 -0
- package/dist/types/components/co-file-field/co-file-field.d.ts +146 -0
- package/dist/types/components/co-file-field/co-file-field.utils.d.ts +18 -0
- package/dist/types/components/co-icon/co-icon.d.ts +1 -1
- package/dist/types/components/co-icon/iconLoader.d.ts +6 -0
- package/dist/types/components/co-icon-button/co-icon-button.d.ts +3 -1
- package/dist/types/components/co-input/co-input.d.ts +4 -1
- package/dist/types/components/co-json-field/co-json-field.d.ts +69 -0
- package/dist/types/components/co-lightbox/co-lightbox.d.ts +95 -0
- package/dist/types/components/co-list-footer/co-list-footer.d.ts +26 -0
- package/dist/types/components/co-list-item/co-list-item.d.ts +12 -0
- package/dist/types/components/co-modal/co-modal.d.ts +10 -0
- package/dist/types/components/co-number-field/co-number-field.d.ts +29 -2
- package/dist/types/components/co-overlay/co-overlay.d.ts +45 -0
- package/dist/types/components/co-overlay/focusTrap.d.ts +20 -0
- package/dist/types/components/co-overlay/overlayAfterClose.d.ts +5 -0
- package/dist/types/components/co-phone-field/co-phone-field.d.ts +58 -0
- package/dist/types/components/co-phone-field/dial-codes.d.ts +14 -0
- package/dist/types/components/co-popover/co-popover.d.ts +9 -0
- package/dist/types/components/co-progress-bar/co-progress-bar.d.ts +2 -0
- package/dist/types/components/co-progress-circle/co-progress-circle.d.ts +16 -0
- package/dist/types/components/co-radio-group/co-radio-group.d.ts +2 -0
- package/dist/types/components/co-ref-field/co-ref-field.d.ts +69 -1
- package/dist/types/components/co-rich-text-editor/co-rich-text-editor.d.ts +246 -0
- package/dist/types/components/co-rich-text-toolbar/co-rich-text-toolbar.d.ts +148 -0
- package/dist/types/components/co-rich-text-viewer/co-rich-text-viewer.d.ts +19 -0
- package/dist/types/components/co-select/co-select.d.ts +31 -1
- package/dist/types/components/co-skeleton/co-skeleton.d.ts +13 -0
- package/dist/types/components/co-switch/co-switch.d.ts +2 -0
- package/dist/types/components/co-tags-field/co-tags-field.d.ts +84 -0
- package/dist/types/components/co-textarea/co-textarea.d.ts +68 -0
- package/dist/types/components/co-toggle-button-group/co-toggle-button-group.d.ts +2 -0
- package/dist/types/components/co-tooltip/co-tooltip.d.ts +12 -0
- package/dist/types/components/co-transfer-list/co-transfer-list.d.ts +4 -0
- package/dist/types/components/co-video/co-video.d.ts +203 -0
- package/dist/types/components.d.ts +5422 -391
- package/dist/types/utils/dateI18n.d.ts +39 -0
- package/dist/types/utils/fieldChip.d.ts +37 -0
- package/dist/types/utils/fileI18n.d.ts +34 -0
- package/dist/types/utils/icon-config.d.ts +31 -0
- package/dist/types/utils/lightboxI18n.d.ts +12 -0
- package/dist/types/utils/normalizeText.d.ts +41 -0
- package/dist/types/utils/overlayScroll.d.ts +17 -0
- package/dist/types/utils/positioning.d.ts +7 -14
- package/dist/types/utils/requiredMark.d.ts +13 -0
- package/dist/types/utils/richTextI18n.d.ts +130 -0
- package/dist/types/utils/sheetGesture.d.ts +31 -0
- package/package.json +10 -1
- package/dist/cjs/co-drawer.cjs.entry.js +0 -75
- package/dist/cjs/co-loader.cjs.entry.js +0 -34
- package/dist/cjs/co-overlay.cjs.entry.js +0 -23
- package/dist/cjs/color-YhUkm10t.js +0 -32
- package/dist/cobalt/p-08afdc51.entry.js +0 -1
- package/dist/cobalt/p-1b7d6808.entry.js +0 -1
- package/dist/cobalt/p-1d3338b6.entry.js +0 -1
- package/dist/cobalt/p-1d91ec93.entry.js +0 -1
- package/dist/cobalt/p-230a23f3.entry.js +0 -1
- package/dist/cobalt/p-31bc842d.entry.js +0 -1
- package/dist/cobalt/p-37c1f700.entry.js +0 -1
- package/dist/cobalt/p-4905b51d.entry.js +0 -1
- package/dist/cobalt/p-4dd7499c.entry.js +0 -1
- package/dist/cobalt/p-4e7ce8ee.entry.js +0 -1
- package/dist/cobalt/p-4ffba5a3.entry.js +0 -1
- package/dist/cobalt/p-5a13e3a0.entry.js +0 -1
- package/dist/cobalt/p-6793c51e.entry.js +0 -1
- package/dist/cobalt/p-689e38b3.entry.js +0 -1
- package/dist/cobalt/p-7028880b.entry.js +0 -1
- package/dist/cobalt/p-72113ec2.entry.js +0 -1
- package/dist/cobalt/p-8e54e74d.entry.js +0 -1
- package/dist/cobalt/p-92c39eed.entry.js +0 -1
- package/dist/cobalt/p-9887b828.entry.js +0 -1
- package/dist/cobalt/p-9a5c6600.entry.js +0 -1
- package/dist/cobalt/p-Am-OlB8h.js +0 -1
- package/dist/cobalt/p-B0lqrhFo.js +0 -2
- package/dist/cobalt/p-BG4WRR22.js +0 -1
- package/dist/cobalt/p-a1b248ad.entry.js +0 -1
- package/dist/cobalt/p-a470b764.entry.js +0 -1
- package/dist/cobalt/p-a4d55b1a.entry.js +0 -1
- package/dist/cobalt/p-b6840df4.entry.js +0 -1
- package/dist/cobalt/p-b89d54d9.entry.js +0 -1
- package/dist/cobalt/p-ba84631a.entry.js +0 -1
- package/dist/cobalt/p-c9b0e73f.entry.js +0 -1
- package/dist/cobalt/p-ca41eec2.entry.js +0 -1
- package/dist/cobalt/p-cc93ab05.entry.js +0 -1
- package/dist/cobalt/p-d9d8b10e.entry.js +0 -1
- package/dist/cobalt/p-da55678f.entry.js +0 -1
- package/dist/cobalt/p-dc5598d1.entry.js +0 -1
- package/dist/cobalt/p-e2c9cb00.entry.js +0 -1
- package/dist/cobalt/p-e808916c.entry.js +0 -1
- package/dist/cobalt/p-ebd68f56.entry.js +0 -1
- package/dist/cobalt/p-f051f44d.entry.js +0 -1
- package/dist/cobalt/p-fe1447a3.entry.js +0 -1
- package/dist/cobalt/p-ff6a647c.entry.js +0 -1
- package/dist/components/p-Am-OlB8h.js +0 -1
- package/dist/components/p-B18FTYLq.js +0 -1
- package/dist/components/p-BG4WRR22.js +0 -1
- package/dist/components/p-Cr8Yc0zj.js +0 -1
- package/dist/components/p-FBICWTuN.js +0 -1
- package/dist/components/p-cpdUXBiS.js +0 -1
- package/dist/components/p-wwWquAtm.js +0 -1
- package/dist/esm/co-drawer.entry.js +0 -73
- package/dist/esm/co-loader.entry.js +0 -32
- package/dist/esm/co-overlay.entry.js +0 -21
- package/dist/esm/color-BG4WRR22.js +0 -30
|
@@ -0,0 +1,1289 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { toolbarItems, COLOR_PALETTE, TABLE_CONTEXT_ITEMS } from "@prolibu-suite/cobalt-rich-text";
|
|
3
|
+
import { getRichTextStrings } from "../../utils/richTextI18n";
|
|
4
|
+
/**
|
|
5
|
+
* Formatting toolbar for co-rich-text-editor. Receives the Tiptap editor
|
|
6
|
+
* instance via the `editor` JS property, runs commands, and reflects active
|
|
7
|
+
* state. Supports separators, dropdown menus, inline popover inputs, and
|
|
8
|
+
* color palette pickers.
|
|
9
|
+
*
|
|
10
|
+
* @part toolbar - The toolbar container
|
|
11
|
+
* @part button - A toolbar button
|
|
12
|
+
*/
|
|
13
|
+
export class CoRichTextToolbar {
|
|
14
|
+
constructor() {
|
|
15
|
+
/** Toolbar layout variant. */
|
|
16
|
+
this.variant = 'basic';
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
/** BCP-47 locale for UI strings (e.g. 'en', 'es-CO', 'pt-BR'). Default English. */
|
|
19
|
+
this.locale = 'en';
|
|
20
|
+
this.items = [];
|
|
21
|
+
/** Bumped on every editor transaction to refresh active state. */
|
|
22
|
+
this.tick = 0;
|
|
23
|
+
/** Currently open popover/dropdown (action id) or null. */
|
|
24
|
+
this.openPopover = null;
|
|
25
|
+
/** Input value for popover forms (link URL, image URL, etc.). */
|
|
26
|
+
this.popoverInput = '';
|
|
27
|
+
/** Table grid picker state. */
|
|
28
|
+
this.gridHoverRows = 0;
|
|
29
|
+
this.gridHoverCols = 0;
|
|
30
|
+
this.gridLockedRows = 0;
|
|
31
|
+
this.gridLockedCols = 0;
|
|
32
|
+
this.tableTab = 'grid';
|
|
33
|
+
this.tableManualRows = 3;
|
|
34
|
+
this.tableManualCols = 3;
|
|
35
|
+
this.tableWithHeader = false;
|
|
36
|
+
/** Table context items shown when cursor is inside a table. */
|
|
37
|
+
this.tableContextItems = [];
|
|
38
|
+
/** Image popover sub-view: 'menu' shows options, 'url' shows URL input. */
|
|
39
|
+
this.imagePopoverMode = 'menu';
|
|
40
|
+
/** Hex input for toolbar color picker. */
|
|
41
|
+
this.colorHexInput = '';
|
|
42
|
+
this.onTransaction = () => {
|
|
43
|
+
this.tick++;
|
|
44
|
+
// Show/hide table context buttons based on whether cursor is in a table
|
|
45
|
+
this.updateTableContext();
|
|
46
|
+
};
|
|
47
|
+
this.colorPalette = [];
|
|
48
|
+
this._tableContextItems = [];
|
|
49
|
+
/**
|
|
50
|
+
* Prevent toolbar clicks from stealing focus from the editor.
|
|
51
|
+
* This handler is on the HOST element (light DOM), which reliably
|
|
52
|
+
* prevents focus change even when Shadow DOM retargets events.
|
|
53
|
+
*/
|
|
54
|
+
this.handleHostMouseDown = (e) => {
|
|
55
|
+
const path = e.composedPath();
|
|
56
|
+
const isInput = path.some(n => n instanceof HTMLElement && n.tagName === 'INPUT');
|
|
57
|
+
if (!isInput)
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
};
|
|
60
|
+
this.handleDocumentClick = (e) => {
|
|
61
|
+
if (!this.openPopover)
|
|
62
|
+
return;
|
|
63
|
+
if (this.el.contains(e.target))
|
|
64
|
+
return;
|
|
65
|
+
this.closePopover();
|
|
66
|
+
};
|
|
67
|
+
this.run = (item) => {
|
|
68
|
+
const editor = this.editor;
|
|
69
|
+
if (!editor || this.disabled)
|
|
70
|
+
return;
|
|
71
|
+
const chain = editor.chain().focus();
|
|
72
|
+
switch (item.action) {
|
|
73
|
+
case 'bold':
|
|
74
|
+
chain.toggleBold().run();
|
|
75
|
+
break;
|
|
76
|
+
case 'italic':
|
|
77
|
+
chain.toggleItalic().run();
|
|
78
|
+
break;
|
|
79
|
+
case 'underline':
|
|
80
|
+
chain.toggleUnderline().run();
|
|
81
|
+
break;
|
|
82
|
+
case 'strike':
|
|
83
|
+
chain.toggleStrike().run();
|
|
84
|
+
break;
|
|
85
|
+
case 'code':
|
|
86
|
+
chain.toggleCode().run();
|
|
87
|
+
break;
|
|
88
|
+
case 'bulletList':
|
|
89
|
+
chain.toggleBulletList().run();
|
|
90
|
+
break;
|
|
91
|
+
case 'orderedList':
|
|
92
|
+
chain.toggleOrderedList().run();
|
|
93
|
+
break;
|
|
94
|
+
// Split-button main area: toggle the list on/off (caret opens styles)
|
|
95
|
+
case 'bulletListMenu':
|
|
96
|
+
chain.toggleBulletList().run();
|
|
97
|
+
break;
|
|
98
|
+
case 'orderedListMenu':
|
|
99
|
+
chain.toggleOrderedList().run();
|
|
100
|
+
break;
|
|
101
|
+
case 'taskListMenu':
|
|
102
|
+
chain.toggleTaskList().run();
|
|
103
|
+
break;
|
|
104
|
+
case 'blockquote':
|
|
105
|
+
chain.toggleBlockquote().run();
|
|
106
|
+
break;
|
|
107
|
+
case 'codeBlock':
|
|
108
|
+
chain.toggleCodeBlock().run();
|
|
109
|
+
break;
|
|
110
|
+
case 'heading':
|
|
111
|
+
chain.toggleHeading(item.payload).run();
|
|
112
|
+
break;
|
|
113
|
+
case 'horizontalRule':
|
|
114
|
+
chain.setHorizontalRule().run();
|
|
115
|
+
break;
|
|
116
|
+
case 'textAlign':
|
|
117
|
+
chain.setTextAlign(item.payload).run();
|
|
118
|
+
break;
|
|
119
|
+
case 'undo':
|
|
120
|
+
chain.undo().run();
|
|
121
|
+
break;
|
|
122
|
+
case 'redo':
|
|
123
|
+
chain.redo().run();
|
|
124
|
+
break;
|
|
125
|
+
// Table context operations
|
|
126
|
+
case 'addColumnAfter':
|
|
127
|
+
chain.addColumnAfter().run();
|
|
128
|
+
break;
|
|
129
|
+
case 'addColumnBefore':
|
|
130
|
+
chain.addColumnBefore().run();
|
|
131
|
+
break;
|
|
132
|
+
case 'deleteColumn':
|
|
133
|
+
chain.deleteColumn().run();
|
|
134
|
+
break;
|
|
135
|
+
case 'addRowAfter':
|
|
136
|
+
chain.addRowAfter().run();
|
|
137
|
+
break;
|
|
138
|
+
case 'addRowBefore':
|
|
139
|
+
chain.addRowBefore().run();
|
|
140
|
+
break;
|
|
141
|
+
case 'deleteRow':
|
|
142
|
+
chain.deleteRow().run();
|
|
143
|
+
break;
|
|
144
|
+
case 'deleteTable':
|
|
145
|
+
chain.deleteTable().run();
|
|
146
|
+
break;
|
|
147
|
+
case 'mergeCells':
|
|
148
|
+
chain.mergeCells().run();
|
|
149
|
+
break;
|
|
150
|
+
case 'splitCell':
|
|
151
|
+
chain.splitCell().run();
|
|
152
|
+
break;
|
|
153
|
+
case 'toggleHeaderRow':
|
|
154
|
+
chain.toggleHeaderRow().run();
|
|
155
|
+
break;
|
|
156
|
+
// popover/dropdown/color/grid actions are handled via toggle
|
|
157
|
+
case 'indentIncrease':
|
|
158
|
+
if (editor.isActive('bulletList') || editor.isActive('orderedList')) {
|
|
159
|
+
chain.sinkListItem('listItem').run();
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
chain.indent().run();
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
case 'indentDecrease':
|
|
166
|
+
if (editor.isActive('bulletList') || editor.isActive('orderedList')) {
|
|
167
|
+
chain.liftListItem('listItem').run();
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
chain.outdent().run();
|
|
171
|
+
}
|
|
172
|
+
break;
|
|
173
|
+
case 'link':
|
|
174
|
+
case 'image':
|
|
175
|
+
case 'youtube':
|
|
176
|
+
case 'iframe':
|
|
177
|
+
case 'callout':
|
|
178
|
+
case 'fontSize':
|
|
179
|
+
case 'fontFamily':
|
|
180
|
+
case 'headingStyle':
|
|
181
|
+
case 'lineSpacing':
|
|
182
|
+
case 'letterSpacing':
|
|
183
|
+
case 'table':
|
|
184
|
+
case 'textColor':
|
|
185
|
+
case 'highlight':
|
|
186
|
+
this.togglePopover(item.action);
|
|
187
|
+
return; // don't emit action yet
|
|
188
|
+
default: chain.run();
|
|
189
|
+
}
|
|
190
|
+
this.coAction.emit({ action: item.action, payload: item.payload });
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
get s() {
|
|
194
|
+
return getRichTextStrings(this.locale);
|
|
195
|
+
}
|
|
196
|
+
tItem(item) {
|
|
197
|
+
var _a;
|
|
198
|
+
const s = this.s;
|
|
199
|
+
const map = {
|
|
200
|
+
bold: s.bold, italic: s.italic, underline: s.underline,
|
|
201
|
+
strike: s.strikethrough, code: s.code, headingStyle: s.styles,
|
|
202
|
+
fontSize: s.fontSize, fontFamily: s.font,
|
|
203
|
+
bulletList: s.bulletList, orderedList: s.orderedList,
|
|
204
|
+
bulletListMenu: s.bulletList, orderedListMenu: s.orderedList,
|
|
205
|
+
taskListMenu: s.taskList,
|
|
206
|
+
blockquote: s.quote, codeBlock: s.codeBlock,
|
|
207
|
+
horizontalRule: s.horizontalRule,
|
|
208
|
+
link: s.link, image: s.image, youtube: s.youtubeVideo, iframe: s.iframeEmbed,
|
|
209
|
+
table: s.table, textColor: s.textColor, highlight: s.highlight,
|
|
210
|
+
alignment: s.alignment, lineSpacing: s.lineSpacing,
|
|
211
|
+
letterSpacing: s.letterSpacing,
|
|
212
|
+
indentIncrease: s.increaseIndent, indentDecrease: s.decreaseIndent,
|
|
213
|
+
callout: s.callout, undo: s.undo, redo: s.redo,
|
|
214
|
+
addColumnAfter: s.addColumnAfter, addColumnBefore: s.addColumnBefore,
|
|
215
|
+
deleteColumn: s.deleteColumn, addRowAfter: s.addRowAfter,
|
|
216
|
+
addRowBefore: s.addRowBefore, deleteRow: s.deleteRow,
|
|
217
|
+
deleteTable: s.deleteTable, mergeCells: s.mergeCells,
|
|
218
|
+
splitCell: s.splitCell, toggleHeaderRow: s.headerRow,
|
|
219
|
+
};
|
|
220
|
+
return (_a = map[item.action]) !== null && _a !== void 0 ? _a : item.label;
|
|
221
|
+
}
|
|
222
|
+
tOpt(opt) {
|
|
223
|
+
var _a, _b, _c, _d, _e;
|
|
224
|
+
const s = this.s;
|
|
225
|
+
if (opt.action === 'separator')
|
|
226
|
+
return `─── ${s.systemFonts} ───`;
|
|
227
|
+
if (opt.action === 'paragraph')
|
|
228
|
+
return s.normalText;
|
|
229
|
+
if (opt.action === 'heading') {
|
|
230
|
+
const level = (_a = opt.payload) === null || _a === void 0 ? void 0 : _a.level;
|
|
231
|
+
if (level === 1)
|
|
232
|
+
return s.title;
|
|
233
|
+
if (level === 2)
|
|
234
|
+
return s.subtitle;
|
|
235
|
+
if (level === 3)
|
|
236
|
+
return s.heading3;
|
|
237
|
+
}
|
|
238
|
+
if (opt.action === 'bulletStyle') {
|
|
239
|
+
const m = { disc: s.disc, circle: s.circle, square: s.square };
|
|
240
|
+
return (_b = m[opt.payload]) !== null && _b !== void 0 ? _b : opt.label;
|
|
241
|
+
}
|
|
242
|
+
if (opt.action === 'taskStyle') {
|
|
243
|
+
if (opt.payload === 'strike')
|
|
244
|
+
return s.strikeOnComplete;
|
|
245
|
+
if (opt.payload === 'plain')
|
|
246
|
+
return s.noStrikethrough;
|
|
247
|
+
}
|
|
248
|
+
if (opt.action === 'textAlign') {
|
|
249
|
+
const m = { left: s.left, center: s.center, right: s.right, justify: s.justify };
|
|
250
|
+
return (_c = m[opt.payload]) !== null && _c !== void 0 ? _c : opt.label;
|
|
251
|
+
}
|
|
252
|
+
if (opt.action === 'lineHeight') {
|
|
253
|
+
if (opt.payload === '1')
|
|
254
|
+
return s.single;
|
|
255
|
+
if (opt.payload === '2')
|
|
256
|
+
return s.double;
|
|
257
|
+
}
|
|
258
|
+
if (opt.action === 'letterSpacing') {
|
|
259
|
+
const m = { normal: s.normal, '-0.05em': s.tight, '0.05em': s.light, '0.1em': s.wide, '0.2em': s.veryWide };
|
|
260
|
+
return (_d = m[opt.payload]) !== null && _d !== void 0 ? _d : opt.label;
|
|
261
|
+
}
|
|
262
|
+
if (opt.action === 'callout') {
|
|
263
|
+
const m = { info: s.info, warning: s.warning, success: s.success, error: s.error };
|
|
264
|
+
return (_e = m[opt.payload]) !== null && _e !== void 0 ? _e : opt.label;
|
|
265
|
+
}
|
|
266
|
+
return opt.label;
|
|
267
|
+
}
|
|
268
|
+
connectedCallback() {
|
|
269
|
+
this.el.addEventListener('mousedown', this.handleHostMouseDown);
|
|
270
|
+
document.addEventListener('click', this.handleDocumentClick, true);
|
|
271
|
+
}
|
|
272
|
+
componentWillLoad() {
|
|
273
|
+
this.items = this.resolveItems(this.variant);
|
|
274
|
+
this.colorPalette = COLOR_PALETTE;
|
|
275
|
+
this._tableContextItems = TABLE_CONTEXT_ITEMS;
|
|
276
|
+
}
|
|
277
|
+
onVariantChange(v) {
|
|
278
|
+
this.items = this.resolveItems(v);
|
|
279
|
+
}
|
|
280
|
+
onEditorChange(next, prev) {
|
|
281
|
+
prev === null || prev === void 0 ? void 0 : prev.off('transaction', this.onTransaction);
|
|
282
|
+
next === null || next === void 0 ? void 0 : next.on('transaction', this.onTransaction);
|
|
283
|
+
// The active preset decides which extensions are loaded; re-filter now that
|
|
284
|
+
// we can inspect the editor so a toolbar variant wider than the schema
|
|
285
|
+
// (e.g. `full` on a preset without tables/images) drops the dead buttons.
|
|
286
|
+
this.items = this.resolveItems(this.variant);
|
|
287
|
+
this.tick++;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Resolve a variant to the items actually usable in the current editor:
|
|
291
|
+
* hide any control whose extension the active preset didn't load, then
|
|
292
|
+
* collapse the separators left dangling by the removals. Until the editor is
|
|
293
|
+
* wired we can't inspect the schema, so the full variant is shown and
|
|
294
|
+
* re-filtered from `onEditorChange`.
|
|
295
|
+
*/
|
|
296
|
+
resolveItems(variant) {
|
|
297
|
+
const base = toolbarItems((variant === 'none' ? 'compact' : variant));
|
|
298
|
+
const editor = this.editor;
|
|
299
|
+
if (!editor)
|
|
300
|
+
return base;
|
|
301
|
+
const available = (cmd) => {
|
|
302
|
+
try {
|
|
303
|
+
return typeof editor.can()[cmd] === 'function';
|
|
304
|
+
}
|
|
305
|
+
catch (_a) {
|
|
306
|
+
return true; // never hide a control because a probe threw
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const kept = base.filter((entry) => {
|
|
310
|
+
if (this.isSeparator(entry))
|
|
311
|
+
return true;
|
|
312
|
+
const cmd = CoRichTextToolbar.ITEM_COMMAND[entry.action];
|
|
313
|
+
return cmd ? available(cmd) : true;
|
|
314
|
+
});
|
|
315
|
+
// Drop separators that ended up leading, trailing, or doubled-up.
|
|
316
|
+
const out = [];
|
|
317
|
+
for (const entry of kept) {
|
|
318
|
+
if (this.isSeparator(entry) && (!out.length || this.isSeparator(out[out.length - 1])))
|
|
319
|
+
continue;
|
|
320
|
+
out.push(entry);
|
|
321
|
+
}
|
|
322
|
+
if (out.length && this.isSeparator(out[out.length - 1]))
|
|
323
|
+
out.pop();
|
|
324
|
+
return out;
|
|
325
|
+
}
|
|
326
|
+
onOpenPopoverChange(next, prev) {
|
|
327
|
+
if (!!next === !!prev)
|
|
328
|
+
return;
|
|
329
|
+
this.coPopoverChange.emit({ open: !!next });
|
|
330
|
+
}
|
|
331
|
+
disconnectedCallback() {
|
|
332
|
+
var _a;
|
|
333
|
+
(_a = this.editor) === null || _a === void 0 ? void 0 : _a.off('transaction', this.onTransaction);
|
|
334
|
+
this.el.removeEventListener('mousedown', this.handleHostMouseDown);
|
|
335
|
+
document.removeEventListener('click', this.handleDocumentClick, true);
|
|
336
|
+
}
|
|
337
|
+
updateTableContext() {
|
|
338
|
+
if (!this.editor) {
|
|
339
|
+
if (this.tableContextItems.length)
|
|
340
|
+
this.tableContextItems = [];
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const isInTable = this.editor.isActive('table');
|
|
344
|
+
if (isInTable && !this.tableContextItems.length) {
|
|
345
|
+
this.tableContextItems = this._tableContextItems;
|
|
346
|
+
}
|
|
347
|
+
else if (!isInTable && this.tableContextItems.length) {
|
|
348
|
+
this.tableContextItems = [];
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
isSeparator(entry) {
|
|
352
|
+
return entry.type === 'separator';
|
|
353
|
+
}
|
|
354
|
+
isActive(item) {
|
|
355
|
+
if (!this.editor)
|
|
356
|
+
return false;
|
|
357
|
+
try {
|
|
358
|
+
if (item.action === 'textAlign')
|
|
359
|
+
return this.editor.isActive({ textAlign: item.payload });
|
|
360
|
+
if (item.action === 'heading')
|
|
361
|
+
return this.editor.isActive('heading', item.payload);
|
|
362
|
+
if (item.action === 'bulletListMenu')
|
|
363
|
+
return this.editor.isActive('bulletList');
|
|
364
|
+
if (item.action === 'orderedListMenu')
|
|
365
|
+
return this.editor.isActive('orderedList');
|
|
366
|
+
if (item.action === 'taskListMenu')
|
|
367
|
+
return this.editor.isActive('taskList');
|
|
368
|
+
if (item.action === 'iframe')
|
|
369
|
+
return this.editor.isActive('iframe');
|
|
370
|
+
if (item.action === 'youtube')
|
|
371
|
+
return this.editor.isActive('youtube');
|
|
372
|
+
if (item.type === 'toggle')
|
|
373
|
+
return this.editor.isActive(item.action);
|
|
374
|
+
}
|
|
375
|
+
catch ( /* ignore */_a) { /* ignore */ }
|
|
376
|
+
return false;
|
|
377
|
+
}
|
|
378
|
+
/** Toolbar icon that reflects current state (e.g. alignment shows the active alignment). */
|
|
379
|
+
getDynamicIcon(item) {
|
|
380
|
+
if (item.action === 'alignment' && this.editor) {
|
|
381
|
+
if (this.editor.isActive({ textAlign: 'center' }))
|
|
382
|
+
return 'text-align-center';
|
|
383
|
+
if (this.editor.isActive({ textAlign: 'right' }))
|
|
384
|
+
return 'text-align-right';
|
|
385
|
+
if (this.editor.isActive({ textAlign: 'justify' }))
|
|
386
|
+
return 'text-align-justify';
|
|
387
|
+
return 'text-align-left';
|
|
388
|
+
}
|
|
389
|
+
return item.icon;
|
|
390
|
+
}
|
|
391
|
+
togglePopover(action) {
|
|
392
|
+
var _a, _b;
|
|
393
|
+
if (this.openPopover === action) {
|
|
394
|
+
this.openPopover = null;
|
|
395
|
+
this.popoverInput = '';
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
this.openPopover = action;
|
|
399
|
+
this.popoverInput = '';
|
|
400
|
+
// Pre-fill URL if editing existing link or iframe
|
|
401
|
+
if (action === 'link' && ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.isActive('link'))) {
|
|
402
|
+
this.popoverInput = this.editor.getAttributes('link').href || '';
|
|
403
|
+
}
|
|
404
|
+
else if (action === 'iframe' && ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.isActive('iframe'))) {
|
|
405
|
+
this.popoverInput = this.editor.getAttributes('iframe').src || '';
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
closePopover() {
|
|
410
|
+
this.openPopover = null;
|
|
411
|
+
this.popoverInput = '';
|
|
412
|
+
this.colorHexInput = '';
|
|
413
|
+
this.imagePopoverMode = 'menu';
|
|
414
|
+
this.gridLockedRows = 0;
|
|
415
|
+
this.gridLockedCols = 0;
|
|
416
|
+
this.gridHoverRows = 0;
|
|
417
|
+
this.gridHoverCols = 0;
|
|
418
|
+
}
|
|
419
|
+
submitPopover(action) {
|
|
420
|
+
const editor = this.editor;
|
|
421
|
+
if (!editor || !this.popoverInput.trim()) {
|
|
422
|
+
this.closePopover();
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const url = this.popoverInput.trim();
|
|
426
|
+
const isEmbed = action === 'youtube' || action === 'iframe';
|
|
427
|
+
if (isEmbed) {
|
|
428
|
+
editor.view.focus();
|
|
429
|
+
}
|
|
430
|
+
const chain = isEmbed
|
|
431
|
+
? editor.chain()
|
|
432
|
+
: editor.chain().focus();
|
|
433
|
+
switch (action) {
|
|
434
|
+
case 'link':
|
|
435
|
+
chain.setLink({ href: url }).run();
|
|
436
|
+
break;
|
|
437
|
+
case 'image':
|
|
438
|
+
chain.setImage({ src: url }).run();
|
|
439
|
+
break;
|
|
440
|
+
case 'youtube':
|
|
441
|
+
chain.setYoutubeVideo({ src: url }).run();
|
|
442
|
+
break;
|
|
443
|
+
case 'iframe':
|
|
444
|
+
if (editor.isActive('iframe')) {
|
|
445
|
+
chain.updateIframe({ src: url }).run();
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
chain.setIframe({ src: url }).run();
|
|
449
|
+
}
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
this.coAction.emit({ action, payload: url });
|
|
453
|
+
this.closePopover();
|
|
454
|
+
if (isEmbed)
|
|
455
|
+
this.smoothScrollToInserted();
|
|
456
|
+
}
|
|
457
|
+
smoothScrollToInserted() {
|
|
458
|
+
requestAnimationFrame(() => {
|
|
459
|
+
const editor = this.editor;
|
|
460
|
+
if (!editor)
|
|
461
|
+
return;
|
|
462
|
+
const dom = editor.view.dom;
|
|
463
|
+
const selected = dom.querySelector('.ProseMirror-selectednode');
|
|
464
|
+
if (selected) {
|
|
465
|
+
selected.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const { from } = editor.state.selection;
|
|
469
|
+
const resolved = editor.state.doc.resolve(from);
|
|
470
|
+
if (resolved.nodeBefore) {
|
|
471
|
+
try {
|
|
472
|
+
const nodeDom = editor.view.nodeDOM(from - resolved.nodeBefore.nodeSize);
|
|
473
|
+
if (nodeDom instanceof HTMLElement) {
|
|
474
|
+
nodeDom.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
catch ( /* ignore */_a) { /* ignore */ }
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
removeLink() {
|
|
482
|
+
const editor = this.editor;
|
|
483
|
+
if (!editor)
|
|
484
|
+
return;
|
|
485
|
+
editor.chain().focus().unsetLink().run();
|
|
486
|
+
this.coAction.emit({ action: 'link', payload: null });
|
|
487
|
+
this.closePopover();
|
|
488
|
+
}
|
|
489
|
+
removeIframe() {
|
|
490
|
+
const editor = this.editor;
|
|
491
|
+
if (!editor)
|
|
492
|
+
return;
|
|
493
|
+
editor.chain().focus().deleteSelection().run();
|
|
494
|
+
this.coAction.emit({ action: 'iframe', payload: null });
|
|
495
|
+
this.closePopover();
|
|
496
|
+
}
|
|
497
|
+
selectColor(action, color) {
|
|
498
|
+
const editor = this.editor;
|
|
499
|
+
if (!editor)
|
|
500
|
+
return;
|
|
501
|
+
const chain = editor.chain().focus();
|
|
502
|
+
if (action === 'textColor') {
|
|
503
|
+
chain.setColor(color).run();
|
|
504
|
+
}
|
|
505
|
+
else if (action === 'highlight') {
|
|
506
|
+
chain.setHighlight({ color }).run();
|
|
507
|
+
}
|
|
508
|
+
this.coAction.emit({ action, payload: color });
|
|
509
|
+
this.closePopover();
|
|
510
|
+
}
|
|
511
|
+
clearColor(action) {
|
|
512
|
+
const editor = this.editor;
|
|
513
|
+
if (!editor)
|
|
514
|
+
return;
|
|
515
|
+
const chain = editor.chain().focus();
|
|
516
|
+
if (action === 'textColor') {
|
|
517
|
+
chain.unsetColor().run();
|
|
518
|
+
}
|
|
519
|
+
else if (action === 'highlight') {
|
|
520
|
+
chain.unsetHighlight().run();
|
|
521
|
+
}
|
|
522
|
+
this.coAction.emit({ action, payload: null });
|
|
523
|
+
this.closePopover();
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Whether an action is allowed in the current selection. Beyond undo/redo,
|
|
527
|
+
* this disables commands that would produce content the editor can't
|
|
528
|
+
* represent — most importantly the Table button while the cursor is already
|
|
529
|
+
* inside a table, since nested tables are invalid and corrupt the document
|
|
530
|
+
* when it's reloaded (tiptap throws "Invalid HTML content" on such markup).
|
|
531
|
+
*
|
|
532
|
+
* Each command is probed through tiptap's `can()` dry-run, so a button also
|
|
533
|
+
* disables automatically anywhere ProseMirror's schema would reject it (e.g.
|
|
534
|
+
* marks inside a code block). The probe defaults to enabled on any error or
|
|
535
|
+
* unknown command so a quirk never makes a control silently disappear.
|
|
536
|
+
*/
|
|
537
|
+
/**
|
|
538
|
+
* Whether an action can run *right now*. Extension availability is already
|
|
539
|
+
* handled by `resolveItems` (unavailable controls aren't rendered), so this
|
|
540
|
+
* only covers the dynamic, cursor-dependent cases: the hard "no table inside
|
|
541
|
+
* a table" rule, and position validity (e.g. marks inside a code block) via
|
|
542
|
+
* tiptap's `can()` dry-run. A thrown dry-run defaults to enabled so a quirk
|
|
543
|
+
* never makes a visible control silently lock up.
|
|
544
|
+
*/
|
|
545
|
+
canRun(item) {
|
|
546
|
+
if (!this.editor || this.disabled)
|
|
547
|
+
return false;
|
|
548
|
+
const editor = this.editor;
|
|
549
|
+
const can = editor.can();
|
|
550
|
+
const probe = (name, ...args) => {
|
|
551
|
+
if (typeof can[name] !== 'function')
|
|
552
|
+
return true;
|
|
553
|
+
try {
|
|
554
|
+
return can[name](...args);
|
|
555
|
+
}
|
|
556
|
+
catch (_a) {
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
switch (item.action) {
|
|
561
|
+
case 'undo': return probe('undo');
|
|
562
|
+
case 'redo': return probe('redo');
|
|
563
|
+
// Hard rule: a table can never nest inside another table.
|
|
564
|
+
case 'table': return !editor.isActive('table');
|
|
565
|
+
case 'bold': return probe('toggleBold');
|
|
566
|
+
case 'italic': return probe('toggleItalic');
|
|
567
|
+
case 'underline': return probe('toggleUnderline');
|
|
568
|
+
case 'strike': return probe('toggleStrike');
|
|
569
|
+
case 'code': return probe('toggleCode');
|
|
570
|
+
case 'blockquote': return probe('toggleBlockquote');
|
|
571
|
+
case 'codeBlock': return probe('toggleCodeBlock');
|
|
572
|
+
case 'horizontalRule': return probe('setHorizontalRule');
|
|
573
|
+
case 'bulletList':
|
|
574
|
+
case 'bulletListMenu': return probe('toggleBulletList');
|
|
575
|
+
case 'orderedList':
|
|
576
|
+
case 'orderedListMenu': return probe('toggleOrderedList');
|
|
577
|
+
case 'taskListMenu': return probe('toggleTaskList');
|
|
578
|
+
default: return true;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
getDropdownLabel(item) {
|
|
582
|
+
if (!this.editor)
|
|
583
|
+
return null;
|
|
584
|
+
const s = this.s;
|
|
585
|
+
if (item.action === 'headingStyle') {
|
|
586
|
+
if (this.editor.isActive('heading', { level: 1 }))
|
|
587
|
+
return s.title;
|
|
588
|
+
if (this.editor.isActive('heading', { level: 2 }))
|
|
589
|
+
return s.subtitle;
|
|
590
|
+
if (this.editor.isActive('heading', { level: 3 }))
|
|
591
|
+
return s.headingAbbr3;
|
|
592
|
+
return s.normal;
|
|
593
|
+
}
|
|
594
|
+
if (item.action === 'fontSize') {
|
|
595
|
+
const attrs = this.editor.getAttributes('textStyle');
|
|
596
|
+
const fs = attrs === null || attrs === void 0 ? void 0 : attrs.fontSize;
|
|
597
|
+
return fs ? fs.replace('px', '') : '16';
|
|
598
|
+
}
|
|
599
|
+
if (item.action === 'fontFamily') {
|
|
600
|
+
const attrs = this.editor.getAttributes('textStyle');
|
|
601
|
+
const ff = attrs === null || attrs === void 0 ? void 0 : attrs.fontFamily;
|
|
602
|
+
if (!ff)
|
|
603
|
+
return 'Sans-serif';
|
|
604
|
+
const match = ff.replace(/['"]/g, '').split(',')[0].trim();
|
|
605
|
+
return match.length > 10 ? match.substring(0, 10) + '…' : match;
|
|
606
|
+
}
|
|
607
|
+
return null;
|
|
608
|
+
}
|
|
609
|
+
getActiveColor(action) {
|
|
610
|
+
var _a, _b;
|
|
611
|
+
if (!this.editor)
|
|
612
|
+
return action === 'textColor' ? '#000000' : 'transparent';
|
|
613
|
+
const attrs = this.editor.getAttributes('textStyle');
|
|
614
|
+
if (action === 'textColor')
|
|
615
|
+
return (_a = attrs === null || attrs === void 0 ? void 0 : attrs.color) !== null && _a !== void 0 ? _a : '#000000';
|
|
616
|
+
const hlAttrs = this.editor.getAttributes('highlight');
|
|
617
|
+
return (_b = hlAttrs === null || hlAttrs === void 0 ? void 0 : hlAttrs.color) !== null && _b !== void 0 ? _b : 'transparent';
|
|
618
|
+
}
|
|
619
|
+
renderButton(item) {
|
|
620
|
+
var _a, _b;
|
|
621
|
+
const isPopoverType = item.type === 'popover' || item.type === 'dropdown' || item.type === 'color' || item.type === 'grid';
|
|
622
|
+
const isOpen = this.openPopover === item.action;
|
|
623
|
+
const isLabelDropdown = item.action === 'headingStyle' || item.action === 'fontSize' || item.action === 'fontFamily';
|
|
624
|
+
const dropdownLabel = isLabelDropdown ? this.getDropdownLabel(item) : null;
|
|
625
|
+
// Alignment: render as icon-only button group (Google Docs style)
|
|
626
|
+
if (item.action === 'alignment' && ((_a = item.options) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
627
|
+
return this.renderAlignmentGroup(item);
|
|
628
|
+
}
|
|
629
|
+
// Split button: main area toggles, caret opens the marker-style grid.
|
|
630
|
+
if (item.type === 'listpicker') {
|
|
631
|
+
const active = this.isActive(item);
|
|
632
|
+
const label = this.tItem(item);
|
|
633
|
+
return (h("div", { class: "co-rich-text-toolbar__split-wrap", key: item.action }, h("button", { type: "button", class: {
|
|
634
|
+
'co-rich-text-toolbar__btn': true,
|
|
635
|
+
'co-rich-text-toolbar__split-main': true,
|
|
636
|
+
'co-rich-text-toolbar__btn--active': active,
|
|
637
|
+
}, "data-tooltip": label, "aria-label": label, "aria-pressed": String(active), disabled: !this.canRun(item), onMouseDown: (e) => e.preventDefault(), onClick: () => this.run(item), part: "button" }, h("co-icon", { name: item.icon, size: 18 })), h("button", { type: "button", class: {
|
|
638
|
+
'co-rich-text-toolbar__split-caret': true,
|
|
639
|
+
'co-rich-text-toolbar__split-caret--open': isOpen,
|
|
640
|
+
}, "data-tooltip": `${this.s.stylesPrefix} ${label}`, "aria-label": `${this.s.stylesPrefix} ${label}`, "aria-expanded": String(isOpen), disabled: !this.canRun(item), onMouseDown: (e) => e.preventDefault(), onClick: () => this.togglePopover(item.action) }, h("co-icon", { name: "caret-down", size: 10 })), isOpen && this.renderListPicker(item)));
|
|
641
|
+
}
|
|
642
|
+
// Color buttons: render with color indicator bar
|
|
643
|
+
if (item.type === 'color') {
|
|
644
|
+
return this.renderColorButton(item);
|
|
645
|
+
}
|
|
646
|
+
const itemLabel = this.tItem(item);
|
|
647
|
+
return (h("div", { class: "co-rich-text-toolbar__btn-wrap", key: `${item.action}-${JSON.stringify((_b = item.payload) !== null && _b !== void 0 ? _b : '')}` }, isLabelDropdown ? (h("button", { type: "button", class: {
|
|
648
|
+
'co-rich-text-toolbar__select-btn': true,
|
|
649
|
+
'co-rich-text-toolbar__select-btn--open': isOpen,
|
|
650
|
+
}, "data-tooltip": itemLabel, "aria-label": itemLabel, "aria-expanded": String(isOpen), disabled: !this.canRun(item), onMouseDown: (e) => e.preventDefault(), onClick: () => this.run(item), part: "button" }, h("span", { class: "co-rich-text-toolbar__select-label" }, dropdownLabel), h("co-icon", { name: "caret-down", size: 10 }))) : (h("button", { type: "button", class: {
|
|
651
|
+
'co-rich-text-toolbar__btn': true,
|
|
652
|
+
'co-rich-text-toolbar__btn--active': this.isActive(item) || isOpen,
|
|
653
|
+
}, "data-tooltip": itemLabel, "aria-label": itemLabel, "aria-pressed": item.type === 'toggle' ? String(this.isActive(item)) : undefined, "aria-expanded": isPopoverType ? String(isOpen) : undefined, disabled: !this.canRun(item), onMouseDown: (e) => e.preventDefault(), onClick: () => this.run(item), part: "button" }, h("co-icon", { name: this.getDynamicIcon(item), size: 18 }))), isOpen && item.type === 'popover' && this.renderInputPopover(item), isOpen && item.type === 'dropdown' && this.renderDropdown(item), isOpen && item.type === 'grid' && this.renderTableGrid()));
|
|
654
|
+
}
|
|
655
|
+
renderAlignmentGroup(item) {
|
|
656
|
+
const s = this.s;
|
|
657
|
+
const alignLabels = {
|
|
658
|
+
left: s.alignLeft, center: s.center, right: s.alignRight, justify: s.justify,
|
|
659
|
+
};
|
|
660
|
+
return (h("div", { class: "co-rich-text-toolbar__align-group", key: item.action }, item.options.map((opt) => {
|
|
661
|
+
var _a, _b, _c;
|
|
662
|
+
const active = (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.isActive({ textAlign: opt.payload })) !== null && _b !== void 0 ? _b : false;
|
|
663
|
+
const label = (_c = alignLabels[opt.payload]) !== null && _c !== void 0 ? _c : opt.label;
|
|
664
|
+
return (h("button", { type: "button", class: {
|
|
665
|
+
'co-rich-text-toolbar__btn': true,
|
|
666
|
+
'co-rich-text-toolbar__btn--active': active,
|
|
667
|
+
}, "data-tooltip": label, "aria-label": label, "aria-pressed": String(active), disabled: !this.editor || this.disabled, onMouseDown: (e) => e.preventDefault(), onClick: () => {
|
|
668
|
+
if (!this.editor)
|
|
669
|
+
return;
|
|
670
|
+
this.editor.chain().focus().setTextAlign(opt.payload).run();
|
|
671
|
+
this.coAction.emit({ action: 'textAlign', payload: opt.payload });
|
|
672
|
+
}, part: "button" }, h("co-icon", { name: opt.icon, size: 18 })));
|
|
673
|
+
})));
|
|
674
|
+
}
|
|
675
|
+
renderColorButton(item) {
|
|
676
|
+
const isOpen = this.openPopover === item.action;
|
|
677
|
+
const itemLabel = this.tItem(item);
|
|
678
|
+
const activeColor = this.getActiveColor(item.action);
|
|
679
|
+
const isTextColor = item.action === 'textColor';
|
|
680
|
+
return (h("div", { class: "co-rich-text-toolbar__btn-wrap", key: item.action }, h("button", { type: "button", class: {
|
|
681
|
+
'co-rich-text-toolbar__btn': true,
|
|
682
|
+
'co-rich-text-toolbar__btn--active': isOpen,
|
|
683
|
+
}, "data-tooltip": itemLabel, "aria-label": itemLabel, "aria-expanded": String(isOpen), disabled: !this.canRun(item), onMouseDown: (e) => e.preventDefault(), onClick: () => this.run(item), part: "button" }, isTextColor ? (h("span", { class: "co-rich-text-toolbar__color-indicator" }, h("span", { class: "co-rich-text-toolbar__color-letter" }, "A"), h("span", { class: "co-rich-text-toolbar__color-bar", style: { background: activeColor } }))) : (h("span", { class: "co-rich-text-toolbar__color-indicator" }, h("co-icon", { name: item.icon, size: 16 }), h("span", { class: "co-rich-text-toolbar__color-bar", style: { background: activeColor === 'transparent' ? '#cccccc' : activeColor } })))), isOpen && this.renderColorPicker(item)));
|
|
684
|
+
}
|
|
685
|
+
/** Visual grid of list-marker styles (Google-Docs style). */
|
|
686
|
+
renderListPicker(item) {
|
|
687
|
+
var _a, _b;
|
|
688
|
+
if (!((_a = item.options) === null || _a === void 0 ? void 0 : _a.length))
|
|
689
|
+
return null;
|
|
690
|
+
if (item.action === 'taskListMenu')
|
|
691
|
+
return this.renderTaskListPicker(item);
|
|
692
|
+
const isOrdered = item.action === 'orderedListMenu';
|
|
693
|
+
const activeStyle = this.editor
|
|
694
|
+
? (_b = this.editor.getAttributes(isOrdered ? 'orderedList' : 'bulletList')) === null || _b === void 0 ? void 0 : _b.listStyleType
|
|
695
|
+
: null;
|
|
696
|
+
return (h("div", { class: "co-rich-text-toolbar__listpicker", onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); } }, item.options.map((opt) => {
|
|
697
|
+
const isActive = activeStyle === opt.payload;
|
|
698
|
+
return (h("button", { type: "button", class: {
|
|
699
|
+
'co-rich-text-toolbar__listpicker-item': true,
|
|
700
|
+
'co-rich-text-toolbar__listpicker-item--active': isActive,
|
|
701
|
+
}, "data-tooltip": opt.label, onMouseDown: (e) => e.preventDefault(), onClick: () => this.applyListStyle(isOrdered, opt.payload) }, h("ol", { class: {
|
|
702
|
+
'co-rich-text-toolbar__listpicker-preview': true,
|
|
703
|
+
'co-rich-text-toolbar__listpicker-preview--ordered': isOrdered,
|
|
704
|
+
}, style: { 'list-style-type': opt.payload } }, h("li", null), h("li", null), h("li", null))));
|
|
705
|
+
})));
|
|
706
|
+
}
|
|
707
|
+
/** Visual picker for task-list variants (checkboxes; strike vs plain). */
|
|
708
|
+
renderTaskListPicker(item) {
|
|
709
|
+
var _a, _b;
|
|
710
|
+
const activeVariant = this.editor && this.editor.isActive('taskList')
|
|
711
|
+
? ((_b = (_a = this.editor.getAttributes('taskList')) === null || _a === void 0 ? void 0 : _a.variant) !== null && _b !== void 0 ? _b : 'strike')
|
|
712
|
+
: null;
|
|
713
|
+
return (h("div", { class: "co-rich-text-toolbar__listpicker co-rich-text-toolbar__listpicker--task", onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); } }, item.options.map((opt) => {
|
|
714
|
+
const variant = opt.payload;
|
|
715
|
+
const isActive = activeVariant === variant;
|
|
716
|
+
return (h("button", { type: "button", class: {
|
|
717
|
+
'co-rich-text-toolbar__listpicker-item': true,
|
|
718
|
+
'co-rich-text-toolbar__listpicker-item--task': true,
|
|
719
|
+
'co-rich-text-toolbar__listpicker-item--active': isActive,
|
|
720
|
+
}, "data-tooltip": opt.label, onMouseDown: (e) => e.preventDefault(), onClick: () => this.applyTaskStyle(variant) }, h("span", { class: "co-rich-text-toolbar__taskpreview", "data-variant": variant }, h("span", { class: "co-rich-text-toolbar__taskpreview-row" }, h("span", { class: "co-rich-text-toolbar__taskpreview-box" }), h("span", { class: "co-rich-text-toolbar__taskpreview-line" })), h("span", { class: "co-rich-text-toolbar__taskpreview-row co-rich-text-toolbar__taskpreview-row--checked" }, h("span", { class: "co-rich-text-toolbar__taskpreview-box co-rich-text-toolbar__taskpreview-box--checked" }), h("span", { class: "co-rich-text-toolbar__taskpreview-line" })))));
|
|
721
|
+
})));
|
|
722
|
+
}
|
|
723
|
+
applyListStyle(isOrdered, style) {
|
|
724
|
+
const editor = this.editor;
|
|
725
|
+
if (!editor)
|
|
726
|
+
return;
|
|
727
|
+
const chain = editor.chain().focus();
|
|
728
|
+
// Ensure the right list type is active, then apply the marker style.
|
|
729
|
+
if (isOrdered) {
|
|
730
|
+
if (!editor.isActive('orderedList'))
|
|
731
|
+
chain.toggleOrderedList();
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
if (!editor.isActive('bulletList'))
|
|
735
|
+
chain.toggleBulletList();
|
|
736
|
+
}
|
|
737
|
+
chain.setListStyleType(style).run();
|
|
738
|
+
this.coAction.emit({ action: isOrdered ? 'orderedStyle' : 'bulletStyle', payload: style });
|
|
739
|
+
this.closePopover();
|
|
740
|
+
}
|
|
741
|
+
applyTaskStyle(variant) {
|
|
742
|
+
const editor = this.editor;
|
|
743
|
+
if (!editor)
|
|
744
|
+
return;
|
|
745
|
+
const chain = editor.chain().focus();
|
|
746
|
+
if (!editor.isActive('taskList'))
|
|
747
|
+
chain.toggleTaskList();
|
|
748
|
+
chain.setTaskListVariant(variant).run();
|
|
749
|
+
this.coAction.emit({ action: 'taskStyle', payload: variant });
|
|
750
|
+
this.closePopover();
|
|
751
|
+
}
|
|
752
|
+
renderInputPopover(item) {
|
|
753
|
+
var _a, _b;
|
|
754
|
+
if (item.action === 'image')
|
|
755
|
+
return this.renderImagePopover();
|
|
756
|
+
const isLink = item.action === 'link';
|
|
757
|
+
const isIframe = item.action === 'iframe';
|
|
758
|
+
const hasExisting = (isLink && ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.isActive('link'))) || (isIframe && ((_b = this.editor) === null || _b === void 0 ? void 0 : _b.isActive('iframe')));
|
|
759
|
+
const placeholder = item.action === 'iframe'
|
|
760
|
+
? this.s.iframeUrlPlaceholder
|
|
761
|
+
: item.action === 'link'
|
|
762
|
+
? 'https://...'
|
|
763
|
+
: this.s.youtubeUrlPlaceholder;
|
|
764
|
+
return (h("div", { class: "co-rich-text-toolbar__popover", onMouseDown: (e) => {
|
|
765
|
+
if (e.target.tagName !== 'INPUT')
|
|
766
|
+
e.preventDefault();
|
|
767
|
+
e.stopPropagation();
|
|
768
|
+
} }, h("input", { type: "url", class: "co-rich-text-toolbar__popover-input", placeholder: placeholder, value: this.popoverInput, onInput: (e) => { this.popoverInput = e.target.value; }, onKeyDown: (e) => {
|
|
769
|
+
if (e.key === 'Enter')
|
|
770
|
+
this.submitPopover(item.action);
|
|
771
|
+
if (e.key === 'Escape')
|
|
772
|
+
this.closePopover();
|
|
773
|
+
}, ref: (el) => el && setTimeout(() => el.focus(), 0) }), h("div", { class: "co-rich-text-toolbar__popover-actions" }, h("button", { type: "button", class: "co-rich-text-toolbar__popover-btn co-rich-text-toolbar__popover-btn--primary", onMouseDown: (e) => e.preventDefault(), onClick: () => this.submitPopover(item.action) }, this.s.add), hasExisting && (h("button", { type: "button", class: "co-rich-text-toolbar__popover-btn co-rich-text-toolbar__popover-btn--danger", onMouseDown: (e) => e.preventDefault(), onClick: () => isLink ? this.removeLink() : this.removeIframe() }, this.s.remove)), h("button", { type: "button", class: "co-rich-text-toolbar__popover-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => this.closePopover() }, this.s.cancel))));
|
|
774
|
+
}
|
|
775
|
+
renderImagePopover() {
|
|
776
|
+
if (this.imagePopoverMode === 'url') {
|
|
777
|
+
return (h("div", { class: "co-rich-text-toolbar__popover", onMouseDown: (e) => {
|
|
778
|
+
if (e.target.tagName !== 'INPUT')
|
|
779
|
+
e.preventDefault();
|
|
780
|
+
e.stopPropagation();
|
|
781
|
+
} }, h("input", { type: "url", class: "co-rich-text-toolbar__popover-input", placeholder: this.s.imageUrlPlaceholder, value: this.popoverInput, onInput: (e) => { this.popoverInput = e.target.value; }, onKeyDown: (e) => {
|
|
782
|
+
if (e.key === 'Enter')
|
|
783
|
+
this.submitPopover('image');
|
|
784
|
+
if (e.key === 'Escape') {
|
|
785
|
+
this.imagePopoverMode = 'menu';
|
|
786
|
+
}
|
|
787
|
+
}, ref: (el) => el && setTimeout(() => el.focus(), 0) }), h("div", { class: "co-rich-text-toolbar__popover-actions" }, h("button", { type: "button", class: "co-rich-text-toolbar__popover-btn co-rich-text-toolbar__popover-btn--primary", onMouseDown: (e) => e.preventDefault(), onClick: () => this.submitPopover('image') }, this.s.add), h("button", { type: "button", class: "co-rich-text-toolbar__popover-btn", onMouseDown: (e) => e.preventDefault(), onClick: () => { this.imagePopoverMode = 'menu'; } }, this.s.back))));
|
|
788
|
+
}
|
|
789
|
+
return (h("div", { class: "co-rich-text-toolbar__popover", onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); } }, h("button", { type: "button", class: "co-rich-text-toolbar__popover-option", onMouseDown: (e) => e.preventDefault(), onClick: () => this.triggerImageFileUpload() }, h("co-icon", { name: "upload-simple", size: 16 }), h("span", null, this.s.uploadFromComputer)), h("button", { type: "button", class: "co-rich-text-toolbar__popover-option", onMouseDown: (e) => e.preventDefault(), onClick: () => { this.imagePopoverMode = 'url'; } }, h("co-icon", { name: "link", size: 16 }), h("span", null, this.s.viaUrl))));
|
|
790
|
+
}
|
|
791
|
+
triggerImageFileUpload() {
|
|
792
|
+
const input = document.createElement('input');
|
|
793
|
+
input.type = 'file';
|
|
794
|
+
input.accept = 'image/*';
|
|
795
|
+
input.onchange = () => {
|
|
796
|
+
var _a;
|
|
797
|
+
const file = (_a = input.files) === null || _a === void 0 ? void 0 : _a[0];
|
|
798
|
+
if (!file || !this.editor)
|
|
799
|
+
return;
|
|
800
|
+
const reader = new FileReader();
|
|
801
|
+
reader.onload = () => {
|
|
802
|
+
const base64 = reader.result;
|
|
803
|
+
this.editor.chain().focus().setImage({ src: base64 }).run();
|
|
804
|
+
if (this.imageUpload) {
|
|
805
|
+
this.imageUpload(file).then((result) => {
|
|
806
|
+
var _a;
|
|
807
|
+
const newAttrs = typeof result === 'string'
|
|
808
|
+
? { src: result }
|
|
809
|
+
: { src: result.src, dataFileId: (_a = result.fileId) !== null && _a !== void 0 ? _a : null };
|
|
810
|
+
const { state } = this.editor.view;
|
|
811
|
+
state.doc.descendants((node, pos) => {
|
|
812
|
+
if (node.type.name === 'image' && node.attrs.src === base64) {
|
|
813
|
+
const tr = this.editor.view.state.tr.setNodeMarkup(pos, undefined, Object.assign(Object.assign({}, node.attrs), newAttrs));
|
|
814
|
+
this.editor.view.dispatch(tr);
|
|
815
|
+
return false;
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
}).catch(() => { });
|
|
819
|
+
}
|
|
820
|
+
this.coAction.emit({ action: 'image', payload: base64 });
|
|
821
|
+
};
|
|
822
|
+
reader.readAsDataURL(file);
|
|
823
|
+
this.closePopover();
|
|
824
|
+
};
|
|
825
|
+
input.click();
|
|
826
|
+
}
|
|
827
|
+
isDropdownOptionActive(opt) {
|
|
828
|
+
var _a, _b, _c;
|
|
829
|
+
if (!this.editor)
|
|
830
|
+
return false;
|
|
831
|
+
try {
|
|
832
|
+
if (opt.action === 'textAlign')
|
|
833
|
+
return this.editor.isActive({ textAlign: opt.payload });
|
|
834
|
+
if (opt.action === 'lineHeight') {
|
|
835
|
+
const attrs = this.editor.getAttributes('paragraph');
|
|
836
|
+
return ((_a = attrs === null || attrs === void 0 ? void 0 : attrs.lineHeight) !== null && _a !== void 0 ? _a : null) === ((_b = opt.payload) !== null && _b !== void 0 ? _b : null);
|
|
837
|
+
}
|
|
838
|
+
if (opt.action === 'letterSpacing') {
|
|
839
|
+
const attrs = this.editor.getAttributes('textStyle');
|
|
840
|
+
const cur = (_c = attrs === null || attrs === void 0 ? void 0 : attrs.letterSpacing) !== null && _c !== void 0 ? _c : null;
|
|
841
|
+
if (opt.payload === 'normal')
|
|
842
|
+
return cur === null || cur === 'normal';
|
|
843
|
+
return cur === opt.payload;
|
|
844
|
+
}
|
|
845
|
+
if (opt.action === 'heading')
|
|
846
|
+
return this.editor.isActive('heading', opt.payload);
|
|
847
|
+
if (opt.action === 'paragraph')
|
|
848
|
+
return !this.editor.isActive('heading');
|
|
849
|
+
}
|
|
850
|
+
catch ( /* ignore */_d) { /* ignore */ }
|
|
851
|
+
return false;
|
|
852
|
+
}
|
|
853
|
+
/** Apply a free-form value typed into a dropdown's custom input. */
|
|
854
|
+
applyDropdownCustom(action, raw) {
|
|
855
|
+
const editor = this.editor;
|
|
856
|
+
const value = raw.trim();
|
|
857
|
+
if (!editor || !value)
|
|
858
|
+
return;
|
|
859
|
+
const chain = editor.chain().focus();
|
|
860
|
+
if (action === 'fontSize') {
|
|
861
|
+
const n = parseFloat(value);
|
|
862
|
+
if (!(n > 0))
|
|
863
|
+
return;
|
|
864
|
+
chain.setFontSize(/^\d+(\.\d+)?$/.test(value) ? `${n}px` : value).run();
|
|
865
|
+
}
|
|
866
|
+
else if (action === 'lineSpacing') {
|
|
867
|
+
chain.setLineHeight(value).run();
|
|
868
|
+
}
|
|
869
|
+
else if (action === 'letterSpacing') {
|
|
870
|
+
if (value === 'normal')
|
|
871
|
+
chain.unsetLetterSpacing().run();
|
|
872
|
+
else
|
|
873
|
+
chain.setLetterSpacing(value).run();
|
|
874
|
+
}
|
|
875
|
+
this.closePopover();
|
|
876
|
+
}
|
|
877
|
+
renderDropdown(item) {
|
|
878
|
+
var _a;
|
|
879
|
+
if (!((_a = item.options) === null || _a === void 0 ? void 0 : _a.length))
|
|
880
|
+
return null;
|
|
881
|
+
const isFontSize = item.action === 'fontSize';
|
|
882
|
+
const isFontFamily = item.action === 'fontFamily';
|
|
883
|
+
const isHeadingStyle = item.action === 'headingStyle';
|
|
884
|
+
const isAlignment = item.action === 'alignment';
|
|
885
|
+
const isLineSpacing = item.action === 'lineSpacing';
|
|
886
|
+
const isLetterSpacing = item.action === 'letterSpacing';
|
|
887
|
+
const showCheckmarks = isAlignment || isLineSpacing || isLetterSpacing || isHeadingStyle;
|
|
888
|
+
const customInput = isFontSize
|
|
889
|
+
? { placeholder: this.s.sizePlaceholder }
|
|
890
|
+
: isLineSpacing
|
|
891
|
+
? { placeholder: this.s.lineSpacingPlaceholder }
|
|
892
|
+
: isLetterSpacing
|
|
893
|
+
? { placeholder: this.s.letterSpacingPlaceholder }
|
|
894
|
+
: null;
|
|
895
|
+
return (h("div", { class: "co-rich-text-toolbar__dropdown", onMouseDown: (e) => { e.preventDefault(); e.stopPropagation(); } }, customInput && (h("div", { class: "co-rich-text-toolbar__dropdown-input-wrap" }, h("input", { type: "text", class: "co-rich-text-toolbar__dropdown-input", placeholder: customInput.placeholder, onMouseDown: (e) => e.stopPropagation(), onKeyDown: (e) => {
|
|
896
|
+
if (e.key === 'Enter') {
|
|
897
|
+
this.applyDropdownCustom(item.action, e.target.value);
|
|
898
|
+
e.target.value = '';
|
|
899
|
+
}
|
|
900
|
+
else if (e.key === 'Escape') {
|
|
901
|
+
this.closePopover();
|
|
902
|
+
}
|
|
903
|
+
} }))), item.options.map((opt) => {
|
|
904
|
+
var _a;
|
|
905
|
+
if (opt.action === 'separator') {
|
|
906
|
+
return (h("div", { class: "co-rich-text-toolbar__dropdown-sep-label" }, h("span", null, this.tOpt(opt))));
|
|
907
|
+
}
|
|
908
|
+
const style = {};
|
|
909
|
+
const active = showCheckmarks && this.isDropdownOptionActive(opt);
|
|
910
|
+
if (isHeadingStyle) {
|
|
911
|
+
if (opt.action === 'heading') {
|
|
912
|
+
const lvl = (_a = opt.payload) === null || _a === void 0 ? void 0 : _a.level;
|
|
913
|
+
style.fontSize = lvl === 1 ? '20px' : lvl === 2 ? '16px' : '14px';
|
|
914
|
+
style.fontWeight = '600';
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
if (isFontFamily && opt.payload) {
|
|
918
|
+
style.fontFamily = opt.payload;
|
|
919
|
+
}
|
|
920
|
+
return (h("button", { type: "button", class: {
|
|
921
|
+
'co-rich-text-toolbar__dropdown-item': true,
|
|
922
|
+
'co-rich-text-toolbar__dropdown-item--active': active,
|
|
923
|
+
}, style: style, onMouseDown: (e) => e.preventDefault(), onClick: () => this.handleDropdownSelect(item, opt) }, showCheckmarks && (h("span", { class: "co-rich-text-toolbar__dropdown-check" }, active ? h("co-icon", { name: "check", size: 14 }) : null)), opt.icon && h("co-icon", { name: opt.icon, size: 16 }), h("span", null, this.tOpt(opt))));
|
|
924
|
+
})));
|
|
925
|
+
}
|
|
926
|
+
handleDropdownSelect(item, opt) {
|
|
927
|
+
const editor = this.editor;
|
|
928
|
+
if (!editor)
|
|
929
|
+
return;
|
|
930
|
+
const chain = editor.chain().focus();
|
|
931
|
+
switch (opt.action) {
|
|
932
|
+
case 'heading':
|
|
933
|
+
chain.toggleHeading(opt.payload).run();
|
|
934
|
+
break;
|
|
935
|
+
case 'paragraph':
|
|
936
|
+
chain.setParagraph().run();
|
|
937
|
+
break;
|
|
938
|
+
case 'fontSize':
|
|
939
|
+
chain.setFontSize(opt.payload).run();
|
|
940
|
+
break;
|
|
941
|
+
case 'fontFamily':
|
|
942
|
+
chain.setFontFamily(opt.payload).run();
|
|
943
|
+
break;
|
|
944
|
+
case 'textAlign':
|
|
945
|
+
chain.setTextAlign(opt.payload).run();
|
|
946
|
+
break;
|
|
947
|
+
case 'lineHeight':
|
|
948
|
+
chain.setLineHeight(opt.payload).run();
|
|
949
|
+
break;
|
|
950
|
+
case 'letterSpacing':
|
|
951
|
+
if (opt.payload === 'normal')
|
|
952
|
+
chain.unsetLetterSpacing().run();
|
|
953
|
+
else
|
|
954
|
+
chain.setLetterSpacing(opt.payload).run();
|
|
955
|
+
break;
|
|
956
|
+
case 'callout':
|
|
957
|
+
chain.insertCallout(opt.payload).run();
|
|
958
|
+
break;
|
|
959
|
+
default:
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
this.coAction.emit({ action: opt.action, payload: opt.payload });
|
|
963
|
+
this.closePopover();
|
|
964
|
+
}
|
|
965
|
+
renderTableGrid() {
|
|
966
|
+
return (h("div", { class: "co-rich-text-toolbar__table-picker", onMouseDown: (e) => {
|
|
967
|
+
if (e.target.tagName !== 'INPUT')
|
|
968
|
+
e.preventDefault();
|
|
969
|
+
e.stopPropagation();
|
|
970
|
+
} }, h("div", { class: "co-rich-text-toolbar__table-header" }, h("co-icon", { name: "table", size: 16 }), h("span", { class: "co-rich-text-toolbar__table-title" }, this.s.configureTable), h("button", { type: "button", class: "co-rich-text-toolbar__table-close", onMouseDown: (e) => e.preventDefault(), onClick: () => this.closePopover() }, h("co-icon", { name: "x", size: 16 }))), h("div", { class: "co-rich-text-toolbar__table-tabs" }, h("button", { type: "button", class: { 'co-rich-text-toolbar__table-tab': true, 'co-rich-text-toolbar__table-tab--active': this.tableTab === 'grid' }, onMouseDown: (e) => e.preventDefault(), onClick: () => { this.tableTab = 'grid'; } }, this.s.grid), h("button", { type: "button", class: { 'co-rich-text-toolbar__table-tab': true, 'co-rich-text-toolbar__table-tab--active': this.tableTab === 'manual' }, onMouseDown: (e) => e.preventDefault(), onClick: () => { this.tableTab = 'manual'; } }, this.s.manual)), this.tableTab === 'grid' && this.renderGridTab(), this.tableTab === 'manual' && this.renderManualTab(), h("label", { class: "co-rich-text-toolbar__table-check" }, h("input", { type: "checkbox", checked: this.tableWithHeader, onChange: (e) => { this.tableWithHeader = e.target.checked; } }), h("span", null, this.s.includeHeaderRow)), this.tableTab === 'manual' && (h("div", { class: "co-rich-text-toolbar__table-actions" }, h("button", { type: "button", class: "co-rich-text-toolbar__table-btn co-rich-text-toolbar__table-btn--secondary", onMouseDown: (e) => e.preventDefault(), onClick: () => this.closePopover() }, this.s.cancel), h("button", { type: "button", class: "co-rich-text-toolbar__table-btn co-rich-text-toolbar__table-btn--primary", onMouseDown: (e) => e.preventDefault(), onClick: () => this.insertTable(this.tableManualRows, this.tableManualCols) }, this.s.createTable)))));
|
|
971
|
+
}
|
|
972
|
+
renderGridTab() {
|
|
973
|
+
const ROWS = 8;
|
|
974
|
+
const COLS = 8;
|
|
975
|
+
const cells = [];
|
|
976
|
+
const isLocked = this.gridLockedRows > 0;
|
|
977
|
+
const displayRows = isLocked ? this.gridLockedRows : this.gridHoverRows;
|
|
978
|
+
const displayCols = isLocked ? this.gridLockedCols : this.gridHoverCols;
|
|
979
|
+
for (let r = 1; r <= ROWS; r++) {
|
|
980
|
+
for (let c = 1; c <= COLS; c++) {
|
|
981
|
+
const isHighlighted = r <= displayRows && c <= displayCols;
|
|
982
|
+
cells.push(h("div", { class: { 'co-rich-text-toolbar__grid-cell': true, 'co-rich-text-toolbar__grid-cell--active': isHighlighted }, onMouseEnter: () => {
|
|
983
|
+
if (!isLocked) {
|
|
984
|
+
this.gridHoverRows = r;
|
|
985
|
+
this.gridHoverCols = c;
|
|
986
|
+
}
|
|
987
|
+
}, onMouseDown: (e) => e.preventDefault(), onClick: () => { this.gridLockedRows = r; this.gridLockedCols = c; } }));
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
const s = this.s;
|
|
991
|
+
const label = displayRows > 0
|
|
992
|
+
? `${displayCols} × ${displayRows} (${displayCols} ${s.columns.toLowerCase()} × ${displayRows} ${s.rows.toLowerCase()})`
|
|
993
|
+
: s.selectSize;
|
|
994
|
+
return (h("div", { class: "co-rich-text-toolbar__grid-container", onMouseLeave: () => {
|
|
995
|
+
if (!isLocked) {
|
|
996
|
+
this.gridHoverRows = 0;
|
|
997
|
+
this.gridHoverCols = 0;
|
|
998
|
+
}
|
|
999
|
+
} }, h("div", { class: "co-rich-text-toolbar__grid", style: { 'grid-template-columns': `repeat(${COLS}, 1fr)` } }, cells), h("div", { class: "co-rich-text-toolbar__grid-footer" }, h("span", { class: "co-rich-text-toolbar__grid-label" }, label), isLocked && (h("button", { type: "button", class: "co-rich-text-toolbar__grid-reset", onMouseDown: (e) => e.preventDefault(), onClick: () => { this.gridLockedRows = 0; this.gridLockedCols = 0; this.gridHoverRows = 0; this.gridHoverCols = 0; } }, s.changeSelection))), isLocked && (h("div", { class: "co-rich-text-toolbar__table-actions" }, h("button", { type: "button", class: "co-rich-text-toolbar__table-btn co-rich-text-toolbar__table-btn--secondary", onMouseDown: (e) => e.preventDefault(), onClick: () => this.closePopover() }, s.cancel), h("button", { type: "button", class: "co-rich-text-toolbar__table-btn co-rich-text-toolbar__table-btn--primary", onMouseDown: (e) => e.preventDefault(), onClick: () => this.insertTable(this.gridLockedRows, this.gridLockedCols) }, s.createTable)))));
|
|
1000
|
+
}
|
|
1001
|
+
renderManualTab() {
|
|
1002
|
+
return (h("div", { class: "co-rich-text-toolbar__table-manual" }, h("div", { class: "co-rich-text-toolbar__table-field" }, h("label", null, this.s.columns, ":"), h("input", { type: "number", min: "1", max: "20", value: this.tableManualCols, onInput: (e) => { this.tableManualCols = Math.max(1, parseInt(e.target.value) || 1); } })), h("div", { class: "co-rich-text-toolbar__table-field" }, h("label", null, this.s.rows, ":"), h("input", { type: "number", min: "1", max: "50", value: this.tableManualRows, onInput: (e) => { this.tableManualRows = Math.max(1, parseInt(e.target.value) || 1); } }))));
|
|
1003
|
+
}
|
|
1004
|
+
insertTable(rows, cols) {
|
|
1005
|
+
const editor = this.editor;
|
|
1006
|
+
if (!editor)
|
|
1007
|
+
return;
|
|
1008
|
+
// Defense in depth: never nest a table inside a table cell. The toolbar
|
|
1009
|
+
// button is already disabled in this case, but guard the insert itself so
|
|
1010
|
+
// no other caller can produce the invalid markup.
|
|
1011
|
+
if (editor.isActive('table')) {
|
|
1012
|
+
this.closePopover();
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
const withHeader = this.tableWithHeader;
|
|
1016
|
+
// Build the table node by hand so a header row can ship with placeholder
|
|
1017
|
+
// titles ("Header 1", "Header 2", …) instead of empty header cells. Tiptap's
|
|
1018
|
+
// insertTable() only toggles header cells on, it can't seed their content.
|
|
1019
|
+
const emptyCell = () => ({ type: 'tableCell', content: [{ type: 'paragraph' }] });
|
|
1020
|
+
const headerCell = (i) => ({
|
|
1021
|
+
type: 'tableHeader',
|
|
1022
|
+
content: [{ type: 'paragraph', content: [{ type: 'text', text: `${this.s.tableHeaderLabel} ${i + 1}` }] }],
|
|
1023
|
+
});
|
|
1024
|
+
const content = [];
|
|
1025
|
+
if (withHeader) {
|
|
1026
|
+
content.push({
|
|
1027
|
+
type: 'tableRow',
|
|
1028
|
+
content: Array.from({ length: cols }, (_, i) => headerCell(i)),
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
const bodyRows = withHeader ? rows - 1 : rows;
|
|
1032
|
+
for (let r = 0; r < bodyRows; r++) {
|
|
1033
|
+
content.push({
|
|
1034
|
+
type: 'tableRow',
|
|
1035
|
+
content: Array.from({ length: cols }, () => emptyCell()),
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
editor.chain().focus().insertContent({ type: 'table', content }).run();
|
|
1039
|
+
this.coAction.emit({ action: 'table', payload: { rows, cols, withHeaderRow: withHeader } });
|
|
1040
|
+
this.closePopover();
|
|
1041
|
+
}
|
|
1042
|
+
renderColorPicker(item) {
|
|
1043
|
+
return (h("div", { class: "co-rich-text-toolbar__color-picker", onMouseDown: (e) => {
|
|
1044
|
+
if (e.target.tagName !== 'INPUT')
|
|
1045
|
+
e.preventDefault();
|
|
1046
|
+
e.stopPropagation();
|
|
1047
|
+
} }, h("div", { class: "co-rich-text-toolbar__color-grid" }, this.colorPalette.map((color) => (h("button", { type: "button", class: "co-rich-text-toolbar__color-swatch", style: Object.assign({ background: color }, (color === '#ffffff' ? { border: '1px solid #ccc' } : {})), title: color, onMouseDown: (e) => e.preventDefault(), onClick: () => this.selectColor(item.action, color) })))), h("div", { class: "co-rich-text-toolbar__color-hex" }, h("input", { type: "text", class: "co-rich-text-toolbar__color-hex-input", placeholder: "#hex", maxLength: 7, value: this.colorHexInput, onInput: (e) => { this.colorHexInput = e.target.value; }, onKeyDown: (e) => {
|
|
1048
|
+
if (e.key === 'Enter') {
|
|
1049
|
+
const val = this.colorHexInput.trim();
|
|
1050
|
+
if (/^#[0-9a-fA-F]{3,6}$/.test(val)) {
|
|
1051
|
+
this.selectColor(item.action, val);
|
|
1052
|
+
this.colorHexInput = '';
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
else if (e.key === 'Escape') {
|
|
1056
|
+
this.closePopover();
|
|
1057
|
+
}
|
|
1058
|
+
} })), h("button", { type: "button", class: "co-rich-text-toolbar__color-clear", onMouseDown: (e) => e.preventDefault(), onClick: () => this.clearColor(item.action) }, h("co-icon", { name: "x", size: 12 }), h("span", null, this.s.removeColor))));
|
|
1059
|
+
}
|
|
1060
|
+
render() {
|
|
1061
|
+
if (this.variant === 'none' || this.items.length === 0)
|
|
1062
|
+
return null;
|
|
1063
|
+
// reference tick so Stencil re-renders on selection changes
|
|
1064
|
+
void this.tick;
|
|
1065
|
+
return (h("div", { class: "co-rich-text-toolbar", role: "toolbar", "aria-label": "Formatting", part: "toolbar" }, this.items.map((entry) => {
|
|
1066
|
+
if (this.isSeparator(entry)) {
|
|
1067
|
+
return h("span", { class: "co-rich-text-toolbar__sep" });
|
|
1068
|
+
}
|
|
1069
|
+
return this.renderButton(entry);
|
|
1070
|
+
})));
|
|
1071
|
+
}
|
|
1072
|
+
static get is() { return "co-rich-text-toolbar"; }
|
|
1073
|
+
static get encapsulation() { return "shadow"; }
|
|
1074
|
+
static get originalStyleUrls() {
|
|
1075
|
+
return {
|
|
1076
|
+
"$": ["co-rich-text-toolbar.css"]
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
static get styleUrls() {
|
|
1080
|
+
return {
|
|
1081
|
+
"$": ["co-rich-text-toolbar.css"]
|
|
1082
|
+
};
|
|
1083
|
+
}
|
|
1084
|
+
static get properties() {
|
|
1085
|
+
return {
|
|
1086
|
+
"editor": {
|
|
1087
|
+
"type": "unknown",
|
|
1088
|
+
"mutable": false,
|
|
1089
|
+
"complexType": {
|
|
1090
|
+
"original": "Editor",
|
|
1091
|
+
"resolved": "Editor | undefined",
|
|
1092
|
+
"references": {
|
|
1093
|
+
"Editor": {
|
|
1094
|
+
"location": "import",
|
|
1095
|
+
"path": "@prolibu-suite/cobalt-rich-text",
|
|
1096
|
+
"id": "../rich-text/dist/index.d.ts::Editor",
|
|
1097
|
+
"referenceLocation": "Editor"
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
"required": false,
|
|
1102
|
+
"optional": true,
|
|
1103
|
+
"docs": {
|
|
1104
|
+
"tags": [],
|
|
1105
|
+
"text": "Editor instance (set as a property by the host editor)."
|
|
1106
|
+
},
|
|
1107
|
+
"getter": false,
|
|
1108
|
+
"setter": false
|
|
1109
|
+
},
|
|
1110
|
+
"variant": {
|
|
1111
|
+
"type": "string",
|
|
1112
|
+
"mutable": false,
|
|
1113
|
+
"complexType": {
|
|
1114
|
+
"original": "'none' | 'compact' | 'basic' | 'full'",
|
|
1115
|
+
"resolved": "\"basic\" | \"compact\" | \"full\" | \"none\"",
|
|
1116
|
+
"references": {}
|
|
1117
|
+
},
|
|
1118
|
+
"required": false,
|
|
1119
|
+
"optional": false,
|
|
1120
|
+
"docs": {
|
|
1121
|
+
"tags": [],
|
|
1122
|
+
"text": "Toolbar layout variant."
|
|
1123
|
+
},
|
|
1124
|
+
"getter": false,
|
|
1125
|
+
"setter": false,
|
|
1126
|
+
"reflect": false,
|
|
1127
|
+
"attribute": "variant",
|
|
1128
|
+
"defaultValue": "'basic'"
|
|
1129
|
+
},
|
|
1130
|
+
"disabled": {
|
|
1131
|
+
"type": "boolean",
|
|
1132
|
+
"mutable": false,
|
|
1133
|
+
"complexType": {
|
|
1134
|
+
"original": "boolean",
|
|
1135
|
+
"resolved": "boolean",
|
|
1136
|
+
"references": {}
|
|
1137
|
+
},
|
|
1138
|
+
"required": false,
|
|
1139
|
+
"optional": false,
|
|
1140
|
+
"docs": {
|
|
1141
|
+
"tags": [],
|
|
1142
|
+
"text": ""
|
|
1143
|
+
},
|
|
1144
|
+
"getter": false,
|
|
1145
|
+
"setter": false,
|
|
1146
|
+
"reflect": false,
|
|
1147
|
+
"attribute": "disabled",
|
|
1148
|
+
"defaultValue": "false"
|
|
1149
|
+
},
|
|
1150
|
+
"locale": {
|
|
1151
|
+
"type": "string",
|
|
1152
|
+
"mutable": false,
|
|
1153
|
+
"complexType": {
|
|
1154
|
+
"original": "string",
|
|
1155
|
+
"resolved": "string",
|
|
1156
|
+
"references": {}
|
|
1157
|
+
},
|
|
1158
|
+
"required": false,
|
|
1159
|
+
"optional": false,
|
|
1160
|
+
"docs": {
|
|
1161
|
+
"tags": [],
|
|
1162
|
+
"text": "BCP-47 locale for UI strings (e.g. 'en', 'es-CO', 'pt-BR'). Default English."
|
|
1163
|
+
},
|
|
1164
|
+
"getter": false,
|
|
1165
|
+
"setter": false,
|
|
1166
|
+
"reflect": false,
|
|
1167
|
+
"attribute": "locale",
|
|
1168
|
+
"defaultValue": "'en'"
|
|
1169
|
+
},
|
|
1170
|
+
"imageUpload": {
|
|
1171
|
+
"type": "unknown",
|
|
1172
|
+
"mutable": false,
|
|
1173
|
+
"complexType": {
|
|
1174
|
+
"original": "(file: File) => Promise<any>",
|
|
1175
|
+
"resolved": "((file: File) => Promise<any>) | undefined",
|
|
1176
|
+
"references": {
|
|
1177
|
+
"File": {
|
|
1178
|
+
"location": "global",
|
|
1179
|
+
"id": "global::File"
|
|
1180
|
+
},
|
|
1181
|
+
"Promise": {
|
|
1182
|
+
"location": "global",
|
|
1183
|
+
"id": "global::Promise"
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
},
|
|
1187
|
+
"required": false,
|
|
1188
|
+
"optional": true,
|
|
1189
|
+
"docs": {
|
|
1190
|
+
"tags": [],
|
|
1191
|
+
"text": "Image upload handler (JS property): `(file) => Promise<url | {src, fileId}>`."
|
|
1192
|
+
},
|
|
1193
|
+
"getter": false,
|
|
1194
|
+
"setter": false
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
static get states() {
|
|
1199
|
+
return {
|
|
1200
|
+
"items": {},
|
|
1201
|
+
"tick": {},
|
|
1202
|
+
"openPopover": {},
|
|
1203
|
+
"popoverInput": {},
|
|
1204
|
+
"gridHoverRows": {},
|
|
1205
|
+
"gridHoverCols": {},
|
|
1206
|
+
"gridLockedRows": {},
|
|
1207
|
+
"gridLockedCols": {},
|
|
1208
|
+
"tableTab": {},
|
|
1209
|
+
"tableManualRows": {},
|
|
1210
|
+
"tableManualCols": {},
|
|
1211
|
+
"tableWithHeader": {},
|
|
1212
|
+
"tableContextItems": {},
|
|
1213
|
+
"imagePopoverMode": {},
|
|
1214
|
+
"colorHexInput": {}
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
static get events() {
|
|
1218
|
+
return [{
|
|
1219
|
+
"method": "coAction",
|
|
1220
|
+
"name": "coAction",
|
|
1221
|
+
"bubbles": true,
|
|
1222
|
+
"cancelable": true,
|
|
1223
|
+
"composed": true,
|
|
1224
|
+
"docs": {
|
|
1225
|
+
"tags": [],
|
|
1226
|
+
"text": "Emitted whenever a toolbar action runs (observability for hosts)."
|
|
1227
|
+
},
|
|
1228
|
+
"complexType": {
|
|
1229
|
+
"original": "{ action: string; payload?: unknown }",
|
|
1230
|
+
"resolved": "{ action: string; payload?: unknown; }",
|
|
1231
|
+
"references": {}
|
|
1232
|
+
}
|
|
1233
|
+
}, {
|
|
1234
|
+
"method": "coPopoverChange",
|
|
1235
|
+
"name": "coPopoverChange",
|
|
1236
|
+
"bubbles": true,
|
|
1237
|
+
"cancelable": true,
|
|
1238
|
+
"composed": true,
|
|
1239
|
+
"docs": {
|
|
1240
|
+
"tags": [],
|
|
1241
|
+
"text": "Emitted when a toolbar popover/dropdown opens or closes (host hides the\nselection bubble while one is open to avoid spatial overlap)."
|
|
1242
|
+
},
|
|
1243
|
+
"complexType": {
|
|
1244
|
+
"original": "{ open: boolean }",
|
|
1245
|
+
"resolved": "{ open: boolean; }",
|
|
1246
|
+
"references": {}
|
|
1247
|
+
}
|
|
1248
|
+
}];
|
|
1249
|
+
}
|
|
1250
|
+
static get elementRef() { return "el"; }
|
|
1251
|
+
static get watchers() {
|
|
1252
|
+
return [{
|
|
1253
|
+
"propName": "variant",
|
|
1254
|
+
"methodName": "onVariantChange"
|
|
1255
|
+
}, {
|
|
1256
|
+
"propName": "editor",
|
|
1257
|
+
"methodName": "onEditorChange"
|
|
1258
|
+
}, {
|
|
1259
|
+
"propName": "openPopover",
|
|
1260
|
+
"methodName": "onOpenPopoverChange"
|
|
1261
|
+
}];
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Command whose presence in the schema proves an item's extension is loaded.
|
|
1266
|
+
* Items without an entry have no extension dependency (separators, core marks,
|
|
1267
|
+
* link, paragraph/heading, undo/redo, text color) and are always shown.
|
|
1268
|
+
*/
|
|
1269
|
+
CoRichTextToolbar.ITEM_COMMAND = {
|
|
1270
|
+
table: 'insertTable',
|
|
1271
|
+
image: 'setImage',
|
|
1272
|
+
youtube: 'setYoutubeVideo',
|
|
1273
|
+
iframe: 'setIframe',
|
|
1274
|
+
callout: 'insertCallout',
|
|
1275
|
+
fontFamily: 'setFontFamily',
|
|
1276
|
+
fontSize: 'setFontSize',
|
|
1277
|
+
highlight: 'toggleHighlight',
|
|
1278
|
+
alignment: 'setTextAlign',
|
|
1279
|
+
lineSpacing: 'setLineHeight',
|
|
1280
|
+
letterSpacing: 'setLetterSpacing',
|
|
1281
|
+
taskListMenu: 'toggleTaskList',
|
|
1282
|
+
indentIncrease: 'indent',
|
|
1283
|
+
indentDecrease: 'outdent',
|
|
1284
|
+
codeBlock: 'toggleCodeBlock',
|
|
1285
|
+
blockquote: 'toggleBlockquote',
|
|
1286
|
+
horizontalRule: 'setHorizontalRule',
|
|
1287
|
+
bulletListMenu: 'toggleBulletList',
|
|
1288
|
+
orderedListMenu: 'toggleOrderedList',
|
|
1289
|
+
};
|