@opentiny/fluent-editor 4.0.0-alpha.1 → 4.0.0-alpha.2
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 +24 -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/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 +4 -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 +8 -0
- package/es/ui/icons.config.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 +33 -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/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 +5 -11
- package/lib/themes/snow.cjs.js.map +1 -1
- package/lib/tools/fullscreen.cjs.js.map +1 -1
- package/lib/ui/icons.config.cjs.js +8 -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 +2 -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/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 +1 -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
|
@@ -0,0 +1,32 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import { BlotSpec } from "./blot-spec.es.js";
|
|
5
|
+
class ImageSpec extends BlotSpec {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
__publicField(this, "img", null);
|
|
9
|
+
__publicField(this, "onClick", (event) => {
|
|
10
|
+
const el = event.target;
|
|
11
|
+
if (!(el instanceof HTMLElement) || el.tagName !== "IMG") {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
this.img = el;
|
|
16
|
+
this.formatter.show(this);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
init() {
|
|
20
|
+
this.formatter.quill.root.addEventListener("click", this.onClick);
|
|
21
|
+
}
|
|
22
|
+
getTargetElement() {
|
|
23
|
+
return this.img;
|
|
24
|
+
}
|
|
25
|
+
onHide() {
|
|
26
|
+
this.img = null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
ImageSpec
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=image-spec.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-spec.es.js","sources":["../../../../../src/modules/custom-image/specs/image-spec.ts"],"sourcesContent":["import { BlotSpec } from './blot-spec'\r\n\r\nexport class ImageSpec extends BlotSpec {\r\n img: HTMLImageElement | null = null\r\n\r\n init() {\r\n this.formatter.quill.root.addEventListener('click', this.onClick)\r\n }\r\n\r\n getTargetElement() {\r\n return this.img\r\n }\r\n\r\n onHide() {\r\n this.img = null\r\n }\r\n\r\n onClick = (event: MouseEvent) => {\r\n const el = event.target\r\n if (!(el instanceof HTMLElement) || el.tagName !== 'IMG') {\r\n return\r\n }\r\n event.stopPropagation()\r\n\r\n this.img = el as HTMLImageElement\r\n this.formatter.show(this)\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAEO,MAAM,kBAAkB,SAAS;AAAA,EAAjC;AAAA;AACL,+BAA+B;AAc/B,mCAAU,CAAC,UAAsB;AAC/B,YAAM,KAAK,MAAM;AACjB,UAAI,EAAE,cAAc,gBAAgB,GAAG,YAAY,OAAO;AACxD;AAAA,MAAA;AAEF,YAAM,gBAAgB;AAEtB,WAAK,MAAM;AACN,WAAA,UAAU,KAAK,IAAI;AAAA,IAC1B;AAAA;AAAA,EArBA,OAAO;AACL,SAAK,UAAU,MAAM,KAAK,iBAAiB,SAAS,KAAK,OAAO;AAAA,EAAA;AAAA,EAGlE,mBAAmB;AACjB,WAAO,KAAK;AAAA,EAAA;AAAA,EAGd,SAAS;AACP,SAAK,MAAM;AAAA,EAAA;AAaf;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import Quill from "quill";
|
|
2
5
|
import { isString } from "../utils/is.es.js";
|
|
3
6
|
const Uploader = Quill.import("modules/uploader");
|
|
4
7
|
const Delta = Quill.import("delta");
|
|
5
|
-
|
|
8
|
+
class FileUploader extends Uploader {
|
|
6
9
|
constructor(quill, options) {
|
|
7
10
|
super(quill, options);
|
|
8
11
|
this.quill = quill;
|
|
@@ -67,9 +70,8 @@ const _FileUploader = class _FileUploader extends Uploader {
|
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let FileUploader = _FileUploader;
|
|
73
|
+
}
|
|
74
|
+
__publicField(FileUploader, "DEFAULTS", {});
|
|
73
75
|
export {
|
|
74
76
|
FileUploader
|
|
75
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-uploader.es.js","sources":["../../../src/modules/custom-uploader.ts"],"sourcesContent":["import type { Range } from 'quill'\r\nimport type TypeUploader from 'quill/modules/uploader'\r\nimport type FluentEditor from '../core/fluent-editor'\r\nimport Quill from 'quill'\r\nimport { isString } from '../utils/is'\r\n\r\nconst Uploader = Quill.import('modules/uploader') as typeof TypeUploader\r\nconst Delta = Quill.import('delta')\r\n\r\ninterface UploaderOptions {\r\n mimetypes: string[]\r\n handler: (this: { quill: Quill }, range: Range, files: File[]) => void\r\n}\r\nexport interface FileUploaderOptions {\r\n mimetypes: string[]\r\n maxSize: number\r\n handler: (this: { quill: FluentEditor }, range: Range, files: File[]) => Promise<(string | false)[]> | (string | false)[]\r\n success: (this: { quill: FluentEditor }, file: File, range: Range) => void\r\n fail: (this: { quill: FluentEditor }, file: File, range: Range) => void\r\n}\r\nexport class FileUploader extends Uploader {\r\n static DEFAULTS = {} as
|
|
1
|
+
{"version":3,"file":"custom-uploader.es.js","sources":["../../../src/modules/custom-uploader.ts"],"sourcesContent":["import type { Range } from 'quill'\r\nimport type TypeUploader from 'quill/modules/uploader'\r\nimport type FluentEditor from '../core/fluent-editor'\r\nimport Quill from 'quill'\r\nimport { isString } from '../utils/is'\r\n\r\nconst Uploader = Quill.import('modules/uploader') as typeof TypeUploader\r\nconst Delta = Quill.import('delta')\r\n\r\ninterface UploaderOptions {\r\n mimetypes: string[]\r\n handler: (this: { quill: Quill }, range: Range, files: File[]) => void\r\n}\r\nexport interface FileUploaderOptions {\r\n mimetypes: string[]\r\n maxSize: number\r\n handler: (this: { quill: FluentEditor }, range: Range, files: File[]) => Promise<(string | false)[]> | (string | false)[]\r\n success: (this: { quill: FluentEditor }, file: File, range: Range) => void\r\n fail: (this: { quill: FluentEditor }, file: File, range: Range) => void\r\n}\r\nexport class FileUploader extends Uploader {\r\n static DEFAULTS = {} as any\r\n // Partial<UploaderOptions> for ts type\r\n declare options: Partial<UploaderOptions> & FileUploaderOptions\r\n constructor(public quill: FluentEditor, options: Partial<FileUploaderOptions>) {\r\n super(quill, options as any)\r\n this.options = this.resolveOptions(options)\r\n // paste handle in clipboard\r\n }\r\n\r\n resolveOptions(options: Partial<FileUploaderOptions> = {}) {\r\n return Object.assign({\r\n mimetypes: ['*'],\r\n maxSize: Number.POSITIVE_INFINITY,\r\n handler(range: Range, files: File[]) {\r\n return files.map(file => URL.createObjectURL(file))\r\n },\r\n success() {},\r\n fail() {},\r\n }, options)\r\n }\r\n\r\n validateFile(file: File) {\r\n return this.options.mimetypes.some(type => (file.type || 'text/plain').match(type.replaceAll('*', '.*'))) && file.size < this.options.maxSize\r\n }\r\n\r\n async getFileUrls(files: File[], range: Range) {\r\n const uploads = files.filter(file => this.validateFile(file))\r\n return this.options.handler.call(this, range, uploads)\r\n }\r\n\r\n async upload(range: Range, files: FileList | File[]) {\r\n const uploads = []\r\n const fails = []\r\n for (const file of Array.from(files)) {\r\n if (this.validateFile(file)) {\r\n uploads.push(file)\r\n }\r\n else {\r\n fails.push(file)\r\n }\r\n }\r\n const result = await this.options.handler.call(this, range, uploads)\r\n const updateDelta = result.reduce((delta, url, i) => {\r\n if (isString(url)) {\r\n const type = uploads[i].type\r\n if (type.startsWith('image/')) {\r\n delta.insert({ image: url })\r\n }\r\n else if (type.startsWith('video/')) {\r\n delta.insert({ video: { src: url } })\r\n }\r\n else {\r\n delta.insert({ file: { size: uploads[i].size, title: uploads[i].name, src: url } })\r\n }\r\n }\r\n else {\r\n delta.insert('\\n')\r\n }\r\n return delta\r\n }, new Delta().retain(range.index).delete(range.length))\r\n this.quill.updateContents(updateDelta, Quill.sources.USER)\r\n this.quill.setSelection(range.index + result.length, Quill.sources.SILENT)\r\n for (const file of fails) {\r\n this.options.fail.call(this, file, range)\r\n }\r\n for (const [i, res] of result.entries()) {\r\n if (isString(res)) {\r\n this.options.success.call(this, files[i], { index: range.index + i, length: 0 })\r\n }\r\n else {\r\n this.options.fail.call(this, files[i], { index: range.index + i, length: 0 })\r\n }\r\n }\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;AAMA,MAAM,WAAW,MAAM,OAAO,k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key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import Quill from "quill";
|
|
2
5
|
const BlockEmbed = Quill.import("blots/block/embed");
|
|
3
|
-
|
|
6
|
+
class DividerBlot extends BlockEmbed {
|
|
4
7
|
static create() {
|
|
5
8
|
const node = super.create();
|
|
6
9
|
node.setAttribute("contenteditable", "false");
|
|
7
10
|
return node;
|
|
8
11
|
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let DividerBlot = _DividerBlot;
|
|
13
|
-
Quill.register(DividerBlot);
|
|
12
|
+
}
|
|
13
|
+
__publicField(DividerBlot, "blotName", "divider");
|
|
14
|
+
__publicField(DividerBlot, "tagName", "hr");
|
|
14
15
|
export {
|
|
15
|
-
DividerBlot
|
|
16
|
+
DividerBlot
|
|
16
17
|
};
|
|
17
18
|
//# sourceMappingURL=divider.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divider.es.js","sources":["../../../src/modules/divider.ts"],"sourcesContent":["import Quill from 'quill'\r\n\r\nconst BlockEmbed = Quill.import('blots/block/embed')\r\n\r\
|
|
1
|
+
{"version":3,"file":"divider.es.js","sources":["../../../src/modules/divider.ts"],"sourcesContent":["import type { BlockEmbed as TypeBlockEmbed } from 'quill/blots/block'\r\nimport Quill from 'quill'\r\n\r\nconst BlockEmbed = Quill.import('blots/block/embed') as typeof TypeBlockEmbed\r\n\r\nexport class DividerBlot extends BlockEmbed {\r\n static blotName = 'divider'\r\n static tagName = 'hr'\r\n\r\n static create() {\r\n const node = super.create() as HTMLElement\r\n node.setAttribute('contenteditable', 'false')\r\n return node\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAGA,MAAM,aAAa,MAAM,OAAO,mBAAmB;AAE5C,MAAM,oBAAoB,WAAW;AAAA,EAI1C,OAAO,SAAS;AACR,UAAA,OAAO,MAAM,OAAO;AACrB,SAAA,aAAa,mBAAmB,OAAO;AACrC,WAAA;AAAA,EAAA;AAEX;AARE,cADW,aACJ,YAAW;AAClB,cAFW,aAEJ,WAAU;"}
|
|
@@ -0,0 +1,175 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import data from "../node_modules/.pnpm/@emoji-mart_data@1.2.1/node_modules/@emoji-mart/data/sets/15/native.json.es.js";
|
|
5
|
+
import { computePosition } from "../node_modules/.pnpm/@floating-ui_dom@1.7.2/node_modules/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
6
|
+
import { Picker as $efa000751917694d$export$2e2bcd8739ae039 } from "../node_modules/.pnpm/emoji-mart@5.6.0/node_modules/emoji-mart/dist/module.es.js";
|
|
7
|
+
import { debounce } from "lodash-es";
|
|
8
|
+
const DEFAULT_OPTIONS = {
|
|
9
|
+
theme: "light",
|
|
10
|
+
set: "native",
|
|
11
|
+
skinTonePosition: "none",
|
|
12
|
+
previewPosition: "bottom",
|
|
13
|
+
searchPosition: "sticky",
|
|
14
|
+
categories: ["frequent", "people", "nature", "foods", "activity", "places", "objects", "symbols", "flags"],
|
|
15
|
+
maxFrequentRows: 2,
|
|
16
|
+
perLine: 8,
|
|
17
|
+
navPosition: "top",
|
|
18
|
+
noCountryFlags: false,
|
|
19
|
+
dynamicWidth: false
|
|
20
|
+
};
|
|
21
|
+
const PICKER_DOM_ID = "emoji-picker";
|
|
22
|
+
const LOCALE_MAP = {
|
|
23
|
+
"zh-CN": "zh",
|
|
24
|
+
"en-US": "en"
|
|
25
|
+
};
|
|
26
|
+
class EmojiModule {
|
|
27
|
+
constructor(quill, options = {}) {
|
|
28
|
+
__publicField(this, "quill");
|
|
29
|
+
__publicField(this, "options");
|
|
30
|
+
__publicField(this, "picker", null);
|
|
31
|
+
__publicField(this, "isPickerVisible", false);
|
|
32
|
+
__publicField(this, "cleanupResizeObserver", null);
|
|
33
|
+
this.quill = quill;
|
|
34
|
+
this.options = options;
|
|
35
|
+
const toolbar = this.quill.getModule("toolbar");
|
|
36
|
+
if (toolbar) {
|
|
37
|
+
toolbar.addHandler("emoji", () => {
|
|
38
|
+
if (this.isPickerVisible) {
|
|
39
|
+
this.closeDialog();
|
|
40
|
+
} else {
|
|
41
|
+
this.openDialog();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
getEmojiButton() {
|
|
47
|
+
return document.querySelector(".ql-emoji");
|
|
48
|
+
}
|
|
49
|
+
async updatePickerPosition() {
|
|
50
|
+
const button = this.getEmojiButton();
|
|
51
|
+
const pickerElement = document.getElementById(PICKER_DOM_ID);
|
|
52
|
+
if (!button || !this.picker || !pickerElement) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const { x, y } = await computePosition(button, pickerElement);
|
|
57
|
+
this.picker.style.top = `${y}px`;
|
|
58
|
+
this.picker.style.left = `${x}px`;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.warn("Failed to compute picker position:", error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// 监听容器大小变化,更新表情选择弹窗位置
|
|
64
|
+
setupContainerResizeObserver() {
|
|
65
|
+
const container = this.quill.root.parentElement;
|
|
66
|
+
if (!container) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const debouncedUpdate = debounce(() => {
|
|
70
|
+
this.updatePickerPosition();
|
|
71
|
+
}, 100);
|
|
72
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
73
|
+
debouncedUpdate();
|
|
74
|
+
});
|
|
75
|
+
resizeObserver.observe(container);
|
|
76
|
+
return () => {
|
|
77
|
+
resizeObserver.disconnect();
|
|
78
|
+
debouncedUpdate.cancel();
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// 创建表情选择弹窗
|
|
82
|
+
createPicker() {
|
|
83
|
+
const pickerConfig = {
|
|
84
|
+
...DEFAULT_OPTIONS,
|
|
85
|
+
// emoji-mart 与 tiny-editor 国际化的的 locale 不一致使用 LOCALE_MAP 转换
|
|
86
|
+
locale: LOCALE_MAP[this.quill.lang] ?? "en",
|
|
87
|
+
...this.options,
|
|
88
|
+
data,
|
|
89
|
+
onEmojiSelect: this.handleEmojiSelect.bind(this),
|
|
90
|
+
onClickOutside: this.handleClickOutside.bind(this)
|
|
91
|
+
};
|
|
92
|
+
const picker = new $efa000751917694d$export$2e2bcd8739ae039(pickerConfig);
|
|
93
|
+
picker.id = PICKER_DOM_ID;
|
|
94
|
+
picker.style.position = "absolute";
|
|
95
|
+
picker.style.zIndex = "1000";
|
|
96
|
+
return picker;
|
|
97
|
+
}
|
|
98
|
+
// 打开表情弹窗
|
|
99
|
+
openDialog() {
|
|
100
|
+
if (this.picker) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
this.picker = this.createPicker();
|
|
105
|
+
document.body.appendChild(this.picker);
|
|
106
|
+
this.updatePickerPosition();
|
|
107
|
+
this.cleanupResizeObserver = this.setupContainerResizeObserver();
|
|
108
|
+
this.isPickerVisible = true;
|
|
109
|
+
} catch (error) {
|
|
110
|
+
console.error("Failed to open emoji picker:", error);
|
|
111
|
+
this.closeDialog();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// 关闭表情弹窗
|
|
115
|
+
closeDialog() {
|
|
116
|
+
var _a;
|
|
117
|
+
if (!this.picker) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
this.isPickerVisible = false;
|
|
121
|
+
this.picker.remove();
|
|
122
|
+
this.picker = null;
|
|
123
|
+
(_a = this.cleanupResizeObserver) == null ? void 0 : _a.call(this);
|
|
124
|
+
this.cleanupResizeObserver = null;
|
|
125
|
+
}
|
|
126
|
+
// 处理表情选择事件
|
|
127
|
+
handleEmojiSelect(emoji) {
|
|
128
|
+
const selection = this.quill.getSelection(true);
|
|
129
|
+
if (!selection) {
|
|
130
|
+
console.warn("No selection available for emoji insertion");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
const emojiDelta = this.quill.insertText(selection.index, emoji.native, "user");
|
|
135
|
+
this.closeDialog();
|
|
136
|
+
this.setSelectionAfterEmoji(emojiDelta);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error("Failed to insert emoji:", error);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
// 设置表情插入后的光标位置
|
|
142
|
+
setSelectionAfterEmoji(emojiDelta) {
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
try {
|
|
145
|
+
const newSelection = this.quill.getSelection(true);
|
|
146
|
+
if (newSelection && emojiDelta) {
|
|
147
|
+
this.quill.setSelection(newSelection.index + emojiDelta.length());
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
console.warn("Failed to set selection after emoji insertion:", error);
|
|
151
|
+
}
|
|
152
|
+
}, 0);
|
|
153
|
+
}
|
|
154
|
+
// 处理外部点击事件
|
|
155
|
+
handleClickOutside(event) {
|
|
156
|
+
const button = this.getEmojiButton();
|
|
157
|
+
const target = event.target;
|
|
158
|
+
const isClickOnButton = target === button || target instanceof Element && (button == null ? void 0 : button.contains(target));
|
|
159
|
+
if (isClickOnButton) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.closeDialog();
|
|
163
|
+
}
|
|
164
|
+
// 销毁模块,清理资源
|
|
165
|
+
destroy() {
|
|
166
|
+
var _a;
|
|
167
|
+
(_a = this.cleanupResizeObserver) == null ? void 0 : _a.call(this);
|
|
168
|
+
this.cleanupResizeObserver = null;
|
|
169
|
+
this.closeDialog();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
export {
|
|
173
|
+
EmojiModule
|
|
174
|
+
};
|
|
175
|
+
//# sourceMappingURL=emoji.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emoji.es.js","sources":["../../../src/modules/emoji.ts"],"sourcesContent":["import type { Delta } from 'quill'\r\nimport type TypeToolbar from 'quill/modules/toolbar'\r\nimport type FluentEditor from '../fluent-editor'\r\nimport data from '@emoji-mart/data'\r\nimport { computePosition } from '@floating-ui/dom'\r\nimport { Picker } from 'emoji-mart'\r\nimport { debounce } from 'lodash-es'\r\n\r\nexport interface EmojiModuleOptions {\r\n theme?: string\r\n locale?: string\r\n set?: string\r\n skinTonePosition?: string\r\n previewPosition?: string\r\n searchPosition?: string\r\n categories?: string[]\r\n maxFrequentRows?: number\r\n perLine?: number\r\n navPosition?: string\r\n noCountryFlags?: boolean\r\n dynamicWidth?: boolean\r\n}\r\n\r\nconst DEFAULT_OPTIONS: Readonly<EmojiModuleOptions> = {\r\n theme: 'light',\r\n set: 'native',\r\n skinTonePosition: 'none',\r\n previewPosition: 'bottom',\r\n searchPosition: 'sticky',\r\n categories: ['frequent', 'people', 'nature', 'foods', 'activity', 'places', 'objects', 'symbols', 'flags'],\r\n maxFrequentRows: 2,\r\n perLine: 8,\r\n navPosition: 'top',\r\n noCountryFlags: false,\r\n dynamicWidth: false,\r\n} as const\r\n\r\nconst PICKER_DOM_ID = 'emoji-picker'\r\n\r\nconst LOCALE_MAP = {\r\n 'zh-CN': 'zh',\r\n 'en-US': 'en',\r\n} as const\r\n\r\nclass EmojiModule {\r\n private readonly quill: FluentEditor\r\n private readonly options: EmojiModuleOptions\r\n private picker: HTMLElement | null = null\r\n private isPickerVisible = false\r\n private cleanupResizeObserver: (() => void) | null = null\r\n\r\n constructor(quill: FluentEditor, options: EmojiModuleOptions = {}) {\r\n this.quill = quill\r\n\r\n this.options = options\r\n\r\n const toolbar = this.quill.getModule('toolbar') as TypeToolbar\r\n\r\n if (toolbar) {\r\n toolbar.addHandler('emoji', () => {\r\n if (this.isPickerVisible) {\r\n this.closeDialog()\r\n }\r\n else {\r\n this.openDialog()\r\n }\r\n })\r\n }\r\n }\r\n\r\n private getEmojiButton() {\r\n return document.querySelector('.ql-emoji') as HTMLElement | null\r\n }\r\n\r\n private async updatePickerPosition() {\r\n const button = this.getEmojiButton()\r\n const pickerElement = document.getElementById(PICKER_DOM_ID)\r\n\r\n if (!button || !this.picker || !pickerElement) {\r\n return\r\n }\r\n\r\n try {\r\n const { x, y } = await computePosition(button, pickerElement)\r\n this.picker.style.top = `${y}px`\r\n this.picker.style.left = `${x}px`\r\n }\r\n catch (error) {\r\n console.warn('Failed to compute picker position:', error)\r\n }\r\n }\r\n\r\n // 监听容器大小变化,更新表情选择弹窗位置\r\n private setupContainerResizeObserver() {\r\n const container = this.quill.root.parentElement\r\n if (!container) {\r\n return null\r\n }\r\n\r\n const debouncedUpdate = debounce(() => {\r\n this.updatePickerPosition()\r\n }, 100)\r\n\r\n const resizeObserver = new ResizeObserver(() => {\r\n debouncedUpdate()\r\n })\r\n\r\n resizeObserver.observe(container)\r\n\r\n return () => {\r\n resizeObserver.disconnect()\r\n debouncedUpdate.cancel()\r\n }\r\n }\r\n\r\n // 创建表情选择弹窗\r\n private createPicker() {\r\n const pickerConfig = {\r\n ...DEFAULT_OPTIONS,\r\n // emoji-mart 与 tiny-editor 国际化的的 locale 不一致使用 LOCALE_MAP 转换\r\n locale: LOCALE_MAP[this.quill.lang] ?? 'en',\r\n ...this.options,\r\n data,\r\n onEmojiSelect: this.handleEmojiSelect.bind(this),\r\n onClickOutside: this.handleClickOutside.bind(this),\r\n }\r\n\r\n const picker = new Picker(pickerConfig) as unknown as HTMLElement\r\n\r\n // 设置样式和属性\r\n picker.id = PICKER_DOM_ID\r\n picker.style.position = 'absolute'\r\n picker.style.zIndex = '1000'\r\n\r\n return picker\r\n }\r\n\r\n // 打开表情弹窗\r\n public openDialog() {\r\n if (this.picker) {\r\n return\r\n }\r\n\r\n try {\r\n this.picker = this.createPicker()\r\n document.body.appendChild(this.picker)\r\n\r\n this.updatePickerPosition()\r\n this.cleanupResizeObserver = this.setupContainerResizeObserver()\r\n this.isPickerVisible = true\r\n }\r\n catch (error) {\r\n console.error('Failed to open emoji picker:', error)\r\n this.closeDialog()\r\n }\r\n }\r\n\r\n // 关闭表情弹窗\r\n public closeDialog() {\r\n if (!this.picker) {\r\n return\r\n }\r\n\r\n this.isPickerVisible = false\r\n this.picker.remove()\r\n this.picker = null\r\n\r\n this.cleanupResizeObserver?.()\r\n this.cleanupResizeObserver = null\r\n }\r\n\r\n // 处理表情选择事件\r\n private handleEmojiSelect(emoji: { native: string }) {\r\n const selection = this.quill.getSelection(true)\r\n if (!selection) {\r\n console.warn('No selection available for emoji insertion')\r\n return\r\n }\r\n\r\n try {\r\n const emojiDelta = this.quill.insertText(selection.index, emoji.native, 'user')\r\n\r\n this.closeDialog()\r\n\r\n // 异步设置光标位置,确保插入完成后再设置\r\n this.setSelectionAfterEmoji(emojiDelta)\r\n }\r\n catch (error) {\r\n console.error('Failed to insert emoji:', error)\r\n }\r\n }\r\n\r\n // 设置表情插入后的光标位置\r\n private setSelectionAfterEmoji(emojiDelta: Delta) {\r\n setTimeout(() => {\r\n try {\r\n const newSelection = this.quill.getSelection(true)\r\n if (newSelection && emojiDelta) {\r\n this.quill.setSelection(newSelection.index + emojiDelta.length())\r\n }\r\n }\r\n catch (error) {\r\n console.warn('Failed to set selection after emoji insertion:', error)\r\n }\r\n }, 0)\r\n }\r\n\r\n // 处理外部点击事件\r\n private handleClickOutside(event: MouseEvent) {\r\n const button = this.getEmojiButton()\r\n\r\n const target = event.target\r\n\r\n const isClickOnButton = target === button || (target instanceof Element && button?.contains(target))\r\n\r\n // 如果点击的是表情符号按钮或其子元素,则不关闭选择器\r\n if (isClickOnButton) {\r\n return\r\n }\r\n\r\n this.closeDialog()\r\n }\r\n\r\n // 销毁模块,清理资源\r\n public destroy() {\r\n this.cleanupResizeObserver?.()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BAAkB;AACvB,SAAK,OAAO,OAAO;AACnB,SAAK,SAAS;AAEd,eAAK,0BAAL;AACA,SAAK,wBAAwB;AAAA,EAAA;AAAA;AAAA,EAIvB,kBAAkB,OAA2B;AACnD,UAAM,YAAY,KAAK,MAAM,aAAa,IAAI;AAC9C,QAAI,CAAC,WAAW;AACd,cAAQ,KAAK,4CAA4C;AACzD;AAAA,IAAA;AAGE,QAAA;AACI,YAAA,aAAa,KAAK,MAAM,WAAW,UAAU,OAAO,MAAM,QAAQ,MAAM;AAE9E,WAAK,YAAY;AAGjB,WAAK,uBAAuB,UAAU;AAAA,aAEjC,OAAO;AACJ,cAAA,MAAM,2BAA2B,KAAK;AAAA,IAAA;AAAA,EAChD;AAAA;AAAA,EAIM,uBAAuB,YAAmB;AAChD,eAAW,MAAM;AACX,UAAA;AACF,cAAM,eAAe,KAAK,MAAM,aAAa,IAAI;AACjD,YAAI,gBAAgB,YAAY;AAC9B,eAAK,MAAM,aAAa,aAAa,QAAQ,WAAW,QAAQ;AAAA,QAAA;AAAA,eAG7D,OAAO;AACJ,gBAAA,KAAK,kDAAkD,KAAK;AAAA,MAAA;AAAA,OAErE,CAAC;AAAA,EAAA;AAAA;AAAA,EAIE,mBAAmB,OAAmB;AACtC,UAAA,SAAS,KAAK,eAAe;AAEnC,UAAM,SAAS,MAAM;AAErB,UAAM,kBAAkB,WAAW,UAAW,kBAAkB,YAAW,iCAAQ,SAAS;AAG5F,QAAI,iBAAiB;AACnB;AAAA,IAAA;AAGF,SAAK,YAAY;AAAA,EAAA;AAAA;AAAA,EAIZ,UAAU;;AACf,eAAK,0BAAL;AACA,SAAK,wBAAwB;AAC7B,SAAK,YAAY;AAAA,EAAA;AAErB;"}
|
|
@@ -1,8 +1,11 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import Quill from "quill";
|
|
2
5
|
import { sanitize } from "../../../config/editor.utils.es.js";
|
|
3
6
|
const Embed = Quill.import("blots/embed");
|
|
4
7
|
const FILE_ATTRIBUTES = ["id", "title", "size", "lastModified"];
|
|
5
|
-
|
|
8
|
+
class File extends Embed {
|
|
6
9
|
static create(value) {
|
|
7
10
|
const node = super.create(value);
|
|
8
11
|
const size = value.size / 1024;
|
|
@@ -42,13 +45,12 @@ const _File = class _File extends Embed {
|
|
|
42
45
|
static sanitize(url) {
|
|
43
46
|
return sanitize(url, this.PROTOCOL_WHITELIST) && url || "";
|
|
44
47
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
let File = _File;
|
|
48
|
+
}
|
|
49
|
+
__publicField(File, "blotName", "file");
|
|
50
|
+
__publicField(File, "tagName", "A");
|
|
51
|
+
__publicField(File, "className", "ql-file-item");
|
|
52
|
+
__publicField(File, "PROTOCOL_WHITELIST", ["http", "https", "blob"]);
|
|
51
53
|
export {
|
|
52
|
-
File
|
|
54
|
+
File
|
|
53
55
|
};
|
|
54
56
|
//# sourceMappingURL=file.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.es.js","sources":["../../../../../src/modules/file/formats/file.ts"],"sourcesContent":["import type TypeEmbed from 'quill/blots/embed'\r\nimport Quill from 'quill'\r\nimport { sanitize } from '../../../config/editor.utils'\r\n\r\nconst Embed = Quill.import('blots/embed') as typeof TypeEmbed\r\nconst FILE_ATTRIBUTES = ['id', 'title', 'size', 'lastModified']\r\n\r\nexport interface FileValue {\r\n size: number\r\n src: string\r\n title: string\r\n}\r\
|
|
1
|
+
{"version":3,"file":"file.es.js","sources":["../../../../../src/modules/file/formats/file.ts"],"sourcesContent":["import type TypeEmbed from 'quill/blots/embed'\r\nimport Quill from 'quill'\r\nimport { sanitize } from '../../../config/editor.utils'\r\n\r\nconst Embed = Quill.import('blots/embed') as typeof TypeEmbed\r\nconst FILE_ATTRIBUTES = ['id', 'title', 'size', 'lastModified']\r\n\r\nexport interface FileValue {\r\n size: number\r\n src: string\r\n title: string\r\n}\r\nexport class File extends Embed {\r\n static blotName = 'file'\r\n static tagName = 'A'\r\n static className = 'ql-file-item'\r\n static PROTOCOL_WHITELIST = ['http', 'https', 'blob']\r\n\r\n static create(value: FileValue) {\r\n const node = super.create(value) as HTMLAnchorElement\r\n const size = value.size / 1024\r\n const fixSize = !size ? 0 : size < 1 ? 1 : size.toFixed(0)\r\n node.classList.add('icon-file')\r\n node.setAttribute('contenteditable', 'false')\r\n const fileSvg = '<svg viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\"><path d=\"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326z m1.8 562H232V136h302v216c0 23.2 18.8 42 42 42h216v494z\" p-id=\"2307\"></path></svg>'\r\n node.innerHTML = `${fileSvg} ${value.title} (${fixSize} KB)`\r\n const src = this.sanitize(value.src)\r\n if (src) {\r\n node.href = src\r\n node.target = '_blank'\r\n }\r\n FILE_ATTRIBUTES.forEach((key) => {\r\n if (value[key]) {\r\n node.dataset[key] = value[key]\r\n }\r\n })\r\n return node\r\n }\r\n\r\n static value(domNode: HTMLAnchorElement) {\r\n return this.getFormats(domNode)\r\n }\r\n\r\n static getFormats(domNode: HTMLAnchorElement) {\r\n const formats: Record<string, string> = {}\r\n const href = this.sanitize(domNode.href)\r\n if (href) {\r\n formats.src = href\r\n }\r\n FILE_ATTRIBUTES.forEach((key) => {\r\n if (domNode.dataset[key]) {\r\n formats[key] = domNode.dataset[key]\r\n }\r\n })\r\n return formats\r\n }\r\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Q,SAAS,KAAK,KAAK,kBAAkB,KAAK,OAAQ;AAAA,EAAA;AAE9D;AA/CE,cADW,MACJ,YAAW;AAClB,cAFW,MAEJ,WAAU;AACjB,cAHW,MAGJ,aAAY;AACnB,cAJW,MAIJ,sBAAqB,CAAC,QAAQ,SAAS,MAAM;"}
|
|
@@ -1,31 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
class FileModule {
|
|
5
|
-
constructor(quill) {
|
|
6
|
-
this.quill = quill;
|
|
7
|
-
this.quill = quill;
|
|
8
|
-
quill.root.addEventListener("click", (event) => this.clickEvent(event), false);
|
|
9
|
-
}
|
|
10
|
-
static register() {
|
|
11
|
-
Quill.register("formats/file", File, true);
|
|
12
|
-
}
|
|
13
|
-
clickEvent(event) {
|
|
14
|
-
event.preventDefault();
|
|
15
|
-
const target = event.target;
|
|
16
|
-
const fileDom = target.closest("a.ql-file-item");
|
|
17
|
-
if (fileDom) {
|
|
18
|
-
if (this.fileBar) {
|
|
19
|
-
this.fileBar.destroy();
|
|
20
|
-
}
|
|
21
|
-
this.fileBar = new FileBar(this.quill, fileDom);
|
|
22
|
-
} else if (this.fileBar && !target.closest(".ql-file-bar")) {
|
|
23
|
-
this.fileBar.destroy();
|
|
24
|
-
this.fileBar = null;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
import { File } from "./formats/file.es.js";
|
|
2
|
+
import { FileBar } from "./modules/file-bar.es.js";
|
|
3
|
+
import { FileModule } from "./modules/file-module.es.js";
|
|
28
4
|
export {
|
|
29
|
-
|
|
5
|
+
File,
|
|
6
|
+
FileBar,
|
|
7
|
+
FileModule
|
|
30
8
|
};
|
|
31
9
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -1,10 +1,18 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import Quill from "quill";
|
|
2
5
|
import { Range } from "quill/core/selection";
|
|
3
6
|
import { unshiftString } from "../../../utils/method.es.js";
|
|
4
|
-
import File from "../formats/file.es.js";
|
|
5
|
-
const Delta = Quill.
|
|
7
|
+
import { File } from "../formats/file.es.js";
|
|
8
|
+
const Delta = Quill.import("delta");
|
|
6
9
|
class FileBar {
|
|
7
10
|
constructor(quill, target) {
|
|
11
|
+
__publicField(this, "quill");
|
|
12
|
+
__publicField(this, "file");
|
|
13
|
+
__publicField(this, "domNode");
|
|
14
|
+
__publicField(this, "fileRange");
|
|
15
|
+
__publicField(this, "template");
|
|
8
16
|
this.quill = quill;
|
|
9
17
|
this.file = target;
|
|
10
18
|
const fileBlot = Quill.find(target);
|
|
@@ -120,6 +128,6 @@ class FileBar {
|
|
|
120
128
|
}
|
|
121
129
|
}
|
|
122
130
|
export {
|
|
123
|
-
FileBar
|
|
131
|
+
FileBar
|
|
124
132
|
};
|
|
125
133
|
//# sourceMappingURL=file-bar.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-bar.es.js","sources":["../../../../../src/modules/file/modules/file-bar.ts"],"sourcesContent":["import Quill from 'quill'\r\nimport { Range } from 'quill/core/selection'\r\nimport { unshiftString } from '../../../utils/method'\r\nimport File from '../formats/file'\r\n\r\nconst Delta = Quill.
|
|
1
|
+
{"version":3,"file":"file-bar.es.js","sources":["../../../../../src/modules/file/modules/file-bar.ts"],"sourcesContent":["import Quill from 'quill'\r\nimport { Range } from 'quill/core/selection'\r\nimport { unshiftString } from '../../../utils/method'\r\nimport { File } from '../formats/file'\r\n\r\nconst Delta = Quill.import('delta')\r\n\r\nexport class FileBar {\r\n quill: any\r\n file: any\r\n domNode: HTMLElement\r\n fileRange: any\r\n template: string\r\n\r\n constructor(quill, target) {\r\n this.quill = quill\r\n this.file = target\r\n const fileBlot = Quill.find(target)\r\n const index = this.quill.getIndex(fileBlot)\r\n const [fileItem, offset] = this.quill.scroll.descendant(File, index)\r\n const length = fileItem && fileItem.length()\r\n this.fileRange = new Range(index - offset, length)\r\n\r\n const timestamp = Number(this.file.dataset.lastModified)\r\n const _lastModifiedDate = this.formatDate(timestamp)\r\n this.template = [\r\n // `<a class=\"ql-last-modified-date\" href=\"${this.file.href}\" target=\"_blank\">${this.file.href}</a>`,\r\n // '<span class=\"ql-split\"></span>',\r\n // `<a class=\"ql-file-preview\"><i class=\"icon-preview\"></i></a>`,\r\n `<a class=\"ql-file-download\"><i class=\"icon-download\"></i></a>`,\r\n '<a class=\"ql-file-delete\"><i class=\"icon-delete\"></i></a>',\r\n ].join('')\r\n\r\n this.createFileBar()\r\n }\r\n\r\n createFileBar() {\r\n this.domNode = document.createElement('div')\r\n this.domNode.className = 'ql-file-bar'\r\n this.domNode.innerHTML = this.template\r\n // 查看文件\r\n const filePreview = this.domNode.querySelector('a.ql-file-preview')\r\n if (filePreview) {\r\n filePreview.addEventListener('click', (event) => {\r\n this.operateFile(event, 'view')\r\n })\r\n }\r\n // 下载文件\r\n const fileDownload = this.domNode.querySelector('a.ql-file-download')\r\n if (fileDownload) {\r\n fileDownload.addEventListener('click', (event) => {\r\n this.operateFile(event, 'download')\r\n })\r\n }\r\n // 删除文件\r\n const fileDelete = this.domNode.querySelector('a.ql-file-delete')\r\n if (fileDelete) {\r\n fileDelete.addEventListener('click', (event) => {\r\n this.operateFile(event, 'delete')\r\n const delta = new Delta()\r\n .retain(this.fileRange.index)\r\n .delete(this.fileRange.length)\r\n this.quill.updateContents(delta, Quill.sources.USER)\r\n this.quill.setSelection(this.fileRange.index)\r\n })\r\n }\r\n\r\n this.setPosition()\r\n this.quill.root.parentNode.appendChild(this.domNode)\r\n }\r\n\r\n destroy() {\r\n if (this.domNode) {\r\n this.domNode.remove()\r\n this.domNode = null\r\n this.file = null\r\n }\r\n }\r\n\r\n operateFile(event, operate) {\r\n event.preventDefault()\r\n const fileId = this.file.dataset.id || ''\r\n const fileName = this.file.dataset.title || ''\r\n const fileDownloadUrl = this.file.href || ''\r\n if (fileId) {\r\n this.quill.emitter.emit('file-change', {\r\n operation: operate,\r\n data: { fileId, fileDownloadUrl },\r\n })\r\n }\r\n if (operate === 'download') {\r\n const a = document.createElement('a')\r\n a.href = fileDownloadUrl\r\n a.target = '_blank'\r\n a.id = 'exppub'\r\n a.download = fileName\r\n document.body.appendChild(a)\r\n const alink = document.getElementById('exppub')\r\n alink.click()\r\n alink.parentNode.removeChild(a)\r\n }\r\n this.destroy()\r\n }\r\n\r\n setPosition() {\r\n if (this.domNode && this.file) {\r\n const parent = this.quill.root.parentNode\r\n const child = this.file.querySelector('span')\r\n const containerRect = parent.getBoundingClientRect()\r\n const fileRect = child.getBoundingClientRect()\r\n this.css(this.domNode, {\r\n left: `${fileRect.left - containerRect.left}px`,\r\n top: `${fileRect.top - containerRect.top + 10}px`,\r\n })\r\n }\r\n }\r\n\r\n css(domNode, rules) {\r\n if (typeof rules === 'object') {\r\n for (const prop in rules) {\r\n if (prop) {\r\n if (Array.isArray(rules[prop])) {\r\n // 兼容IE11浏览器\r\n rules[prop].forEach((val) => {\r\n domNode.style[prop] = val\r\n })\r\n }\r\n else {\r\n domNode.style[prop] = rules[prop]\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n formatDate(timestamp) {\r\n const date = new Date(timestamp)\r\n const year = date.getFullYear()\r\n // TODO\r\n const month = unshiftString(`${date.getMonth() + 1}`, 2, '0')\r\n const day = unshiftString(`${date.getDate()}`, 2, '0')\r\n const hour = unshiftString(`${date.getHours()}`, 2, '0')\r\n const minute = unshiftString(`${date.getMinutes()}`, 2, '0')\r\n return Number.isNaN(year) ? '--' : `${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BAAsB;AACxC,WAAA,IAAI,KAAK,SAAS;AAAA,QACrB,MAAM,GAAG,SAAS,OAAO,cAAc,IAAI;AAAA,QAC3C,KAAK,GAAG,SAAS,MAAM,cAAc,MAAM,EAAE;AAAA,MAAA,CAC9C;AAAA,IAAA;AAAA,EACH;AAAA,EAGF,IAAI,SAAS,OAAO;AACd,QAAA,OAAO,UAAU,UAAU;AAC7B,iBAAW,QAAQ,OAAO;AACxB,YAAI,MAAM;AACR,cAAI,MAAM,QAAQ,MAAM,IAAI,CAAC,GAAG;AAE9B,kBAAM,IAAI,EAAE,QAAQ,CAAC,QAAQ;AACnB,sBAAA,MAAM,IAAI,IAAI;AAAA,YAAA,CACvB;AAAA,UAAA,OAEE;AACH,oBAAQ,MAAM,IAAI,IAAI,MAAM,IAAI;AAAA,UAAA;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAGF,WAAW,WAAW;AACd,UAAA,OAAO,IAAI,KAAK,SAAS;AACzB,UAAA,OAAO,KAAK,YAAY;AAExB,UAAA,QAAQ,cAAc,GAAG,KAAK,SAAa,IAAA,CAAC,IAAI,GAAG,GAAG;AACtD,UAAA,MAAM,cAAc,GAAG,KAAK,SAAS,IAAI,GAAG,GAAG;AAC/C,UAAA,OAAO,cAAc,GAAG,KAAK,UAAU,IAAI,GAAG,GAAG;AACjD,UAAA,SAAS,cAAc,GAAG,KAAK,YAAY,IAAI,GAAG,GAAG;AAC3D,WAAO,OAAO,MAAM,IAAI,IAAI,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,IAAI,IAAI,IAAI,MAAM;AAAA,EAAA;AAEhF;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
import Quill from "quill";
|
|
5
|
+
import { File } from "../formats/file.es.js";
|
|
6
|
+
import { FileBar } from "./file-bar.es.js";
|
|
7
|
+
class FileModule {
|
|
8
|
+
constructor(quill) {
|
|
9
|
+
__publicField(this, "fileBar");
|
|
10
|
+
this.quill = quill;
|
|
11
|
+
this.quill = quill;
|
|
12
|
+
quill.root.addEventListener("click", (event) => this.clickEvent(event), false);
|
|
13
|
+
}
|
|
14
|
+
static register() {
|
|
15
|
+
Quill.register("formats/file", File, true);
|
|
16
|
+
}
|
|
17
|
+
clickEvent(event) {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
const target = event.target;
|
|
20
|
+
const fileDom = target.closest("a.ql-file-item");
|
|
21
|
+
if (fileDom) {
|
|
22
|
+
if (this.fileBar) {
|
|
23
|
+
this.fileBar.destroy();
|
|
24
|
+
}
|
|
25
|
+
this.fileBar = new FileBar(this.quill, fileDom);
|
|
26
|
+
} else if (this.fileBar && !target.closest(".ql-file-bar")) {
|
|
27
|
+
this.fileBar.destroy();
|
|
28
|
+
this.fileBar = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
FileModule
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=file-module.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-module.es.js","sources":["../../../../../src/modules/file/modules/file-module.ts"],"sourcesContent":["import type FluentEditor from '../../../core/fluent-editor'\r\nimport Quill from 'quill'\r\nimport { File } from '../formats/file'\r\nimport { FileBar } from './file-bar'\r\n\r\nexport class FileModule {\r\n fileBar: FileBar\r\n\r\n static register() {\r\n Quill.register('formats/file', File, true)\r\n }\r\n\r\n constructor(public quill: FluentEditor) {\r\n this.quill = quill\r\n quill.root.addEventListener('click', event => this.clickEvent(event), false)\r\n }\r\n\r\n clickEvent(event: MouseEvent) {\r\n event.preventDefault()\r\n const target = event.target as HTMLElement\r\n const fileDom = target.closest('a.ql-file-item')\r\n if (fileDom) {\r\n if (this.fileBar) {\r\n this.fileBar.destroy()\r\n }\r\n this.fileBar = new FileBar(this.quill, fileDom)\r\n }\r\n else if (this.fileBar && !target.closest('.ql-file-bar')) {\r\n this.fileBar.destroy()\r\n this.fileBar = null\r\n }\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;;;AAKO,MAAM,WAAW;AAAA,EAOtB,YAAmB,OAAqB;AANxC;AAMmB,SAAA,QAAA;AACjB,SAAK,QAAQ;AACP,UAAA,KAAK,iBAAiB,SAAS,CAAA,UAAS,KAAK,WAAW,KAAK,GAAG,KAAK;AAAA,EAAA;AAAA,EAN7E,OAAO,WAAW;AACV,UAAA,SAAS,gBAAgB,MAAM,IAAI;AAAA,EAAA;AAAA,EAQ3C,WAAW,OAAmB;AAC5B,UAAM,eAAe;AACrB,UAAM,SAAS,MAAM;AACf,UAAA,UAAU,OAAO,QAAQ,gBAAgB;AAC/C,QAAI,SAAS;AACX,UAAI,KAAK,SAAS;AAChB,aAAK,QAAQ,QAAQ;AAAA,MAAA;AAEvB,WAAK,UAAU,IAAI,QAAQ,KAAK,OAAO,OAAO;AAAA,IAAA,WAEvC,KAAK,WAAW,CAAC,OAAO,QAAQ,cAAc,GAAG;AACxD,WAAK,QAAQ,QAAQ;AACrB,WAAK,UAAU;AAAA,IAAA;AAAA,EACjB;AAEJ;"}
|
package/es/modules/i18n.es.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
4
|
import "../config/index.es.js";
|
|
2
5
|
import { isUndefined } from "../utils/is.es.js";
|
|
3
6
|
import { defaultLanguage, CHANGE_LANGUAGE_EVENT } from "../config/editor.config.es.js";
|
|
4
7
|
const langs = {};
|
|
5
8
|
class I18N {
|
|
6
9
|
constructor(quill, options) {
|
|
7
|
-
this
|
|
8
|
-
this.options = {
|
|
10
|
+
__publicField(this, "options", {
|
|
9
11
|
lang: ""
|
|
10
|
-
};
|
|
12
|
+
});
|
|
13
|
+
this.quill = quill;
|
|
11
14
|
this.options = Object.assign({}, options, this.resolveLanguageOption(options || {}));
|
|
12
15
|
Promise.resolve().then(() => this.changeLanguage(this.options, true));
|
|
13
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.es.js","sources":["../../../src/modules/i18n.ts"],"sourcesContent":["import type FluentEditor from '../fluent-editor'\r\nimport { CHANGE_LANGUAGE_EVENT, defaultLanguage } from '../config'\r\nimport { isUndefined } from '../utils/is'\r\n\r\nconst langs: Record<string, Record<string, string>> = {}\r\n\r\
|
|
1
|
+
{"version":3,"file":"i18n.es.js","sources":["../../../src/modules/i18n.ts"],"sourcesContent":["import type FluentEditor from '../fluent-editor'\r\nimport { CHANGE_LANGUAGE_EVENT, defaultLanguage } from '../config'\r\nimport { isUndefined } from '../utils/is'\r\n\r\nconst langs: Record<string, Record<string, string>> = {}\r\n\r\nexport interface I18NOptions {\r\n lang: string\r\n}\r\nexport class I18N {\r\n static register(inputLangs: Record<string, Record<string, string>>, isCover: boolean = true) {\r\n for (const lang in inputLangs) {\r\n const texts = inputLangs[lang]\r\n if (isCover) {\r\n langs[lang] = texts\r\n }\r\n else {\r\n if (!langs[lang]) langs[lang] = {}\r\n Object.assign(langs[lang], texts)\r\n }\r\n }\r\n }\r\n\r\n static parserText(text: string, lang: string): string {\r\n const i18nPattern = /^_i18n\"([^\"]*)\"/\r\n const match = text.match(i18nPattern)\r\n let key = text\r\n if (match) {\r\n key = match[1]\r\n }\r\n return langs[lang]?.[key] || key\r\n }\r\n\r\n options: I18NOptions = {\r\n lang: '',\r\n }\r\n\r\n constructor(public quill: FluentEditor, options: Partial<I18NOptions>) {\r\n this.options = Object.assign({}, options, this.resolveLanguageOption(options || {}))\r\n // wait until all module registed\r\n Promise.resolve().then(() => this.changeLanguage(this.options, true))\r\n }\r\n\r\n resolveLanguageOption(options: Partial<I18NOptions>): I18NOptions {\r\n if (isUndefined(options.lang)) {\r\n options.lang = defaultLanguage\r\n }\r\n if (!(options.lang in langs)) {\r\n console.warn(`The language ${options.lang} is not supported. Use the default language: ${defaultLanguage}`)\r\n options.lang = defaultLanguage\r\n }\r\n return {\r\n lang: options.lang,\r\n }\r\n }\r\n\r\n changeLanguage(options: Partial<I18NOptions>, force: boolean = false) {\r\n const currentLang = this.options.lang\r\n const langOps = this.resolveLanguageOption(options)\r\n if (langOps.lang === currentLang && !force) return\r\n this.options.lang = langOps.lang\r\n this.quill.emitter.emit(CHANGE_LANGUAGE_EVENT, this.options.lang, langs[langOps.lang])\r\n }\r\n}\r\n\r\nexport default I18N\r\n"],"names":[],"mappings":";;;;;;AAIA,MAAM,QAAgD,CAAC;AAKhD,MAAM,KAAK;AAAA,EA4BhB,YAAmB,OAAqB,SAA+B;AAJvE,mCAAuB;AAAA,MACrB,MAAM;AAAA,IACR;AAEmB,SAAA,QAAA;AACZ,SAAA,UAAU,OAAO,OAAO,CAAC,GAAG,SAAS,KAAK,sBAAsB,WAAW,CAAA,CAAE,CAAC;AAE3E,YAAA,UAAU,KAAK,MAAM,KAAK,eAAe,KAAK,SAAS,IAAI,CAAC;AAAA,EAAA;AAAA,EA9BtE,OAAO,SAAS,YAAoD,UAAmB,MAAM;AAC3F,eAAW,QAAQ,YAAY;AACvB,YAAA,QAAQ,WAAW,IAAI;AAC7B,UAAI,SAAS;AACX,cAAM,IAAI,IAAI;AAAA,MAAA,OAEX;AACH,YAAI,CAAC,MAAM,IAAI,EAAS,OAAA,IAAI,IAAI,CAAC;AACjC,eAAO,OAAO,MAAM,IAAI,GAAG,KAAK;AAAA,MAAA;AAAA,IAClC;AAAA,EACF;AAAA,EAGF,OAAO,WAAW,MAAc,MAAsB;;AACpD,UAAM,cAAc;AACd,UAAA,QAAQ,KAAK,MAAM,WAAW;AACpC,QAAI,MAAM;AACV,QAAI,OAAO;AACT,YAAM,MAAM,CAAC;AAAA,IAAA;AAEf,aAAO,WAAM,IAAI,MAAV,mBAAc,SAAQ;AAAA,EAAA;AAAA,EAa/B,sBAAsB,SAA4C;AAC5D,QAAA,YAAY,QAAQ,IAAI,GAAG;AAC7B,cAAQ,OAAO;AAAA,IAAA;AAEb,QAAA,EAAE,QAAQ,QAAQ,QAAQ;AAC5B,cAAQ,KAAK,gBAAgB,QAAQ,IAAI,gDAAgD,eAAe,EAAE;AAC1G,cAAQ,OAAO;AAAA,IAAA;AAEV,WAAA;AAAA,MACL,MAAM,QAAQ;AAAA,IAChB;AAAA,EAAA;AAAA,EAGF,eAAe,SAA+B,QAAiB,OAAO;AAC9D,UAAA,cAAc,KAAK,QAAQ;AAC3B,UAAA,UAAU,KAAK,sBAAsB,OAAO;AAClD,QAAI,QAAQ,SAAS,eAAe,CAAC,MAAO;AACvC,SAAA,QAAQ,OAAO,QAAQ;AACvB,SAAA,MAAM,QAAQ,KAAK,uBAAuB,KAAK,QAAQ,MAAM,MAAM,QAAQ,IAAI,CAAC;AAAA,EAAA;AAEzF;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "./counter.es.js";
|
|
2
|
+
import { CustomClipboard } from "./custom-clipboard.es.js";
|
|
3
|
+
import "./custom-image/index.es.js";
|
|
4
|
+
import { FileUploader } from "./custom-uploader.es.js";
|
|
5
|
+
import { DividerBlot } from "./divider.es.js";
|
|
6
|
+
import { EmojiModule } from "./emoji.es.js";
|
|
7
|
+
import "./file/index.es.js";
|
|
8
|
+
import { I18N } from "./i18n.es.js";
|
|
9
|
+
import "./link/index.es.js";
|
|
10
|
+
import "./mathlive/index.es.js";
|
|
11
|
+
import "./mention/index.es.js";
|
|
12
|
+
import { ShortCutKey, shortKey } from "./shortcut-key/index.es.js";
|
|
13
|
+
import "./syntax.es.js";
|
|
14
|
+
import { generateTableUp } from "./table-up/index.es.js";
|
|
15
|
+
import "./toolbar/index.es.js";
|
|
16
|
+
export {
|
|
17
|
+
CustomClipboard,
|
|
18
|
+
DividerBlot,
|
|
19
|
+
EmojiModule,
|
|
20
|
+
FileUploader,
|
|
21
|
+
I18N,
|
|
22
|
+
ShortCutKey,
|
|
23
|
+
generateTableUp,
|
|
24
|
+
shortKey
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|