@opentiny/fluent-editor 4.0.0-alpha.1 → 4.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -24
- package/es/config/editor.utils.es.js +0 -2
- package/es/config/editor.utils.es.js.map +1 -1
- package/es/config/index.es.js +2 -2
- package/es/config/index.es.js.map +1 -1
- package/es/config/types/index.es.js +0 -20
- package/es/config/types/index.es.js.map +1 -1
- package/es/core/fluent-editor.es.js +4 -1
- package/es/core/fluent-editor.es.js.map +1 -1
- package/es/fluent-editor.es.js +26 -19
- package/es/fluent-editor.es.js.map +1 -1
- package/es/formats/emoji.es.js +14 -0
- package/es/formats/emoji.es.js.map +1 -0
- package/es/formats/index.es.js +11 -0
- package/es/formats/index.es.js.map +1 -0
- package/es/formats/soft-break.es.js +12 -5
- package/es/formats/soft-break.es.js.map +1 -1
- package/es/formats/strike.es.js +8 -5
- package/es/formats/strike.es.js.map +1 -1
- package/es/formats/video.es.js +14 -10
- package/es/formats/video.es.js.map +1 -1
- package/es/index.es.js +90 -31
- package/es/index.es.js.map +1 -1
- package/es/modules/ai/index.es.js +238 -0
- package/es/modules/ai/index.es.js.map +1 -0
- package/es/modules/counter.es.js +8 -3
- package/es/modules/counter.es.js.map +1 -1
- package/es/modules/custom-clipboard.es.js +20 -22
- package/es/modules/custom-clipboard.es.js.map +1 -1
- package/es/modules/custom-image/actions/action.es.js +19 -0
- package/es/modules/custom-image/actions/action.es.js.map +1 -0
- package/es/modules/custom-image/actions/{CustomResizeAction.es.js → custom-resize-action.es.js} +24 -11
- package/es/modules/custom-image/actions/{CustomResizeAction.es.js.map → custom-resize-action.es.js.map} +1 -1
- package/es/modules/custom-image/actions/{DeleteAction.es.js → delete-action.es.js} +8 -5
- package/es/modules/custom-image/actions/delete-action.es.js.map +1 -0
- package/es/modules/custom-image/actions/image-toolbar-buttons.es.js +137 -0
- package/es/modules/custom-image/actions/image-toolbar-buttons.es.js.map +1 -0
- package/es/modules/custom-image/actions/index.es.js +18 -0
- package/es/modules/custom-image/actions/index.es.js.map +1 -0
- package/es/modules/custom-image/actions/toolbar-action.es.js +33 -0
- package/es/modules/custom-image/actions/toolbar-action.es.js.map +1 -0
- package/es/modules/custom-image/actions/toolbar.es.js +110 -0
- package/es/modules/custom-image/actions/toolbar.es.js.map +1 -0
- package/es/modules/custom-image/{BlotFormatter.es.js → blot-formatter.es.js} +23 -49
- package/es/modules/custom-image/blot-formatter.es.js.map +1 -0
- package/es/modules/custom-image/image.es.js +31 -6
- package/es/modules/custom-image/image.es.js.map +1 -1
- package/es/modules/custom-image/index.es.js +9 -0
- package/es/modules/custom-image/index.es.js.map +1 -0
- package/es/modules/custom-image/options.es.js +85 -0
- package/es/modules/custom-image/options.es.js.map +1 -0
- package/es/modules/custom-image/specs/blot-spec.es.js +33 -0
- package/es/modules/custom-image/specs/blot-spec.es.js.map +1 -0
- package/es/modules/custom-image/specs/{CustomImageSpec.es.js → custom-image-spec.es.js} +13 -14
- package/es/modules/custom-image/specs/custom-image-spec.es.js.map +1 -0
- package/es/modules/custom-image/specs/image-spec.es.js +32 -0
- package/es/modules/custom-image/specs/image-spec.es.js.map +1 -0
- package/es/modules/custom-image/specs/index.es.js +9 -0
- package/es/modules/custom-image/specs/index.es.js.map +1 -0
- package/es/modules/custom-uploader.es.js +6 -4
- package/es/modules/custom-uploader.es.js.map +1 -1
- package/es/modules/divider.es.js +8 -7
- package/es/modules/divider.es.js.map +1 -1
- package/es/modules/emoji.es.js +175 -0
- package/es/modules/emoji.es.js.map +1 -0
- package/es/modules/file/formats/file.es.js +10 -8
- package/es/modules/file/formats/file.es.js.map +1 -1
- package/es/modules/file/index.es.js +6 -28
- package/es/modules/file/index.es.js.map +1 -1
- package/es/modules/file/modules/file-bar.es.js +11 -3
- package/es/modules/file/modules/file-bar.es.js.map +1 -1
- package/es/modules/file/modules/file-module.es.js +35 -0
- package/es/modules/file/modules/file-module.es.js.map +1 -0
- package/es/modules/i18n.es.js +6 -3
- package/es/modules/i18n.es.js.map +1 -1
- package/es/modules/index.es.js +26 -0
- package/es/modules/index.es.js.map +1 -0
- package/es/modules/link/formats/link.es.js +14 -10
- package/es/modules/link/formats/link.es.js.map +1 -1
- package/es/modules/link/index.es.js +4 -12
- package/es/modules/link/index.es.js.map +1 -1
- package/es/modules/link/modules/tooltip.es.js +28 -19
- package/es/modules/link/modules/tooltip.es.js.map +1 -1
- package/es/modules/mathlive/formats.es.js +10 -7
- package/es/modules/mathlive/formats.es.js.map +1 -1
- package/es/modules/mathlive/index.es.js +6 -30
- package/es/modules/mathlive/index.es.js.map +1 -1
- package/es/modules/mathlive/module.es.js +40 -0
- package/es/modules/mathlive/module.es.js.map +1 -0
- package/es/modules/mathlive/tooltip.es.js +9 -5
- package/es/modules/mathlive/tooltip.es.js.map +1 -1
- package/es/modules/mention/index.es.js +7 -0
- package/es/modules/{emoji/emoji-list → mention}/index.es.js.map +1 -1
- package/es/modules/mention/{MentionLink.es.js → mention-link.es.js} +14 -6
- package/es/modules/mention/mention-link.es.js.map +1 -0
- package/es/modules/mention/{Mention.es.js → mention.es.js} +28 -20
- package/es/modules/mention/mention.es.js.map +1 -0
- package/es/modules/shortcut-key/index.es.js.map +1 -1
- package/es/modules/syntax.es.js +4 -0
- package/es/modules/syntax.es.js.map +1 -1
- package/es/modules/table-up/index.es.js +4 -0
- package/es/modules/table-up/index.es.js.map +1 -1
- package/es/modules/toolbar/better-picker.es.js +5 -0
- package/es/modules/toolbar/better-picker.es.js.map +1 -1
- package/es/modules/toolbar/better-toolbar.es.js +138 -0
- package/es/modules/toolbar/better-toolbar.es.js.map +1 -0
- package/es/modules/toolbar/index.es.js +5 -135
- package/es/modules/toolbar/index.es.js.map +1 -1
- package/es/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.es.js +40145 -0
- package/es/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.es.js.map +1 -0
- package/es/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.es.js +938 -0
- package/es/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.es.js.map +1 -0
- package/es/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.es.js +624 -0
- package/es/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.es.js.map +1 -0
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.es.js +174 -0
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.es.js.map +1 -0
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.es.js +159 -0
- package/es/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.es.js.map +1 -0
- package/es/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.es.js +2849 -0
- package/es/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.es.js.map +1 -0
- package/es/themes/snow.es.js +6 -10
- package/es/themes/snow.es.js.map +1 -1
- package/es/tools/fullscreen.es.js.map +1 -1
- package/es/ui/icons.config.es.js +23 -0
- package/es/ui/icons.config.es.js.map +1 -1
- package/es/ui/icons.es.js +2 -1
- package/es/ui/icons.es.js.map +1 -1
- package/es/utils/is.es.js.map +1 -1
- package/lib/config/editor.utils.cjs.js +0 -2
- package/lib/config/editor.utils.cjs.js.map +1 -1
- package/lib/config/index.cjs.js +1 -1
- package/lib/config/index.cjs.js.map +1 -1
- package/lib/config/types/index.cjs.js +0 -20
- package/lib/config/types/index.cjs.js.map +1 -1
- package/lib/core/fluent-editor.cjs.js +4 -1
- package/lib/core/fluent-editor.cjs.js.map +1 -1
- package/lib/fluent-editor.cjs.js +35 -28
- package/lib/fluent-editor.cjs.js.map +1 -1
- package/lib/formats/emoji.cjs.js +14 -0
- package/lib/formats/emoji.cjs.js.map +1 -0
- package/lib/formats/index.cjs.js +11 -0
- package/lib/formats/index.cjs.js.map +1 -0
- package/lib/formats/soft-break.cjs.js +13 -6
- package/lib/formats/soft-break.cjs.js.map +1 -1
- package/lib/formats/strike.cjs.js +9 -6
- package/lib/formats/strike.cjs.js.map +1 -1
- package/lib/formats/video.cjs.js +15 -11
- package/lib/formats/video.cjs.js.map +1 -1
- package/lib/index.cjs.js +111 -34
- package/lib/index.cjs.js.map +1 -1
- package/lib/modules/ai/index.cjs.js +238 -0
- package/lib/modules/ai/index.cjs.js.map +1 -0
- package/lib/modules/counter.cjs.js +8 -3
- package/lib/modules/counter.cjs.js.map +1 -1
- package/lib/modules/custom-clipboard.cjs.js +21 -23
- package/lib/modules/custom-clipboard.cjs.js.map +1 -1
- package/lib/modules/custom-image/actions/action.cjs.js +19 -0
- package/lib/modules/custom-image/actions/action.cjs.js.map +1 -0
- package/lib/modules/custom-image/actions/{CustomResizeAction.cjs.js → custom-resize-action.cjs.js} +26 -13
- package/lib/modules/custom-image/actions/{CustomResizeAction.cjs.js.map → custom-resize-action.cjs.js.map} +1 -1
- package/lib/modules/custom-image/actions/{DeleteAction.cjs.js → delete-action.cjs.js} +10 -7
- package/lib/modules/custom-image/actions/delete-action.cjs.js.map +1 -0
- package/lib/modules/custom-image/actions/image-toolbar-buttons.cjs.js +137 -0
- package/lib/modules/custom-image/actions/image-toolbar-buttons.cjs.js.map +1 -0
- package/lib/modules/custom-image/actions/index.cjs.js +18 -0
- package/lib/modules/custom-image/actions/index.cjs.js.map +1 -0
- package/lib/modules/custom-image/actions/toolbar-action.cjs.js +33 -0
- package/lib/modules/custom-image/actions/toolbar-action.cjs.js.map +1 -0
- package/lib/modules/custom-image/actions/toolbar.cjs.js +110 -0
- package/lib/modules/custom-image/actions/toolbar.cjs.js.map +1 -0
- package/lib/modules/custom-image/{BlotFormatter.cjs.js → blot-formatter.cjs.js} +24 -50
- package/lib/modules/custom-image/blot-formatter.cjs.js.map +1 -0
- package/lib/modules/custom-image/image.cjs.js +32 -7
- package/lib/modules/custom-image/image.cjs.js.map +1 -1
- package/lib/modules/custom-image/index.cjs.js +9 -0
- package/lib/modules/custom-image/index.cjs.js.map +1 -0
- package/lib/modules/custom-image/options.cjs.js +85 -0
- package/lib/modules/custom-image/options.cjs.js.map +1 -0
- package/lib/modules/custom-image/specs/blot-spec.cjs.js +33 -0
- package/lib/modules/custom-image/specs/blot-spec.cjs.js.map +1 -0
- package/lib/modules/custom-image/specs/{CustomImageSpec.cjs.js → custom-image-spec.cjs.js} +14 -15
- package/lib/modules/custom-image/specs/custom-image-spec.cjs.js.map +1 -0
- package/lib/modules/custom-image/specs/image-spec.cjs.js +32 -0
- package/lib/modules/custom-image/specs/image-spec.cjs.js.map +1 -0
- package/lib/modules/custom-image/specs/index.cjs.js +9 -0
- package/lib/modules/custom-image/specs/index.cjs.js.map +1 -0
- package/lib/modules/custom-uploader.cjs.js +6 -4
- package/lib/modules/custom-uploader.cjs.js.map +1 -1
- package/lib/modules/divider.cjs.js +9 -8
- package/lib/modules/divider.cjs.js.map +1 -1
- package/lib/modules/emoji.cjs.js +175 -0
- package/lib/modules/emoji.cjs.js.map +1 -0
- package/lib/modules/file/formats/file.cjs.js +11 -9
- package/lib/modules/file/formats/file.cjs.js.map +1 -1
- package/lib/modules/file/index.cjs.js +5 -27
- package/lib/modules/file/index.cjs.js.map +1 -1
- package/lib/modules/file/modules/file-bar.cjs.js +12 -4
- package/lib/modules/file/modules/file-bar.cjs.js.map +1 -1
- package/lib/modules/file/modules/file-module.cjs.js +35 -0
- package/lib/modules/file/modules/file-module.cjs.js.map +1 -0
- package/lib/modules/i18n.cjs.js +6 -3
- package/lib/modules/i18n.cjs.js.map +1 -1
- package/lib/modules/index.cjs.js +26 -0
- package/lib/modules/index.cjs.js.map +1 -0
- package/lib/modules/link/formats/link.cjs.js +15 -11
- package/lib/modules/link/formats/link.cjs.js.map +1 -1
- package/lib/modules/link/index.cjs.js +4 -12
- package/lib/modules/link/index.cjs.js.map +1 -1
- package/lib/modules/link/modules/tooltip.cjs.js +28 -19
- package/lib/modules/link/modules/tooltip.cjs.js.map +1 -1
- package/lib/modules/mathlive/formats.cjs.js +11 -8
- package/lib/modules/mathlive/formats.cjs.js.map +1 -1
- package/lib/modules/mathlive/index.cjs.js +5 -29
- package/lib/modules/mathlive/index.cjs.js.map +1 -1
- package/lib/modules/mathlive/module.cjs.js +40 -0
- package/lib/modules/mathlive/module.cjs.js.map +1 -0
- package/lib/modules/mathlive/tooltip.cjs.js +10 -6
- package/lib/modules/mathlive/tooltip.cjs.js.map +1 -1
- package/lib/modules/mention/index.cjs.js +7 -0
- package/lib/modules/{emoji/emoji-list → mention}/index.cjs.js.map +1 -1
- package/lib/modules/mention/{MentionLink.cjs.js → mention-link.cjs.js} +15 -7
- package/lib/modules/mention/mention-link.cjs.js.map +1 -0
- package/lib/modules/mention/{Mention.cjs.js → mention.cjs.js} +30 -22
- package/lib/modules/mention/mention.cjs.js.map +1 -0
- package/lib/modules/shortcut-key/index.cjs.js.map +1 -1
- package/lib/modules/syntax.cjs.js +4 -0
- package/lib/modules/syntax.cjs.js.map +1 -1
- package/lib/modules/table-up/index.cjs.js +4 -0
- package/lib/modules/table-up/index.cjs.js.map +1 -1
- package/lib/modules/toolbar/better-picker.cjs.js +5 -0
- package/lib/modules/toolbar/better-picker.cjs.js.map +1 -1
- package/lib/modules/toolbar/better-toolbar.cjs.js +138 -0
- package/lib/modules/toolbar/better-toolbar.cjs.js.map +1 -0
- package/lib/modules/toolbar/index.cjs.js +6 -136
- package/lib/modules/toolbar/index.cjs.js.map +1 -1
- package/lib/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.cjs.js +40145 -0
- package/lib/node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.cjs.js.map +1 -0
- package/lib/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.cjs.js +938 -0
- package/lib/node_modules/.pnpm/@floating-ui_core@1.7.2/node_modules/@floating-ui/core/dist/floating-ui.core.cjs.js.map +1 -0
- package/lib/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs.js +624 -0
- package/lib/node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs.js.map +1 -0
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs.js +159 -0
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs.js.map +1 -0
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.js +174 -0
- package/lib/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs.js.map +1 -0
- package/lib/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.cjs.js +2847 -0
- package/lib/node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.cjs.js.map +1 -0
- package/lib/themes/snow.cjs.js +7 -11
- package/lib/themes/snow.cjs.js.map +1 -1
- package/lib/tools/fullscreen.cjs.js.map +1 -1
- package/lib/ui/icons.cjs.js +1 -0
- package/lib/ui/icons.cjs.js.map +1 -1
- package/lib/ui/icons.config.cjs.js +23 -0
- package/lib/ui/icons.config.cjs.js.map +1 -1
- package/lib/utils/is.cjs.js.map +1 -1
- package/package.json +8 -7
- package/style.css +92 -933
- package/types/config/editor.utils.d.ts +0 -1
- package/types/config/index.d.ts +1 -0
- package/types/config/types/editor-config.interface.d.ts +0 -7
- package/types/config/types/editor-modules.interface.d.ts +21 -12
- package/types/config/types/index.d.ts +0 -20
- package/types/config/types/type.d.ts +0 -4
- package/types/core/fluent-editor.d.ts +0 -1
- package/types/formats/emoji.d.ts +9 -0
- package/types/formats/index.d.ts +4 -0
- package/types/formats/soft-break.d.ts +6 -7
- package/types/formats/strike.d.ts +6 -4
- package/types/formats/video.d.ts +4 -6
- package/types/index.d.ts +6 -5
- package/types/modules/ai/index.d.ts +39 -0
- package/types/modules/counter.d.ts +8 -1
- package/types/modules/custom-clipboard.d.ts +3 -6
- package/types/modules/custom-image/Options.d.ts +34 -23
- package/types/modules/custom-image/actions/Action.d.ts +5 -3
- package/types/modules/custom-image/actions/custom-resize-action.d.ts +24 -0
- package/types/modules/custom-image/actions/delete-action.d.ts +7 -0
- package/types/modules/custom-image/actions/image-toolbar-buttons.d.ts +17 -0
- package/types/modules/custom-image/actions/index.d.ts +6 -0
- package/types/modules/custom-image/actions/toolbar-action.d.ts +12 -0
- package/types/modules/custom-image/actions/toolbar.d.ts +20 -0
- package/types/modules/custom-image/blot-formatter.d.ts +24 -0
- package/types/modules/custom-image/image-bar.d.ts +9 -7
- package/types/modules/custom-image/image.d.ts +15 -13
- package/types/modules/custom-image/index.d.ts +4 -0
- package/types/modules/custom-image/specs/blot-spec.d.ts +13 -0
- package/types/modules/custom-image/specs/custom-image-spec.d.ts +18 -0
- package/types/modules/custom-image/specs/image-spec.d.ts +9 -0
- package/types/modules/custom-image/specs/index.d.ts +3 -0
- package/types/modules/custom-uploader.d.ts +41 -0
- package/types/modules/divider.d.ts +6 -4
- package/types/modules/emoji/formats/emoji-blot.d.ts +9 -7
- package/types/modules/emoji/index.d.ts +3 -10
- package/types/modules/emoji/modules/emoji.d.ts +6 -6
- package/types/modules/emoji/modules/toolbar-emoji.d.ts +7 -6
- package/types/modules/emoji.d.ts +35 -0
- package/types/modules/file/formats/file.d.ts +2 -2
- package/types/modules/file/index.d.ts +3 -11
- package/types/modules/file/modules/file-bar.d.ts +1 -1
- package/types/modules/file/modules/file-module.d.ts +10 -0
- package/types/modules/i18n.d.ts +1 -2
- package/types/modules/index.d.ts +15 -0
- package/types/modules/link/formats/link.d.ts +5 -5
- package/types/modules/link/index.d.ts +2 -6
- package/types/modules/link/modules/tooltip.d.ts +5 -10
- package/types/modules/mathlive/formats.d.ts +2 -2
- package/types/modules/mathlive/index.d.ts +3 -9
- package/types/modules/mathlive/module.d.ts +10 -0
- package/types/modules/mathlive/tooltip.d.ts +1 -1
- package/types/modules/mention/Mention.d.ts +3 -4
- package/types/modules/mention/index.d.ts +2 -0
- package/types/modules/mention/mention-link.d.ts +17 -0
- package/types/modules/shortcut-key/index.d.ts +12 -8
- package/types/modules/table-up/index.d.ts +3 -3
- package/types/modules/toolbar/better-toolbar.d.ts +8 -0
- package/types/modules/toolbar/index.d.ts +2 -8
- package/types/tools/fullscreen.d.ts +5 -1
- package/types/ui/icons.config.d.ts +2 -0
- package/types/utils/is.d.ts +1 -1
- package/es/config/types/additional-toolbar-item.interface.es.js +0 -2
- package/es/config/types/additional-toolbar-item.interface.es.js.map +0 -1
- package/es/config/types/content-change.interface.es.js +0 -2
- package/es/config/types/content-change.interface.es.js.map +0 -1
- package/es/config/types/content-save.interface.es.js +0 -2
- package/es/config/types/content-save.interface.es.js.map +0 -1
- package/es/config/types/counter-option.interface.es.js +0 -2
- package/es/config/types/counter-option.interface.es.js.map +0 -1
- package/es/config/types/editor-toolbar.interface.es.js +0 -2
- package/es/config/types/editor-toolbar.interface.es.js.map +0 -1
- package/es/config/types/file-operation.interface.es.js +0 -2
- package/es/config/types/file-operation.interface.es.js.map +0 -1
- package/es/config/types/focus-change.interface.es.js +0 -2
- package/es/config/types/focus-change.interface.es.js.map +0 -1
- package/es/config/types/fullscreen-module.interface.es.js +0 -2
- package/es/config/types/fullscreen-module.interface.es.js.map +0 -1
- package/es/config/types/help-panel-item.interface.es.js +0 -2
- package/es/config/types/help-panel-item.interface.es.js.map +0 -1
- package/es/config/types/help-panel-option.interface.es.js +0 -2
- package/es/config/types/help-panel-option.interface.es.js.map +0 -1
- package/es/config/types/image-module.interface.es.js +0 -2
- package/es/config/types/image-module.interface.es.js.map +0 -1
- package/es/config/types/image-upload.interface.es.js +0 -2
- package/es/config/types/image-upload.interface.es.js.map +0 -1
- package/es/config/types/load-on-demand-module.interface.es.js +0 -2
- package/es/config/types/load-on-demand-module.interface.es.js.map +0 -1
- package/es/config/types/mention-module.interface.es.js +0 -2
- package/es/config/types/mention-module.interface.es.js.map +0 -1
- package/es/config/types/paste-change.interface.es.js +0 -2
- package/es/config/types/paste-change.interface.es.js.map +0 -1
- package/es/config/types/quick-menu-module.interface.es.js +0 -2
- package/es/config/types/quick-menu-module.interface.es.js.map +0 -1
- package/es/config/types/range.interface.es.js +0 -2
- package/es/config/types/range.interface.es.js.map +0 -1
- package/es/config/types/registry-options.interface.es.js +0 -2
- package/es/config/types/registry-options.interface.es.js.map +0 -1
- package/es/config/types/selection-change.interface.es.js +0 -2
- package/es/config/types/selection-change.interface.es.js.map +0 -1
- package/es/config/types/toolbar-item.interface.es.js +0 -2
- package/es/config/types/toolbar-item.interface.es.js.map +0 -1
- package/es/config/types/validate-error.interface.es.js +0 -2
- package/es/config/types/validate-error.interface.es.js.map +0 -1
- package/es/modules/custom-image/BlotFormatter.es.js.map +0 -1
- package/es/modules/custom-image/Options.es.js +0 -95
- package/es/modules/custom-image/Options.es.js.map +0 -1
- package/es/modules/custom-image/actions/Action.es.js +0 -15
- package/es/modules/custom-image/actions/Action.es.js.map +0 -1
- package/es/modules/custom-image/actions/DeleteAction.es.js.map +0 -1
- package/es/modules/custom-image/image-bar.es.js +0 -127
- package/es/modules/custom-image/image-bar.es.js.map +0 -1
- package/es/modules/custom-image/specs/BlotSpec.es.js +0 -27
- package/es/modules/custom-image/specs/BlotSpec.es.js.map +0 -1
- package/es/modules/custom-image/specs/CustomImageSpec.es.js.map +0 -1
- package/es/modules/custom-image/specs/ImageSpec.es.js +0 -29
- package/es/modules/custom-image/specs/ImageSpec.es.js.map +0 -1
- package/es/modules/emoji/emoji-list/index.es.js +0 -5
- package/es/modules/emoji/emoji-list/people.es.js +0 -114
- package/es/modules/emoji/emoji-list/people.es.js.map +0 -1
- package/es/modules/emoji/emoji-list.es.js +0 -9
- package/es/modules/emoji/emoji-list.es.js.map +0 -1
- package/es/modules/emoji/emoji-map.es.js +0 -9
- package/es/modules/emoji/emoji-map.es.js.map +0 -1
- package/es/modules/emoji/emoji-sprite.es.js +0 -5
- package/es/modules/emoji/emoji-sprite.es.js.map +0 -1
- package/es/modules/emoji/formats/emoji-blot.es.js +0 -41
- package/es/modules/emoji/formats/emoji-blot.es.js.map +0 -1
- package/es/modules/emoji/index.es.js +0 -8
- package/es/modules/emoji/index.es.js.map +0 -1
- package/es/modules/emoji/modules/emoji.es.js +0 -248
- package/es/modules/emoji/modules/emoji.es.js.map +0 -1
- package/es/modules/emoji/modules/toolbar-emoji.es.js +0 -153
- package/es/modules/emoji/modules/toolbar-emoji.es.js.map +0 -1
- package/es/modules/emoji/utils.es.js +0 -19
- package/es/modules/emoji/utils.es.js.map +0 -1
- package/es/modules/mention/Mention.es.js.map +0 -1
- package/es/modules/mention/MentionLink.es.js.map +0 -1
- package/lib/config/types/additional-toolbar-item.interface.cjs.js +0 -2
- package/lib/config/types/additional-toolbar-item.interface.cjs.js.map +0 -1
- package/lib/config/types/content-change.interface.cjs.js +0 -2
- package/lib/config/types/content-change.interface.cjs.js.map +0 -1
- package/lib/config/types/content-save.interface.cjs.js +0 -2
- package/lib/config/types/content-save.interface.cjs.js.map +0 -1
- package/lib/config/types/counter-option.interface.cjs.js +0 -2
- package/lib/config/types/counter-option.interface.cjs.js.map +0 -1
- package/lib/config/types/editor-toolbar.interface.cjs.js +0 -2
- package/lib/config/types/editor-toolbar.interface.cjs.js.map +0 -1
- package/lib/config/types/file-operation.interface.cjs.js +0 -2
- package/lib/config/types/file-operation.interface.cjs.js.map +0 -1
- package/lib/config/types/focus-change.interface.cjs.js +0 -2
- package/lib/config/types/focus-change.interface.cjs.js.map +0 -1
- package/lib/config/types/fullscreen-module.interface.cjs.js +0 -2
- package/lib/config/types/fullscreen-module.interface.cjs.js.map +0 -1
- package/lib/config/types/help-panel-item.interface.cjs.js +0 -2
- package/lib/config/types/help-panel-item.interface.cjs.js.map +0 -1
- package/lib/config/types/help-panel-option.interface.cjs.js +0 -2
- package/lib/config/types/help-panel-option.interface.cjs.js.map +0 -1
- package/lib/config/types/image-module.interface.cjs.js +0 -2
- package/lib/config/types/image-module.interface.cjs.js.map +0 -1
- package/lib/config/types/image-upload.interface.cjs.js +0 -2
- package/lib/config/types/image-upload.interface.cjs.js.map +0 -1
- package/lib/config/types/load-on-demand-module.interface.cjs.js +0 -2
- package/lib/config/types/load-on-demand-module.interface.cjs.js.map +0 -1
- package/lib/config/types/mention-module.interface.cjs.js +0 -2
- package/lib/config/types/mention-module.interface.cjs.js.map +0 -1
- package/lib/config/types/paste-change.interface.cjs.js +0 -2
- package/lib/config/types/paste-change.interface.cjs.js.map +0 -1
- package/lib/config/types/quick-menu-module.interface.cjs.js +0 -2
- package/lib/config/types/quick-menu-module.interface.cjs.js.map +0 -1
- package/lib/config/types/range.interface.cjs.js +0 -2
- package/lib/config/types/range.interface.cjs.js.map +0 -1
- package/lib/config/types/registry-options.interface.cjs.js +0 -2
- package/lib/config/types/registry-options.interface.cjs.js.map +0 -1
- package/lib/config/types/selection-change.interface.cjs.js +0 -2
- package/lib/config/types/selection-change.interface.cjs.js.map +0 -1
- package/lib/config/types/toolbar-item.interface.cjs.js +0 -2
- package/lib/config/types/toolbar-item.interface.cjs.js.map +0 -1
- package/lib/config/types/validate-error.interface.cjs.js +0 -2
- package/lib/config/types/validate-error.interface.cjs.js.map +0 -1
- package/lib/modules/custom-image/BlotFormatter.cjs.js.map +0 -1
- package/lib/modules/custom-image/Options.cjs.js +0 -95
- package/lib/modules/custom-image/Options.cjs.js.map +0 -1
- package/lib/modules/custom-image/actions/Action.cjs.js +0 -15
- package/lib/modules/custom-image/actions/Action.cjs.js.map +0 -1
- package/lib/modules/custom-image/actions/DeleteAction.cjs.js.map +0 -1
- package/lib/modules/custom-image/image-bar.cjs.js +0 -127
- package/lib/modules/custom-image/image-bar.cjs.js.map +0 -1
- package/lib/modules/custom-image/specs/BlotSpec.cjs.js +0 -27
- package/lib/modules/custom-image/specs/BlotSpec.cjs.js.map +0 -1
- package/lib/modules/custom-image/specs/CustomImageSpec.cjs.js.map +0 -1
- package/lib/modules/custom-image/specs/ImageSpec.cjs.js +0 -29
- package/lib/modules/custom-image/specs/ImageSpec.cjs.js.map +0 -1
- package/lib/modules/emoji/emoji-list/index.cjs.js +0 -5
- package/lib/modules/emoji/emoji-list/people.cjs.js +0 -114
- package/lib/modules/emoji/emoji-list/people.cjs.js.map +0 -1
- package/lib/modules/emoji/emoji-list.cjs.js +0 -9
- package/lib/modules/emoji/emoji-list.cjs.js.map +0 -1
- package/lib/modules/emoji/emoji-map.cjs.js +0 -9
- package/lib/modules/emoji/emoji-map.cjs.js.map +0 -1
- package/lib/modules/emoji/emoji-sprite.cjs.js +0 -5
- package/lib/modules/emoji/emoji-sprite.cjs.js.map +0 -1
- package/lib/modules/emoji/formats/emoji-blot.cjs.js +0 -41
- package/lib/modules/emoji/formats/emoji-blot.cjs.js.map +0 -1
- package/lib/modules/emoji/index.cjs.js +0 -8
- package/lib/modules/emoji/index.cjs.js.map +0 -1
- package/lib/modules/emoji/modules/emoji.cjs.js +0 -248
- package/lib/modules/emoji/modules/emoji.cjs.js.map +0 -1
- package/lib/modules/emoji/modules/toolbar-emoji.cjs.js +0 -153
- package/lib/modules/emoji/modules/toolbar-emoji.cjs.js.map +0 -1
- package/lib/modules/emoji/utils.cjs.js +0 -19
- package/lib/modules/emoji/utils.cjs.js.map +0 -1
- package/lib/modules/mention/Mention.cjs.js.map +0 -1
- package/lib/modules/mention/MentionLink.cjs.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"better-picker.cjs.js","sources":["../../../../src/modules/toolbar/better-picker.ts"],"sourcesContent":["import type TypePicker from 'quill/ui/picker'\r\nimport { EasyColorPicker } from 'quill-easy-color'\r\nimport FluentEditor from '../../core/fluent-editor'\r\n\r\nconst OriginPicker = FluentEditor.import('ui/picker') as typeof TypePicker\r\nexport class Picker extends OriginPicker {\r\n buildLabel() {\r\n const label = document.createElement('span')\r\n label.classList.add('ql-picker-label')\r\n label.innerHTML = `<i class=\"icon\" />`\r\n label.tabIndex = 0\r\n label.setAttribute('role', 'button')\r\n label.setAttribute('aria-expanded', 'false')\r\n this.container.appendChild(label)\r\n return label\r\n }\r\n\r\n buildItem(option: HTMLOptionElement) {\r\n const item = super.buildItem(option)\r\n const value = option.getAttribute('value')\r\n item.style.setProperty('--value', value)\r\n return item\r\n }\r\n\r\n selectItem(item: HTMLElement | null, trigger = false) {\r\n const selected = this.container.querySelector('.ql-selected')\r\n if (item === selected || item == null) return\r\n // move ql-selected clear after judge.\r\n // ql-selected is the class for check mark in picker\r\n if (selected != null) {\r\n selected.classList.remove('ql-selected')\r\n }\r\n item.classList.add('ql-selected')\r\n this.select.selectedIndex = Array.from(item.parentNode.children).indexOf(item)\r\n if (item.hasAttribute('data-value')) {\r\n this.label.setAttribute('data-value', item.getAttribute('data-value'))\r\n }\r\n else {\r\n this.label.removeAttribute('data-value')\r\n }\r\n if (item.hasAttribute('data-label')) {\r\n this.label.setAttribute('data-label', item.getAttribute('data-label'))\r\n }\r\n else {\r\n this.label.removeAttribute('data-label')\r\n }\r\n if (trigger) {\r\n this.select.dispatchEvent(new Event('change'))\r\n this.close()\r\n }\r\n }\r\n}\r\n\r\nexport class ColorPicker extends EasyColorPicker {\r\n static clearText: string\r\n static customText: string\r\n\r\n constructor(select: HTMLSelectElement, label: string, options: any) {\r\n super(select, label, options)\r\n }\r\n\r\n buildItem(option: HTMLOptionElement) {\r\n const item = super.buildItem(option)\r\n item.setAttribute('title', option.getAttribute('value'))\r\n return item\r\n }\r\n}\r\n"],"names":["FluentEditor","EasyColorPicker"],"mappings":"
|
|
1
|
+
{"version":3,"file":"better-picker.cjs.js","sources":["../../../../src/modules/toolbar/better-picker.ts"],"sourcesContent":["import type TypePicker from 'quill/ui/picker'\r\nimport { EasyColorPicker } from 'quill-easy-color'\r\nimport FluentEditor from '../../core/fluent-editor'\r\n\r\nconst OriginPicker = FluentEditor.import('ui/picker') as typeof TypePicker\r\nexport class Picker extends OriginPicker {\r\n buildLabel() {\r\n const label = document.createElement('span')\r\n label.classList.add('ql-picker-label')\r\n label.innerHTML = `<i class=\"icon\" />`\r\n label.tabIndex = 0\r\n label.setAttribute('role', 'button')\r\n label.setAttribute('aria-expanded', 'false')\r\n this.container.appendChild(label)\r\n return label\r\n }\r\n\r\n buildItem(option: HTMLOptionElement) {\r\n const item = super.buildItem(option)\r\n const value = option.getAttribute('value')\r\n item.style.setProperty('--value', value)\r\n return item\r\n }\r\n\r\n selectItem(item: HTMLElement | null, trigger = false) {\r\n const selected = this.container.querySelector('.ql-selected')\r\n if (item === selected || item == null) return\r\n // move ql-selected clear after judge.\r\n // ql-selected is the class for check mark in picker\r\n if (selected != null) {\r\n selected.classList.remove('ql-selected')\r\n }\r\n item.classList.add('ql-selected')\r\n this.select.selectedIndex = Array.from(item.parentNode.children).indexOf(item)\r\n if (item.hasAttribute('data-value')) {\r\n this.label.setAttribute('data-value', item.getAttribute('data-value'))\r\n }\r\n else {\r\n this.label.removeAttribute('data-value')\r\n }\r\n if (item.hasAttribute('data-label')) {\r\n this.label.setAttribute('data-label', item.getAttribute('data-label'))\r\n }\r\n else {\r\n this.label.removeAttribute('data-label')\r\n }\r\n if (trigger) {\r\n this.select.dispatchEvent(new Event('change'))\r\n this.close()\r\n }\r\n }\r\n}\r\n\r\nexport class ColorPicker extends EasyColorPicker {\r\n static clearText: string\r\n static customText: string\r\n\r\n constructor(select: HTMLSelectElement, label: string, options: any) {\r\n super(select, label, options)\r\n }\r\n\r\n buildItem(option: HTMLOptionElement) {\r\n const item = super.buildItem(option)\r\n item.setAttribute('title', option.getAttribute('value'))\r\n return item\r\n }\r\n}\r\n"],"names":["FluentEditor","EasyColorPicker"],"mappings":";;;;;;;AAIA,MAAM,eAAeA,aAAAA,QAAa,OAAO,WAAW;AAC7C,MAAM,eAAe,aAAa;AAAA,EACvC,aAAa;AACL,UAAA,QAAQ,SAAS,cAAc,MAAM;AACrC,UAAA,UAAU,IAAI,iBAAiB;AACrC,UAAM,YAAY;AAClB,UAAM,WAAW;AACX,UAAA,aAAa,QAAQ,QAAQ;AAC7B,UAAA,aAAa,iBAAiB,OAAO;AACtC,SAAA,UAAU,YAAY,KAAK;AACzB,WAAA;AAAA,EAAA;AAAA,EAGT,UAAU,QAA2B;AAC7B,UAAA,OAAO,MAAM,UAAU,MAAM;AAC7B,UAAA,QAAQ,OAAO,aAAa,OAAO;AACpC,SAAA,MAAM,YAAY,WAAW,KAAK;AAChC,WAAA;AAAA,EAAA;AAAA,EAGT,WAAW,MAA0B,UAAU,OAAO;AACpD,UAAM,WAAW,KAAK,UAAU,cAAc,cAAc;AACxD,QAAA,SAAS,YAAY,QAAQ,KAAM;AAGvC,QAAI,YAAY,MAAM;AACX,eAAA,UAAU,OAAO,aAAa;AAAA,IAAA;AAEpC,SAAA,UAAU,IAAI,aAAa;AAC3B,SAAA,OAAO,gBAAgB,MAAM,KAAK,KAAK,WAAW,QAAQ,EAAE,QAAQ,IAAI;AACzE,QAAA,KAAK,aAAa,YAAY,GAAG;AACnC,WAAK,MAAM,aAAa,cAAc,KAAK,aAAa,YAAY,CAAC;AAAA,IAAA,OAElE;AACE,WAAA,MAAM,gBAAgB,YAAY;AAAA,IAAA;AAErC,QAAA,KAAK,aAAa,YAAY,GAAG;AACnC,WAAK,MAAM,aAAa,cAAc,KAAK,aAAa,YAAY,CAAC;AAAA,IAAA,OAElE;AACE,WAAA,MAAM,gBAAgB,YAAY;AAAA,IAAA;AAEzC,QAAI,SAAS;AACX,WAAK,OAAO,cAAc,IAAI,MAAM,QAAQ,CAAC;AAC7C,WAAK,MAAM;AAAA,IAAA;AAAA,EACb;AAEJ;AAEO,MAAM,oBAAoBC,eAAAA,gBAAgB;AAAA,EAI/C,YAAY,QAA2B,OAAe,SAAc;AAC5D,UAAA,QAAQ,OAAO,OAAO;AAAA,EAAA;AAAA,EAG9B,UAAU,QAA2B;AAC7B,UAAA,OAAO,MAAM,UAAU,MAAM;AACnC,SAAK,aAAa,SAAS,OAAO,aAAa,OAAO,CAAC;AAChD,WAAA;AAAA,EAAA;AAEX;AAZE,cADW,aACJ;AACP,cAFW,aAEJ;;;"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Quill = require("quill");
|
|
4
|
+
const editor_utils = require("../../config/editor.utils.cjs.js");
|
|
5
|
+
const Delta = Quill.import("delta");
|
|
6
|
+
const Parchment = Quill.import("parchment");
|
|
7
|
+
const levels = ["error", "warn", "log", "info"];
|
|
8
|
+
let level = "warn";
|
|
9
|
+
function debuglogger(method, ...args) {
|
|
10
|
+
if (levels.indexOf(method) <= levels.indexOf(level)) {
|
|
11
|
+
console[method](...args);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function namespace(ns) {
|
|
15
|
+
return levels.reduce((logger, method) => {
|
|
16
|
+
logger[method] = debuglogger.bind(console, method, ns);
|
|
17
|
+
return logger;
|
|
18
|
+
}, {});
|
|
19
|
+
}
|
|
20
|
+
namespace.level = (newLevel) => {
|
|
21
|
+
level = newLevel;
|
|
22
|
+
};
|
|
23
|
+
debuglogger.level = namespace.level;
|
|
24
|
+
const debug = namespace("quill:toolbar");
|
|
25
|
+
const Toolbar = Quill.import("modules/toolbar");
|
|
26
|
+
class BetterToolbar extends Toolbar {
|
|
27
|
+
update(range) {
|
|
28
|
+
const formats = editor_utils.isNullOrUndefined(range) ? {} : this.quill.getFormat(range);
|
|
29
|
+
this.controls.forEach((pair) => {
|
|
30
|
+
const [format, input] = pair;
|
|
31
|
+
if (input.tagName === "SELECT") {
|
|
32
|
+
const select = input;
|
|
33
|
+
let option;
|
|
34
|
+
if (editor_utils.isNullOrUndefined(range)) {
|
|
35
|
+
option = null;
|
|
36
|
+
} else if (editor_utils.isNullOrUndefined(formats[format])) {
|
|
37
|
+
option = select.querySelector("option[selected]");
|
|
38
|
+
} else if (!Array.isArray(formats[format])) {
|
|
39
|
+
let value = format === "header" ? formats[format].value : formats[format];
|
|
40
|
+
if (typeof value === "string") {
|
|
41
|
+
value = value.replace(/"/g, '\\"');
|
|
42
|
+
}
|
|
43
|
+
option = select.querySelector(`option[value="${value}"]`);
|
|
44
|
+
}
|
|
45
|
+
if (editor_utils.isNullOrUndefined(option)) {
|
|
46
|
+
select.value = "";
|
|
47
|
+
select.selectedIndex = -1;
|
|
48
|
+
} else {
|
|
49
|
+
option.selected = true;
|
|
50
|
+
}
|
|
51
|
+
} else if (editor_utils.isNullOrUndefined(range)) {
|
|
52
|
+
input.classList.remove("ql-active");
|
|
53
|
+
} else if (input.hasAttribute("value")) {
|
|
54
|
+
let isActive = formats[format] === input.getAttribute("value") || !editor_utils.isNullOrUndefined(formats[format]) && (formats[format].value === input.getAttribute("value") || formats[format].toString() === input.getAttribute("value")) || editor_utils.isNullOrUndefined(formats[format]) && !input.getAttribute("value");
|
|
55
|
+
if (!isActive) {
|
|
56
|
+
const checkFormat = formats[format];
|
|
57
|
+
if (checkFormat === "checked" || checkFormat === "unchecked") {
|
|
58
|
+
isActive = input.getAttribute("value") === "check";
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (isActive) {
|
|
62
|
+
input.classList.add("ql-active");
|
|
63
|
+
} else {
|
|
64
|
+
input.classList.remove("ql-active");
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
if (!editor_utils.isNullOrUndefined(formats[format])) {
|
|
68
|
+
input.classList.add("ql-active");
|
|
69
|
+
} else {
|
|
70
|
+
input.classList.remove("ql-active");
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
attach(input) {
|
|
76
|
+
let format = Array.from(input.classList).find((className) => {
|
|
77
|
+
return className.indexOf("ql-") === 0;
|
|
78
|
+
});
|
|
79
|
+
if (!format) return;
|
|
80
|
+
format = format.slice("ql-".length);
|
|
81
|
+
if (input.tagName === "BUTTON") {
|
|
82
|
+
input.setAttribute("type", "button");
|
|
83
|
+
}
|
|
84
|
+
if (this.handlers[format] == null && this.quill.scroll.query(format) == null) {
|
|
85
|
+
debug.warn("ignoring attaching to nonexistent format", format, input);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const eventName = input.tagName === "SELECT" ? "change" : "click";
|
|
89
|
+
input.addEventListener(eventName, (e) => {
|
|
90
|
+
let value;
|
|
91
|
+
if (input.tagName === "SELECT") {
|
|
92
|
+
const select = input;
|
|
93
|
+
if (select.selectedIndex < 0) return;
|
|
94
|
+
const selected = select.options[select.selectedIndex];
|
|
95
|
+
if (selected.hasAttribute("selected")) {
|
|
96
|
+
value = false;
|
|
97
|
+
} else {
|
|
98
|
+
value = selected.value || false;
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
const button = input;
|
|
102
|
+
if (button.classList.contains("ql-active")) {
|
|
103
|
+
value = false;
|
|
104
|
+
} else {
|
|
105
|
+
value = button.value || !button.hasAttribute("value");
|
|
106
|
+
}
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
}
|
|
109
|
+
this.quill.focus({ preventScroll: format === "screenshot" });
|
|
110
|
+
const [range] = this.quill.selection.getRange();
|
|
111
|
+
if (this.handlers[format] != null) {
|
|
112
|
+
if (!editor_utils.isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === "blockquote" || format === "code-block" || format === "list" || format === "indent" || format === "clean")) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.handlers[format].call(this, value);
|
|
116
|
+
} else if (
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
this.quill.scroll.query(format).prototype instanceof Parchment.EmbedBlot
|
|
119
|
+
) {
|
|
120
|
+
value = prompt(`Enter ${format}`);
|
|
121
|
+
if (!value) return;
|
|
122
|
+
this.quill.updateContents(
|
|
123
|
+
new Delta().retain(range.index).delete(range.length).insert({ [format]: value }),
|
|
124
|
+
Quill.sources.USER
|
|
125
|
+
);
|
|
126
|
+
} else {
|
|
127
|
+
if (!editor_utils.isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === "blockquote" || format === "code-block" || format === "list" || format === "indent" || format === "clean")) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
this.quill.format(format, value, Quill.sources.USER);
|
|
131
|
+
}
|
|
132
|
+
this.update(range);
|
|
133
|
+
});
|
|
134
|
+
this.controls.push([format, input]);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.BetterToolbar = BetterToolbar;
|
|
138
|
+
//# sourceMappingURL=better-toolbar.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"better-toolbar.cjs.js","sources":["../../../../src/modules/toolbar/better-toolbar.ts"],"sourcesContent":["import type TypeToolbar from 'quill/modules/toolbar'\r\nimport Quill from 'quill'\r\nimport { isNullOrUndefined } from '../../config/editor.utils'\r\n\r\nconst Delta = Quill.import('delta')\r\nconst Parchment = Quill.import('parchment')\r\nconst levels = ['error', 'warn', 'log', 'info'] as const\r\nlet level = 'warn' as const\r\n\r\nfunction debuglogger(method: typeof levels[number], ...args) {\r\n if (levels.indexOf(method) <= levels.indexOf(level)) {\r\n console[method](...args) // eslint-disable-line no-console\r\n }\r\n}\r\n\r\nfunction namespace(ns) {\r\n return levels.reduce((logger, method) => {\r\n logger[method] = debuglogger.bind(console, method, ns)\r\n return logger\r\n }, {} as Record<typeof levels[number], (...args: any) => void>)\r\n}\r\n\r\nnamespace.level = (newLevel) => {\r\n level = newLevel\r\n}\r\ndebuglogger.level = namespace.level\r\nconst debug = namespace('quill:toolbar')\r\n\r\nconst Toolbar = Quill.import('modules/toolbar') as typeof TypeToolbar\r\n\r\nexport class BetterToolbar extends Toolbar {\r\n update(range) {\r\n const formats = isNullOrUndefined(range) ? {} : this.quill.getFormat(range) as Record<string, any>\r\n this.controls.forEach((pair) => {\r\n const [format, input] = pair\r\n if (input.tagName === 'SELECT') {\r\n const select = input as HTMLSelectElement\r\n let option\r\n if (isNullOrUndefined(range)) {\r\n option = null\r\n }\r\n else if (isNullOrUndefined(formats[format])) {\r\n option = select.querySelector('option[selected]')\r\n }\r\n else if (!Array.isArray(formats[format])) {\r\n let value = format === 'header' ? formats[format].value : formats[format]\r\n if (typeof value === 'string') {\r\n value = value.replace(/\"/g, '\\\\\"')\r\n }\r\n option = select.querySelector(`option[value=\"${value}\"]`)\r\n }\r\n if (isNullOrUndefined(option)) {\r\n select.value = '' // TODO make configurable?\r\n select.selectedIndex = -1\r\n }\r\n else {\r\n option.selected = true\r\n }\r\n }\r\n else if (isNullOrUndefined(range)) {\r\n input.classList.remove('ql-active')\r\n }\r\n else if (input.hasAttribute('value')) {\r\n // both being null should match (default values)\r\n // '1' should match with 1 (headers)\r\n let isActive\r\n = formats[format] === input.getAttribute('value')\r\n || (!isNullOrUndefined(formats[format])\r\n && (formats[format].value === input.getAttribute('value')\r\n || formats[format].toString() === input.getAttribute('value')))\r\n || (isNullOrUndefined(formats[format]) && !input.getAttribute('value'))\r\n\r\n if (!isActive) {\r\n const checkFormat = formats[format]\r\n if (checkFormat === 'checked' || checkFormat === 'unchecked') {\r\n isActive = input.getAttribute('value') === 'check'\r\n }\r\n }\r\n\r\n if (isActive) {\r\n input.classList.add('ql-active')\r\n }\r\n else {\r\n input.classList.remove('ql-active')\r\n }\r\n }\r\n else {\r\n if (!isNullOrUndefined(formats[format])) {\r\n input.classList.add('ql-active')\r\n }\r\n else {\r\n input.classList.remove('ql-active')\r\n }\r\n }\r\n })\r\n }\r\n\r\n attach(input: HTMLElement) {\r\n let format = Array.from(input.classList).find((className) => {\r\n return className.indexOf('ql-') === 0\r\n })\r\n if (!format) return\r\n format = format.slice('ql-'.length)\r\n\r\n if (input.tagName === 'BUTTON') {\r\n input.setAttribute('type', 'button')\r\n }\r\n\r\n if (this.handlers[format] == null && this.quill.scroll.query(format) == null) {\r\n debug.warn('ignoring attaching to nonexistent format', format, input)\r\n return\r\n }\r\n\r\n const eventName = input.tagName === 'SELECT' ? 'change' : 'click'\r\n input.addEventListener(eventName, (e) => {\r\n let value: boolean | string\r\n\r\n if (input.tagName === 'SELECT') {\r\n const select = input as HTMLSelectElement\r\n if (select.selectedIndex < 0) return\r\n const selected = select.options[select.selectedIndex]\r\n\r\n if (selected.hasAttribute('selected')) {\r\n value = false\r\n }\r\n else {\r\n value = selected.value || false\r\n }\r\n }\r\n else {\r\n const button = input as HTMLButtonElement\r\n if (button.classList.contains('ql-active')) {\r\n value = false\r\n }\r\n else {\r\n value = button.value || !button.hasAttribute('value')\r\n }\r\n e.preventDefault()\r\n }\r\n\r\n this.quill.focus({ preventScroll: format === 'screenshot' })\r\n const [range] = this.quill.selection.getRange()\r\n if (this.handlers[format] != null) {\r\n // @ts-ignore\r\n if (!isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === 'blockquote' || format === 'code-block' || format === 'list' || format === 'indent' || format === 'clean')) {\r\n return\r\n }\r\n this.handlers[format].call(this, value)\r\n }\r\n else if (\r\n // @ts-ignore\r\n this.quill.scroll.query(format).prototype instanceof Parchment.EmbedBlot\r\n ) {\r\n value = prompt(`Enter ${format}`)\r\n if (!value) return\r\n this.quill.updateContents(\r\n new Delta()\r\n .retain(range.index)\r\n .delete(range.length)\r\n .insert({ [format]: value }),\r\n Quill.sources.USER,\r\n )\r\n }\r\n else {\r\n // @ts-ignore\r\n if (!isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === 'blockquote' || format === 'code-block' || format === 'list' || format === 'indent' || format === 'clean')) {\r\n return\r\n }\r\n this.quill.format(format, value, Quill.sources.USER)\r\n }\r\n\r\n this.update(range)\r\n })\r\n this.controls.push([format, input])\r\n }\r\n}\r\n"],"names":["isNullOrUndefined"],"mappings":";;;;AAIA,MAAM,QAAQ,MAAM,OAAO,OAAO;AAClC,MAAM,YAAY,MAAM,OAAO,WAAW;AAC1C,MAAM,SAAS,CAAC,SAAS,QAAQ,OAAO,MAAM;AAC9C,IAAI,QAAQ;AAEZ,SAAS,YAAY,WAAkC,MAAM;AAC3D,MAAI,OAAO,QAAQ,MAAM,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC3C,YAAA,MAAM,EAAE,GAAG,IAAI;AAAA,EAAA;AAE3B;AAEA,SAAS,UAAU,IAAI;AACrB,SAAO,OAAO,OAAO,CAAC,QAAQ,WAAW;AACvC,WAAO,MAAM,IAAI,YAAY,KAAK,SAAS,QAAQ,EAAE;AAC9C,WAAA;AAAA,EACT,GAAG,EAA2D;AAChE;AAEA,UAAU,QAAQ,CAAC,aAAa;AACtB,UAAA;AACV;AACA,YAAY,QAAQ,UAAU;AAC9B,MAAM,QAAQ,UAAU,eAAe;AAEvC,MAAM,UAAU,MAAM,OAAO,iBAAiB;AAEvC,MAAM,sBAAsB,QAAQ;AAAA,EACzC,OAAO,OAAO;AACN,UAAA,UAAUA,+BAAkB,KAAK,IAAI,CAAK,IAAA,KAAK,MAAM,UAAU,KAAK;AACrE,SAAA,SAAS,QAAQ,CAAC,SAAS;AACxB,YAAA,CAAC,QAAQ,KAAK,IAAI;AACpB,UAAA,MAAM,YAAY,UAAU;AAC9B,cAAM,SAAS;AACX,YAAA;AACA,YAAAA,aAAAA,kBAAkB,KAAK,GAAG;AACnB,mBAAA;AAAA,QAEF,WAAAA,aAAA,kBAAkB,QAAQ,MAAM,CAAC,GAAG;AAClC,mBAAA,OAAO,cAAc,kBAAkB;AAAA,QAAA,WAEzC,CAAC,MAAM,QAAQ,QAAQ,MAAM,CAAC,GAAG;AACpC,cAAA,QAAQ,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,aAAK,SAAS,MAAM,EAAE,KAAK,MAAM,KAAK;AAAA,MAAA;AAAA;AAAA,QAItC,KAAK,MAAM,OAAO,MAAM,MAAM,EAAE,qBAAqB,UAAU;AAAA,QAC/D;AACQ,gBAAA,OAAO,SAAS,MAAM,EAAE;AAChC,YAAI,CAAC,MAAO;AACZ,aAAK,MAAM;AAAA,UACT,IAAI,MAAM,EACP,OAAO,MAAM,KAAK,EAClB,OAAO,MAAM,MAAM,EACnB,OAAO,EAAE,CAAC,MAAM,GAAG,OAAO;AAAA,UAC7B,MAAM,QAAQ;AAAA,QAChB;AAAA,MAAA,OAEG;AAEH,YAAI,CAACA,aAAkB,kBAAA,OAAO,cAAc,KAAK,OAAO,mBAAmB,SAAS,WAAW,gBAAgB,WAAW,gBAAgB,WAAW,UAAU,WAAW,YAAY,WAAW,UAAU;AACzM;AAAA,QAAA;AAEF,aAAK,MAAM,OAAO,QAAQ,OAAO,MAAM,QAAQ,IAAI;AAAA,MAAA;AAGrD,WAAK,OAAO,KAAK;AAAA,IAAA,CAClB;AACD,SAAK,SAAS,KAAK,CAAC,QAAQ,KAAK,CAAC;AAAA,EAAA;AAEtC;;"}
|
|
@@ -1,140 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const betterPicker = require("./better-picker.cjs.js");
|
|
4
|
+
const betterToolbar = require("./better-toolbar.cjs.js");
|
|
5
5
|
const toolbarTip = require("./toolbar-tip.cjs.js");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let level = "warn";
|
|
10
|
-
function debuglogger(method, ...args) {
|
|
11
|
-
if (levels.indexOf(method) <= levels.indexOf(level)) {
|
|
12
|
-
console[method](...args);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function namespace(ns) {
|
|
16
|
-
return levels.reduce((logger, method) => {
|
|
17
|
-
logger[method] = debuglogger.bind(console, method, ns);
|
|
18
|
-
return logger;
|
|
19
|
-
}, {});
|
|
20
|
-
}
|
|
21
|
-
namespace.level = (newLevel) => {
|
|
22
|
-
level = newLevel;
|
|
23
|
-
};
|
|
24
|
-
debuglogger.level = namespace.level;
|
|
25
|
-
const debug = namespace("quill:toolbar");
|
|
26
|
-
const Toolbar = Quill.import("modules/toolbar");
|
|
27
|
-
class BetterToolbar extends Toolbar {
|
|
28
|
-
update(range) {
|
|
29
|
-
const formats = editor_utils.isNullOrUndefined(range) ? {} : this.quill.getFormat(range);
|
|
30
|
-
this.controls.forEach((pair) => {
|
|
31
|
-
const [format, input] = pair;
|
|
32
|
-
if (input.tagName === "SELECT") {
|
|
33
|
-
const select = input;
|
|
34
|
-
let option;
|
|
35
|
-
if (editor_utils.isNullOrUndefined(range)) {
|
|
36
|
-
option = null;
|
|
37
|
-
} else if (editor_utils.isNullOrUndefined(formats[format])) {
|
|
38
|
-
option = select.querySelector("option[selected]");
|
|
39
|
-
} else if (!Array.isArray(formats[format])) {
|
|
40
|
-
let value = format === "header" ? formats[format].value : formats[format];
|
|
41
|
-
if (typeof value === "string") {
|
|
42
|
-
value = value.replace(/"/g, '\\"');
|
|
43
|
-
}
|
|
44
|
-
option = select.querySelector(`option[value="${value}"]`);
|
|
45
|
-
}
|
|
46
|
-
if (editor_utils.isNullOrUndefined(option)) {
|
|
47
|
-
select.value = "";
|
|
48
|
-
select.selectedIndex = -1;
|
|
49
|
-
} else {
|
|
50
|
-
option.selected = true;
|
|
51
|
-
}
|
|
52
|
-
} else if (editor_utils.isNullOrUndefined(range)) {
|
|
53
|
-
input.classList.remove("ql-active");
|
|
54
|
-
} else if (input.hasAttribute("value")) {
|
|
55
|
-
let isActive = formats[format] === input.getAttribute("value") || !editor_utils.isNullOrUndefined(formats[format]) && (formats[format].value === input.getAttribute("value") || formats[format].toString() === input.getAttribute("value")) || editor_utils.isNullOrUndefined(formats[format]) && !input.getAttribute("value");
|
|
56
|
-
if (!isActive) {
|
|
57
|
-
const checkFormat = formats[format];
|
|
58
|
-
if (checkFormat === "checked" || checkFormat === "unchecked") {
|
|
59
|
-
isActive = input.getAttribute("value") === "check";
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (isActive) {
|
|
63
|
-
input.classList.add("ql-active");
|
|
64
|
-
} else {
|
|
65
|
-
input.classList.remove("ql-active");
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
if (!editor_utils.isNullOrUndefined(formats[format])) {
|
|
69
|
-
input.classList.add("ql-active");
|
|
70
|
-
} else {
|
|
71
|
-
input.classList.remove("ql-active");
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
attach(input) {
|
|
77
|
-
let format = Array.from(input.classList).find((className) => {
|
|
78
|
-
return className.indexOf("ql-") === 0;
|
|
79
|
-
});
|
|
80
|
-
if (!format) return;
|
|
81
|
-
format = format.slice("ql-".length);
|
|
82
|
-
if (input.tagName === "BUTTON") {
|
|
83
|
-
input.setAttribute("type", "button");
|
|
84
|
-
}
|
|
85
|
-
if (this.handlers[format] == null && this.quill.scroll.query(format) == null) {
|
|
86
|
-
debug.warn("ignoring attaching to nonexistent format", format, input);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const eventName = input.tagName === "SELECT" ? "change" : "click";
|
|
90
|
-
input.addEventListener(eventName, (e) => {
|
|
91
|
-
let value;
|
|
92
|
-
if (input.tagName === "SELECT") {
|
|
93
|
-
const select = input;
|
|
94
|
-
if (select.selectedIndex < 0) return;
|
|
95
|
-
const selected = select.options[select.selectedIndex];
|
|
96
|
-
if (selected.hasAttribute("selected")) {
|
|
97
|
-
value = false;
|
|
98
|
-
} else {
|
|
99
|
-
value = selected.value || false;
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
const button = input;
|
|
103
|
-
if (button.classList.contains("ql-active")) {
|
|
104
|
-
value = false;
|
|
105
|
-
} else {
|
|
106
|
-
value = button.value || !button.hasAttribute("value");
|
|
107
|
-
}
|
|
108
|
-
e.preventDefault();
|
|
109
|
-
}
|
|
110
|
-
this.quill.focus({ preventScroll: format === "screenshot" });
|
|
111
|
-
const [range] = this.quill.selection.getRange();
|
|
112
|
-
if (this.handlers[format] != null) {
|
|
113
|
-
if (!editor_utils.isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === "blockquote" || format === "code-block" || format === "list" || format === "indent" || format === "clean")) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
this.handlers[format].call(this, value);
|
|
117
|
-
} else if (
|
|
118
|
-
// @ts-ignore
|
|
119
|
-
this.quill.scroll.query(format).prototype instanceof Parchment.EmbedBlot
|
|
120
|
-
) {
|
|
121
|
-
value = prompt(`Enter ${format}`);
|
|
122
|
-
if (!value) return;
|
|
123
|
-
this.quill.updateContents(
|
|
124
|
-
new Delta().retain(range.index).delete(range.length).insert({ [format]: value }),
|
|
125
|
-
Quill.sources.USER
|
|
126
|
-
);
|
|
127
|
-
} else {
|
|
128
|
-
if (!editor_utils.isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === "blockquote" || format === "code-block" || format === "list" || format === "indent" || format === "clean")) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
this.quill.format(format, value, Quill.sources.USER);
|
|
132
|
-
}
|
|
133
|
-
this.update(range);
|
|
134
|
-
});
|
|
135
|
-
this.controls.push([format, input]);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
6
|
+
exports.ColorPicker = betterPicker.ColorPicker;
|
|
7
|
+
exports.Picker = betterPicker.Picker;
|
|
8
|
+
exports.BetterToolbar = betterToolbar.BetterToolbar;
|
|
138
9
|
exports.generateToolbarTip = toolbarTip.generateToolbarTip;
|
|
139
|
-
exports.default = BetterToolbar;
|
|
140
10
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../../src/modules/toolbar/index.ts"],"sourcesContent":["import type TypeToolbar from 'quill/modules/toolbar'\r\nimport Quill from 'quill'\r\nimport { isNullOrUndefined } from '../../config/editor.utils'\r\n\r\nconst Delta = Quill.import('delta')\r\nconst Parchment = Quill.import('parchment')\r\nconst levels = ['error', 'warn', 'log', 'info'] as const\r\nlet level = 'warn' as const\r\n\r\nfunction debuglogger(method: typeof levels[number], ...args) {\r\n if (levels.indexOf(method) <= levels.indexOf(level)) {\r\n console[method](...args) // eslint-disable-line no-console\r\n }\r\n}\r\n\r\nfunction namespace(ns) {\r\n return levels.reduce((logger, method) => {\r\n logger[method] = debuglogger.bind(console, method, ns)\r\n return logger\r\n }, {} as Record<typeof levels[number], (...args: any) => void>)\r\n}\r\n\r\nnamespace.level = (newLevel) => {\r\n level = newLevel\r\n}\r\ndebuglogger.level = namespace.level\r\nconst debug = namespace('quill:toolbar')\r\n\r\nconst Toolbar = Quill.import('modules/toolbar') as typeof TypeToolbar\r\n\r\nclass BetterToolbar extends Toolbar {\r\n update(range) {\r\n const formats = isNullOrUndefined(range) ? {} : this.quill.getFormat(range) as Record<string, any>\r\n this.controls.forEach((pair) => {\r\n const [format, input] = pair\r\n if (input.tagName === 'SELECT') {\r\n const select = input as HTMLSelectElement\r\n let option\r\n if (isNullOrUndefined(range)) {\r\n option = null\r\n }\r\n else if (isNullOrUndefined(formats[format])) {\r\n option = select.querySelector('option[selected]')\r\n }\r\n else if (!Array.isArray(formats[format])) {\r\n let value = format === 'header' ? formats[format].value : formats[format]\r\n if (typeof value === 'string') {\r\n value = value.replace(/\"/g, '\\\\\"')\r\n }\r\n option = select.querySelector(`option[value=\"${value}\"]`)\r\n }\r\n if (isNullOrUndefined(option)) {\r\n select.value = '' // TODO make configurable?\r\n select.selectedIndex = -1\r\n }\r\n else {\r\n option.selected = true\r\n }\r\n }\r\n else if (isNullOrUndefined(range)) {\r\n input.classList.remove('ql-active')\r\n }\r\n else if (input.hasAttribute('value')) {\r\n // both being null should match (default values)\r\n // '1' should match with 1 (headers)\r\n let isActive\r\n = formats[format] === input.getAttribute('value')\r\n || (!isNullOrUndefined(formats[format])\r\n && (formats[format].value === input.getAttribute('value')\r\n || formats[format].toString() === input.getAttribute('value')))\r\n || (isNullOrUndefined(formats[format]) && !input.getAttribute('value'))\r\n\r\n if (!isActive) {\r\n const checkFormat = formats[format]\r\n if (checkFormat === 'checked' || checkFormat === 'unchecked') {\r\n isActive = input.getAttribute('value') === 'check'\r\n }\r\n }\r\n\r\n if (isActive) {\r\n input.classList.add('ql-active')\r\n }\r\n else {\r\n input.classList.remove('ql-active')\r\n }\r\n }\r\n else {\r\n if (!isNullOrUndefined(formats[format])) {\r\n input.classList.add('ql-active')\r\n }\r\n else {\r\n input.classList.remove('ql-active')\r\n }\r\n }\r\n })\r\n }\r\n\r\n attach(input: HTMLElement) {\r\n let format = Array.from(input.classList).find((className) => {\r\n return className.indexOf('ql-') === 0\r\n })\r\n if (!format) return\r\n format = format.slice('ql-'.length)\r\n\r\n if (input.tagName === 'BUTTON') {\r\n input.setAttribute('type', 'button')\r\n }\r\n\r\n if (this.handlers[format] == null && this.quill.scroll.query(format) == null) {\r\n debug.warn('ignoring attaching to nonexistent format', format, input)\r\n return\r\n }\r\n\r\n const eventName = input.tagName === 'SELECT' ? 'change' : 'click'\r\n input.addEventListener(eventName, (e) => {\r\n let value: boolean | string\r\n\r\n if (input.tagName === 'SELECT') {\r\n const select = input as HTMLSelectElement\r\n if (select.selectedIndex < 0) return\r\n const selected = select.options[select.selectedIndex]\r\n\r\n if (selected.hasAttribute('selected')) {\r\n value = false\r\n }\r\n else {\r\n value = selected.value || false\r\n }\r\n }\r\n else {\r\n const button = input as HTMLButtonElement\r\n if (button.classList.contains('ql-active')) {\r\n value = false\r\n }\r\n else {\r\n value = button.value || !button.hasAttribute('value')\r\n }\r\n e.preventDefault()\r\n }\r\n\r\n this.quill.focus({ preventScroll: format === 'screenshot' })\r\n const [range] = this.quill.selection.getRange()\r\n if (this.handlers[format] != null) {\r\n // @ts-ignore\r\n if (!isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === 'blockquote' || format === 'code-block' || format === 'list' || format === 'indent' || format === 'clean')) {\r\n return\r\n }\r\n this.handlers[format].call(this, value)\r\n }\r\n else if (\r\n // @ts-ignore\r\n this.quill.scroll.query(format).prototype instanceof Parchment.EmbedBlot\r\n ) {\r\n value = prompt(`Enter ${format}`)\r\n if (!value) return\r\n this.quill.updateContents(\r\n new Delta()\r\n .retain(range.index)\r\n .delete(range.length)\r\n .insert({ [format]: value }),\r\n Quill.sources.USER,\r\n )\r\n }\r\n else {\r\n // @ts-ignore\r\n if (!isNullOrUndefined(window.quillIsIntable) && window.quillIsIntable === true && (format === 'blockquote' || format === 'code-block' || format === 'list' || format === 'indent' || format === 'clean')) {\r\n return\r\n }\r\n this.quill.format(format, value, Quill.sources.USER)\r\n }\r\n\r\n this.update(range)\r\n })\r\n this.controls.push([format, input])\r\n }\r\n}\r\n\r\nexport default BetterToolbar\r\nexport * from './toolbar-tip'\r\n"],"names":["isNullOrUndefined"],"mappings":";;;;;AAIA,MAAM,QAAQ,MAAM,OAAO,OAAO;AAClC,MAAM,YAAY,MAAM,OAAO,WAAW;AAC1C,MAAM,SAAS,CAAC,SAAS,QAAQ,OAAO,MAAM;AAC9C,IAAI,QAAQ;AAEZ,SAAS,YAAY,WAAkC,MAAM;AAC3D,MAAI,OAAO,QAAQ,MAAM,KAAK,OAAO,QAAQ,KAAK,GAAG;AAC3C,YAAA,MAAM,EAAE,GAAG,IAAI;AAAA,EAAA;AAE3B;AAEA,SAAS,UAAU,IAAI;AACrB,SAAO,OAAO,OAAO,CAAC,QAAQ,WAAW;AACvC,WAAO,MAAM,IAAI,YAAY,KAAK,SAAS,QAAQ,EAAE;AAC9C,WAAA;AAAA,EACT,GAAG,EAA2D;AAChE;AAEA,UAAU,QAAQ,CAAC,aAAa;AACtB,UAAA;AACV;AACA,YAAY,QAAQ,UAAU;AAC9B,MAA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