fiery-rabbit 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +10 -0
- package/.editorconfig +13 -0
- package/.eslintignore +7 -0
- package/.eslintrc.js +51 -0
- package/.prettierrc +13 -0
- package/.vscode/extensions.json +4 -0
- package/README.md +18 -0
- package/dist/auto-oniAJtOb.mjs +14951 -0
- package/dist/components/accordion/src/accordion.vue.d.ts +74 -0
- package/dist/components/accordion/src/accordion.vue.d.ts.map +1 -0
- package/dist/components/auto-complete/src/auto-complete.vue.d.ts +210 -0
- package/dist/components/auto-complete/src/auto-complete.vue.d.ts.map +1 -0
- package/dist/components/avatar/src/avatar.vue.d.ts +60 -0
- package/dist/components/avatar/src/avatar.vue.d.ts.map +1 -0
- package/dist/components/avatar-group/src/avatar-group.vue.d.ts +43 -0
- package/dist/components/avatar-group/src/avatar-group.vue.d.ts.map +1 -0
- package/dist/components/badge/src/badge.vue.d.ts +47 -0
- package/dist/components/badge/src/badge.vue.d.ts.map +1 -0
- package/dist/components/block-ui/src/block-ui.vue.d.ts +65 -0
- package/dist/components/block-ui/src/block-ui.vue.d.ts.map +1 -0
- package/dist/components/breadcrumb/src/breadcrumb.vue.d.ts +57 -0
- package/dist/components/breadcrumb/src/breadcrumb.vue.d.ts.map +1 -0
- package/dist/components/button/src/button.vue.d.ts +97 -0
- package/dist/components/button/src/button.vue.d.ts.map +1 -0
- package/dist/components/card/src/card.vue.d.ts +47 -0
- package/dist/components/card/src/card.vue.d.ts.map +1 -0
- package/dist/components/carousel/src/carousel.vue.d.ts +99 -0
- package/dist/components/carousel/src/carousel.vue.d.ts.map +1 -0
- package/dist/components/cascade-select/src/cascade-select.vue.d.ts +149 -0
- package/dist/components/cascade-select/src/cascade-select.vue.d.ts.map +1 -0
- package/dist/components/chart/src/chart.vue.d.ts +56 -0
- package/dist/components/chart/src/chart.vue.d.ts.map +1 -0
- package/dist/components/checkbox/src/checkbox.vue.d.ts +101 -0
- package/dist/components/checkbox/src/checkbox.vue.d.ts.map +1 -0
- package/dist/components/chip/src/chip.vue.d.ts +58 -0
- package/dist/components/chip/src/chip.vue.d.ts.map +1 -0
- package/dist/components/chips/src/chips.vue.d.ts +91 -0
- package/dist/components/chips/src/chips.vue.d.ts.map +1 -0
- package/dist/components/color-picker/src/color-picker.vue.d.ts +78 -0
- package/dist/components/color-picker/src/color-picker.vue.d.ts.map +1 -0
- package/dist/components/confirm-dialog/src/confirm-dialog.vue.d.ts +62 -0
- package/dist/components/confirm-dialog/src/confirm-dialog.vue.d.ts.map +1 -0
- package/dist/components/confirm-popup/src/confirm-popup.vue.d.ts +56 -0
- package/dist/components/confirm-popup/src/confirm-popup.vue.d.ts.map +1 -0
- package/dist/components/data-view/src/data-view.vue.d.ts +110 -0
- package/dist/components/data-view/src/data-view.vue.d.ts.map +1 -0
- package/dist/components/data-view-layout-options/src/data-view-layout-options.vue.d.ts +49 -0
- package/dist/components/data-view-layout-options/src/data-view-layout-options.vue.d.ts.map +1 -0
- package/dist/components/deferred/src/deferred.vue.d.ts +47 -0
- package/dist/components/deferred/src/deferred.vue.d.ts.map +1 -0
- package/dist/components/dialog/src/dialog.vue.d.ts +149 -0
- package/dist/components/dialog/src/dialog.vue.d.ts.map +1 -0
- package/dist/components/divider/src/divider.vue.d.ts +52 -0
- package/dist/components/divider/src/divider.vue.d.ts.map +1 -0
- package/dist/components/dock/src/dock.vue.d.ts +74 -0
- package/dist/components/dock/src/dock.vue.d.ts.map +1 -0
- package/dist/components/dropdown/src/dropdown.vue.d.ts +194 -0
- package/dist/components/dropdown/src/dropdown.vue.d.ts.map +1 -0
- package/dist/components/dynamic-dialog/src/dynamic-dialog.vue.d.ts +38 -0
- package/dist/components/dynamic-dialog/src/dynamic-dialog.vue.d.ts.map +1 -0
- package/dist/components/fieldset/src/fieldset.vue.d.ts +59 -0
- package/dist/components/fieldset/src/fieldset.vue.d.ts.map +1 -0
- package/dist/components/file-upload/src/file-upload.vue.d.ts +145 -0
- package/dist/components/file-upload/src/file-upload.vue.d.ts.map +1 -0
- package/dist/components/float-label/src/float-label.vue.d.ts +43 -0
- package/dist/components/float-label/src/float-label.vue.d.ts.map +1 -0
- package/dist/components/form/src/form.vue.d.ts +83 -0
- package/dist/components/form/src/form.vue.d.ts.map +1 -0
- package/dist/components/form-item/src/form-item.vue.d.ts +44 -0
- package/dist/components/form-item/src/form-item.vue.d.ts.map +1 -0
- package/dist/components/galleria/src/galleria.vue.d.ts +151 -0
- package/dist/components/galleria/src/galleria.vue.d.ts.map +1 -0
- package/dist/components/icon-field/src/icon-field.vue.d.ts +56 -0
- package/dist/components/icon-field/src/icon-field.vue.d.ts.map +1 -0
- package/dist/components/image/src/image.vue.d.ts +72 -0
- package/dist/components/image/src/image.vue.d.ts.map +1 -0
- package/dist/components/inline-message/src/inline-message.vue.d.ts +49 -0
- package/dist/components/inline-message/src/inline-message.vue.d.ts.map +1 -0
- package/dist/components/inplace/src/inplace.vue.d.ts +68 -0
- package/dist/components/inplace/src/inplace.vue.d.ts.map +1 -0
- package/dist/components/input-group/src/input-group.vue.d.ts +58 -0
- package/dist/components/input-group/src/input-group.vue.d.ts.map +1 -0
- package/dist/components/input-mask/src/input-mask.vue.d.ts +88 -0
- package/dist/components/input-mask/src/input-mask.vue.d.ts.map +1 -0
- package/dist/components/input-otp/src/input-otp.vue.d.ts +90 -0
- package/dist/components/input-otp/src/input-otp.vue.d.ts.map +1 -0
- package/dist/components/input-switch/src/input-switch.vue.d.ts +70 -0
- package/dist/components/input-switch/src/input-switch.vue.d.ts.map +1 -0
- package/dist/components/input-text/src/input-text.vue.d.ts +76 -0
- package/dist/components/input-text/src/input-text.vue.d.ts.map +1 -0
- package/dist/components/knob/src/knob.vue.d.ts +97 -0
- package/dist/components/knob/src/knob.vue.d.ts.map +1 -0
- package/dist/components/layout/src/layout-aside.vue.d.ts +35 -0
- package/dist/components/layout/src/layout-aside.vue.d.ts.map +1 -0
- package/dist/components/layout/src/layout-main.vue.d.ts +18 -0
- package/dist/components/layout/src/layout-main.vue.d.ts.map +1 -0
- package/dist/components/layout/src/layout-setting.vue.d.ts +9 -0
- package/dist/components/layout/src/layout-setting.vue.d.ts.map +1 -0
- package/dist/components/layout/src/layout.vue.d.ts +80 -0
- package/dist/components/layout/src/layout.vue.d.ts.map +1 -0
- package/dist/components/listbox/src/listbox.vue.d.ts +162 -0
- package/dist/components/listbox/src/listbox.vue.d.ts.map +1 -0
- package/dist/components/mega-menu/src/mega-menu.vue.d.ts +86 -0
- package/dist/components/mega-menu/src/mega-menu.vue.d.ts.map +1 -0
- package/dist/components/menu/src/menu.vue.d.ts +84 -0
- package/dist/components/menu/src/menu.vue.d.ts.map +1 -0
- package/dist/components/menubar/src/menubar.vue.d.ts +75 -0
- package/dist/components/menubar/src/menubar.vue.d.ts.map +1 -0
- package/dist/components/message/src/message.vue.d.ts +78 -0
- package/dist/components/message/src/message.vue.d.ts.map +1 -0
- package/dist/components/meter-group/src/meter-group.vue.d.ts +90 -0
- package/dist/components/meter-group/src/meter-group.vue.d.ts.map +1 -0
- package/dist/components/multi-select/src/multi-select.vue.d.ts +240 -0
- package/dist/components/multi-select/src/multi-select.vue.d.ts.map +1 -0
- package/dist/components/order-list/src/order-list.vue.d.ts +97 -0
- package/dist/components/order-list/src/order-list.vue.d.ts.map +1 -0
- package/dist/components/org-chart/src/org-chart.vue.d.ts +72 -0
- package/dist/components/org-chart/src/org-chart.vue.d.ts.map +1 -0
- package/dist/components/overlay-panel/src/overlay-panel.vue.d.ts +80 -0
- package/dist/components/overlay-panel/src/overlay-panel.vue.d.ts.map +1 -0
- package/dist/components/paginator/src/paginator.vue.d.ts +88 -0
- package/dist/components/paginator/src/paginator.vue.d.ts.map +1 -0
- package/dist/components/panel/src/panel.vue.d.ts +67 -0
- package/dist/components/panel/src/panel.vue.d.ts.map +1 -0
- package/dist/components/panel-menu/src/panel-menu.vue.d.ts +77 -0
- package/dist/components/panel-menu/src/panel-menu.vue.d.ts.map +1 -0
- package/dist/components/password/src/password.vue.d.ts +111 -0
- package/dist/components/password/src/password.vue.d.ts.map +1 -0
- package/dist/components/pick-list/src/pick-list.vue.d.ts +137 -0
- package/dist/components/pick-list/src/pick-list.vue.d.ts.map +1 -0
- package/dist/components/progress-bar/src/progress-bar.vue.d.ts +52 -0
- package/dist/components/progress-bar/src/progress-bar.vue.d.ts.map +1 -0
- package/dist/components/progress-spinner/src/progress-spinner.vue.d.ts +45 -0
- package/dist/components/progress-spinner/src/progress-spinner.vue.d.ts.map +1 -0
- package/dist/components/radio-button/src/radio-button.vue.d.ts +71 -0
- package/dist/components/radio-button/src/radio-button.vue.d.ts.map +1 -0
- package/dist/components/rating/src/rating.vue.d.ts +82 -0
- package/dist/components/rating/src/rating.vue.d.ts.map +1 -0
- package/dist/components/scroll-panel/src/scroll-panel.vue.d.ts +48 -0
- package/dist/components/scroll-panel/src/scroll-panel.vue.d.ts.map +1 -0
- package/dist/components/scroll-top/src/scroll-top.vue.d.ts +55 -0
- package/dist/components/scroll-top/src/scroll-top.vue.d.ts.map +1 -0
- package/dist/components/select-button/src/select-button.vue.d.ts +84 -0
- package/dist/components/select-button/src/select-button.vue.d.ts.map +1 -0
- package/dist/components/sidebar/src/sidebar.vue.d.ts +94 -0
- package/dist/components/sidebar/src/sidebar.vue.d.ts.map +1 -0
- package/dist/components/sidebar-menu/src/sidebar-menu.vue.d.ts +59 -0
- package/dist/components/sidebar-menu/src/sidebar-menu.vue.d.ts.map +1 -0
- package/dist/components/skeleton/src/skeleton.vue.d.ts +54 -0
- package/dist/components/skeleton/src/skeleton.vue.d.ts.map +1 -0
- package/dist/components/slider/src/slider.vue.d.ts +73 -0
- package/dist/components/slider/src/slider.vue.d.ts.map +1 -0
- package/dist/components/speed-dial/src/speed-dial.vue.d.ts +110 -0
- package/dist/components/speed-dial/src/speed-dial.vue.d.ts.map +1 -0
- package/dist/components/split-button/src/split-button.vue.d.ts +111 -0
- package/dist/components/split-button/src/split-button.vue.d.ts.map +1 -0
- package/dist/components/splitter/src/splitter.vue.d.ts +68 -0
- package/dist/components/splitter/src/splitter.vue.d.ts.map +1 -0
- package/dist/components/stepper/src/stepper.vue.d.ts +63 -0
- package/dist/components/stepper/src/stepper.vue.d.ts.map +1 -0
- package/dist/components/steps/src/steps.vue.d.ts +64 -0
- package/dist/components/steps/src/steps.vue.d.ts.map +1 -0
- package/dist/components/tab-menu/src/tab-menu.vue.d.ts +67 -0
- package/dist/components/tab-menu/src/tab-menu.vue.d.ts.map +1 -0
- package/dist/components/tag/src/tag.vue.d.ts +51 -0
- package/dist/components/tag/src/tag.vue.d.ts.map +1 -0
- package/dist/components/terminal/src/terminal.vue.d.ts +38 -0
- package/dist/components/terminal/src/terminal.vue.d.ts.map +1 -0
- package/dist/components/textarea/src/textarea.vue.d.ts +68 -0
- package/dist/components/textarea/src/textarea.vue.d.ts.map +1 -0
- package/dist/components/tiered-menu/src/tiered-menu.vue.d.ts +97 -0
- package/dist/components/tiered-menu/src/tiered-menu.vue.d.ts.map +1 -0
- package/dist/components/timeline/src/timeline.vue.d.ts +68 -0
- package/dist/components/timeline/src/timeline.vue.d.ts.map +1 -0
- package/dist/components/toast/src/toast.vue.d.ts +76 -0
- package/dist/components/toast/src/toast.vue.d.ts.map +1 -0
- package/dist/components/toggle-button/src/toggle-button.vue.d.ts +85 -0
- package/dist/components/toggle-button/src/toggle-button.vue.d.ts.map +1 -0
- package/dist/components/toolbar/src/toolbar.vue.d.ts +46 -0
- package/dist/components/toolbar/src/toolbar.vue.d.ts.map +1 -0
- package/dist/components/tree-select/src/tree-select.vue.d.ts +138 -0
- package/dist/components/tree-select/src/tree-select.vue.d.ts.map +1 -0
- package/dist/components/tri-state-checkbox/src/tri-state-checkbox.vue.d.ts +79 -0
- package/dist/components/tri-state-checkbox/src/tri-state-checkbox.vue.d.ts.map +1 -0
- package/dist/components/virtual-scroller/src/virtual-scroller.vue.d.ts +145 -0
- package/dist/components/virtual-scroller/src/virtual-scroller.vue.d.ts.map +1 -0
- package/dist/components/virtual-tree/src/virtual-tree.vue.d.ts +82 -0
- package/dist/components/virtual-tree/src/virtual-tree.vue.d.ts.map +1 -0
- package/dist/components/x6-graph/src/x6-graph.vue.d.ts +168 -0
- package/dist/components/x6-graph/src/x6-graph.vue.d.ts.map +1 -0
- package/dist/fiery-rabbit.d.ts +6 -0
- package/dist/fiery-rabbit.d.ts.map +1 -0
- package/dist/fiery-rabbit.es.js +128 -0
- package/dist/fiery-rabbit.umd.js +19 -0
- package/dist/hooks/enum/index.d.ts +5 -0
- package/dist/hooks/enum/index.d.ts.map +1 -0
- package/dist/hooks/indexed-db/index.d.ts +13 -0
- package/dist/hooks/indexed-db/index.d.ts.map +1 -0
- package/dist/hooks/request/index.d.ts +76 -0
- package/dist/hooks/request/index.d.ts.map +1 -0
- package/dist/hooks/router/index.d.ts +6 -0
- package/dist/hooks/router/index.d.ts.map +1 -0
- package/dist/hooks/websocket/index.d.ts +8 -0
- package/dist/hooks/websocket/index.d.ts.map +1 -0
- package/dist/locales/en/index.d.ts +26 -0
- package/dist/locales/en/index.d.ts.map +1 -0
- package/dist/locales/ja/index.d.ts +26 -0
- package/dist/locales/ja/index.d.ts.map +1 -0
- package/dist/locales/ko/index.d.ts +26 -0
- package/dist/locales/ko/index.d.ts.map +1 -0
- package/dist/locales/zh-CN/index.d.ts +26 -0
- package/dist/locales/zh-CN/index.d.ts.map +1 -0
- package/dist/locales/zh-TW/index.d.ts +26 -0
- package/dist/locales/zh-TW/index.d.ts.map +1 -0
- package/dist/main-UdTkuoT2.mjs +129321 -0
- package/dist/main.d.ts +134 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/quill-ZYFQ7rhl.mjs +1975 -0
- package/dist/style.css +1 -0
- package/package.json +98 -0
- package/src/assets/arya.png +0 -0
- package/src/assets/aura.png +0 -0
- package/src/assets/bootstrap.png +0 -0
- package/src/assets/en.svg +1 -0
- package/src/assets/ja.svg +1 -0
- package/src/assets/ko.svg +1 -0
- package/src/assets/lara-light-teal.png +0 -0
- package/src/assets/luna-amber.png +0 -0
- package/src/assets/md-light-indigo.svg +9 -0
- package/src/assets/nova.png +0 -0
- package/src/assets/saga.png +0 -0
- package/src/assets/zh-CN.svg +1 -0
- package/src/assets/zh-TW.svg +1 -0
- package/src/components/accordion/src/accordion.vue +89 -0
- package/src/components/accordion/style/style.scss +0 -0
- package/src/components/auto-complete/src/auto-complete.vue +506 -0
- package/src/components/auto-complete/style/style.scss +7 -0
- package/src/components/avatar/src/avatar.vue +63 -0
- package/src/components/avatar/style/style.scss +0 -0
- package/src/components/avatar-group/src/avatar-group.vue +38 -0
- package/src/components/avatar-group/style/style.scss +0 -0
- package/src/components/badge/src/badge.vue +46 -0
- package/src/components/badge/style/style.scss +0 -0
- package/src/components/block-ui/src/block-ui.vue +57 -0
- package/src/components/block-ui/style/style.scss +0 -0
- package/src/components/breadcrumb/src/breadcrumb.vue +73 -0
- package/src/components/breadcrumb/style/style.scss +0 -0
- package/src/components/button/src/button.vue +169 -0
- package/src/components/button/style/style.scss +0 -0
- package/src/components/calendar/src/calendar.vue +354 -0
- package/src/components/calendar/style/style.scss +0 -0
- package/src/components/card/src/card.vue +67 -0
- package/src/components/card/style/style.scss +0 -0
- package/src/components/carousel/src/carousel.vue +131 -0
- package/src/components/carousel/style/style.scss +0 -0
- package/src/components/cascade-select/src/cascade-select.vue +330 -0
- package/src/components/cascade-select/style/style.scss +7 -0
- package/src/components/chart/src/chart.vue +59 -0
- package/src/components/chart/style/style.scss +0 -0
- package/src/components/checkbox/src/checkbox.vue +191 -0
- package/src/components/checkbox/style/style.scss +0 -0
- package/src/components/chip/src/chip.vue +66 -0
- package/src/components/chip/style/style.scss +0 -0
- package/src/components/chips/src/chips.vue +204 -0
- package/src/components/chips/style/style.scss +7 -0
- package/src/components/color-picker/src/color-picker.vue +93 -0
- package/src/components/color-picker/style/style.scss +0 -0
- package/src/components/confirm-dialog/src/confirm-dialog.vue +86 -0
- package/src/components/confirm-dialog/style/style.scss +0 -0
- package/src/components/confirm-popup/src/confirm-popup.vue +80 -0
- package/src/components/confirm-popup/style/style.scss +0 -0
- package/src/components/data-table/src/data-table.vue +812 -0
- package/src/components/data-table/style/style.scss +0 -0
- package/src/components/data-view/src/data-view.vue +157 -0
- package/src/components/data-view/style/style.scss +0 -0
- package/src/components/data-view-layout-options/src/data-view-layout-options.vue +65 -0
- package/src/components/data-view-layout-options/style/style.scss +0 -0
- package/src/components/deferred/src/deferred.vue +43 -0
- package/src/components/deferred/style/style.scss +0 -0
- package/src/components/dialog/src/dialog.vue +171 -0
- package/src/components/dialog/style/style.scss +0 -0
- package/src/components/divider/src/divider.vue +46 -0
- package/src/components/divider/style/style.scss +0 -0
- package/src/components/dock/src/dock.vue +88 -0
- package/src/components/dock/style/style.scss +0 -0
- package/src/components/dropdown/src/dropdown.vue +291 -0
- package/src/components/dropdown/style/style.scss +0 -0
- package/src/components/dynamic-dialog/src/dynamic-dialog.vue +28 -0
- package/src/components/dynamic-dialog/style/style.scss +0 -0
- package/src/components/editor/src/editor.vue +77 -0
- package/src/components/editor/style/style.scss +0 -0
- package/src/components/fieldset/src/fieldset.vue +67 -0
- package/src/components/fieldset/style/style.scss +0 -0
- package/src/components/file-upload/src/file-upload.vue +188 -0
- package/src/components/file-upload/style/style.scss +0 -0
- package/src/components/float-label/src/float-label.vue +38 -0
- package/src/components/float-label/style/style.scss +0 -0
- package/src/components/form/src/form.vue +242 -0
- package/src/components/form/style/style.scss +0 -0
- package/src/components/form-item/src/form-item.vue +448 -0
- package/src/components/form-item/style/style.scss +52 -0
- package/src/components/galleria/src/galleria.vue +214 -0
- package/src/components/galleria/style/style.scss +0 -0
- package/src/components/icon-field/src/icon-field.vue +73 -0
- package/src/components/icon-field/style/style.scss +0 -0
- package/src/components/image/src/image.vue +108 -0
- package/src/components/image/style/style.scss +0 -0
- package/src/components/inline-message/src/inline-message.vue +49 -0
- package/src/components/inline-message/style/style.scss +0 -0
- package/src/components/inplace/src/inplace.vue +85 -0
- package/src/components/inplace/style/style.scss +0 -0
- package/src/components/input-group/src/input-group.vue +112 -0
- package/src/components/input-group/style/style.scss +0 -0
- package/src/components/input-mask/src/input-mask.vue +155 -0
- package/src/components/input-mask/style/style.scss +11 -0
- package/src/components/input-number/src/input-number.vue +221 -0
- package/src/components/input-number/style/style.scss +9 -0
- package/src/components/input-otp/src/input-otp.vue +99 -0
- package/src/components/input-otp/style/style.scss +0 -0
- package/src/components/input-switch/src/input-switch.vue +87 -0
- package/src/components/input-switch/style/style.scss +0 -0
- package/src/components/input-text/src/input-text.vue +143 -0
- package/src/components/input-text/style/style.scss +7 -0
- package/src/components/knob/src/knob.vue +106 -0
- package/src/components/knob/style/style.scss +0 -0
- package/src/components/layout/src/layout-aside.vue +337 -0
- package/src/components/layout/src/layout-main.vue +429 -0
- package/src/components/layout/src/layout-setting.vue +1559 -0
- package/src/components/layout/src/layout.vue +580 -0
- package/src/components/layout/style/style.scss +162 -0
- package/src/components/listbox/src/listbox.vue +234 -0
- package/src/components/listbox/style/style.scss +0 -0
- package/src/components/mega-menu/src/mega-menu.vue +122 -0
- package/src/components/mega-menu/style/style.scss +0 -0
- package/src/components/menu/src/menu.vue +109 -0
- package/src/components/menu/style/style.scss +0 -0
- package/src/components/menubar/src/menubar.vue +111 -0
- package/src/components/menubar/style/style.scss +0 -0
- package/src/components/message/src/message.vue +90 -0
- package/src/components/message/style/style.scss +0 -0
- package/src/components/meter-group/src/meter-group.vue +111 -0
- package/src/components/meter-group/style/style.scss +0 -0
- package/src/components/multi-select/src/multi-select.vue +633 -0
- package/src/components/multi-select/style/style.scss +7 -0
- package/src/components/order-list/src/order-list.vue +161 -0
- package/src/components/order-list/style/style.scss +0 -0
- package/src/components/org-chart/src/org-chart.vue +96 -0
- package/src/components/org-chart/style/style.scss +0 -0
- package/src/components/overlay-panel/src/overlay-panel.vue +83 -0
- package/src/components/overlay-panel/style/style.scss +0 -0
- package/src/components/paginator/src/paginator.vue +141 -0
- package/src/components/paginator/style/style.scss +0 -0
- package/src/components/panel/src/panel.vue +92 -0
- package/src/components/panel/style/style.scss +0 -0
- package/src/components/panel-menu/src/panel-menu.vue +112 -0
- package/src/components/panel-menu/style/style.scss +0 -0
- package/src/components/password/src/password.vue +267 -0
- package/src/components/password/style/style.scss +7 -0
- package/src/components/pick-list/src/pick-list.vue +254 -0
- package/src/components/pick-list/style/style.scss +0 -0
- package/src/components/progress-bar/src/progress-bar.vue +46 -0
- package/src/components/progress-bar/style/style.scss +0 -0
- package/src/components/progress-spinner/src/progress-spinner.vue +44 -0
- package/src/components/progress-spinner/style/style.scss +0 -0
- package/src/components/radio-button/src/radio-button.vue +144 -0
- package/src/components/radio-button/style/style.scss +0 -0
- package/src/components/rating/src/rating.vue +108 -0
- package/src/components/rating/style/style.scss +0 -0
- package/src/components/scroll-panel/src/scroll-panel.vue +43 -0
- package/src/components/scroll-panel/style/style.scss +0 -0
- package/src/components/scroll-top/src/scroll-top.vue +52 -0
- package/src/components/scroll-top/style/style.scss +0 -0
- package/src/components/select-button/src/select-button.vue +108 -0
- package/src/components/select-button/style/style.scss +0 -0
- package/src/components/sidebar/src/sidebar.vue +110 -0
- package/src/components/sidebar/style/style.scss +0 -0
- package/src/components/sidebar-menu/src/sidebar-menu.vue +562 -0
- package/src/components/sidebar-menu/style/style.scss +87 -0
- package/src/components/skeleton/src/skeleton.vue +52 -0
- package/src/components/skeleton/style/style.scss +0 -0
- package/src/components/slider/src/slider.vue +90 -0
- package/src/components/slider/style/style.scss +0 -0
- package/src/components/speed-dial/src/speed-dial.vue +124 -0
- package/src/components/speed-dial/style/style.scss +0 -0
- package/src/components/split-button/src/split-button.vue +135 -0
- package/src/components/split-button/style/style.scss +0 -0
- package/src/components/splitter/src/splitter.vue +66 -0
- package/src/components/splitter/style/style.scss +0 -0
- package/src/components/stepper/src/stepper.vue +74 -0
- package/src/components/stepper/style/style.scss +0 -0
- package/src/components/steps/src/steps.vue +74 -0
- package/src/components/steps/style/style.scss +0 -0
- package/src/components/tab-menu/src/tab-menu.vue +85 -0
- package/src/components/tab-menu/style/style.scss +0 -0
- package/src/components/tab-view/src/tab-view.vue +82 -0
- package/src/components/tab-view/style/style.scss +0 -0
- package/src/components/tag/src/tag.vue +53 -0
- package/src/components/tag/style/style.scss +0 -0
- package/src/components/terminal/src/terminal.vue +40 -0
- package/src/components/terminal/style/style.scss +0 -0
- package/src/components/textarea/src/textarea.vue +86 -0
- package/src/components/textarea/style/style.scss +0 -0
- package/src/components/tiered-menu/src/tiered-menu.vue +122 -0
- package/src/components/tiered-menu/style/style.scss +0 -0
- package/src/components/timeline/src/timeline.vue +87 -0
- package/src/components/timeline/style/style.scss +0 -0
- package/src/components/toast/src/toast.vue +96 -0
- package/src/components/toast/style/style.scss +0 -0
- package/src/components/toggle-button/src/toggle-button.vue +103 -0
- package/src/components/toggle-button/style/style.scss +0 -0
- package/src/components/toolbar/src/toolbar.vue +57 -0
- package/src/components/toolbar/style/style.scss +0 -0
- package/src/components/tree/src/tree.vue +165 -0
- package/src/components/tree/style/style.scss +0 -0
- package/src/components/tree-select/src/tree-select.vue +329 -0
- package/src/components/tree-select/style/style.scss +7 -0
- package/src/components/tree-table/src/tree-table.vue +344 -0
- package/src/components/tree-table/style/style.scss +0 -0
- package/src/components/tri-state-checkbox/src/tri-state-checkbox.vue +111 -0
- package/src/components/tri-state-checkbox/style/style.scss +0 -0
- package/src/components/virtual-scroller/src/virtual-scroller.vue +283 -0
- package/src/components/virtual-scroller/style/style.scss +0 -0
- package/src/components/virtual-tree/src/virtual-tree.vue +285 -0
- package/src/components/virtual-tree/style/style.scss +45 -0
- package/src/components/x6-graph/src/x6-graph.vue +700 -0
- package/src/components/x6-graph/style/style.scss +0 -0
- package/src/fiery-rabbit.ts +74 -0
- package/src/hooks/enum/index.ts +17 -0
- package/src/hooks/indexed-db/index.ts +218 -0
- package/src/hooks/request/index.ts +213 -0
- package/src/hooks/router/index.ts +34 -0
- package/src/hooks/websocket/index.ts +73 -0
- package/src/locales/en/index.ts +24 -0
- package/src/locales/ja/index.ts +24 -0
- package/src/locales/ko/index.ts +24 -0
- package/src/locales/zh-CN/index.ts +24 -0
- package/src/locales/zh-TW/index.ts +24 -0
- package/src/main.ts +256 -0
- package/src/styles/base.scss +18 -0
- package/src/styles/function.scss +14 -0
- package/src/styles/index.scss +2 -0
- package/src/vite-env.d.ts +7 -0
- package/tsconfig.d.json +9 -0
- package/tsconfig.json +18 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +109 -0
|
@@ -0,0 +1,1975 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { S as Scope, C as ClassAttributor$1, B as Block, a as Container, Q as Quill, I as Inline, E as Embed, b as EmbedBlot$1, c as BlockEmbed, d as Cursor, T as Text, e as Break, f as CodeBlock, g as CodeBlockContainer, h as blockDelta, D as Delta, i as escapeText, M as Module, t as traverse, n as namespace, m as merge, j as Theme, k as Emitter, R as Range, l as DirectionAttribute, A as AlignClass, o as BackgroundClass, p as ColorClass, q as DirectionClass, F as FontClass, r as SizeClass, s as AlignStyle, u as BackgroundStyle, v as ColorStyle, w as DirectionStyle, x as FontStyle, y as SizeStyle, z as Code } from "./main-UdTkuoT2.mjs";
|
|
8
|
+
import { P } from "./main-UdTkuoT2.mjs";
|
|
9
|
+
import "vue";
|
|
10
|
+
import "vue-i18n";
|
|
11
|
+
import "lodash";
|
|
12
|
+
import "dayjs";
|
|
13
|
+
import "@vueuse/core";
|
|
14
|
+
import "vue-router";
|
|
15
|
+
import "nanoid";
|
|
16
|
+
class IndentAttributor extends ClassAttributor$1 {
|
|
17
|
+
add(node, value) {
|
|
18
|
+
let normalizedValue = 0;
|
|
19
|
+
if (value === "+1" || value === "-1") {
|
|
20
|
+
const indent = this.value(node) || 0;
|
|
21
|
+
normalizedValue = value === "+1" ? indent + 1 : indent - 1;
|
|
22
|
+
} else if (typeof value === "number") {
|
|
23
|
+
normalizedValue = value;
|
|
24
|
+
}
|
|
25
|
+
if (normalizedValue === 0) {
|
|
26
|
+
this.remove(node);
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return super.add(node, normalizedValue.toString());
|
|
30
|
+
}
|
|
31
|
+
canAdd(node, value) {
|
|
32
|
+
return super.canAdd(node, value) || super.canAdd(node, parseInt(value, 10));
|
|
33
|
+
}
|
|
34
|
+
value(node) {
|
|
35
|
+
return parseInt(super.value(node), 10) || void 0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const IndentClass = new IndentAttributor("indent", "ql-indent", {
|
|
39
|
+
scope: Scope.BLOCK,
|
|
40
|
+
// @ts-expect-error
|
|
41
|
+
whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
|
|
42
|
+
});
|
|
43
|
+
class Blockquote extends Block {
|
|
44
|
+
}
|
|
45
|
+
__publicField(Blockquote, "blotName", "blockquote");
|
|
46
|
+
__publicField(Blockquote, "tagName", "blockquote");
|
|
47
|
+
class Header extends Block {
|
|
48
|
+
static formats(domNode) {
|
|
49
|
+
return this.tagName.indexOf(domNode.tagName) + 1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
__publicField(Header, "blotName", "header");
|
|
53
|
+
__publicField(Header, "tagName", ["H1", "H2", "H3", "H4", "H5", "H6"]);
|
|
54
|
+
class ListContainer extends Container {
|
|
55
|
+
}
|
|
56
|
+
ListContainer.blotName = "list-container";
|
|
57
|
+
ListContainer.tagName = "OL";
|
|
58
|
+
class ListItem extends Block {
|
|
59
|
+
static create(value) {
|
|
60
|
+
const node = super.create();
|
|
61
|
+
node.setAttribute("data-list", value);
|
|
62
|
+
return node;
|
|
63
|
+
}
|
|
64
|
+
static formats(domNode) {
|
|
65
|
+
return domNode.getAttribute("data-list") || void 0;
|
|
66
|
+
}
|
|
67
|
+
static register() {
|
|
68
|
+
Quill.register(ListContainer);
|
|
69
|
+
}
|
|
70
|
+
constructor(scroll, domNode) {
|
|
71
|
+
super(scroll, domNode);
|
|
72
|
+
const ui = domNode.ownerDocument.createElement("span");
|
|
73
|
+
const listEventHandler = (e) => {
|
|
74
|
+
if (!scroll.isEnabled())
|
|
75
|
+
return;
|
|
76
|
+
const format = this.statics.formats(domNode, scroll);
|
|
77
|
+
if (format === "checked") {
|
|
78
|
+
this.format("list", "unchecked");
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
} else if (format === "unchecked") {
|
|
81
|
+
this.format("list", "checked");
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
ui.addEventListener("mousedown", listEventHandler);
|
|
86
|
+
ui.addEventListener("touchstart", listEventHandler);
|
|
87
|
+
this.attachUI(ui);
|
|
88
|
+
}
|
|
89
|
+
format(name, value) {
|
|
90
|
+
if (name === this.statics.blotName && value) {
|
|
91
|
+
this.domNode.setAttribute("data-list", value);
|
|
92
|
+
} else {
|
|
93
|
+
super.format(name, value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
ListItem.blotName = "list";
|
|
98
|
+
ListItem.tagName = "LI";
|
|
99
|
+
ListContainer.allowedChildren = [ListItem];
|
|
100
|
+
ListItem.requiredContainer = ListContainer;
|
|
101
|
+
class Bold extends Inline {
|
|
102
|
+
static create() {
|
|
103
|
+
return super.create();
|
|
104
|
+
}
|
|
105
|
+
static formats() {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
optimize(context) {
|
|
109
|
+
super.optimize(context);
|
|
110
|
+
if (this.domNode.tagName !== this.statics.tagName[0]) {
|
|
111
|
+
this.replaceWith(this.statics.blotName);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
__publicField(Bold, "blotName", "bold");
|
|
116
|
+
__publicField(Bold, "tagName", ["STRONG", "B"]);
|
|
117
|
+
class Italic extends Bold {
|
|
118
|
+
}
|
|
119
|
+
__publicField(Italic, "blotName", "italic");
|
|
120
|
+
__publicField(Italic, "tagName", ["EM", "I"]);
|
|
121
|
+
class Link extends Inline {
|
|
122
|
+
static create(value) {
|
|
123
|
+
const node = super.create(value);
|
|
124
|
+
node.setAttribute("href", this.sanitize(value));
|
|
125
|
+
node.setAttribute("rel", "noopener noreferrer");
|
|
126
|
+
node.setAttribute("target", "_blank");
|
|
127
|
+
return node;
|
|
128
|
+
}
|
|
129
|
+
static formats(domNode) {
|
|
130
|
+
return domNode.getAttribute("href");
|
|
131
|
+
}
|
|
132
|
+
static sanitize(url) {
|
|
133
|
+
return sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
|
|
134
|
+
}
|
|
135
|
+
format(name, value) {
|
|
136
|
+
if (name !== this.statics.blotName || !value) {
|
|
137
|
+
super.format(name, value);
|
|
138
|
+
} else {
|
|
139
|
+
this.domNode.setAttribute("href", this.constructor.sanitize(value));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
__publicField(Link, "blotName", "link");
|
|
144
|
+
__publicField(Link, "tagName", "A");
|
|
145
|
+
__publicField(Link, "SANITIZED_URL", "about:blank");
|
|
146
|
+
__publicField(Link, "PROTOCOL_WHITELIST", ["http", "https", "mailto", "tel", "sms"]);
|
|
147
|
+
function sanitize(url, protocols) {
|
|
148
|
+
const anchor = document.createElement("a");
|
|
149
|
+
anchor.href = url;
|
|
150
|
+
const protocol = anchor.href.slice(0, anchor.href.indexOf(":"));
|
|
151
|
+
return protocols.indexOf(protocol) > -1;
|
|
152
|
+
}
|
|
153
|
+
class Script extends Inline {
|
|
154
|
+
static create(value) {
|
|
155
|
+
if (value === "super") {
|
|
156
|
+
return document.createElement("sup");
|
|
157
|
+
}
|
|
158
|
+
if (value === "sub") {
|
|
159
|
+
return document.createElement("sub");
|
|
160
|
+
}
|
|
161
|
+
return super.create(value);
|
|
162
|
+
}
|
|
163
|
+
static formats(domNode) {
|
|
164
|
+
if (domNode.tagName === "SUB")
|
|
165
|
+
return "sub";
|
|
166
|
+
if (domNode.tagName === "SUP")
|
|
167
|
+
return "super";
|
|
168
|
+
return void 0;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
__publicField(Script, "blotName", "script");
|
|
172
|
+
__publicField(Script, "tagName", ["SUB", "SUP"]);
|
|
173
|
+
class Strike extends Bold {
|
|
174
|
+
}
|
|
175
|
+
__publicField(Strike, "blotName", "strike");
|
|
176
|
+
__publicField(Strike, "tagName", ["S", "STRIKE"]);
|
|
177
|
+
class Underline extends Inline {
|
|
178
|
+
}
|
|
179
|
+
__publicField(Underline, "blotName", "underline");
|
|
180
|
+
__publicField(Underline, "tagName", "U");
|
|
181
|
+
class Formula extends Embed {
|
|
182
|
+
static create(value) {
|
|
183
|
+
if (window.katex == null) {
|
|
184
|
+
throw new Error("Formula module requires KaTeX.");
|
|
185
|
+
}
|
|
186
|
+
const node = super.create(value);
|
|
187
|
+
if (typeof value === "string") {
|
|
188
|
+
window.katex.render(value, node, {
|
|
189
|
+
throwOnError: false,
|
|
190
|
+
errorColor: "#f00"
|
|
191
|
+
});
|
|
192
|
+
node.setAttribute("data-value", value);
|
|
193
|
+
}
|
|
194
|
+
return node;
|
|
195
|
+
}
|
|
196
|
+
static value(domNode) {
|
|
197
|
+
return domNode.getAttribute("data-value");
|
|
198
|
+
}
|
|
199
|
+
html() {
|
|
200
|
+
const {
|
|
201
|
+
formula
|
|
202
|
+
} = this.value();
|
|
203
|
+
return `<span>${formula}</span>`;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
__publicField(Formula, "blotName", "formula");
|
|
207
|
+
__publicField(Formula, "className", "ql-formula");
|
|
208
|
+
__publicField(Formula, "tagName", "SPAN");
|
|
209
|
+
const ATTRIBUTES$1 = ["alt", "height", "width"];
|
|
210
|
+
class Image extends EmbedBlot$1 {
|
|
211
|
+
static create(value) {
|
|
212
|
+
const node = super.create(value);
|
|
213
|
+
if (typeof value === "string") {
|
|
214
|
+
node.setAttribute("src", this.sanitize(value));
|
|
215
|
+
}
|
|
216
|
+
return node;
|
|
217
|
+
}
|
|
218
|
+
static formats(domNode) {
|
|
219
|
+
return ATTRIBUTES$1.reduce((formats, attribute) => {
|
|
220
|
+
if (domNode.hasAttribute(attribute)) {
|
|
221
|
+
formats[attribute] = domNode.getAttribute(attribute);
|
|
222
|
+
}
|
|
223
|
+
return formats;
|
|
224
|
+
}, {});
|
|
225
|
+
}
|
|
226
|
+
static match(url) {
|
|
227
|
+
return /\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url);
|
|
228
|
+
}
|
|
229
|
+
static sanitize(url) {
|
|
230
|
+
return sanitize(url, ["http", "https", "data"]) ? url : "//:0";
|
|
231
|
+
}
|
|
232
|
+
static value(domNode) {
|
|
233
|
+
return domNode.getAttribute("src");
|
|
234
|
+
}
|
|
235
|
+
format(name, value) {
|
|
236
|
+
if (ATTRIBUTES$1.indexOf(name) > -1) {
|
|
237
|
+
if (value) {
|
|
238
|
+
this.domNode.setAttribute(name, value);
|
|
239
|
+
} else {
|
|
240
|
+
this.domNode.removeAttribute(name);
|
|
241
|
+
}
|
|
242
|
+
} else {
|
|
243
|
+
super.format(name, value);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
__publicField(Image, "blotName", "image");
|
|
248
|
+
__publicField(Image, "tagName", "IMG");
|
|
249
|
+
const ATTRIBUTES = ["height", "width"];
|
|
250
|
+
class Video extends BlockEmbed {
|
|
251
|
+
static create(value) {
|
|
252
|
+
const node = super.create(value);
|
|
253
|
+
node.setAttribute("frameborder", "0");
|
|
254
|
+
node.setAttribute("allowfullscreen", "true");
|
|
255
|
+
node.setAttribute("src", this.sanitize(value));
|
|
256
|
+
return node;
|
|
257
|
+
}
|
|
258
|
+
static formats(domNode) {
|
|
259
|
+
return ATTRIBUTES.reduce((formats, attribute) => {
|
|
260
|
+
if (domNode.hasAttribute(attribute)) {
|
|
261
|
+
formats[attribute] = domNode.getAttribute(attribute);
|
|
262
|
+
}
|
|
263
|
+
return formats;
|
|
264
|
+
}, {});
|
|
265
|
+
}
|
|
266
|
+
static sanitize(url) {
|
|
267
|
+
return Link.sanitize(url);
|
|
268
|
+
}
|
|
269
|
+
static value(domNode) {
|
|
270
|
+
return domNode.getAttribute("src");
|
|
271
|
+
}
|
|
272
|
+
format(name, value) {
|
|
273
|
+
if (ATTRIBUTES.indexOf(name) > -1) {
|
|
274
|
+
if (value) {
|
|
275
|
+
this.domNode.setAttribute(name, value);
|
|
276
|
+
} else {
|
|
277
|
+
this.domNode.removeAttribute(name);
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
super.format(name, value);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
html() {
|
|
284
|
+
const {
|
|
285
|
+
video
|
|
286
|
+
} = this.value();
|
|
287
|
+
return `<a href="${video}">${video}</a>`;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
__publicField(Video, "blotName", "video");
|
|
291
|
+
__publicField(Video, "className", "ql-video");
|
|
292
|
+
__publicField(Video, "tagName", "IFRAME");
|
|
293
|
+
const TokenAttributor = new ClassAttributor$1("code-token", "hljs", {
|
|
294
|
+
scope: Scope.INLINE
|
|
295
|
+
});
|
|
296
|
+
class CodeToken extends Inline {
|
|
297
|
+
static formats(node, scroll) {
|
|
298
|
+
while (node != null && node !== scroll.domNode) {
|
|
299
|
+
if (node.classList && node.classList.contains(CodeBlock.className)) {
|
|
300
|
+
return super.formats(node, scroll);
|
|
301
|
+
}
|
|
302
|
+
node = node.parentNode;
|
|
303
|
+
}
|
|
304
|
+
return void 0;
|
|
305
|
+
}
|
|
306
|
+
constructor(scroll, domNode, value) {
|
|
307
|
+
super(scroll, domNode, value);
|
|
308
|
+
TokenAttributor.add(this.domNode, value);
|
|
309
|
+
}
|
|
310
|
+
format(format, value) {
|
|
311
|
+
if (format !== CodeToken.blotName) {
|
|
312
|
+
super.format(format, value);
|
|
313
|
+
} else if (value) {
|
|
314
|
+
TokenAttributor.add(this.domNode, value);
|
|
315
|
+
} else {
|
|
316
|
+
TokenAttributor.remove(this.domNode);
|
|
317
|
+
this.domNode.classList.remove(this.statics.className);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
optimize() {
|
|
321
|
+
super.optimize(...arguments);
|
|
322
|
+
if (!TokenAttributor.value(this.domNode)) {
|
|
323
|
+
this.unwrap();
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
CodeToken.blotName = "code-token";
|
|
328
|
+
CodeToken.className = "ql-token";
|
|
329
|
+
class SyntaxCodeBlock extends CodeBlock {
|
|
330
|
+
static create(value) {
|
|
331
|
+
const domNode = super.create(value);
|
|
332
|
+
if (typeof value === "string") {
|
|
333
|
+
domNode.setAttribute("data-language", value);
|
|
334
|
+
}
|
|
335
|
+
return domNode;
|
|
336
|
+
}
|
|
337
|
+
static formats(domNode) {
|
|
338
|
+
return domNode.getAttribute("data-language") || "plain";
|
|
339
|
+
}
|
|
340
|
+
static register() {
|
|
341
|
+
}
|
|
342
|
+
// Syntax module will register
|
|
343
|
+
format(name, value) {
|
|
344
|
+
if (name === this.statics.blotName && value) {
|
|
345
|
+
this.domNode.setAttribute("data-language", value);
|
|
346
|
+
} else {
|
|
347
|
+
super.format(name, value);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
replaceWith(name, value) {
|
|
351
|
+
this.formatAt(0, this.length(), CodeToken.blotName, false);
|
|
352
|
+
return super.replaceWith(name, value);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
class SyntaxCodeBlockContainer extends CodeBlockContainer {
|
|
356
|
+
attach() {
|
|
357
|
+
super.attach();
|
|
358
|
+
this.forceNext = false;
|
|
359
|
+
this.scroll.emitMount(this);
|
|
360
|
+
}
|
|
361
|
+
format(name, value) {
|
|
362
|
+
if (name === SyntaxCodeBlock.blotName) {
|
|
363
|
+
this.forceNext = true;
|
|
364
|
+
this.children.forEach((child) => {
|
|
365
|
+
child.format(name, value);
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
formatAt(index, length, name, value) {
|
|
370
|
+
if (name === SyntaxCodeBlock.blotName) {
|
|
371
|
+
this.forceNext = true;
|
|
372
|
+
}
|
|
373
|
+
super.formatAt(index, length, name, value);
|
|
374
|
+
}
|
|
375
|
+
highlight(highlight2) {
|
|
376
|
+
let forced = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
377
|
+
if (this.children.head == null)
|
|
378
|
+
return;
|
|
379
|
+
const nodes = Array.from(this.domNode.childNodes).filter((node) => node !== this.uiNode);
|
|
380
|
+
const text = `${nodes.map((node) => node.textContent).join("\n")}
|
|
381
|
+
`;
|
|
382
|
+
const language = SyntaxCodeBlock.formats(this.children.head.domNode);
|
|
383
|
+
if (forced || this.forceNext || this.cachedText !== text) {
|
|
384
|
+
if (text.trim().length > 0 || this.cachedText == null) {
|
|
385
|
+
const oldDelta = this.children.reduce((delta2, child) => {
|
|
386
|
+
return delta2.concat(blockDelta(child, false));
|
|
387
|
+
}, new Delta());
|
|
388
|
+
const delta = highlight2(text, language);
|
|
389
|
+
oldDelta.diff(delta).reduce((index, _ref) => {
|
|
390
|
+
let {
|
|
391
|
+
retain,
|
|
392
|
+
attributes
|
|
393
|
+
} = _ref;
|
|
394
|
+
if (!retain)
|
|
395
|
+
return index;
|
|
396
|
+
if (attributes) {
|
|
397
|
+
Object.keys(attributes).forEach((format) => {
|
|
398
|
+
if ([SyntaxCodeBlock.blotName, CodeToken.blotName].includes(format)) {
|
|
399
|
+
this.formatAt(index, retain, format, attributes[format]);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
return index + retain;
|
|
404
|
+
}, 0);
|
|
405
|
+
}
|
|
406
|
+
this.cachedText = text;
|
|
407
|
+
this.forceNext = false;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
html(index, length) {
|
|
411
|
+
const [codeBlock] = this.children.find(index);
|
|
412
|
+
const language = codeBlock ? SyntaxCodeBlock.formats(codeBlock.domNode) : "plain";
|
|
413
|
+
return `<pre data-language="${language}">
|
|
414
|
+
${escapeText(this.code(index, length))}
|
|
415
|
+
</pre>`;
|
|
416
|
+
}
|
|
417
|
+
optimize(context) {
|
|
418
|
+
super.optimize(context);
|
|
419
|
+
if (this.parent != null && this.children.head != null && this.uiNode != null) {
|
|
420
|
+
const language = SyntaxCodeBlock.formats(this.children.head.domNode);
|
|
421
|
+
if (language !== this.uiNode.value) {
|
|
422
|
+
this.uiNode.value = language;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
SyntaxCodeBlockContainer.allowedChildren = [SyntaxCodeBlock];
|
|
428
|
+
SyntaxCodeBlock.requiredContainer = SyntaxCodeBlockContainer;
|
|
429
|
+
SyntaxCodeBlock.allowedChildren = [CodeToken, Cursor, Text, Break];
|
|
430
|
+
const highlight = (lib, language, text) => {
|
|
431
|
+
if (typeof lib.versionString === "string") {
|
|
432
|
+
const majorVersion = lib.versionString.split(".")[0];
|
|
433
|
+
if (parseInt(majorVersion, 10) >= 11) {
|
|
434
|
+
return lib.highlight(text, {
|
|
435
|
+
language
|
|
436
|
+
}).value;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return lib.highlight(language, text).value;
|
|
440
|
+
};
|
|
441
|
+
class Syntax extends Module {
|
|
442
|
+
static register() {
|
|
443
|
+
Quill.register(CodeToken, true);
|
|
444
|
+
Quill.register(SyntaxCodeBlock, true);
|
|
445
|
+
Quill.register(SyntaxCodeBlockContainer, true);
|
|
446
|
+
}
|
|
447
|
+
constructor(quill, options) {
|
|
448
|
+
super(quill, options);
|
|
449
|
+
if (this.options.hljs == null) {
|
|
450
|
+
throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");
|
|
451
|
+
}
|
|
452
|
+
this.languages = this.options.languages.reduce((memo, _ref2) => {
|
|
453
|
+
let {
|
|
454
|
+
key
|
|
455
|
+
} = _ref2;
|
|
456
|
+
memo[key] = true;
|
|
457
|
+
return memo;
|
|
458
|
+
}, {});
|
|
459
|
+
this.highlightBlot = this.highlightBlot.bind(this);
|
|
460
|
+
this.initListener();
|
|
461
|
+
this.initTimer();
|
|
462
|
+
}
|
|
463
|
+
initListener() {
|
|
464
|
+
this.quill.on(Quill.events.SCROLL_BLOT_MOUNT, (blot) => {
|
|
465
|
+
if (!(blot instanceof SyntaxCodeBlockContainer))
|
|
466
|
+
return;
|
|
467
|
+
const select = this.quill.root.ownerDocument.createElement("select");
|
|
468
|
+
this.options.languages.forEach((_ref3) => {
|
|
469
|
+
let {
|
|
470
|
+
key,
|
|
471
|
+
label
|
|
472
|
+
} = _ref3;
|
|
473
|
+
const option = select.ownerDocument.createElement("option");
|
|
474
|
+
option.textContent = label;
|
|
475
|
+
option.setAttribute("value", key);
|
|
476
|
+
select.appendChild(option);
|
|
477
|
+
});
|
|
478
|
+
select.addEventListener("change", () => {
|
|
479
|
+
blot.format(SyntaxCodeBlock.blotName, select.value);
|
|
480
|
+
this.quill.root.focus();
|
|
481
|
+
this.highlight(blot, true);
|
|
482
|
+
});
|
|
483
|
+
if (blot.uiNode == null) {
|
|
484
|
+
blot.attachUI(select);
|
|
485
|
+
if (blot.children.head) {
|
|
486
|
+
select.value = SyntaxCodeBlock.formats(blot.children.head.domNode);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
initTimer() {
|
|
492
|
+
let timer = null;
|
|
493
|
+
this.quill.on(Quill.events.SCROLL_OPTIMIZE, () => {
|
|
494
|
+
if (timer) {
|
|
495
|
+
clearTimeout(timer);
|
|
496
|
+
}
|
|
497
|
+
timer = setTimeout(() => {
|
|
498
|
+
this.highlight();
|
|
499
|
+
timer = null;
|
|
500
|
+
}, this.options.interval);
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
highlight() {
|
|
504
|
+
let blot = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
505
|
+
let force = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
506
|
+
if (this.quill.selection.composing)
|
|
507
|
+
return;
|
|
508
|
+
this.quill.update(Quill.sources.USER);
|
|
509
|
+
const range = this.quill.getSelection();
|
|
510
|
+
const blots = blot == null ? this.quill.scroll.descendants(SyntaxCodeBlockContainer) : [blot];
|
|
511
|
+
blots.forEach((container) => {
|
|
512
|
+
container.highlight(this.highlightBlot, force);
|
|
513
|
+
});
|
|
514
|
+
this.quill.update(Quill.sources.SILENT);
|
|
515
|
+
if (range != null) {
|
|
516
|
+
this.quill.setSelection(range, Quill.sources.SILENT);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
highlightBlot(text) {
|
|
520
|
+
let language = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "plain";
|
|
521
|
+
language = this.languages[language] ? language : "plain";
|
|
522
|
+
if (language === "plain") {
|
|
523
|
+
return escapeText(text).split("\n").reduce((delta, line, i) => {
|
|
524
|
+
if (i !== 0) {
|
|
525
|
+
delta.insert("\n", {
|
|
526
|
+
[CodeBlock.blotName]: language
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
return delta.insert(line);
|
|
530
|
+
}, new Delta());
|
|
531
|
+
}
|
|
532
|
+
const container = this.quill.root.ownerDocument.createElement("div");
|
|
533
|
+
container.classList.add(CodeBlock.className);
|
|
534
|
+
container.innerHTML = highlight(this.options.hljs, language, text);
|
|
535
|
+
return traverse(this.quill.scroll, container, [(node, delta) => {
|
|
536
|
+
const value = TokenAttributor.value(node);
|
|
537
|
+
if (value) {
|
|
538
|
+
return delta.compose(new Delta().retain(delta.length(), {
|
|
539
|
+
[CodeToken.blotName]: value
|
|
540
|
+
}));
|
|
541
|
+
}
|
|
542
|
+
return delta;
|
|
543
|
+
}], [(node, delta) => {
|
|
544
|
+
return node.data.split("\n").reduce((memo, nodeText, i) => {
|
|
545
|
+
if (i !== 0)
|
|
546
|
+
memo.insert("\n", {
|
|
547
|
+
[CodeBlock.blotName]: language
|
|
548
|
+
});
|
|
549
|
+
return memo.insert(nodeText);
|
|
550
|
+
}, delta);
|
|
551
|
+
}], /* @__PURE__ */ new WeakMap());
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
Syntax.DEFAULTS = {
|
|
555
|
+
hljs: (() => {
|
|
556
|
+
return window.hljs;
|
|
557
|
+
})(),
|
|
558
|
+
interval: 1e3,
|
|
559
|
+
languages: [{
|
|
560
|
+
key: "plain",
|
|
561
|
+
label: "Plain"
|
|
562
|
+
}, {
|
|
563
|
+
key: "bash",
|
|
564
|
+
label: "Bash"
|
|
565
|
+
}, {
|
|
566
|
+
key: "cpp",
|
|
567
|
+
label: "C++"
|
|
568
|
+
}, {
|
|
569
|
+
key: "cs",
|
|
570
|
+
label: "C#"
|
|
571
|
+
}, {
|
|
572
|
+
key: "css",
|
|
573
|
+
label: "CSS"
|
|
574
|
+
}, {
|
|
575
|
+
key: "diff",
|
|
576
|
+
label: "Diff"
|
|
577
|
+
}, {
|
|
578
|
+
key: "xml",
|
|
579
|
+
label: "HTML/XML"
|
|
580
|
+
}, {
|
|
581
|
+
key: "java",
|
|
582
|
+
label: "Java"
|
|
583
|
+
}, {
|
|
584
|
+
key: "javascript",
|
|
585
|
+
label: "JavaScript"
|
|
586
|
+
}, {
|
|
587
|
+
key: "markdown",
|
|
588
|
+
label: "Markdown"
|
|
589
|
+
}, {
|
|
590
|
+
key: "php",
|
|
591
|
+
label: "PHP"
|
|
592
|
+
}, {
|
|
593
|
+
key: "python",
|
|
594
|
+
label: "Python"
|
|
595
|
+
}, {
|
|
596
|
+
key: "ruby",
|
|
597
|
+
label: "Ruby"
|
|
598
|
+
}, {
|
|
599
|
+
key: "sql",
|
|
600
|
+
label: "SQL"
|
|
601
|
+
}]
|
|
602
|
+
};
|
|
603
|
+
const _TableCell = class _TableCell extends Block {
|
|
604
|
+
static create(value) {
|
|
605
|
+
const node = super.create();
|
|
606
|
+
if (value) {
|
|
607
|
+
node.setAttribute("data-row", value);
|
|
608
|
+
} else {
|
|
609
|
+
node.setAttribute("data-row", tableId());
|
|
610
|
+
}
|
|
611
|
+
return node;
|
|
612
|
+
}
|
|
613
|
+
static formats(domNode) {
|
|
614
|
+
if (domNode.hasAttribute("data-row")) {
|
|
615
|
+
return domNode.getAttribute("data-row");
|
|
616
|
+
}
|
|
617
|
+
return void 0;
|
|
618
|
+
}
|
|
619
|
+
cellOffset() {
|
|
620
|
+
if (this.parent) {
|
|
621
|
+
return this.parent.children.indexOf(this);
|
|
622
|
+
}
|
|
623
|
+
return -1;
|
|
624
|
+
}
|
|
625
|
+
format(name, value) {
|
|
626
|
+
if (name === _TableCell.blotName && value) {
|
|
627
|
+
this.domNode.setAttribute("data-row", value);
|
|
628
|
+
} else {
|
|
629
|
+
super.format(name, value);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
row() {
|
|
633
|
+
return this.parent;
|
|
634
|
+
}
|
|
635
|
+
rowOffset() {
|
|
636
|
+
if (this.row()) {
|
|
637
|
+
return this.row().rowOffset();
|
|
638
|
+
}
|
|
639
|
+
return -1;
|
|
640
|
+
}
|
|
641
|
+
table() {
|
|
642
|
+
return this.row() && this.row().table();
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
__publicField(_TableCell, "blotName", "table");
|
|
646
|
+
__publicField(_TableCell, "tagName", "TD");
|
|
647
|
+
let TableCell = _TableCell;
|
|
648
|
+
class TableRow extends Container {
|
|
649
|
+
checkMerge() {
|
|
650
|
+
if (super.checkMerge() && this.next.children.head != null) {
|
|
651
|
+
const thisHead = this.children.head.formats();
|
|
652
|
+
const thisTail = this.children.tail.formats();
|
|
653
|
+
const nextHead = this.next.children.head.formats();
|
|
654
|
+
const nextTail = this.next.children.tail.formats();
|
|
655
|
+
return thisHead.table === thisTail.table && thisHead.table === nextHead.table && thisHead.table === nextTail.table;
|
|
656
|
+
}
|
|
657
|
+
return false;
|
|
658
|
+
}
|
|
659
|
+
optimize(context) {
|
|
660
|
+
super.optimize(context);
|
|
661
|
+
this.children.forEach((child) => {
|
|
662
|
+
if (child.next == null)
|
|
663
|
+
return;
|
|
664
|
+
const childFormats = child.formats();
|
|
665
|
+
const nextFormats = child.next.formats();
|
|
666
|
+
if (childFormats.table !== nextFormats.table) {
|
|
667
|
+
const next = this.splitAfter(child);
|
|
668
|
+
if (next) {
|
|
669
|
+
next.optimize();
|
|
670
|
+
}
|
|
671
|
+
if (this.prev) {
|
|
672
|
+
this.prev.optimize();
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
rowOffset() {
|
|
678
|
+
if (this.parent) {
|
|
679
|
+
return this.parent.children.indexOf(this);
|
|
680
|
+
}
|
|
681
|
+
return -1;
|
|
682
|
+
}
|
|
683
|
+
table() {
|
|
684
|
+
return this.parent && this.parent.parent;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
__publicField(TableRow, "blotName", "table-row");
|
|
688
|
+
__publicField(TableRow, "tagName", "TR");
|
|
689
|
+
class TableBody extends Container {
|
|
690
|
+
}
|
|
691
|
+
__publicField(TableBody, "blotName", "table-body");
|
|
692
|
+
__publicField(TableBody, "tagName", "TBODY");
|
|
693
|
+
class TableContainer extends Container {
|
|
694
|
+
balanceCells() {
|
|
695
|
+
const rows = this.descendants(TableRow);
|
|
696
|
+
const maxColumns = rows.reduce((max, row) => {
|
|
697
|
+
return Math.max(row.children.length, max);
|
|
698
|
+
}, 0);
|
|
699
|
+
rows.forEach((row) => {
|
|
700
|
+
new Array(maxColumns - row.children.length).fill(0).forEach(() => {
|
|
701
|
+
let value;
|
|
702
|
+
if (row.children.head != null) {
|
|
703
|
+
value = TableCell.formats(row.children.head.domNode);
|
|
704
|
+
}
|
|
705
|
+
const blot = this.scroll.create(TableCell.blotName, value);
|
|
706
|
+
row.appendChild(blot);
|
|
707
|
+
blot.optimize();
|
|
708
|
+
});
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
cells(column) {
|
|
712
|
+
return this.rows().map((row) => row.children.at(column));
|
|
713
|
+
}
|
|
714
|
+
deleteColumn(index) {
|
|
715
|
+
const [body] = this.descendant(TableBody);
|
|
716
|
+
if (body == null || body.children.head == null)
|
|
717
|
+
return;
|
|
718
|
+
body.children.forEach((row) => {
|
|
719
|
+
const cell = row.children.at(index);
|
|
720
|
+
if (cell != null) {
|
|
721
|
+
cell.remove();
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
insertColumn(index) {
|
|
726
|
+
const [body] = this.descendant(TableBody);
|
|
727
|
+
if (body == null || body.children.head == null)
|
|
728
|
+
return;
|
|
729
|
+
body.children.forEach((row) => {
|
|
730
|
+
const ref = row.children.at(index);
|
|
731
|
+
const value = TableCell.formats(row.children.head.domNode);
|
|
732
|
+
const cell = this.scroll.create(TableCell.blotName, value);
|
|
733
|
+
row.insertBefore(cell, ref);
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
insertRow(index) {
|
|
737
|
+
const [body] = this.descendant(TableBody);
|
|
738
|
+
if (body == null || body.children.head == null)
|
|
739
|
+
return;
|
|
740
|
+
const id = tableId();
|
|
741
|
+
const row = this.scroll.create(TableRow.blotName);
|
|
742
|
+
body.children.head.children.forEach(() => {
|
|
743
|
+
const cell = this.scroll.create(TableCell.blotName, id);
|
|
744
|
+
row.appendChild(cell);
|
|
745
|
+
});
|
|
746
|
+
const ref = body.children.at(index);
|
|
747
|
+
body.insertBefore(row, ref);
|
|
748
|
+
}
|
|
749
|
+
rows() {
|
|
750
|
+
const body = this.children.head;
|
|
751
|
+
if (body == null)
|
|
752
|
+
return [];
|
|
753
|
+
return body.children.map((row) => row);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
__publicField(TableContainer, "blotName", "table-container");
|
|
757
|
+
__publicField(TableContainer, "tagName", "TABLE");
|
|
758
|
+
TableContainer.allowedChildren = [TableBody];
|
|
759
|
+
TableBody.requiredContainer = TableContainer;
|
|
760
|
+
TableBody.allowedChildren = [TableRow];
|
|
761
|
+
TableRow.requiredContainer = TableBody;
|
|
762
|
+
TableRow.allowedChildren = [TableCell];
|
|
763
|
+
TableCell.requiredContainer = TableRow;
|
|
764
|
+
function tableId() {
|
|
765
|
+
const id = Math.random().toString(36).slice(2, 6);
|
|
766
|
+
return `row-${id}`;
|
|
767
|
+
}
|
|
768
|
+
class Table extends Module {
|
|
769
|
+
static register() {
|
|
770
|
+
Quill.register(TableCell);
|
|
771
|
+
Quill.register(TableRow);
|
|
772
|
+
Quill.register(TableBody);
|
|
773
|
+
Quill.register(TableContainer);
|
|
774
|
+
}
|
|
775
|
+
constructor() {
|
|
776
|
+
super(...arguments);
|
|
777
|
+
this.listenBalanceCells();
|
|
778
|
+
}
|
|
779
|
+
balanceTables() {
|
|
780
|
+
this.quill.scroll.descendants(TableContainer).forEach((table) => {
|
|
781
|
+
table.balanceCells();
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
deleteColumn() {
|
|
785
|
+
const [table, , cell] = this.getTable();
|
|
786
|
+
if (cell == null)
|
|
787
|
+
return;
|
|
788
|
+
table.deleteColumn(cell.cellOffset());
|
|
789
|
+
this.quill.update(Quill.sources.USER);
|
|
790
|
+
}
|
|
791
|
+
deleteRow() {
|
|
792
|
+
const [, row] = this.getTable();
|
|
793
|
+
if (row == null)
|
|
794
|
+
return;
|
|
795
|
+
row.remove();
|
|
796
|
+
this.quill.update(Quill.sources.USER);
|
|
797
|
+
}
|
|
798
|
+
deleteTable() {
|
|
799
|
+
const [table] = this.getTable();
|
|
800
|
+
if (table == null)
|
|
801
|
+
return;
|
|
802
|
+
const offset = table.offset();
|
|
803
|
+
table.remove();
|
|
804
|
+
this.quill.update(Quill.sources.USER);
|
|
805
|
+
this.quill.setSelection(offset, Quill.sources.SILENT);
|
|
806
|
+
}
|
|
807
|
+
getTable() {
|
|
808
|
+
let range = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.quill.getSelection();
|
|
809
|
+
if (range == null)
|
|
810
|
+
return [null, null, null, -1];
|
|
811
|
+
const [cell, offset] = this.quill.getLine(range.index);
|
|
812
|
+
if (cell == null || cell.statics.blotName !== TableCell.blotName) {
|
|
813
|
+
return [null, null, null, -1];
|
|
814
|
+
}
|
|
815
|
+
const row = cell.parent;
|
|
816
|
+
const table = row.parent.parent;
|
|
817
|
+
return [table, row, cell, offset];
|
|
818
|
+
}
|
|
819
|
+
insertColumn(offset) {
|
|
820
|
+
const range = this.quill.getSelection();
|
|
821
|
+
if (!range)
|
|
822
|
+
return;
|
|
823
|
+
const [table, row, cell] = this.getTable(range);
|
|
824
|
+
if (cell == null)
|
|
825
|
+
return;
|
|
826
|
+
const column = cell.cellOffset();
|
|
827
|
+
table.insertColumn(column + offset);
|
|
828
|
+
this.quill.update(Quill.sources.USER);
|
|
829
|
+
let shift = row.rowOffset();
|
|
830
|
+
if (offset === 0) {
|
|
831
|
+
shift += 1;
|
|
832
|
+
}
|
|
833
|
+
this.quill.setSelection(range.index + shift, range.length, Quill.sources.SILENT);
|
|
834
|
+
}
|
|
835
|
+
insertColumnLeft() {
|
|
836
|
+
this.insertColumn(0);
|
|
837
|
+
}
|
|
838
|
+
insertColumnRight() {
|
|
839
|
+
this.insertColumn(1);
|
|
840
|
+
}
|
|
841
|
+
insertRow(offset) {
|
|
842
|
+
const range = this.quill.getSelection();
|
|
843
|
+
if (!range)
|
|
844
|
+
return;
|
|
845
|
+
const [table, row, cell] = this.getTable(range);
|
|
846
|
+
if (cell == null)
|
|
847
|
+
return;
|
|
848
|
+
const index = row.rowOffset();
|
|
849
|
+
table.insertRow(index + offset);
|
|
850
|
+
this.quill.update(Quill.sources.USER);
|
|
851
|
+
if (offset > 0) {
|
|
852
|
+
this.quill.setSelection(range, Quill.sources.SILENT);
|
|
853
|
+
} else {
|
|
854
|
+
this.quill.setSelection(range.index + row.children.length, range.length, Quill.sources.SILENT);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
insertRowAbove() {
|
|
858
|
+
this.insertRow(0);
|
|
859
|
+
}
|
|
860
|
+
insertRowBelow() {
|
|
861
|
+
this.insertRow(1);
|
|
862
|
+
}
|
|
863
|
+
insertTable(rows, columns) {
|
|
864
|
+
const range = this.quill.getSelection();
|
|
865
|
+
if (range == null)
|
|
866
|
+
return;
|
|
867
|
+
const delta = new Array(rows).fill(0).reduce((memo) => {
|
|
868
|
+
const text = new Array(columns).fill("\n").join("");
|
|
869
|
+
return memo.insert(text, {
|
|
870
|
+
table: tableId()
|
|
871
|
+
});
|
|
872
|
+
}, new Delta().retain(range.index));
|
|
873
|
+
this.quill.updateContents(delta, Quill.sources.USER);
|
|
874
|
+
this.quill.setSelection(range.index, Quill.sources.SILENT);
|
|
875
|
+
this.balanceTables();
|
|
876
|
+
}
|
|
877
|
+
listenBalanceCells() {
|
|
878
|
+
this.quill.on(Quill.events.SCROLL_OPTIMIZE, (mutations) => {
|
|
879
|
+
mutations.some((mutation) => {
|
|
880
|
+
if (["TD", "TR", "TBODY", "TABLE"].includes(mutation.target.tagName)) {
|
|
881
|
+
this.quill.once(Quill.events.TEXT_CHANGE, (delta, old, source) => {
|
|
882
|
+
if (source !== Quill.sources.USER)
|
|
883
|
+
return;
|
|
884
|
+
this.balanceTables();
|
|
885
|
+
});
|
|
886
|
+
return true;
|
|
887
|
+
}
|
|
888
|
+
return false;
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
const debug = namespace("quill:toolbar");
|
|
894
|
+
class Toolbar extends Module {
|
|
895
|
+
constructor(quill, options) {
|
|
896
|
+
var _a, _b;
|
|
897
|
+
super(quill, options);
|
|
898
|
+
if (Array.isArray(this.options.container)) {
|
|
899
|
+
const container = document.createElement("div");
|
|
900
|
+
container.setAttribute("role", "toolbar");
|
|
901
|
+
addControls(container, this.options.container);
|
|
902
|
+
(_b = (_a = quill.container) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.insertBefore(container, quill.container);
|
|
903
|
+
this.container = container;
|
|
904
|
+
} else if (typeof this.options.container === "string") {
|
|
905
|
+
this.container = document.querySelector(this.options.container);
|
|
906
|
+
} else {
|
|
907
|
+
this.container = this.options.container;
|
|
908
|
+
}
|
|
909
|
+
if (!(this.container instanceof HTMLElement)) {
|
|
910
|
+
debug.error("Container required for toolbar", this.options);
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
this.container.classList.add("ql-toolbar");
|
|
914
|
+
this.controls = [];
|
|
915
|
+
this.handlers = {};
|
|
916
|
+
if (this.options.handlers) {
|
|
917
|
+
Object.keys(this.options.handlers).forEach((format) => {
|
|
918
|
+
var _a2;
|
|
919
|
+
const handler = (_a2 = this.options.handlers) == null ? void 0 : _a2[format];
|
|
920
|
+
if (handler) {
|
|
921
|
+
this.addHandler(format, handler);
|
|
922
|
+
}
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
Array.from(this.container.querySelectorAll("button, select")).forEach((input) => {
|
|
926
|
+
this.attach(input);
|
|
927
|
+
});
|
|
928
|
+
this.quill.on(Quill.events.EDITOR_CHANGE, () => {
|
|
929
|
+
const [range] = this.quill.selection.getRange();
|
|
930
|
+
this.update(range);
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
addHandler(format, handler) {
|
|
934
|
+
this.handlers[format] = handler;
|
|
935
|
+
}
|
|
936
|
+
attach(input) {
|
|
937
|
+
let format = Array.from(input.classList).find((className) => {
|
|
938
|
+
return className.indexOf("ql-") === 0;
|
|
939
|
+
});
|
|
940
|
+
if (!format)
|
|
941
|
+
return;
|
|
942
|
+
format = format.slice("ql-".length);
|
|
943
|
+
if (input.tagName === "BUTTON") {
|
|
944
|
+
input.setAttribute("type", "button");
|
|
945
|
+
}
|
|
946
|
+
if (this.handlers[format] == null && this.quill.scroll.query(format) == null) {
|
|
947
|
+
debug.warn("ignoring attaching to nonexistent format", format, input);
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
const eventName = input.tagName === "SELECT" ? "change" : "click";
|
|
951
|
+
input.addEventListener(eventName, (e) => {
|
|
952
|
+
let value;
|
|
953
|
+
if (input.tagName === "SELECT") {
|
|
954
|
+
if (input.selectedIndex < 0)
|
|
955
|
+
return;
|
|
956
|
+
const selected = input.options[input.selectedIndex];
|
|
957
|
+
if (selected.hasAttribute("selected")) {
|
|
958
|
+
value = false;
|
|
959
|
+
} else {
|
|
960
|
+
value = selected.value || false;
|
|
961
|
+
}
|
|
962
|
+
} else {
|
|
963
|
+
if (input.classList.contains("ql-active")) {
|
|
964
|
+
value = false;
|
|
965
|
+
} else {
|
|
966
|
+
value = input.value || !input.hasAttribute("value");
|
|
967
|
+
}
|
|
968
|
+
e.preventDefault();
|
|
969
|
+
}
|
|
970
|
+
this.quill.focus();
|
|
971
|
+
const [range] = this.quill.selection.getRange();
|
|
972
|
+
if (this.handlers[format] != null) {
|
|
973
|
+
this.handlers[format].call(this, value);
|
|
974
|
+
} else if (
|
|
975
|
+
// @ts-expect-error
|
|
976
|
+
this.quill.scroll.query(format).prototype instanceof EmbedBlot$1
|
|
977
|
+
) {
|
|
978
|
+
value = prompt(`Enter ${format}`);
|
|
979
|
+
if (!value)
|
|
980
|
+
return;
|
|
981
|
+
this.quill.updateContents(new Delta().retain(range.index).delete(range.length).insert({
|
|
982
|
+
[format]: value
|
|
983
|
+
}), Quill.sources.USER);
|
|
984
|
+
} else {
|
|
985
|
+
this.quill.format(format, value, Quill.sources.USER);
|
|
986
|
+
}
|
|
987
|
+
this.update(range);
|
|
988
|
+
});
|
|
989
|
+
this.controls.push([format, input]);
|
|
990
|
+
}
|
|
991
|
+
update(range) {
|
|
992
|
+
const formats = range == null ? {} : this.quill.getFormat(range);
|
|
993
|
+
this.controls.forEach((pair) => {
|
|
994
|
+
const [format, input] = pair;
|
|
995
|
+
if (input.tagName === "SELECT") {
|
|
996
|
+
let option = null;
|
|
997
|
+
if (range == null) {
|
|
998
|
+
option = null;
|
|
999
|
+
} else if (formats[format] == null) {
|
|
1000
|
+
option = input.querySelector("option[selected]");
|
|
1001
|
+
} else if (!Array.isArray(formats[format])) {
|
|
1002
|
+
let value = formats[format];
|
|
1003
|
+
if (typeof value === "string") {
|
|
1004
|
+
value = value.replace(/"/g, '\\"');
|
|
1005
|
+
}
|
|
1006
|
+
option = input.querySelector(`option[value="${value}"]`);
|
|
1007
|
+
}
|
|
1008
|
+
if (option == null) {
|
|
1009
|
+
input.value = "";
|
|
1010
|
+
input.selectedIndex = -1;
|
|
1011
|
+
} else {
|
|
1012
|
+
option.selected = true;
|
|
1013
|
+
}
|
|
1014
|
+
} else if (range == null) {
|
|
1015
|
+
input.classList.remove("ql-active");
|
|
1016
|
+
input.setAttribute("aria-pressed", "false");
|
|
1017
|
+
} else if (input.hasAttribute("value")) {
|
|
1018
|
+
const value = formats[format];
|
|
1019
|
+
const isActive = value === input.getAttribute("value") || value != null && value.toString() === input.getAttribute("value") || value == null && !input.getAttribute("value");
|
|
1020
|
+
input.classList.toggle("ql-active", isActive);
|
|
1021
|
+
input.setAttribute("aria-pressed", isActive.toString());
|
|
1022
|
+
} else {
|
|
1023
|
+
const isActive = formats[format] != null;
|
|
1024
|
+
input.classList.toggle("ql-active", isActive);
|
|
1025
|
+
input.setAttribute("aria-pressed", isActive.toString());
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
Toolbar.DEFAULTS = {};
|
|
1031
|
+
function addButton(container, format, value) {
|
|
1032
|
+
const input = document.createElement("button");
|
|
1033
|
+
input.setAttribute("type", "button");
|
|
1034
|
+
input.classList.add(`ql-${format}`);
|
|
1035
|
+
input.setAttribute("aria-pressed", "false");
|
|
1036
|
+
if (value != null) {
|
|
1037
|
+
input.value = value;
|
|
1038
|
+
input.setAttribute("aria-label", `${format}: ${value}`);
|
|
1039
|
+
} else {
|
|
1040
|
+
input.setAttribute("aria-label", format);
|
|
1041
|
+
}
|
|
1042
|
+
container.appendChild(input);
|
|
1043
|
+
}
|
|
1044
|
+
function addControls(container, groups) {
|
|
1045
|
+
if (!Array.isArray(groups[0])) {
|
|
1046
|
+
groups = [groups];
|
|
1047
|
+
}
|
|
1048
|
+
groups.forEach((controls) => {
|
|
1049
|
+
const group = document.createElement("span");
|
|
1050
|
+
group.classList.add("ql-formats");
|
|
1051
|
+
controls.forEach((control) => {
|
|
1052
|
+
if (typeof control === "string") {
|
|
1053
|
+
addButton(group, control);
|
|
1054
|
+
} else {
|
|
1055
|
+
const format = Object.keys(control)[0];
|
|
1056
|
+
const value = control[format];
|
|
1057
|
+
if (Array.isArray(value)) {
|
|
1058
|
+
addSelect(group, format, value);
|
|
1059
|
+
} else {
|
|
1060
|
+
addButton(group, format, value);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
container.appendChild(group);
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
function addSelect(container, format, values) {
|
|
1068
|
+
const input = document.createElement("select");
|
|
1069
|
+
input.classList.add(`ql-${format}`);
|
|
1070
|
+
values.forEach((value) => {
|
|
1071
|
+
const option = document.createElement("option");
|
|
1072
|
+
if (value !== false) {
|
|
1073
|
+
option.setAttribute("value", String(value));
|
|
1074
|
+
} else {
|
|
1075
|
+
option.setAttribute("selected", "selected");
|
|
1076
|
+
}
|
|
1077
|
+
input.appendChild(option);
|
|
1078
|
+
});
|
|
1079
|
+
container.appendChild(input);
|
|
1080
|
+
}
|
|
1081
|
+
Toolbar.DEFAULTS = {
|
|
1082
|
+
container: null,
|
|
1083
|
+
handlers: {
|
|
1084
|
+
clean() {
|
|
1085
|
+
const range = this.quill.getSelection();
|
|
1086
|
+
if (range == null)
|
|
1087
|
+
return;
|
|
1088
|
+
if (range.length === 0) {
|
|
1089
|
+
const formats = this.quill.getFormat();
|
|
1090
|
+
Object.keys(formats).forEach((name) => {
|
|
1091
|
+
if (this.quill.scroll.query(name, Scope.INLINE) != null) {
|
|
1092
|
+
this.quill.format(name, false, Quill.sources.USER);
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
} else {
|
|
1096
|
+
this.quill.removeFormat(range.index, range.length, Quill.sources.USER);
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
direction(value) {
|
|
1100
|
+
const {
|
|
1101
|
+
align
|
|
1102
|
+
} = this.quill.getFormat();
|
|
1103
|
+
if (value === "rtl" && align == null) {
|
|
1104
|
+
this.quill.format("align", "right", Quill.sources.USER);
|
|
1105
|
+
} else if (!value && align === "right") {
|
|
1106
|
+
this.quill.format("align", false, Quill.sources.USER);
|
|
1107
|
+
}
|
|
1108
|
+
this.quill.format("direction", value, Quill.sources.USER);
|
|
1109
|
+
},
|
|
1110
|
+
indent(value) {
|
|
1111
|
+
const range = this.quill.getSelection();
|
|
1112
|
+
const formats = this.quill.getFormat(range);
|
|
1113
|
+
const indent = parseInt(formats.indent || 0, 10);
|
|
1114
|
+
if (value === "+1" || value === "-1") {
|
|
1115
|
+
let modifier = value === "+1" ? 1 : -1;
|
|
1116
|
+
if (formats.direction === "rtl")
|
|
1117
|
+
modifier *= -1;
|
|
1118
|
+
this.quill.format("indent", indent + modifier, Quill.sources.USER);
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
link(value) {
|
|
1122
|
+
if (value === true) {
|
|
1123
|
+
value = prompt("Enter link URL:");
|
|
1124
|
+
}
|
|
1125
|
+
this.quill.format("link", value, Quill.sources.USER);
|
|
1126
|
+
},
|
|
1127
|
+
list(value) {
|
|
1128
|
+
const range = this.quill.getSelection();
|
|
1129
|
+
const formats = this.quill.getFormat(range);
|
|
1130
|
+
if (value === "check") {
|
|
1131
|
+
if (formats.list === "checked" || formats.list === "unchecked") {
|
|
1132
|
+
this.quill.format("list", false, Quill.sources.USER);
|
|
1133
|
+
} else {
|
|
1134
|
+
this.quill.format("list", "unchecked", Quill.sources.USER);
|
|
1135
|
+
}
|
|
1136
|
+
} else {
|
|
1137
|
+
this.quill.format("list", value, Quill.sources.USER);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
};
|
|
1142
|
+
const alignLeftIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>';
|
|
1143
|
+
const alignCenterIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>';
|
|
1144
|
+
const alignRightIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>';
|
|
1145
|
+
const alignJustifyIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>';
|
|
1146
|
+
const backgroundIcon = '<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>';
|
|
1147
|
+
const blockquoteIcon = '<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>';
|
|
1148
|
+
const boldIcon = '<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>';
|
|
1149
|
+
const cleanIcon = '<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>';
|
|
1150
|
+
const codeIcon = '<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>';
|
|
1151
|
+
const colorIcon = '<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>';
|
|
1152
|
+
const directionLeftToRightIcon = '<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>';
|
|
1153
|
+
const directionRightToLeftIcon = '<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>';
|
|
1154
|
+
const formulaIcon = '<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>';
|
|
1155
|
+
const headerIcon = '<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>';
|
|
1156
|
+
const header2Icon = '<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>';
|
|
1157
|
+
const header3Icon = '<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>';
|
|
1158
|
+
const header4Icon = '<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>';
|
|
1159
|
+
const header5Icon = '<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>';
|
|
1160
|
+
const header6Icon = '<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>';
|
|
1161
|
+
const italicIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>';
|
|
1162
|
+
const imageIcon = '<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>';
|
|
1163
|
+
const indentIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>';
|
|
1164
|
+
const outdentIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>';
|
|
1165
|
+
const linkIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>';
|
|
1166
|
+
const listBulletIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>';
|
|
1167
|
+
const listCheckIcon = '<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>';
|
|
1168
|
+
const listOrderedIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>';
|
|
1169
|
+
const subscriptIcon = '<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>';
|
|
1170
|
+
const superscriptIcon = '<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>';
|
|
1171
|
+
const strikeIcon = '<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>';
|
|
1172
|
+
const tableIcon = '<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>';
|
|
1173
|
+
const underlineIcon = '<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>';
|
|
1174
|
+
const videoIcon = '<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>';
|
|
1175
|
+
const Icons = {
|
|
1176
|
+
align: {
|
|
1177
|
+
"": alignLeftIcon,
|
|
1178
|
+
center: alignCenterIcon,
|
|
1179
|
+
right: alignRightIcon,
|
|
1180
|
+
justify: alignJustifyIcon
|
|
1181
|
+
},
|
|
1182
|
+
background: backgroundIcon,
|
|
1183
|
+
blockquote: blockquoteIcon,
|
|
1184
|
+
bold: boldIcon,
|
|
1185
|
+
clean: cleanIcon,
|
|
1186
|
+
code: codeIcon,
|
|
1187
|
+
"code-block": codeIcon,
|
|
1188
|
+
color: colorIcon,
|
|
1189
|
+
direction: {
|
|
1190
|
+
"": directionLeftToRightIcon,
|
|
1191
|
+
rtl: directionRightToLeftIcon
|
|
1192
|
+
},
|
|
1193
|
+
formula: formulaIcon,
|
|
1194
|
+
header: {
|
|
1195
|
+
"1": headerIcon,
|
|
1196
|
+
"2": header2Icon,
|
|
1197
|
+
"3": header3Icon,
|
|
1198
|
+
"4": header4Icon,
|
|
1199
|
+
"5": header5Icon,
|
|
1200
|
+
"6": header6Icon
|
|
1201
|
+
},
|
|
1202
|
+
italic: italicIcon,
|
|
1203
|
+
image: imageIcon,
|
|
1204
|
+
indent: {
|
|
1205
|
+
"+1": indentIcon,
|
|
1206
|
+
"-1": outdentIcon
|
|
1207
|
+
},
|
|
1208
|
+
link: linkIcon,
|
|
1209
|
+
list: {
|
|
1210
|
+
bullet: listBulletIcon,
|
|
1211
|
+
check: listCheckIcon,
|
|
1212
|
+
ordered: listOrderedIcon
|
|
1213
|
+
},
|
|
1214
|
+
script: {
|
|
1215
|
+
sub: subscriptIcon,
|
|
1216
|
+
super: superscriptIcon
|
|
1217
|
+
},
|
|
1218
|
+
strike: strikeIcon,
|
|
1219
|
+
table: tableIcon,
|
|
1220
|
+
underline: underlineIcon,
|
|
1221
|
+
video: videoIcon
|
|
1222
|
+
};
|
|
1223
|
+
const DropdownIcon = '<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>';
|
|
1224
|
+
let optionsCounter = 0;
|
|
1225
|
+
function toggleAriaAttribute(element, attribute) {
|
|
1226
|
+
element.setAttribute(attribute, `${!(element.getAttribute(attribute) === "true")}`);
|
|
1227
|
+
}
|
|
1228
|
+
class Picker {
|
|
1229
|
+
constructor(select) {
|
|
1230
|
+
this.select = select;
|
|
1231
|
+
this.container = document.createElement("span");
|
|
1232
|
+
this.buildPicker();
|
|
1233
|
+
this.select.style.display = "none";
|
|
1234
|
+
this.select.parentNode.insertBefore(this.container, this.select);
|
|
1235
|
+
this.label.addEventListener("mousedown", () => {
|
|
1236
|
+
this.togglePicker();
|
|
1237
|
+
});
|
|
1238
|
+
this.label.addEventListener("keydown", (event) => {
|
|
1239
|
+
switch (event.key) {
|
|
1240
|
+
case "Enter":
|
|
1241
|
+
this.togglePicker();
|
|
1242
|
+
break;
|
|
1243
|
+
case "Escape":
|
|
1244
|
+
this.escape();
|
|
1245
|
+
event.preventDefault();
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
this.select.addEventListener("change", this.update.bind(this));
|
|
1250
|
+
}
|
|
1251
|
+
togglePicker() {
|
|
1252
|
+
this.container.classList.toggle("ql-expanded");
|
|
1253
|
+
toggleAriaAttribute(this.label, "aria-expanded");
|
|
1254
|
+
toggleAriaAttribute(this.options, "aria-hidden");
|
|
1255
|
+
}
|
|
1256
|
+
buildItem(option) {
|
|
1257
|
+
const item = document.createElement("span");
|
|
1258
|
+
item.tabIndex = "0";
|
|
1259
|
+
item.setAttribute("role", "button");
|
|
1260
|
+
item.classList.add("ql-picker-item");
|
|
1261
|
+
const value = option.getAttribute("value");
|
|
1262
|
+
if (value) {
|
|
1263
|
+
item.setAttribute("data-value", value);
|
|
1264
|
+
}
|
|
1265
|
+
if (option.textContent) {
|
|
1266
|
+
item.setAttribute("data-label", option.textContent);
|
|
1267
|
+
}
|
|
1268
|
+
item.addEventListener("click", () => {
|
|
1269
|
+
this.selectItem(item, true);
|
|
1270
|
+
});
|
|
1271
|
+
item.addEventListener("keydown", (event) => {
|
|
1272
|
+
switch (event.key) {
|
|
1273
|
+
case "Enter":
|
|
1274
|
+
this.selectItem(item, true);
|
|
1275
|
+
event.preventDefault();
|
|
1276
|
+
break;
|
|
1277
|
+
case "Escape":
|
|
1278
|
+
this.escape();
|
|
1279
|
+
event.preventDefault();
|
|
1280
|
+
break;
|
|
1281
|
+
}
|
|
1282
|
+
});
|
|
1283
|
+
return item;
|
|
1284
|
+
}
|
|
1285
|
+
buildLabel() {
|
|
1286
|
+
const label = document.createElement("span");
|
|
1287
|
+
label.classList.add("ql-picker-label");
|
|
1288
|
+
label.innerHTML = DropdownIcon;
|
|
1289
|
+
label.tabIndex = "0";
|
|
1290
|
+
label.setAttribute("role", "button");
|
|
1291
|
+
label.setAttribute("aria-expanded", "false");
|
|
1292
|
+
this.container.appendChild(label);
|
|
1293
|
+
return label;
|
|
1294
|
+
}
|
|
1295
|
+
buildOptions() {
|
|
1296
|
+
const options = document.createElement("span");
|
|
1297
|
+
options.classList.add("ql-picker-options");
|
|
1298
|
+
options.setAttribute("aria-hidden", "true");
|
|
1299
|
+
options.tabIndex = "-1";
|
|
1300
|
+
options.id = `ql-picker-options-${optionsCounter}`;
|
|
1301
|
+
optionsCounter += 1;
|
|
1302
|
+
this.label.setAttribute("aria-controls", options.id);
|
|
1303
|
+
this.options = options;
|
|
1304
|
+
Array.from(this.select.options).forEach((option) => {
|
|
1305
|
+
const item = this.buildItem(option);
|
|
1306
|
+
options.appendChild(item);
|
|
1307
|
+
if (option.selected === true) {
|
|
1308
|
+
this.selectItem(item);
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
this.container.appendChild(options);
|
|
1312
|
+
}
|
|
1313
|
+
buildPicker() {
|
|
1314
|
+
Array.from(this.select.attributes).forEach((item) => {
|
|
1315
|
+
this.container.setAttribute(item.name, item.value);
|
|
1316
|
+
});
|
|
1317
|
+
this.container.classList.add("ql-picker");
|
|
1318
|
+
this.label = this.buildLabel();
|
|
1319
|
+
this.buildOptions();
|
|
1320
|
+
}
|
|
1321
|
+
escape() {
|
|
1322
|
+
this.close();
|
|
1323
|
+
setTimeout(() => this.label.focus(), 1);
|
|
1324
|
+
}
|
|
1325
|
+
close() {
|
|
1326
|
+
this.container.classList.remove("ql-expanded");
|
|
1327
|
+
this.label.setAttribute("aria-expanded", "false");
|
|
1328
|
+
this.options.setAttribute("aria-hidden", "true");
|
|
1329
|
+
}
|
|
1330
|
+
selectItem(item) {
|
|
1331
|
+
let trigger = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1332
|
+
const selected = this.container.querySelector(".ql-selected");
|
|
1333
|
+
if (item === selected)
|
|
1334
|
+
return;
|
|
1335
|
+
if (selected != null) {
|
|
1336
|
+
selected.classList.remove("ql-selected");
|
|
1337
|
+
}
|
|
1338
|
+
if (item == null)
|
|
1339
|
+
return;
|
|
1340
|
+
item.classList.add("ql-selected");
|
|
1341
|
+
this.select.selectedIndex = Array.from(item.parentNode.children).indexOf(item);
|
|
1342
|
+
if (item.hasAttribute("data-value")) {
|
|
1343
|
+
this.label.setAttribute("data-value", item.getAttribute("data-value"));
|
|
1344
|
+
} else {
|
|
1345
|
+
this.label.removeAttribute("data-value");
|
|
1346
|
+
}
|
|
1347
|
+
if (item.hasAttribute("data-label")) {
|
|
1348
|
+
this.label.setAttribute("data-label", item.getAttribute("data-label"));
|
|
1349
|
+
} else {
|
|
1350
|
+
this.label.removeAttribute("data-label");
|
|
1351
|
+
}
|
|
1352
|
+
if (trigger) {
|
|
1353
|
+
this.select.dispatchEvent(new Event("change"));
|
|
1354
|
+
this.close();
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
update() {
|
|
1358
|
+
let option;
|
|
1359
|
+
if (this.select.selectedIndex > -1) {
|
|
1360
|
+
const item = (
|
|
1361
|
+
// @ts-expect-error Fix me later
|
|
1362
|
+
this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex]
|
|
1363
|
+
);
|
|
1364
|
+
option = this.select.options[this.select.selectedIndex];
|
|
1365
|
+
this.selectItem(item);
|
|
1366
|
+
} else {
|
|
1367
|
+
this.selectItem(null);
|
|
1368
|
+
}
|
|
1369
|
+
const isActive = option != null && option !== this.select.querySelector("option[selected]");
|
|
1370
|
+
this.label.classList.toggle("ql-active", isActive);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
class ColorPicker extends Picker {
|
|
1374
|
+
constructor(select, label) {
|
|
1375
|
+
super(select);
|
|
1376
|
+
this.label.innerHTML = label;
|
|
1377
|
+
this.container.classList.add("ql-color-picker");
|
|
1378
|
+
Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0, 7).forEach((item) => {
|
|
1379
|
+
item.classList.add("ql-primary");
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
buildItem(option) {
|
|
1383
|
+
const item = super.buildItem(option);
|
|
1384
|
+
item.style.backgroundColor = option.getAttribute("value") || "";
|
|
1385
|
+
return item;
|
|
1386
|
+
}
|
|
1387
|
+
selectItem(item, trigger) {
|
|
1388
|
+
super.selectItem(item, trigger);
|
|
1389
|
+
const colorLabel = this.label.querySelector(".ql-color-label");
|
|
1390
|
+
const value = item ? item.getAttribute("data-value") || "" : "";
|
|
1391
|
+
if (colorLabel) {
|
|
1392
|
+
if (colorLabel.tagName === "line") {
|
|
1393
|
+
colorLabel.style.stroke = value;
|
|
1394
|
+
} else {
|
|
1395
|
+
colorLabel.style.fill = value;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
class IconPicker extends Picker {
|
|
1401
|
+
constructor(select, icons) {
|
|
1402
|
+
super(select);
|
|
1403
|
+
this.container.classList.add("ql-icon-picker");
|
|
1404
|
+
Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach((item) => {
|
|
1405
|
+
item.innerHTML = icons[item.getAttribute("data-value") || ""];
|
|
1406
|
+
});
|
|
1407
|
+
this.defaultItem = this.container.querySelector(".ql-selected");
|
|
1408
|
+
this.selectItem(this.defaultItem);
|
|
1409
|
+
}
|
|
1410
|
+
selectItem(target, trigger) {
|
|
1411
|
+
super.selectItem(target, trigger);
|
|
1412
|
+
const item = target || this.defaultItem;
|
|
1413
|
+
if (item != null) {
|
|
1414
|
+
if (this.label.innerHTML === item.innerHTML)
|
|
1415
|
+
return;
|
|
1416
|
+
this.label.innerHTML = item.innerHTML;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
const isScrollable = (el) => {
|
|
1421
|
+
const {
|
|
1422
|
+
overflowY
|
|
1423
|
+
} = getComputedStyle(el, null);
|
|
1424
|
+
return overflowY !== "visible" && overflowY !== "clip";
|
|
1425
|
+
};
|
|
1426
|
+
class Tooltip {
|
|
1427
|
+
constructor(quill, boundsContainer) {
|
|
1428
|
+
this.quill = quill;
|
|
1429
|
+
this.boundsContainer = boundsContainer || document.body;
|
|
1430
|
+
this.root = quill.addContainer("ql-tooltip");
|
|
1431
|
+
this.root.innerHTML = this.constructor.TEMPLATE;
|
|
1432
|
+
if (isScrollable(this.quill.root)) {
|
|
1433
|
+
this.quill.root.addEventListener("scroll", () => {
|
|
1434
|
+
this.root.style.marginTop = `${-1 * this.quill.root.scrollTop}px`;
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
this.hide();
|
|
1438
|
+
}
|
|
1439
|
+
hide() {
|
|
1440
|
+
this.root.classList.add("ql-hidden");
|
|
1441
|
+
}
|
|
1442
|
+
position(reference) {
|
|
1443
|
+
const left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
|
|
1444
|
+
const top = reference.bottom + this.quill.root.scrollTop;
|
|
1445
|
+
this.root.style.left = `${left}px`;
|
|
1446
|
+
this.root.style.top = `${top}px`;
|
|
1447
|
+
this.root.classList.remove("ql-flip");
|
|
1448
|
+
const containerBounds = this.boundsContainer.getBoundingClientRect();
|
|
1449
|
+
const rootBounds = this.root.getBoundingClientRect();
|
|
1450
|
+
let shift = 0;
|
|
1451
|
+
if (rootBounds.right > containerBounds.right) {
|
|
1452
|
+
shift = containerBounds.right - rootBounds.right;
|
|
1453
|
+
this.root.style.left = `${left + shift}px`;
|
|
1454
|
+
}
|
|
1455
|
+
if (rootBounds.left < containerBounds.left) {
|
|
1456
|
+
shift = containerBounds.left - rootBounds.left;
|
|
1457
|
+
this.root.style.left = `${left + shift}px`;
|
|
1458
|
+
}
|
|
1459
|
+
if (rootBounds.bottom > containerBounds.bottom) {
|
|
1460
|
+
const height = rootBounds.bottom - rootBounds.top;
|
|
1461
|
+
const verticalShift = reference.bottom - reference.top + height;
|
|
1462
|
+
this.root.style.top = `${top - verticalShift}px`;
|
|
1463
|
+
this.root.classList.add("ql-flip");
|
|
1464
|
+
}
|
|
1465
|
+
return shift;
|
|
1466
|
+
}
|
|
1467
|
+
show() {
|
|
1468
|
+
this.root.classList.remove("ql-editing");
|
|
1469
|
+
this.root.classList.remove("ql-hidden");
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
const ALIGNS = [false, "center", "right", "justify"];
|
|
1473
|
+
const COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008a00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"];
|
|
1474
|
+
const FONTS = [false, "serif", "monospace"];
|
|
1475
|
+
const HEADERS = ["1", "2", "3", false];
|
|
1476
|
+
const SIZES = ["small", false, "large", "huge"];
|
|
1477
|
+
class BaseTheme extends Theme {
|
|
1478
|
+
constructor(quill, options) {
|
|
1479
|
+
super(quill, options);
|
|
1480
|
+
const listener = (e) => {
|
|
1481
|
+
if (!document.body.contains(quill.root)) {
|
|
1482
|
+
document.body.removeEventListener("click", listener);
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
if (this.tooltip != null && // @ts-expect-error
|
|
1486
|
+
!this.tooltip.root.contains(e.target) && // @ts-expect-error
|
|
1487
|
+
document.activeElement !== this.tooltip.textbox && !this.quill.hasFocus()) {
|
|
1488
|
+
this.tooltip.hide();
|
|
1489
|
+
}
|
|
1490
|
+
if (this.pickers != null) {
|
|
1491
|
+
this.pickers.forEach((picker) => {
|
|
1492
|
+
if (!picker.container.contains(e.target)) {
|
|
1493
|
+
picker.close();
|
|
1494
|
+
}
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
quill.emitter.listenDOM("click", document.body, listener);
|
|
1499
|
+
}
|
|
1500
|
+
addModule(name) {
|
|
1501
|
+
const module = super.addModule(name);
|
|
1502
|
+
if (name === "toolbar") {
|
|
1503
|
+
this.extendToolbar(module);
|
|
1504
|
+
}
|
|
1505
|
+
return module;
|
|
1506
|
+
}
|
|
1507
|
+
buildButtons(buttons, icons) {
|
|
1508
|
+
Array.from(buttons).forEach((button) => {
|
|
1509
|
+
const className = button.getAttribute("class") || "";
|
|
1510
|
+
className.split(/\s+/).forEach((name) => {
|
|
1511
|
+
if (!name.startsWith("ql-"))
|
|
1512
|
+
return;
|
|
1513
|
+
name = name.slice("ql-".length);
|
|
1514
|
+
if (icons[name] == null)
|
|
1515
|
+
return;
|
|
1516
|
+
if (name === "direction") {
|
|
1517
|
+
button.innerHTML = icons[name][""] + icons[name].rtl;
|
|
1518
|
+
} else if (typeof icons[name] === "string") {
|
|
1519
|
+
button.innerHTML = icons[name];
|
|
1520
|
+
} else {
|
|
1521
|
+
const value = button.value || "";
|
|
1522
|
+
if (value != null && icons[name][value]) {
|
|
1523
|
+
button.innerHTML = icons[name][value];
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
buildPickers(selects, icons) {
|
|
1530
|
+
this.pickers = Array.from(selects).map((select) => {
|
|
1531
|
+
if (select.classList.contains("ql-align")) {
|
|
1532
|
+
if (select.querySelector("option") == null) {
|
|
1533
|
+
fillSelect(select, ALIGNS);
|
|
1534
|
+
}
|
|
1535
|
+
if (typeof icons.align === "object") {
|
|
1536
|
+
return new IconPicker(select, icons.align);
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
if (select.classList.contains("ql-background") || select.classList.contains("ql-color")) {
|
|
1540
|
+
const format = select.classList.contains("ql-background") ? "background" : "color";
|
|
1541
|
+
if (select.querySelector("option") == null) {
|
|
1542
|
+
fillSelect(select, COLORS, format === "background" ? "#ffffff" : "#000000");
|
|
1543
|
+
}
|
|
1544
|
+
return new ColorPicker(select, icons[format]);
|
|
1545
|
+
}
|
|
1546
|
+
if (select.querySelector("option") == null) {
|
|
1547
|
+
if (select.classList.contains("ql-font")) {
|
|
1548
|
+
fillSelect(select, FONTS);
|
|
1549
|
+
} else if (select.classList.contains("ql-header")) {
|
|
1550
|
+
fillSelect(select, HEADERS);
|
|
1551
|
+
} else if (select.classList.contains("ql-size")) {
|
|
1552
|
+
fillSelect(select, SIZES);
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
return new Picker(select);
|
|
1556
|
+
});
|
|
1557
|
+
const update = () => {
|
|
1558
|
+
this.pickers.forEach((picker) => {
|
|
1559
|
+
picker.update();
|
|
1560
|
+
});
|
|
1561
|
+
};
|
|
1562
|
+
this.quill.on(Emitter.events.EDITOR_CHANGE, update);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
BaseTheme.DEFAULTS = merge({}, Theme.DEFAULTS, {
|
|
1566
|
+
modules: {
|
|
1567
|
+
toolbar: {
|
|
1568
|
+
handlers: {
|
|
1569
|
+
formula() {
|
|
1570
|
+
this.quill.theme.tooltip.edit("formula");
|
|
1571
|
+
},
|
|
1572
|
+
image() {
|
|
1573
|
+
let fileInput = this.container.querySelector("input.ql-image[type=file]");
|
|
1574
|
+
if (fileInput == null) {
|
|
1575
|
+
fileInput = document.createElement("input");
|
|
1576
|
+
fileInput.setAttribute("type", "file");
|
|
1577
|
+
fileInput.setAttribute("accept", this.quill.uploader.options.mimetypes.join(", "));
|
|
1578
|
+
fileInput.classList.add("ql-image");
|
|
1579
|
+
fileInput.addEventListener("change", () => {
|
|
1580
|
+
const range = this.quill.getSelection(true);
|
|
1581
|
+
this.quill.uploader.upload(range, fileInput.files);
|
|
1582
|
+
fileInput.value = "";
|
|
1583
|
+
});
|
|
1584
|
+
this.container.appendChild(fileInput);
|
|
1585
|
+
}
|
|
1586
|
+
fileInput.click();
|
|
1587
|
+
},
|
|
1588
|
+
video() {
|
|
1589
|
+
this.quill.theme.tooltip.edit("video");
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1595
|
+
class BaseTooltip extends Tooltip {
|
|
1596
|
+
constructor(quill, boundsContainer) {
|
|
1597
|
+
super(quill, boundsContainer);
|
|
1598
|
+
this.textbox = this.root.querySelector('input[type="text"]');
|
|
1599
|
+
this.listen();
|
|
1600
|
+
}
|
|
1601
|
+
listen() {
|
|
1602
|
+
this.textbox.addEventListener("keydown", (event) => {
|
|
1603
|
+
if (event.key === "Enter") {
|
|
1604
|
+
this.save();
|
|
1605
|
+
event.preventDefault();
|
|
1606
|
+
} else if (event.key === "Escape") {
|
|
1607
|
+
this.cancel();
|
|
1608
|
+
event.preventDefault();
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
cancel() {
|
|
1613
|
+
this.hide();
|
|
1614
|
+
this.restoreFocus();
|
|
1615
|
+
}
|
|
1616
|
+
edit() {
|
|
1617
|
+
let mode = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "link";
|
|
1618
|
+
let preview = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
1619
|
+
this.root.classList.remove("ql-hidden");
|
|
1620
|
+
this.root.classList.add("ql-editing");
|
|
1621
|
+
if (this.textbox == null)
|
|
1622
|
+
return;
|
|
1623
|
+
if (preview != null) {
|
|
1624
|
+
this.textbox.value = preview;
|
|
1625
|
+
} else if (mode !== this.root.getAttribute("data-mode")) {
|
|
1626
|
+
this.textbox.value = "";
|
|
1627
|
+
}
|
|
1628
|
+
const bounds = this.quill.getBounds(this.quill.selection.savedRange);
|
|
1629
|
+
if (bounds != null) {
|
|
1630
|
+
this.position(bounds);
|
|
1631
|
+
}
|
|
1632
|
+
this.textbox.select();
|
|
1633
|
+
this.textbox.setAttribute("placeholder", this.textbox.getAttribute(`data-${mode}`) || "");
|
|
1634
|
+
this.root.setAttribute("data-mode", mode);
|
|
1635
|
+
}
|
|
1636
|
+
restoreFocus() {
|
|
1637
|
+
this.quill.focus({
|
|
1638
|
+
preventScroll: true
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
save() {
|
|
1642
|
+
let {
|
|
1643
|
+
value
|
|
1644
|
+
} = this.textbox;
|
|
1645
|
+
switch (this.root.getAttribute("data-mode")) {
|
|
1646
|
+
case "link": {
|
|
1647
|
+
const {
|
|
1648
|
+
scrollTop
|
|
1649
|
+
} = this.quill.root;
|
|
1650
|
+
if (this.linkRange) {
|
|
1651
|
+
this.quill.formatText(this.linkRange, "link", value, Emitter.sources.USER);
|
|
1652
|
+
delete this.linkRange;
|
|
1653
|
+
} else {
|
|
1654
|
+
this.restoreFocus();
|
|
1655
|
+
this.quill.format("link", value, Emitter.sources.USER);
|
|
1656
|
+
}
|
|
1657
|
+
this.quill.root.scrollTop = scrollTop;
|
|
1658
|
+
break;
|
|
1659
|
+
}
|
|
1660
|
+
case "video": {
|
|
1661
|
+
value = extractVideoUrl(value);
|
|
1662
|
+
}
|
|
1663
|
+
case "formula": {
|
|
1664
|
+
if (!value)
|
|
1665
|
+
break;
|
|
1666
|
+
const range = this.quill.getSelection(true);
|
|
1667
|
+
if (range != null) {
|
|
1668
|
+
const index = range.index + range.length;
|
|
1669
|
+
this.quill.insertEmbed(
|
|
1670
|
+
index,
|
|
1671
|
+
// @ts-expect-error Fix me later
|
|
1672
|
+
this.root.getAttribute("data-mode"),
|
|
1673
|
+
value,
|
|
1674
|
+
Emitter.sources.USER
|
|
1675
|
+
);
|
|
1676
|
+
if (this.root.getAttribute("data-mode") === "formula") {
|
|
1677
|
+
this.quill.insertText(index + 1, " ", Emitter.sources.USER);
|
|
1678
|
+
}
|
|
1679
|
+
this.quill.setSelection(index + 2, Emitter.sources.USER);
|
|
1680
|
+
}
|
|
1681
|
+
break;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
this.textbox.value = "";
|
|
1685
|
+
this.hide();
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
function extractVideoUrl(url) {
|
|
1689
|
+
let match = url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/) || url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);
|
|
1690
|
+
if (match) {
|
|
1691
|
+
return `${match[1] || "https"}://www.youtube.com/embed/${match[2]}?showinfo=0`;
|
|
1692
|
+
}
|
|
1693
|
+
if (match = url.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/)) {
|
|
1694
|
+
return `${match[1] || "https"}://player.vimeo.com/video/${match[2]}/`;
|
|
1695
|
+
}
|
|
1696
|
+
return url;
|
|
1697
|
+
}
|
|
1698
|
+
function fillSelect(select, values) {
|
|
1699
|
+
let defaultValue = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
1700
|
+
values.forEach((value) => {
|
|
1701
|
+
const option = document.createElement("option");
|
|
1702
|
+
if (value === defaultValue) {
|
|
1703
|
+
option.setAttribute("selected", "selected");
|
|
1704
|
+
} else {
|
|
1705
|
+
option.setAttribute("value", String(value));
|
|
1706
|
+
}
|
|
1707
|
+
select.appendChild(option);
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
const TOOLBAR_CONFIG$1 = [["bold", "italic", "link"], [{
|
|
1711
|
+
header: 1
|
|
1712
|
+
}, {
|
|
1713
|
+
header: 2
|
|
1714
|
+
}, "blockquote"]];
|
|
1715
|
+
class BubbleTooltip extends BaseTooltip {
|
|
1716
|
+
constructor(quill, bounds) {
|
|
1717
|
+
super(quill, bounds);
|
|
1718
|
+
this.quill.on(Emitter.events.EDITOR_CHANGE, (type, range, oldRange, source) => {
|
|
1719
|
+
if (type !== Emitter.events.SELECTION_CHANGE)
|
|
1720
|
+
return;
|
|
1721
|
+
if (range != null && range.length > 0 && source === Emitter.sources.USER) {
|
|
1722
|
+
this.show();
|
|
1723
|
+
this.root.style.left = "0px";
|
|
1724
|
+
this.root.style.width = "";
|
|
1725
|
+
this.root.style.width = `${this.root.offsetWidth}px`;
|
|
1726
|
+
const lines = this.quill.getLines(range.index, range.length);
|
|
1727
|
+
if (lines.length === 1) {
|
|
1728
|
+
const bounds2 = this.quill.getBounds(range);
|
|
1729
|
+
if (bounds2 != null) {
|
|
1730
|
+
this.position(bounds2);
|
|
1731
|
+
}
|
|
1732
|
+
} else {
|
|
1733
|
+
const lastLine = lines[lines.length - 1];
|
|
1734
|
+
const index = this.quill.getIndex(lastLine);
|
|
1735
|
+
const length = Math.min(lastLine.length() - 1, range.index + range.length - index);
|
|
1736
|
+
const indexBounds = this.quill.getBounds(new Range(index, length));
|
|
1737
|
+
if (indexBounds != null) {
|
|
1738
|
+
this.position(indexBounds);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
} else if (document.activeElement !== this.textbox && this.quill.hasFocus()) {
|
|
1742
|
+
this.hide();
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
}
|
|
1746
|
+
listen() {
|
|
1747
|
+
super.listen();
|
|
1748
|
+
this.root.querySelector(".ql-close").addEventListener("click", () => {
|
|
1749
|
+
this.root.classList.remove("ql-editing");
|
|
1750
|
+
});
|
|
1751
|
+
this.quill.on(Emitter.events.SCROLL_OPTIMIZE, () => {
|
|
1752
|
+
setTimeout(() => {
|
|
1753
|
+
if (this.root.classList.contains("ql-hidden"))
|
|
1754
|
+
return;
|
|
1755
|
+
const range = this.quill.getSelection();
|
|
1756
|
+
if (range != null) {
|
|
1757
|
+
const bounds = this.quill.getBounds(range);
|
|
1758
|
+
if (bounds != null) {
|
|
1759
|
+
this.position(bounds);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}, 1);
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
cancel() {
|
|
1766
|
+
this.show();
|
|
1767
|
+
}
|
|
1768
|
+
position(reference) {
|
|
1769
|
+
const shift = super.position(reference);
|
|
1770
|
+
const arrow = this.root.querySelector(".ql-tooltip-arrow");
|
|
1771
|
+
arrow.style.marginLeft = "";
|
|
1772
|
+
if (shift !== 0) {
|
|
1773
|
+
arrow.style.marginLeft = `${-1 * shift - arrow.offsetWidth / 2}px`;
|
|
1774
|
+
}
|
|
1775
|
+
return shift;
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
__publicField(BubbleTooltip, "TEMPLATE", ['<span class="ql-tooltip-arrow"></span>', '<div class="ql-tooltip-editor">', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-close"></a>', "</div>"].join(""));
|
|
1779
|
+
class BubbleTheme extends BaseTheme {
|
|
1780
|
+
constructor(quill, options) {
|
|
1781
|
+
if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
|
|
1782
|
+
options.modules.toolbar.container = TOOLBAR_CONFIG$1;
|
|
1783
|
+
}
|
|
1784
|
+
super(quill, options);
|
|
1785
|
+
this.quill.container.classList.add("ql-bubble");
|
|
1786
|
+
}
|
|
1787
|
+
extendToolbar(toolbar) {
|
|
1788
|
+
this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
|
|
1789
|
+
if (toolbar.container != null) {
|
|
1790
|
+
this.tooltip.root.appendChild(toolbar.container);
|
|
1791
|
+
this.buildButtons(toolbar.container.querySelectorAll("button"), Icons);
|
|
1792
|
+
this.buildPickers(toolbar.container.querySelectorAll("select"), Icons);
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
BubbleTheme.DEFAULTS = merge({}, BaseTheme.DEFAULTS, {
|
|
1797
|
+
modules: {
|
|
1798
|
+
toolbar: {
|
|
1799
|
+
handlers: {
|
|
1800
|
+
link(value) {
|
|
1801
|
+
if (!value) {
|
|
1802
|
+
this.quill.format("link", false, Quill.sources.USER);
|
|
1803
|
+
} else {
|
|
1804
|
+
this.quill.theme.tooltip.edit();
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
const TOOLBAR_CONFIG = [[{
|
|
1812
|
+
header: ["1", "2", "3", false]
|
|
1813
|
+
}], ["bold", "italic", "underline", "link"], [{
|
|
1814
|
+
list: "ordered"
|
|
1815
|
+
}, {
|
|
1816
|
+
list: "bullet"
|
|
1817
|
+
}], ["clean"]];
|
|
1818
|
+
class SnowTooltip extends BaseTooltip {
|
|
1819
|
+
constructor() {
|
|
1820
|
+
super(...arguments);
|
|
1821
|
+
__publicField(this, "preview", this.root.querySelector("a.ql-preview"));
|
|
1822
|
+
}
|
|
1823
|
+
listen() {
|
|
1824
|
+
super.listen();
|
|
1825
|
+
this.root.querySelector("a.ql-action").addEventListener("click", (event) => {
|
|
1826
|
+
if (this.root.classList.contains("ql-editing")) {
|
|
1827
|
+
this.save();
|
|
1828
|
+
} else {
|
|
1829
|
+
this.edit("link", this.preview.textContent);
|
|
1830
|
+
}
|
|
1831
|
+
event.preventDefault();
|
|
1832
|
+
});
|
|
1833
|
+
this.root.querySelector("a.ql-remove").addEventListener("click", (event) => {
|
|
1834
|
+
if (this.linkRange != null) {
|
|
1835
|
+
const range = this.linkRange;
|
|
1836
|
+
this.restoreFocus();
|
|
1837
|
+
this.quill.formatText(range, "link", false, Emitter.sources.USER);
|
|
1838
|
+
delete this.linkRange;
|
|
1839
|
+
}
|
|
1840
|
+
event.preventDefault();
|
|
1841
|
+
this.hide();
|
|
1842
|
+
});
|
|
1843
|
+
this.quill.on(Emitter.events.SELECTION_CHANGE, (range, oldRange, source) => {
|
|
1844
|
+
if (range == null)
|
|
1845
|
+
return;
|
|
1846
|
+
if (range.length === 0 && source === Emitter.sources.USER) {
|
|
1847
|
+
const [link, offset] = this.quill.scroll.descendant(Link, range.index);
|
|
1848
|
+
if (link != null) {
|
|
1849
|
+
this.linkRange = new Range(range.index - offset, link.length());
|
|
1850
|
+
const preview = Link.formats(link.domNode);
|
|
1851
|
+
this.preview.textContent = preview;
|
|
1852
|
+
this.preview.setAttribute("href", preview);
|
|
1853
|
+
this.show();
|
|
1854
|
+
const bounds = this.quill.getBounds(this.linkRange);
|
|
1855
|
+
if (bounds != null) {
|
|
1856
|
+
this.position(bounds);
|
|
1857
|
+
}
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
} else {
|
|
1861
|
+
delete this.linkRange;
|
|
1862
|
+
}
|
|
1863
|
+
this.hide();
|
|
1864
|
+
});
|
|
1865
|
+
}
|
|
1866
|
+
show() {
|
|
1867
|
+
super.show();
|
|
1868
|
+
this.root.removeAttribute("data-mode");
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
__publicField(SnowTooltip, "TEMPLATE", ['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join(""));
|
|
1872
|
+
class SnowTheme extends BaseTheme {
|
|
1873
|
+
constructor(quill, options) {
|
|
1874
|
+
if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
|
|
1875
|
+
options.modules.toolbar.container = TOOLBAR_CONFIG;
|
|
1876
|
+
}
|
|
1877
|
+
super(quill, options);
|
|
1878
|
+
this.quill.container.classList.add("ql-snow");
|
|
1879
|
+
}
|
|
1880
|
+
extendToolbar(toolbar) {
|
|
1881
|
+
if (toolbar.container != null) {
|
|
1882
|
+
toolbar.container.classList.add("ql-snow");
|
|
1883
|
+
this.buildButtons(toolbar.container.querySelectorAll("button"), Icons);
|
|
1884
|
+
this.buildPickers(toolbar.container.querySelectorAll("select"), Icons);
|
|
1885
|
+
this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
|
|
1886
|
+
if (toolbar.container.querySelector(".ql-link")) {
|
|
1887
|
+
this.quill.keyboard.addBinding({
|
|
1888
|
+
key: "k",
|
|
1889
|
+
shortKey: true
|
|
1890
|
+
}, (_range, context) => {
|
|
1891
|
+
toolbar.handlers.link.call(toolbar, !context.format.link);
|
|
1892
|
+
});
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
SnowTheme.DEFAULTS = merge({}, BaseTheme.DEFAULTS, {
|
|
1898
|
+
modules: {
|
|
1899
|
+
toolbar: {
|
|
1900
|
+
handlers: {
|
|
1901
|
+
link(value) {
|
|
1902
|
+
if (value) {
|
|
1903
|
+
const range = this.quill.getSelection();
|
|
1904
|
+
if (range == null || range.length === 0)
|
|
1905
|
+
return;
|
|
1906
|
+
let preview = this.quill.getText(range);
|
|
1907
|
+
if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf("mailto:") !== 0) {
|
|
1908
|
+
preview = `mailto:${preview}`;
|
|
1909
|
+
}
|
|
1910
|
+
const {
|
|
1911
|
+
tooltip
|
|
1912
|
+
} = this.quill.theme;
|
|
1913
|
+
tooltip.edit("link", preview);
|
|
1914
|
+
} else {
|
|
1915
|
+
this.quill.format("link", false, Quill.sources.USER);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1922
|
+
Quill.register({
|
|
1923
|
+
"attributors/attribute/direction": DirectionAttribute,
|
|
1924
|
+
"attributors/class/align": AlignClass,
|
|
1925
|
+
"attributors/class/background": BackgroundClass,
|
|
1926
|
+
"attributors/class/color": ColorClass,
|
|
1927
|
+
"attributors/class/direction": DirectionClass,
|
|
1928
|
+
"attributors/class/font": FontClass,
|
|
1929
|
+
"attributors/class/size": SizeClass,
|
|
1930
|
+
"attributors/style/align": AlignStyle,
|
|
1931
|
+
"attributors/style/background": BackgroundStyle,
|
|
1932
|
+
"attributors/style/color": ColorStyle,
|
|
1933
|
+
"attributors/style/direction": DirectionStyle,
|
|
1934
|
+
"attributors/style/font": FontStyle,
|
|
1935
|
+
"attributors/style/size": SizeStyle
|
|
1936
|
+
}, true);
|
|
1937
|
+
Quill.register({
|
|
1938
|
+
"formats/align": AlignClass,
|
|
1939
|
+
"formats/direction": DirectionClass,
|
|
1940
|
+
"formats/indent": IndentClass,
|
|
1941
|
+
"formats/background": BackgroundStyle,
|
|
1942
|
+
"formats/color": ColorStyle,
|
|
1943
|
+
"formats/font": FontClass,
|
|
1944
|
+
"formats/size": SizeClass,
|
|
1945
|
+
"formats/blockquote": Blockquote,
|
|
1946
|
+
"formats/code-block": CodeBlock,
|
|
1947
|
+
"formats/header": Header,
|
|
1948
|
+
"formats/list": ListItem,
|
|
1949
|
+
"formats/bold": Bold,
|
|
1950
|
+
"formats/code": Code,
|
|
1951
|
+
"formats/italic": Italic,
|
|
1952
|
+
"formats/link": Link,
|
|
1953
|
+
"formats/script": Script,
|
|
1954
|
+
"formats/strike": Strike,
|
|
1955
|
+
"formats/underline": Underline,
|
|
1956
|
+
"formats/formula": Formula,
|
|
1957
|
+
"formats/image": Image,
|
|
1958
|
+
"formats/video": Video,
|
|
1959
|
+
"modules/syntax": Syntax,
|
|
1960
|
+
"modules/table": Table,
|
|
1961
|
+
"modules/toolbar": Toolbar,
|
|
1962
|
+
"themes/bubble": BubbleTheme,
|
|
1963
|
+
"themes/snow": SnowTheme,
|
|
1964
|
+
"ui/icons": Icons,
|
|
1965
|
+
"ui/picker": Picker,
|
|
1966
|
+
"ui/icon-picker": IconPicker,
|
|
1967
|
+
"ui/color-picker": ColorPicker,
|
|
1968
|
+
"ui/tooltip": Tooltip
|
|
1969
|
+
}, true);
|
|
1970
|
+
export {
|
|
1971
|
+
Module,
|
|
1972
|
+
P as Parchment,
|
|
1973
|
+
Range,
|
|
1974
|
+
Quill as default
|
|
1975
|
+
};
|