@uzum-tech/ui 2.3.8 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +63601 -32546
- package/dist/index.mjs +64856 -33810
- package/dist/index.prod.js +3 -3
- package/dist/index.prod.mjs +3 -3
- package/es/_internal/icons/Bold.d.ts +2 -0
- package/es/_internal/icons/Bold.mjs +29 -0
- package/es/_internal/icons/BulletList.d.ts +2 -0
- package/es/_internal/icons/BulletList.mjs +23 -0
- package/es/_internal/icons/HorizontalRule.d.ts +2 -0
- package/es/_internal/icons/HorizontalRule.mjs +14 -0
- package/es/_internal/icons/Italic.d.ts +2 -0
- package/es/_internal/icons/Italic.mjs +19 -0
- package/es/_internal/icons/NumberedList.d.ts +2 -0
- package/es/_internal/icons/NumberedList.mjs +23 -0
- package/es/_internal/icons/Quote.d.ts +2 -0
- package/es/_internal/icons/Quote.mjs +23 -0
- package/es/_internal/icons/SettingsLine.d.ts +2 -0
- package/es/_internal/icons/SettingsLine.mjs +19 -0
- package/es/_internal/icons/Strikethrough.d.ts +2 -0
- package/es/_internal/icons/Strikethrough.mjs +14 -0
- package/es/_internal/icons/index.d.ts +8 -0
- package/es/_internal/icons/index.mjs +8 -0
- package/es/_styles/markdown/markdown-content.cssr.d.ts +6 -0
- package/es/_styles/markdown/markdown-content.cssr.mjs +22 -0
- package/es/_utils/markdown/index.d.ts +3 -2
- package/es/_utils/markdown/index.mjs +2 -1
- package/es/_utils/markdown/render-markdown.d.ts +2 -1
- package/es/_utils/markdown/render-markdown.mjs +1 -1
- package/es/chat/src/Chat.d.ts +261 -24
- package/es/chat/src/Chat.mjs +2 -0
- package/es/chat/src/ChatMainArea.d.ts +81 -8
- package/es/chat/src/ChatMainArea.mjs +111 -355
- package/es/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.d.ts +9084 -0
- package/es/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.mjs +71 -0
- package/es/chat/src/ChatParts/ChatAttachmentButton/interface.d.ts +2645 -0
- package/es/chat/src/ChatParts/ChatAttachmentButton/interface.mjs +19 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.d.ts +9070 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.mjs +78 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/interface.d.ts +2637 -0
- package/es/chat/src/ChatParts/ChatEditingBlock/interface.mjs +15 -0
- package/es/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.d.ts +89 -0
- package/es/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.mjs +63 -0
- package/es/chat/src/ChatParts/ChatEditorInput/interface.d.ts +42 -0
- package/es/chat/src/ChatParts/ChatEditorInput/interface.mjs +34 -0
- package/es/chat/src/ChatParts/ChatFooter/ChatFooter.d.ts +115 -0
- package/es/chat/src/ChatParts/ChatFooter/ChatFooter.mjs +99 -0
- package/es/chat/src/ChatParts/ChatFooter/interface.d.ts +56 -0
- package/es/chat/src/ChatParts/ChatFooter/interface.mjs +46 -0
- package/es/chat/src/ChatParts/ChatHeader/ChatHeader.d.ts +9205 -0
- package/es/chat/src/ChatParts/ChatHeader/ChatHeader.mjs +219 -0
- package/es/chat/src/ChatParts/ChatHeader/interface.d.ts +2694 -0
- package/es/chat/src/ChatParts/ChatHeader/interface.mjs +67 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.d.ts +9142 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.mjs +129 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/interface.d.ts +2654 -0
- package/es/chat/src/ChatParts/ChatLegacyInput/interface.mjs +27 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.d.ts +148 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.mjs +92 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/interface.d.ts +72 -0
- package/es/chat/src/ChatParts/ChatMessagesArea/interface.mjs +58 -0
- package/es/chat/src/interface.d.ts +7 -0
- package/es/chat/src/interface.mjs +4 -0
- package/es/chat/styles/light.d.ts +4 -0
- package/es/chat/styles/light.mjs +18 -0
- package/es/components.d.ts +12933 -32
- package/es/components.mjs +5 -0
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/data-table/index.d.ts +1 -1
- package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +156 -0
- package/es/data-table/src/ColumnSettings/ColumnSettingsDrawer.mjs +220 -0
- package/es/data-table/src/ColumnSettings/styles.cssr.d.ts +2 -0
- package/es/data-table/src/ColumnSettings/styles.cssr.mjs +25 -0
- package/es/data-table/src/DataTable.d.ts +60 -2
- package/es/data-table/src/DataTable.mjs +99 -23
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +14 -0
- package/es/data-table/src/interface.d.ts +53 -1
- package/es/data-table/src/interface.mjs +18 -1
- package/es/data-table/src/styles/index.cssr.mjs +17 -1
- package/es/data-table/src/use-column-settings.d.ts +2 -0
- package/es/data-table/src/use-column-settings.mjs +124 -0
- package/es/data-table/src/utils/column-utils.d.ts +2 -1
- package/es/data-table/src/utils/column-utils.mjs +6 -0
- package/es/editor/index.d.ts +10 -0
- package/es/editor/index.mjs +5 -0
- package/es/editor/src/Editor.d.ts +3896 -0
- package/es/editor/src/Editor.mjs +220 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.d.ts +37 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.mjs +63 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/interface.d.ts +21 -0
- package/es/editor/src/EditorParts/BlockTypeSelect/interface.mjs +14 -0
- package/es/editor/src/EditorParts/EditorContent/EditorContent.d.ts +4078 -0
- package/es/editor/src/EditorParts/EditorContent/EditorContent.mjs +154 -0
- package/es/editor/src/EditorParts/EditorContent/index.d.ts +2 -0
- package/es/editor/src/EditorParts/EditorContent/index.mjs +2 -0
- package/es/editor/src/EditorParts/EditorContent/interface.d.ts +1906 -0
- package/es/editor/src/EditorParts/EditorContent/interface.mjs +17 -0
- package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +4582 -0
- package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.mjs +170 -0
- package/es/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.d.ts +11 -0
- package/es/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.mjs +54 -0
- package/es/editor/src/EditorParts/EditorToolbar/index.d.ts +2 -0
- package/es/editor/src/EditorParts/EditorToolbar/index.mjs +2 -0
- package/es/editor/src/EditorParts/EditorToolbar/interface.d.ts +1912 -0
- package/es/editor/src/EditorParts/EditorToolbar/interface.mjs +18 -0
- package/es/editor/src/EditorParts/SendButton/SendButton.d.ts +23 -0
- package/es/editor/src/EditorParts/SendButton/SendButton.mjs +42 -0
- package/es/editor/src/EditorParts/SendButton/interface.d.ts +18 -0
- package/es/editor/src/EditorParts/SendButton/interface.mjs +8 -0
- package/es/editor/src/EditorParts/ToolbarButton/ToolbarButton.d.ts +32 -0
- package/es/editor/src/EditorParts/ToolbarButton/ToolbarButton.mjs +44 -0
- package/es/editor/src/EditorParts/ToolbarButton/interface.d.ts +20 -0
- package/es/editor/src/EditorParts/ToolbarButton/interface.mjs +13 -0
- package/es/editor/src/composables/use-editor-commands.d.ts +8 -0
- package/es/editor/src/composables/use-editor-commands.mjs +69 -0
- package/es/editor/src/composables/use-editor-css-vars.d.ts +4 -0
- package/es/editor/src/composables/use-editor-css-vars.mjs +81 -0
- package/es/editor/src/constants.d.ts +12 -0
- package/es/editor/src/constants.mjs +25 -0
- package/es/editor/src/extensions.d.ts +7 -0
- package/es/editor/src/extensions.mjs +129 -0
- package/es/editor/src/interface.d.ts +2019 -0
- package/es/editor/src/interface.mjs +52 -0
- package/es/editor/src/markdown/constants.d.ts +8 -0
- package/es/editor/src/markdown/constants.mjs +206 -0
- package/es/editor/src/markdown/editor-serializer.d.ts +9 -0
- package/es/editor/src/markdown/editor-serializer.mjs +18 -0
- package/es/editor/src/markdown/escape.d.ts +2 -0
- package/es/editor/src/markdown/escape.mjs +24 -0
- package/es/editor/src/markdown/html.d.ts +1 -0
- package/es/editor/src/markdown/html.mjs +4 -0
- package/es/editor/src/markdown/parser.d.ts +4 -0
- package/es/editor/src/markdown/parser.mjs +36 -0
- package/es/editor/src/markdown/serializer-state.d.ts +10 -0
- package/es/editor/src/markdown/serializer-state.mjs +12 -0
- package/es/editor/src/markdown/serializer.d.ts +3 -0
- package/es/editor/src/markdown/serializer.mjs +8 -0
- package/es/editor/src/styles/index.cssr.d.ts +2 -0
- package/es/editor/src/styles/index.cssr.mjs +119 -0
- package/es/editor/styles/dark.d.ts +630 -0
- package/es/editor/styles/dark.mjs +21 -0
- package/es/editor/styles/index.d.ts +3 -0
- package/es/editor/styles/index.mjs +2 -0
- package/es/editor/styles/light.d.ts +677 -0
- package/es/editor/styles/light.mjs +87 -0
- package/es/editor/tests/fixtures/round-trip.d.ts +12 -0
- package/es/editor/tests/fixtures/round-trip.mjs +98 -0
- package/es/editor/tests/utils.d.ts +7 -0
- package/es/editor/tests/utils.mjs +27 -0
- package/es/locales/common/enUS.d.ts +21 -0
- package/es/locales/common/enUS.mjs +22 -1
- package/es/locales/common/ruRU.mjs +22 -1
- package/es/locales/common/uzUZ.mjs +22 -1
- package/es/locales/common/zhCN.mjs +22 -1
- package/es/message-bubble/src/styles/index.cssr.mjs +4 -17
- package/es/styles.d.ts +1 -0
- package/es/styles.mjs +1 -0
- package/es/themes/dark.mjs +2 -0
- package/es/themes/light.mjs +2 -0
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_internal/icons/Bold.d.ts +2 -0
- package/lib/_internal/icons/Bold.js +13 -0
- package/lib/_internal/icons/BulletList.d.ts +2 -0
- package/lib/_internal/icons/BulletList.js +13 -0
- package/lib/_internal/icons/HorizontalRule.d.ts +2 -0
- package/lib/_internal/icons/HorizontalRule.js +10 -0
- package/lib/_internal/icons/Italic.d.ts +2 -0
- package/lib/_internal/icons/Italic.js +11 -0
- package/lib/_internal/icons/NumberedList.d.ts +2 -0
- package/lib/_internal/icons/NumberedList.js +13 -0
- package/lib/_internal/icons/Quote.d.ts +2 -0
- package/lib/_internal/icons/Quote.js +13 -0
- package/lib/_internal/icons/SettingsLine.d.ts +2 -0
- package/lib/_internal/icons/SettingsLine.js +11 -0
- package/lib/_internal/icons/Strikethrough.d.ts +2 -0
- package/lib/_internal/icons/Strikethrough.js +10 -0
- package/lib/_internal/icons/index.d.ts +8 -0
- package/lib/_internal/icons/index.js +18 -2
- package/lib/_styles/markdown/markdown-content.cssr.d.ts +6 -0
- package/lib/_styles/markdown/markdown-content.cssr.js +28 -0
- package/lib/_utils/markdown/index.d.ts +3 -2
- package/lib/_utils/markdown/index.js +4 -1
- package/lib/_utils/markdown/render-markdown.d.ts +2 -1
- package/lib/_utils/markdown/render-markdown.js +1 -0
- package/lib/chat/src/Chat.d.ts +261 -24
- package/lib/chat/src/Chat.js +2 -0
- package/lib/chat/src/ChatMainArea.d.ts +81 -8
- package/lib/chat/src/ChatMainArea.js +93 -223
- package/lib/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.d.ts +9084 -0
- package/lib/chat/src/ChatParts/ChatAttachmentButton/ChatAttachmentButton.js +52 -0
- package/lib/chat/src/ChatParts/ChatAttachmentButton/interface.d.ts +2645 -0
- package/lib/chat/src/ChatParts/ChatAttachmentButton/interface.js +17 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.d.ts +9070 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.js +55 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/interface.d.ts +2637 -0
- package/lib/chat/src/ChatParts/ChatEditingBlock/interface.js +14 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.d.ts +89 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/ChatEditorInput.js +45 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/interface.d.ts +42 -0
- package/lib/chat/src/ChatParts/ChatEditorInput/interface.js +37 -0
- package/lib/chat/src/ChatParts/ChatFooter/ChatFooter.d.ts +115 -0
- package/lib/chat/src/ChatParts/ChatFooter/ChatFooter.js +66 -0
- package/lib/chat/src/ChatParts/ChatFooter/interface.d.ts +56 -0
- package/lib/chat/src/ChatParts/ChatFooter/interface.js +49 -0
- package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.d.ts +9205 -0
- package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.js +164 -0
- package/lib/chat/src/ChatParts/ChatHeader/interface.d.ts +2694 -0
- package/lib/chat/src/ChatParts/ChatHeader/interface.js +53 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.d.ts +9142 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.js +98 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/interface.d.ts +2654 -0
- package/lib/chat/src/ChatParts/ChatLegacyInput/interface.js +23 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.d.ts +148 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/ChatMessagesArea.js +49 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/interface.d.ts +72 -0
- package/lib/chat/src/ChatParts/ChatMessagesArea/interface.js +61 -0
- package/lib/chat/src/interface.d.ts +7 -0
- package/lib/chat/src/interface.js +3 -0
- package/lib/chat/styles/light.d.ts +4 -0
- package/lib/chat/styles/light.js +19 -0
- package/lib/components.d.ts +12933 -32
- package/lib/components.js +17 -7
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/data-table/index.d.ts +1 -1
- package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.d.ts +156 -0
- package/lib/data-table/src/ColumnSettings/ColumnSettingsDrawer.js +181 -0
- package/lib/data-table/src/ColumnSettings/styles.cssr.d.ts +2 -0
- package/lib/data-table/src/ColumnSettings/styles.cssr.js +30 -0
- package/lib/data-table/src/DataTable.d.ts +60 -2
- package/lib/data-table/src/DataTable.js +65 -23
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +14 -0
- package/lib/data-table/src/interface.d.ts +53 -1
- package/lib/data-table/src/interface.js +17 -2
- package/lib/data-table/src/styles/index.cssr.js +17 -1
- package/lib/data-table/src/use-column-settings.d.ts +2 -0
- package/lib/data-table/src/use-column-settings.js +144 -0
- package/lib/data-table/src/utils/column-utils.d.ts +2 -1
- package/lib/data-table/src/utils/column-utils.js +5 -0
- package/lib/editor/index.d.ts +10 -0
- package/lib/editor/index.js +19 -0
- package/lib/editor/src/Editor.d.ts +3896 -0
- package/lib/editor/src/Editor.js +216 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.d.ts +37 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/BlockTypeSelect.js +47 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/interface.d.ts +21 -0
- package/lib/editor/src/EditorParts/BlockTypeSelect/interface.js +17 -0
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.d.ts +4078 -0
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.js +121 -0
- package/lib/editor/src/EditorParts/EditorContent/index.d.ts +2 -0
- package/lib/editor/src/EditorParts/EditorContent/index.js +10 -0
- package/lib/editor/src/EditorParts/EditorContent/interface.d.ts +1906 -0
- package/lib/editor/src/EditorParts/EditorContent/interface.js +8 -0
- package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +4582 -0
- package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.js +126 -0
- package/lib/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.d.ts +11 -0
- package/lib/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.js +52 -0
- package/lib/editor/src/EditorParts/EditorToolbar/index.d.ts +2 -0
- package/lib/editor/src/EditorParts/EditorToolbar/index.js +10 -0
- package/lib/editor/src/EditorParts/EditorToolbar/interface.d.ts +1912 -0
- package/lib/editor/src/EditorParts/EditorToolbar/interface.js +11 -0
- package/lib/editor/src/EditorParts/SendButton/SendButton.d.ts +23 -0
- package/lib/editor/src/EditorParts/SendButton/SendButton.js +31 -0
- package/lib/editor/src/EditorParts/SendButton/interface.d.ts +18 -0
- package/lib/editor/src/EditorParts/SendButton/interface.js +11 -0
- package/lib/editor/src/EditorParts/ToolbarButton/ToolbarButton.d.ts +32 -0
- package/lib/editor/src/EditorParts/ToolbarButton/ToolbarButton.js +34 -0
- package/lib/editor/src/EditorParts/ToolbarButton/interface.d.ts +20 -0
- package/lib/editor/src/EditorParts/ToolbarButton/interface.js +16 -0
- package/lib/editor/src/composables/use-editor-commands.d.ts +8 -0
- package/lib/editor/src/composables/use-editor-commands.js +70 -0
- package/lib/editor/src/composables/use-editor-css-vars.d.ts +4 -0
- package/lib/editor/src/composables/use-editor-css-vars.js +46 -0
- package/lib/editor/src/constants.d.ts +12 -0
- package/lib/editor/src/constants.js +56 -0
- package/lib/editor/src/extensions.d.ts +7 -0
- package/lib/editor/src/extensions.js +136 -0
- package/lib/editor/src/interface.d.ts +2019 -0
- package/lib/editor/src/interface.js +22 -0
- package/lib/editor/src/markdown/constants.d.ts +8 -0
- package/lib/editor/src/markdown/constants.js +201 -0
- package/lib/editor/src/markdown/editor-serializer.d.ts +9 -0
- package/lib/editor/src/markdown/editor-serializer.js +20 -0
- package/lib/editor/src/markdown/escape.d.ts +2 -0
- package/lib/editor/src/markdown/escape.js +31 -0
- package/lib/editor/src/markdown/html.d.ts +1 -0
- package/lib/editor/src/markdown/html.js +9 -0
- package/lib/editor/src/markdown/parser.d.ts +4 -0
- package/lib/editor/src/markdown/parser.js +42 -0
- package/lib/editor/src/markdown/serializer-state.d.ts +10 -0
- package/lib/editor/src/markdown/serializer-state.js +16 -0
- package/lib/editor/src/markdown/serializer.d.ts +3 -0
- package/lib/editor/src/markdown/serializer.js +9 -0
- package/lib/editor/src/styles/index.cssr.d.ts +2 -0
- package/lib/editor/src/styles/index.cssr.js +124 -0
- package/lib/editor/styles/dark.d.ts +630 -0
- package/lib/editor/styles/dark.js +23 -0
- package/lib/editor/styles/index.d.ts +3 -0
- package/lib/editor/styles/index.js +10 -0
- package/lib/editor/styles/light.d.ts +677 -0
- package/lib/editor/styles/light.js +71 -0
- package/lib/editor/tests/fixtures/round-trip.d.ts +12 -0
- package/lib/editor/tests/fixtures/round-trip.js +125 -0
- package/lib/editor/tests/utils.d.ts +7 -0
- package/lib/editor/tests/utils.js +26 -0
- package/lib/locales/common/enUS.d.ts +21 -0
- package/lib/locales/common/enUS.js +22 -1
- package/lib/locales/common/ruRU.js +22 -1
- package/lib/locales/common/uzUZ.js +22 -1
- package/lib/locales/common/zhCN.js +22 -1
- package/lib/message-bubble/src/styles/index.cssr.js +4 -17
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +127 -125
- package/lib/themes/dark.js +136 -134
- package/lib/themes/light.js +136 -134
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -1
- package/volar.d.ts +3 -0
- package/web-types.json +437 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.editorToolbarProps = void 0;
|
|
4
|
+
const _mixins_1 = require("../../../../_mixins");
|
|
5
|
+
exports.editorToolbarProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { editor: Object, themeVars: Object, toolbar: {
|
|
6
|
+
type: [Array, Boolean],
|
|
7
|
+
default: true
|
|
8
|
+
}, markdownOptions: Object, disabled: Boolean, buttonProps: Object, iconProps: Object, dropdownProps: Object, tooltips: {
|
|
9
|
+
type: Object,
|
|
10
|
+
default: () => ({})
|
|
11
|
+
} });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SlotsType } from 'vue';
|
|
2
|
+
import type { SendButtonSlots } from './interface';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
readonly tooltip: StringConstructor;
|
|
5
|
+
readonly buttonThemeOverrides: import("vue").PropType<import("../../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../../button/styles").ButtonTheme>>;
|
|
6
|
+
readonly buttonProps: import("vue").PropType<Partial<import("../../../../button").ButtonProps>>;
|
|
7
|
+
readonly iconProps: import("vue").PropType<Partial<import("../../../../icon").IconProps>>;
|
|
8
|
+
readonly disabled: BooleanConstructor;
|
|
9
|
+
readonly onActivate: import("vue").PropType<VoidFunction>;
|
|
10
|
+
}>, {
|
|
11
|
+
mergedClsPrefix: import("vue").Ref<string, string>;
|
|
12
|
+
handleClick: () => void;
|
|
13
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
14
|
+
readonly tooltip: StringConstructor;
|
|
15
|
+
readonly buttonThemeOverrides: import("vue").PropType<import("../../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../../button/styles").ButtonTheme>>;
|
|
16
|
+
readonly buttonProps: import("vue").PropType<Partial<import("../../../../button").ButtonProps>>;
|
|
17
|
+
readonly iconProps: import("vue").PropType<Partial<import("../../../../icon").IconProps>>;
|
|
18
|
+
readonly disabled: BooleanConstructor;
|
|
19
|
+
readonly onActivate: import("vue").PropType<VoidFunction>;
|
|
20
|
+
}>> & Readonly<{}>, {
|
|
21
|
+
readonly disabled: boolean;
|
|
22
|
+
}, SlotsType<SendButtonSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vue_1 = require("vue");
|
|
4
|
+
const icons_1 = require("../../../../_internal/icons");
|
|
5
|
+
const _mixins_1 = require("../../../../_mixins");
|
|
6
|
+
const button_1 = require("../../../../button");
|
|
7
|
+
const icon_1 = require("../../../../icon");
|
|
8
|
+
const interface_1 = require("./interface");
|
|
9
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
10
|
+
name: 'EditorSendButton',
|
|
11
|
+
props: interface_1.sendButtonProps,
|
|
12
|
+
slots: Object,
|
|
13
|
+
setup(props) {
|
|
14
|
+
const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)();
|
|
15
|
+
function handleClick() {
|
|
16
|
+
var _a;
|
|
17
|
+
(_a = props.onActivate) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
21
|
+
handleClick
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
render() {
|
|
25
|
+
return ((0, vue_1.h)(button_1.UxButton, Object.assign({ class: `${this.mergedClsPrefix}-editor__send-button`, size: "tiny", bordered: false, builtinThemeOverrides: this.buttonThemeOverrides, disabled: this.disabled, "aria-label": this.tooltip, onClick: this.handleClick }, this.buttonProps), {
|
|
26
|
+
icon: () => ((0, vue_1.h)(icon_1.UIcon, Object.assign({}, this.iconProps), {
|
|
27
|
+
default: () => { var _a, _b, _c; return (_c = (_b = (_a = this.$slots).icon) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : (0, vue_1.h)(icons_1.SendFilled, null); }
|
|
28
|
+
}))
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PropType, VNodeChild } from 'vue';
|
|
2
|
+
import type { ExtractThemeOverrides } from '../../../../_mixins/use-theme';
|
|
3
|
+
import type { ExtractPublicPropTypes } from '../../../../_utils';
|
|
4
|
+
import type { ButtonProps } from '../../../../button';
|
|
5
|
+
import type { ButtonTheme } from '../../../../button/styles';
|
|
6
|
+
import type { IconProps } from '../../../../icon';
|
|
7
|
+
export interface SendButtonSlots {
|
|
8
|
+
icon?: () => VNodeChild;
|
|
9
|
+
}
|
|
10
|
+
export type SendButtonProps = ExtractPublicPropTypes<typeof sendButtonProps>;
|
|
11
|
+
export declare const sendButtonProps: {
|
|
12
|
+
readonly tooltip: StringConstructor;
|
|
13
|
+
readonly buttonThemeOverrides: PropType<ExtractThemeOverrides<ButtonTheme>>;
|
|
14
|
+
readonly buttonProps: PropType<Partial<ButtonProps>>;
|
|
15
|
+
readonly iconProps: PropType<Partial<IconProps>>;
|
|
16
|
+
readonly disabled: BooleanConstructor;
|
|
17
|
+
readonly onActivate: PropType<VoidFunction>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendButtonProps = void 0;
|
|
4
|
+
exports.sendButtonProps = {
|
|
5
|
+
tooltip: String,
|
|
6
|
+
buttonThemeOverrides: Object,
|
|
7
|
+
buttonProps: Object,
|
|
8
|
+
iconProps: Object,
|
|
9
|
+
disabled: Boolean,
|
|
10
|
+
onActivate: Function
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
readonly icon: {
|
|
3
|
+
readonly type: import("vue").PropType<import("vue").Component>;
|
|
4
|
+
readonly required: true;
|
|
5
|
+
};
|
|
6
|
+
readonly tooltip: StringConstructor;
|
|
7
|
+
readonly buttonThemeOverrides: import("vue").PropType<import("../../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../../button/styles").ButtonTheme>>;
|
|
8
|
+
readonly buttonProps: import("vue").PropType<Partial<import("../../../../button").ButtonProps>>;
|
|
9
|
+
readonly iconProps: import("vue").PropType<Partial<import("../../../../icon").IconProps>>;
|
|
10
|
+
readonly active: BooleanConstructor;
|
|
11
|
+
readonly disabled: BooleanConstructor;
|
|
12
|
+
readonly onActivate: import("vue").PropType<VoidFunction>;
|
|
13
|
+
}>, {
|
|
14
|
+
mergedClsPrefix: import("vue").Ref<string, string>;
|
|
15
|
+
handleClick: () => void;
|
|
16
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
|
+
readonly icon: {
|
|
18
|
+
readonly type: import("vue").PropType<import("vue").Component>;
|
|
19
|
+
readonly required: true;
|
|
20
|
+
};
|
|
21
|
+
readonly tooltip: StringConstructor;
|
|
22
|
+
readonly buttonThemeOverrides: import("vue").PropType<import("../../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../../button/styles").ButtonTheme>>;
|
|
23
|
+
readonly buttonProps: import("vue").PropType<Partial<import("../../../../button").ButtonProps>>;
|
|
24
|
+
readonly iconProps: import("vue").PropType<Partial<import("../../../../icon").IconProps>>;
|
|
25
|
+
readonly active: BooleanConstructor;
|
|
26
|
+
readonly disabled: BooleanConstructor;
|
|
27
|
+
readonly onActivate: import("vue").PropType<VoidFunction>;
|
|
28
|
+
}>> & Readonly<{}>, {
|
|
29
|
+
readonly disabled: boolean;
|
|
30
|
+
readonly active: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vue_1 = require("vue");
|
|
4
|
+
const _mixins_1 = require("../../../../_mixins");
|
|
5
|
+
const button_1 = require("../../../../button");
|
|
6
|
+
const icon_1 = require("../../../../icon");
|
|
7
|
+
const tooltip_1 = require("../../../../tooltip");
|
|
8
|
+
const interface_1 = require("./interface");
|
|
9
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
10
|
+
name: 'EditorToolbarButton',
|
|
11
|
+
props: interface_1.toolbarButtonProps,
|
|
12
|
+
setup(props) {
|
|
13
|
+
const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)();
|
|
14
|
+
function handleClick() {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = props.onActivate) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
20
|
+
handleClick
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
render() {
|
|
24
|
+
const button = ((0, vue_1.h)(button_1.UxButton, Object.assign({ class: `${this.mergedClsPrefix}-editor__toolbar-button`, size: "tiny", bordered: false, builtinThemeOverrides: this.buttonThemeOverrides, disabled: this.disabled, "aria-pressed": this.active, "aria-label": this.tooltip, onClick: this.handleClick }, this.buttonProps), {
|
|
25
|
+
icon: () => ((0, vue_1.h)(icon_1.UIcon, Object.assign({}, this.iconProps), { default: () => (0, vue_1.h)(this.icon) }))
|
|
26
|
+
}));
|
|
27
|
+
if (!this.tooltip)
|
|
28
|
+
return button;
|
|
29
|
+
return ((0, vue_1.h)(tooltip_1.UTooltip, null, {
|
|
30
|
+
trigger: () => button,
|
|
31
|
+
default: () => this.tooltip
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Component, PropType } from 'vue';
|
|
2
|
+
import type { ExtractThemeOverrides } from '../../../../_mixins/use-theme';
|
|
3
|
+
import type { ExtractPublicPropTypes } from '../../../../_utils';
|
|
4
|
+
import type { ButtonProps } from '../../../../button';
|
|
5
|
+
import type { ButtonTheme } from '../../../../button/styles';
|
|
6
|
+
import type { IconProps } from '../../../../icon';
|
|
7
|
+
export type ToolbarButtonProps = ExtractPublicPropTypes<typeof toolbarButtonProps>;
|
|
8
|
+
export declare const toolbarButtonProps: {
|
|
9
|
+
readonly icon: {
|
|
10
|
+
readonly type: PropType<Component>;
|
|
11
|
+
readonly required: true;
|
|
12
|
+
};
|
|
13
|
+
readonly tooltip: StringConstructor;
|
|
14
|
+
readonly buttonThemeOverrides: PropType<ExtractThemeOverrides<ButtonTheme>>;
|
|
15
|
+
readonly buttonProps: PropType<Partial<ButtonProps>>;
|
|
16
|
+
readonly iconProps: PropType<Partial<IconProps>>;
|
|
17
|
+
readonly active: BooleanConstructor;
|
|
18
|
+
readonly disabled: BooleanConstructor;
|
|
19
|
+
readonly onActivate: PropType<VoidFunction>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toolbarButtonProps = void 0;
|
|
4
|
+
exports.toolbarButtonProps = {
|
|
5
|
+
icon: {
|
|
6
|
+
type: Object,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
tooltip: String,
|
|
10
|
+
buttonThemeOverrides: Object,
|
|
11
|
+
buttonProps: Object,
|
|
12
|
+
iconProps: Object,
|
|
13
|
+
active: Boolean,
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
onActivate: Function
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/vue-3';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
3
|
+
import type { EditorBlockTypeKey, EditorToolbarItemKey } from '../interface';
|
|
4
|
+
export default function useEditorCommands(editorRef: Ref<Editor | undefined>, keysRef: Ref<EditorToolbarItemKey[]>): {
|
|
5
|
+
commandsRef: import("vue").ComputedRef<Partial<Record<EditorToolbarItemKey, import("../interface").EditorCommand>>>;
|
|
6
|
+
activeBlockTypeRef: import("vue").ComputedRef<EditorBlockTypeKey>;
|
|
7
|
+
setBlockType: (key: EditorBlockTypeKey) => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = useEditorCommands;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const constants_2 = require("../markdown/constants");
|
|
7
|
+
function useEditorCommands(editorRef, keysRef) {
|
|
8
|
+
const editorStateRef = (0, vue_1.shallowRef)();
|
|
9
|
+
let subscribed;
|
|
10
|
+
function handleTransaction() {
|
|
11
|
+
var _a;
|
|
12
|
+
editorStateRef.value = (_a = editorRef.value) === null || _a === void 0 ? void 0 : _a.state;
|
|
13
|
+
}
|
|
14
|
+
function unsubscribe() {
|
|
15
|
+
subscribed === null || subscribed === void 0 ? void 0 : subscribed.off('transaction', handleTransaction);
|
|
16
|
+
subscribed = undefined;
|
|
17
|
+
}
|
|
18
|
+
(0, vue_1.watch)(editorRef, (editor) => {
|
|
19
|
+
unsubscribe();
|
|
20
|
+
editorStateRef.value = editor === null || editor === void 0 ? void 0 : editor.state;
|
|
21
|
+
if (!editor)
|
|
22
|
+
return;
|
|
23
|
+
subscribed = editor;
|
|
24
|
+
editor.on('transaction', handleTransaction);
|
|
25
|
+
}, { immediate: true });
|
|
26
|
+
(0, vue_1.onBeforeUnmount)(unsubscribe);
|
|
27
|
+
const commandsRef = (0, vue_1.computed)(() => {
|
|
28
|
+
const editor = editorRef.value;
|
|
29
|
+
const ready = Boolean(editor && editorStateRef.value);
|
|
30
|
+
const commands = {};
|
|
31
|
+
for (const key of keysRef.value) {
|
|
32
|
+
const spec = constants_2.EDITOR_COMMAND_SPECS[key];
|
|
33
|
+
commands[key] = {
|
|
34
|
+
run: () => {
|
|
35
|
+
if (editor)
|
|
36
|
+
spec.run(editor);
|
|
37
|
+
},
|
|
38
|
+
active: ready && editor ? spec.active(editor) : false,
|
|
39
|
+
disabled: !ready || !editor || !spec.enabled(editor)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return commands;
|
|
43
|
+
});
|
|
44
|
+
const activeBlockTypeRef = (0, vue_1.computed)(() => {
|
|
45
|
+
const editor = editorRef.value;
|
|
46
|
+
if (!editor || !editorStateRef.value)
|
|
47
|
+
return 'paragraph';
|
|
48
|
+
const active = constants_1.EDITOR_BLOCK_TYPES.find((key) => {
|
|
49
|
+
const level = constants_1.EDITOR_BLOCK_TYPE_LEVELS[key];
|
|
50
|
+
return level !== null && editor.isActive('heading', { level });
|
|
51
|
+
});
|
|
52
|
+
return active !== null && active !== void 0 ? active : 'paragraph';
|
|
53
|
+
});
|
|
54
|
+
function setBlockType(key) {
|
|
55
|
+
const editor = editorRef.value;
|
|
56
|
+
if (!editor)
|
|
57
|
+
return;
|
|
58
|
+
const level = constants_1.EDITOR_BLOCK_TYPE_LEVELS[key];
|
|
59
|
+
if (level === null) {
|
|
60
|
+
editor.chain().focus().setParagraph().run();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
editor.chain().focus().setHeading({ level }).run();
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
commandsRef,
|
|
67
|
+
activeBlockTypeRef,
|
|
68
|
+
setBlockType
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
2
|
+
import type { MergedTheme } from '../../../_mixins/use-theme';
|
|
3
|
+
import type { EditorTheme, EditorThemeVars } from '../../styles';
|
|
4
|
+
export default function useEditorCssVars(themeRef: Ref<MergedTheme<EditorTheme>>, themeVarsRef: Ref<EditorThemeVars>): ComputedRef<Record<string, string>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = useEditorCssVars;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
function useEditorCssVars(themeRef, themeVarsRef) {
|
|
6
|
+
return (0, vue_1.computed)(() => {
|
|
7
|
+
const { common: { cubicBezierEaseInOut } } = themeRef.value;
|
|
8
|
+
const { backgroundColor, borderColor, borderRadius, toolbarBackgroundColor, toolbarDividerColor, toolbarButtonColorActive, toolbarButtonColorHover, toolbarIconColorDisabled, toolbarIconColorActive, toolbarIconColorHover, toolbarIconColor, contentBackgroundColor, contentTextColor, placeholderColor, sendButtonColor, blockTypeMenuWidth, blockTypeMenuColor, blockTypeMenuBorderColor, blockTypeMenuBorderRadius, blockTypeMenuBoxShadow, markdownQuoteBorderColor, markdownQuoteTextColor, markdownQuoteBackgroundColor, markdownQuoteMarkerColor, markdownDividerColor, markdownH1FontSize, markdownH2FontSize, markdownH3FontSize, markdownTextFontSize, markdownH1LineHeight, markdownH2LineHeight, markdownH3LineHeight, markdownTextLineHeight } = themeVarsRef.value;
|
|
9
|
+
return {
|
|
10
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
11
|
+
'--u-editor-background-color': backgroundColor,
|
|
12
|
+
'--u-editor-border-color': borderColor,
|
|
13
|
+
'--u-editor-border-radius': borderRadius,
|
|
14
|
+
'--u-editor-toolbar-background-color': toolbarBackgroundColor,
|
|
15
|
+
'--u-editor-toolbar-divider-color': toolbarDividerColor,
|
|
16
|
+
'--u-editor-toolbar-button-color-active': toolbarButtonColorActive,
|
|
17
|
+
'--u-editor-toolbar-button-color-hover': toolbarButtonColorHover,
|
|
18
|
+
'--u-editor-toolbar-icon-color-disabled': toolbarIconColorDisabled,
|
|
19
|
+
'--u-editor-toolbar-icon-color-active': toolbarIconColorActive,
|
|
20
|
+
'--u-editor-toolbar-icon-color-hover': toolbarIconColorHover,
|
|
21
|
+
'--u-editor-toolbar-icon-color': toolbarIconColor,
|
|
22
|
+
'--u-editor-content-background-color': contentBackgroundColor,
|
|
23
|
+
'--u-editor-content-text-color': contentTextColor,
|
|
24
|
+
'--u-editor-placeholder-color': placeholderColor,
|
|
25
|
+
'--u-editor-send-button-color': sendButtonColor,
|
|
26
|
+
'--u-editor-block-type-menu-width': blockTypeMenuWidth,
|
|
27
|
+
'--u-editor-block-type-menu-color': blockTypeMenuColor,
|
|
28
|
+
'--u-editor-block-type-menu-border-color': blockTypeMenuBorderColor,
|
|
29
|
+
'--u-editor-block-type-menu-border-radius': blockTypeMenuBorderRadius,
|
|
30
|
+
'--u-editor-block-type-menu-box-shadow': blockTypeMenuBoxShadow,
|
|
31
|
+
'--u-editor-markdown-quote-border-color': markdownQuoteBorderColor,
|
|
32
|
+
'--u-editor-markdown-quote-text-color': markdownQuoteTextColor,
|
|
33
|
+
'--u-editor-markdown-quote-background-color': markdownQuoteBackgroundColor,
|
|
34
|
+
'--u-editor-markdown-quote-marker-color': markdownQuoteMarkerColor,
|
|
35
|
+
'--u-editor-markdown-divider-color': markdownDividerColor,
|
|
36
|
+
'--u-editor-markdown-h1-font-size': markdownH1FontSize,
|
|
37
|
+
'--u-editor-markdown-h2-font-size': markdownH2FontSize,
|
|
38
|
+
'--u-editor-markdown-h3-font-size': markdownH3FontSize,
|
|
39
|
+
'--u-editor-markdown-text-font-size': markdownTextFontSize,
|
|
40
|
+
'--u-editor-markdown-h1-line-height': markdownH1LineHeight,
|
|
41
|
+
'--u-editor-markdown-h2-line-height': markdownH2LineHeight,
|
|
42
|
+
'--u-editor-markdown-h3-line-height': markdownH3LineHeight,
|
|
43
|
+
'--u-editor-markdown-text-line-height': markdownTextLineHeight
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EditorBlockTypeKey, EditorHeadingLevels, EditorToolbarItemKey } from './interface';
|
|
2
|
+
export declare const EDITOR_HEADING_LEVELS: EditorHeadingLevels[];
|
|
3
|
+
export declare const EDITOR_DEFAULT_TOOLBAR: EditorToolbarItemKey[][];
|
|
4
|
+
export declare const EDITOR_BLOCK_TYPES: EditorBlockTypeKey[];
|
|
5
|
+
export declare const PLAIN_PASTE_NODE_TYPES: Set<string>;
|
|
6
|
+
export declare const MARKDOWN_SOURCE_TYPES: string[];
|
|
7
|
+
export declare const EDITOR_BLOCK_TYPE_LEVELS: Record<EditorBlockTypeKey, EditorHeadingLevels | null>;
|
|
8
|
+
export declare const EDITOR_TOOLBAR_ITEM_FEATURES: Record<EditorToolbarItemKey, string>;
|
|
9
|
+
export declare const EDITOR_MARKDOWN_REGEX: {
|
|
10
|
+
SINGLE_PARAGRAPH_ITEM: RegExp;
|
|
11
|
+
PARAGRAPH_BEFORE_NESTED_LIST: RegExp;
|
|
12
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EDITOR_MARKDOWN_REGEX = exports.EDITOR_TOOLBAR_ITEM_FEATURES = exports.EDITOR_BLOCK_TYPE_LEVELS = exports.MARKDOWN_SOURCE_TYPES = exports.PLAIN_PASTE_NODE_TYPES = exports.EDITOR_BLOCK_TYPES = exports.EDITOR_DEFAULT_TOOLBAR = exports.EDITOR_HEADING_LEVELS = void 0;
|
|
4
|
+
exports.EDITOR_HEADING_LEVELS = [1, 2, 3, 4, 5, 6];
|
|
5
|
+
exports.EDITOR_DEFAULT_TOOLBAR = [
|
|
6
|
+
['blockType'],
|
|
7
|
+
['bold', 'strikethrough', 'italic'],
|
|
8
|
+
['blockquote', 'divider'],
|
|
9
|
+
['bulletList', 'orderedList']
|
|
10
|
+
];
|
|
11
|
+
exports.EDITOR_BLOCK_TYPES = [
|
|
12
|
+
'heading1',
|
|
13
|
+
'heading2',
|
|
14
|
+
'heading3',
|
|
15
|
+
'paragraph'
|
|
16
|
+
];
|
|
17
|
+
exports.PLAIN_PASTE_NODE_TYPES = new Set([
|
|
18
|
+
'doc',
|
|
19
|
+
'paragraph',
|
|
20
|
+
'text',
|
|
21
|
+
'hardBreak'
|
|
22
|
+
]);
|
|
23
|
+
exports.MARKDOWN_SOURCE_TYPES = [
|
|
24
|
+
'paragraph',
|
|
25
|
+
'heading',
|
|
26
|
+
'blockquote',
|
|
27
|
+
'bulletList',
|
|
28
|
+
'orderedList',
|
|
29
|
+
'listItem',
|
|
30
|
+
'horizontalRule',
|
|
31
|
+
'hardBreak',
|
|
32
|
+
'bold',
|
|
33
|
+
'italic',
|
|
34
|
+
'strike',
|
|
35
|
+
'link'
|
|
36
|
+
];
|
|
37
|
+
exports.EDITOR_BLOCK_TYPE_LEVELS = {
|
|
38
|
+
paragraph: null,
|
|
39
|
+
heading1: 1,
|
|
40
|
+
heading2: 2,
|
|
41
|
+
heading3: 3
|
|
42
|
+
};
|
|
43
|
+
exports.EDITOR_TOOLBAR_ITEM_FEATURES = {
|
|
44
|
+
blockType: 'heading',
|
|
45
|
+
bold: 'bold',
|
|
46
|
+
strikethrough: 'strikethrough',
|
|
47
|
+
italic: 'italic',
|
|
48
|
+
blockquote: 'blockquote',
|
|
49
|
+
divider: 'divider',
|
|
50
|
+
bulletList: 'bulletList',
|
|
51
|
+
orderedList: 'orderedList'
|
|
52
|
+
};
|
|
53
|
+
exports.EDITOR_MARKDOWN_REGEX = {
|
|
54
|
+
SINGLE_PARAGRAPH_ITEM: /<li><p>((?:(?!<\/?p[\s>])[\s\S])*)<\/p><\/li>/g,
|
|
55
|
+
PARAGRAPH_BEFORE_NESTED_LIST: /<li><p>((?:(?!<\/?p[\s>])[\s\S])*)<\/p>(?=<[ou]l)/g
|
|
56
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Extensions } from '@tiptap/core';
|
|
2
|
+
import type { CreateEditorExtensionsOptions, MarkdownPasteOptions, SendShortcutOptions } from './interface';
|
|
3
|
+
import { Extension } from '@tiptap/core';
|
|
4
|
+
export declare const MarkdownSource: Extension<any, any>;
|
|
5
|
+
export declare const SendShortcut: Extension<SendShortcutOptions, any>;
|
|
6
|
+
export declare const MarkdownPaste: Extension<MarkdownPasteOptions, any>;
|
|
7
|
+
export declare function createEditorExtensions({ placeholder, markdownOptions, extensions, maxLength, onSendShortcut }?: CreateEditorExtensionsOptions): Extensions;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MarkdownPaste = exports.SendShortcut = exports.MarkdownSource = void 0;
|
|
4
|
+
exports.createEditorExtensions = createEditorExtensions;
|
|
5
|
+
const core_1 = require("@tiptap/core");
|
|
6
|
+
const extensions_1 = require("@tiptap/extensions");
|
|
7
|
+
const model_1 = require("@tiptap/pm/model");
|
|
8
|
+
const state_1 = require("@tiptap/pm/state");
|
|
9
|
+
const starter_kit_1 = require("@tiptap/starter-kit");
|
|
10
|
+
const markdown_1 = require("../../_utils/markdown");
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
const parser_1 = require("./markdown/parser");
|
|
13
|
+
exports.MarkdownSource = core_1.Extension.create({
|
|
14
|
+
name: 'markdownSource',
|
|
15
|
+
addGlobalAttributes() {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
types: constants_1.MARKDOWN_SOURCE_TYPES,
|
|
19
|
+
attributes: {
|
|
20
|
+
markdownSource: {
|
|
21
|
+
default: null,
|
|
22
|
+
parseHTML: () => null,
|
|
23
|
+
renderHTML: () => ({})
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
exports.SendShortcut = core_1.Extension.create({
|
|
31
|
+
name: 'sendShortcut',
|
|
32
|
+
priority: 1000,
|
|
33
|
+
addOptions: () => ({ onSend: null }),
|
|
34
|
+
addKeyboardShortcuts() {
|
|
35
|
+
return {
|
|
36
|
+
Enter: () => {
|
|
37
|
+
const onSend = this.options.onSend;
|
|
38
|
+
if (!onSend)
|
|
39
|
+
return false;
|
|
40
|
+
onSend();
|
|
41
|
+
return true;
|
|
42
|
+
},
|
|
43
|
+
'Shift-Enter': () => {
|
|
44
|
+
const editor = this.editor;
|
|
45
|
+
return editor.commands.first(({ commands }) => [
|
|
46
|
+
...(editor.schema.nodes.listItem
|
|
47
|
+
? [() => commands.splitListItem('listItem')]
|
|
48
|
+
: []),
|
|
49
|
+
() => commands.liftEmptyBlock(),
|
|
50
|
+
() => commands.splitBlock()
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
function hasMarkdownStructure(document) {
|
|
57
|
+
let markdown = false;
|
|
58
|
+
document.descendants((node) => {
|
|
59
|
+
if (markdown)
|
|
60
|
+
return false;
|
|
61
|
+
if (node.marks.length > 0 || !constants_1.PLAIN_PASTE_NODE_TYPES.has(node.type.name)) {
|
|
62
|
+
markdown = true;
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
return markdown;
|
|
68
|
+
}
|
|
69
|
+
exports.MarkdownPaste = core_1.Extension.create({
|
|
70
|
+
name: 'markdownPaste',
|
|
71
|
+
addOptions: () => ({ markdownOptions: undefined }),
|
|
72
|
+
addProseMirrorPlugins() {
|
|
73
|
+
let parser;
|
|
74
|
+
return [
|
|
75
|
+
new state_1.Plugin({
|
|
76
|
+
props: {
|
|
77
|
+
handlePaste: (view, event) => {
|
|
78
|
+
var _a, _b;
|
|
79
|
+
const clipboard = event.clipboardData;
|
|
80
|
+
const text = clipboard === null || clipboard === void 0 ? void 0 : clipboard.getData('text/plain');
|
|
81
|
+
if (!text)
|
|
82
|
+
return false;
|
|
83
|
+
parser !== null && parser !== void 0 ? parser : (parser = (0, parser_1.createMarkdownParser)(view.state.schema, this.options.markdownOptions));
|
|
84
|
+
const document = parser.parse(text);
|
|
85
|
+
if (((_a = clipboard === null || clipboard === void 0 ? void 0 : clipboard.getData('text/html')) === null || _a === void 0 ? void 0 : _a.trim())
|
|
86
|
+
&& !hasMarkdownStructure(document)) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const single = document.childCount === 1
|
|
90
|
+
&& ((_b = document.firstChild) === null || _b === void 0 ? void 0 : _b.type.name) === 'paragraph';
|
|
91
|
+
const slice = single
|
|
92
|
+
? new model_1.Slice(document.content, 1, 1)
|
|
93
|
+
: new model_1.Slice(document.content, 0, 0);
|
|
94
|
+
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
function createEditorExtensions({ placeholder = '', markdownOptions, extensions = [], maxLength, onSendShortcut } = {}) {
|
|
103
|
+
const normalizedOptions = (0, markdown_1.normalizeOptions)(markdownOptions);
|
|
104
|
+
const features = new Set(normalizedOptions.features);
|
|
105
|
+
const headingLevels = constants_1.EDITOR_HEADING_LEVELS.filter(level => level <= normalizedOptions.maxHeadingLevel);
|
|
106
|
+
const lists = features.has('bulletList') || features.has('orderedList');
|
|
107
|
+
return [
|
|
108
|
+
starter_kit_1.StarterKit.configure({
|
|
109
|
+
code: false,
|
|
110
|
+
codeBlock: false,
|
|
111
|
+
underline: false,
|
|
112
|
+
trailingNode: false,
|
|
113
|
+
bold: features.has('bold') && {},
|
|
114
|
+
italic: features.has('italic') && {},
|
|
115
|
+
strike: features.has('strikethrough') && {},
|
|
116
|
+
heading: features.has('heading') && { levels: headingLevels },
|
|
117
|
+
bulletList: features.has('bulletList') && {},
|
|
118
|
+
orderedList: features.has('orderedList') && {},
|
|
119
|
+
blockquote: features.has('blockquote') && {},
|
|
120
|
+
horizontalRule: features.has('divider') && {},
|
|
121
|
+
listItem: lists && {},
|
|
122
|
+
listKeymap: lists && {},
|
|
123
|
+
link: { openOnClick: false, autolink: false, linkOnPaste: false }
|
|
124
|
+
}),
|
|
125
|
+
extensions_1.Placeholder.configure({ placeholder }),
|
|
126
|
+
...(maxLength === undefined
|
|
127
|
+
? []
|
|
128
|
+
: [extensions_1.CharacterCount.configure({ limit: maxLength })]),
|
|
129
|
+
exports.MarkdownSource,
|
|
130
|
+
exports.MarkdownPaste.configure({ markdownOptions }),
|
|
131
|
+
...(onSendShortcut
|
|
132
|
+
? [exports.SendShortcut.configure({ onSend: onSendShortcut })]
|
|
133
|
+
: []),
|
|
134
|
+
...extensions
|
|
135
|
+
];
|
|
136
|
+
}
|