@onereach/ui-components 2.70.0-beta.2131.0 → 2.70.0-beta.2159.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/bundled/v2/{OrAvatar-2fa559e1.js → OrAvatar-ae61bfb9.js} +41 -15
- package/dist/bundled/v2/{OrButton-0e91a808.js → OrButton-4b99c680.js} +5 -1
- package/dist/bundled/v2/{OrCard-58a1ba3e.js → OrCard-29116e1f.js} +2 -2
- package/dist/bundled/v2/OrCardCollection-c4209a92.js +350 -0
- package/dist/bundled/v2/OrCode-be1bd373.js +4255 -0
- package/dist/bundled/v2/{OrConfirm-18c534df.js → OrConfirm-cab6535b.js} +1 -1
- package/dist/bundled/v2/OrEmptyState-9fb413f9.js +160 -0
- package/dist/bundled/v2/{OrRichTextEditor-63ef1357.js → OrRichTextEditor-5843ecda.js} +13803 -20711
- package/dist/bundled/v2/{OrSearch-9d402f56.js → OrSearch-76b002cf.js} +10 -4
- package/dist/bundled/v2/{OrSortHeader-396e6a7c.js → OrSortHeader-9932d28f.js} +2 -2
- package/dist/bundled/v2/codemirrorView-14f6685c.js +7136 -0
- package/dist/bundled/v2/components/index.d.ts +1 -0
- package/dist/bundled/v2/components/index.js +13 -10
- package/dist/bundled/v2/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
- package/dist/bundled/v2/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
- package/dist/bundled/v2/components/or-avatar-v3/index.js +2 -1
- package/dist/bundled/v2/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/bundled/v2/components/or-avatar-v3/styles.d.ts +2 -0
- package/dist/bundled/v2/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
- package/dist/bundled/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
- package/dist/bundled/v2/components/or-card-collection-v3/index.js +7 -4
- package/dist/bundled/v2/components/or-card-collection-v3/props.d.ts +5 -1
- package/dist/bundled/v2/components/or-card-collection-v3/styles.d.ts +2 -2
- package/dist/bundled/v2/components/or-card-collection-v3/types.d.ts +8 -3
- package/dist/bundled/v2/components/or-card-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-code/index.js +3 -2
- package/dist/bundled/v2/components/or-confirm-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
- package/dist/bundled/v2/components/or-empty-state-v3/index.js +3 -159
- package/dist/bundled/v2/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
- package/dist/bundled/v2/components/or-rich-text-editor-v3/index.js +4 -2
- package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +2 -0
- package/dist/bundled/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v2/components/or-search-v3/OrSearch.vue.d.ts +15 -2
- package/dist/bundled/v2/components/or-search-v3/index.js +1 -1
- package/dist/bundled/v2/components/or-sort-header-v3/index.js +1 -1
- package/dist/bundled/v2/index-46cc379c.js +12186 -0
- package/dist/bundled/v2/index-780d00b0.js +13307 -0
- package/dist/bundled/v2/index.js +14 -11
- package/dist/bundled/v3/{OrAvatar.vue_vue_type_script_lang-22e46ce1.js → OrAvatar.vue_vue_type_script_lang-0426862b.js} +35 -13
- package/dist/bundled/v3/OrButton-a671b8a1.js +33 -0
- package/dist/bundled/v3/{OrButton.vue_vue_type_script_lang-3718b300.js → OrButton.vue_vue_type_script_lang-b0dc31ca.js} +5 -1
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-9a2ae9a3.js +236 -0
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-0f668150.js +4133 -0
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-289b5600.js → OrConfirm.vue_vue_type_script_lang-f57ffa1a.js} +6 -36
- package/dist/bundled/v3/OrEmptyState.vue_vue_type_script_lang-da7d6c42.js +111 -0
- package/dist/bundled/v3/{OrIconButton-4bd33e3c.js → OrIconButton-1581013c.js} +1 -1
- package/dist/bundled/v3/{OrIconButton.vue_vue_type_script_lang-641f6e06.js → OrIconButton.vue_vue_type_script_lang-f6f801ff.js} +1 -1
- package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-3a8189f4.js → OrInlineInput.vue_vue_type_script_lang-f29483f4.js} +2 -2
- package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-890b97ab.js → OrInlineTextarea.vue_vue_type_script_lang-cc40af48.js} +2 -2
- package/dist/bundled/v3/OrInput.vue_vue_type_script_lang-f6d793d3.js +2 -2
- package/dist/bundled/v3/{OrModal.vue_vue_type_script_lang-00a477f0.js → OrModal.vue_vue_type_script_lang-80a7b906.js} +2 -2
- package/dist/bundled/v3/OrNotification.vue_vue_type_script_lang-fbb35355.js +2 -2
- package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-47fffbd6.js → OrRichTextEditor.vue_vue_type_script_lang-e0dfd695.js} +13803 -20711
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-ed78b21f.js → OrSearch.vue_vue_type_script_lang-014ad470.js} +9 -3
- package/dist/bundled/v3/OrSelect.vue_vue_type_script_lang-15285ce4.js +1 -1
- package/dist/bundled/v3/{OrTag.vue_vue_type_script_lang-92d9fb12.js → OrTag.vue_vue_type_script_lang-dc6a4011.js} +2 -2
- package/dist/bundled/v3/{OrToastContainer-afb51e5d.js → OrToastContainer-7c3c0b12.js} +1 -1
- package/dist/bundled/v3/codemirrorView-14f6685c.js +7136 -0
- package/dist/bundled/v3/components/index.d.ts +1 -0
- package/dist/bundled/v3/components/index.js +23 -19
- package/dist/bundled/v3/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
- package/dist/bundled/v3/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
- package/dist/bundled/v3/components/or-avatar-v3/index.js +3 -1
- package/dist/bundled/v3/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/bundled/v3/components/or-avatar-v3/styles.d.ts +2 -0
- package/dist/bundled/v3/components/or-button-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
- package/dist/bundled/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
- package/dist/bundled/v3/components/or-card-collection-v3/index.js +13 -6
- package/dist/bundled/v3/components/or-card-collection-v3/props.d.ts +5 -1
- package/dist/bundled/v3/components/or-card-collection-v3/styles.d.ts +2 -2
- package/dist/bundled/v3/components/or-card-collection-v3/types.d.ts +8 -3
- package/dist/bundled/v3/components/or-code/index.js +3 -2
- package/dist/bundled/v3/components/or-confirm-v3/index.js +5 -4
- package/dist/bundled/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
- package/dist/bundled/v3/components/or-empty-state-v3/index.js +2 -134
- package/dist/bundled/v3/components/or-icon-button-v3/index.js +1 -1
- package/dist/bundled/v3/components/or-inline-input-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-inline-textarea-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
- package/dist/bundled/v3/components/or-input-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-modal-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-notification-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-rich-text-editor-v3/index.js +6 -4
- package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +2 -0
- package/dist/bundled/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/bundled/v3/components/or-search-v3/OrSearch.vue.d.ts +15 -2
- package/dist/bundled/v3/components/or-search-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-select-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-tag-v3/index.js +3 -3
- package/dist/bundled/v3/components/or-toast-v3/index.js +4 -4
- package/dist/bundled/v3/index-44faad6a.js +12186 -0
- package/dist/bundled/v3/index-780d00b0.js +13307 -0
- package/dist/bundled/v3/index.js +415 -351
- package/dist/bundled/v3/{types-6c5eee23.js → types-dcc78caa.js} +2 -2
- package/dist/esm/v2/{OrAvatar-0afdef36.js → OrAvatar-3d155af3.js} +41 -15
- package/dist/esm/v2/{OrButton-357a5756.js → OrButton-357e1e2c.js} +5 -1
- package/dist/esm/v2/OrCardCollection-57d11adf.js +350 -0
- package/dist/esm/v2/{OrCode-41dd5f9b.js → OrCode-d4400b42.js} +6 -4
- package/dist/esm/v2/{OrConfirm-b0b2e43c.js → OrConfirm-ec7aef0e.js} +1 -1
- package/dist/esm/v2/OrEmptyState-2481f13f.js +158 -0
- package/dist/esm/v2/{OrRichTextEditor-c3dee275.js → OrRichTextEditor-2d152db0.js} +59 -11
- package/dist/esm/v2/{OrSearch-ddb7c1fe.js → OrSearch-2f260b09.js} +8 -2
- package/dist/esm/v2/codemirrorView-8ea431d2.js +184 -0
- package/dist/esm/v2/components/index.d.ts +1 -0
- package/dist/esm/v2/components/index.js +13 -7
- package/dist/esm/v2/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
- package/dist/esm/v2/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
- package/dist/esm/v2/components/or-avatar-v3/index.js +2 -1
- package/dist/esm/v2/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/esm/v2/components/or-avatar-v3/styles.d.ts +2 -0
- package/dist/esm/v2/components/or-button-v3/index.js +1 -1
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
- package/dist/esm/v2/components/or-card-collection-v3/OrCardCollectionView.vue2.vue.d.ts +35 -0
- package/dist/esm/v2/components/or-card-collection-v3/index.js +7 -4
- package/dist/esm/v2/components/or-card-collection-v3/props.d.ts +5 -1
- package/dist/esm/v2/components/or-card-collection-v3/styles.d.ts +2 -2
- package/dist/esm/v2/components/or-card-collection-v3/types.d.ts +8 -3
- package/dist/esm/v2/components/or-code/index.js +3 -1
- package/dist/esm/v2/components/or-confirm-v3/index.js +2 -2
- package/dist/esm/v2/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
- package/dist/esm/v2/components/or-empty-state-v3/index.js +3 -158
- package/dist/esm/v2/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +8 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v2/components/or-search-v3/OrSearch.vue.d.ts +15 -2
- package/dist/esm/v2/components/or-search-v3/index.js +1 -1
- package/dist/esm/v2/index.js +13 -7
- package/dist/esm/v3/{OrAvatar-ef88d31c.js → OrAvatar-53a4429d.js} +43 -16
- package/dist/esm/v3/{OrButton-f4b9ee51.js → OrButton-bb6bf8a9.js} +5 -1
- package/dist/esm/v3/OrCardCollection-2a6514f3.js +298 -0
- package/dist/esm/v3/{OrCode-ee19a5e6.js → OrCode-5ed69c23.js} +3 -1
- package/dist/esm/v3/{OrConfirm-906427ef.js → OrConfirm-5d56cbd3.js} +1 -1
- package/dist/esm/v3/OrEmptyState-bb8e3145.js +135 -0
- package/dist/esm/v3/OrInput-41691fb3.js +1 -1
- package/dist/esm/v3/{OrInputBox-5247ab25.js → OrInputBox-6d1b6059.js} +1 -1
- package/dist/esm/v3/{OrRichTextEditor-b2e87342.js → OrRichTextEditor-f1271eb6.js} +58 -10
- package/dist/esm/v3/{OrSearch-cdde55ce.js → OrSearch-e5a2e93e.js} +9 -3
- package/dist/esm/v3/OrSelect-7e813982.js +1 -1
- package/dist/esm/v3/OrTextarea-bb9ef3f2.js +1 -1
- package/dist/esm/v3/codemirrorView-8ea431d2.js +184 -0
- package/dist/esm/v3/components/index.d.ts +1 -0
- package/dist/esm/v3/components/index.js +14 -8
- package/dist/esm/v3/components/or-avatar-v3/OrAvatar.stories3.d.ts +1 -1
- package/dist/esm/v3/components/or-avatar-v3/OrAvatar.vue.d.ts +11 -0
- package/dist/esm/v3/components/or-avatar-v3/index.js +2 -1
- package/dist/esm/v3/components/or-avatar-v3/props.d.ts +2 -1
- package/dist/esm/v3/components/or-avatar-v3/styles.d.ts +2 -0
- package/dist/esm/v3/components/or-button-v3/index.js +1 -1
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.stories3.d.ts +10 -0
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollection.vue.d.ts +87 -40
- package/dist/esm/v3/components/or-card-collection-v3/OrCardCollectionView.vue3.vue.d.ts +35 -0
- package/dist/esm/v3/components/or-card-collection-v3/index.js +8 -5
- package/dist/esm/v3/components/or-card-collection-v3/props.d.ts +5 -1
- package/dist/esm/v3/components/or-card-collection-v3/styles.d.ts +2 -2
- package/dist/esm/v3/components/or-card-collection-v3/types.d.ts +8 -3
- package/dist/esm/v3/components/or-code/index.js +3 -1
- package/dist/esm/v3/components/or-confirm-v3/index.js +3 -3
- package/dist/esm/v3/components/or-empty-state-v3/OrEmptyState.vue.d.ts +1 -1
- package/dist/esm/v3/components/or-empty-state-v3/index.js +3 -135
- package/dist/esm/v3/components/or-input-box-v3/OrInputBox.vue.d.ts +1 -2
- package/dist/esm/v3/components/or-input-box-v3/index.js +2 -2
- package/dist/esm/v3/components/or-input-v3/index.js +1 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +8 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.d.ts +3 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.d.ts +45 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.d.ts +1 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/index.js +5 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/utils/codemirror/types.d.ts +19 -0
- package/dist/esm/v3/components/or-search-v3/OrSearch.vue.d.ts +15 -2
- package/dist/esm/v3/components/or-search-v3/index.js +2 -2
- package/dist/esm/v3/components/or-select-v3/index.js +1 -1
- package/dist/esm/v3/components/or-textarea-v3/index.js +1 -1
- package/dist/esm/v3/index.js +14 -8
- package/package.json +2 -1
- package/src/components/index.ts +1 -0
- package/src/components/or-avatar-v3/OrAvatar.stories3.ts +9 -7
- package/src/components/or-avatar-v3/OrAvatar.vue +22 -2
- package/src/components/or-avatar-v3/props.ts +1 -0
- package/src/components/or-avatar-v3/styles.ts +49 -11
- package/src/components/or-button-v3/styles.ts +6 -0
- package/src/components/or-card/OrCard.stories.ts +1 -1
- package/src/components/or-card-collection/OrCardCollection.stories.ts +1 -1
- package/src/components/or-card-collection-v3/OrCardCollection.docs.mdx +4 -0
- package/src/components/or-card-collection-v3/OrCardCollection.stories3.ts +246 -30
- package/src/components/or-card-collection-v3/OrCardCollection.vue +132 -77
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue2.vue +41 -0
- package/src/components/or-card-collection-v3/OrCardCollectionView.vue3.vue +42 -0
- package/src/components/or-card-collection-v3/props.ts +14 -1
- package/src/components/or-card-collection-v3/styles.ts +6 -4
- package/src/components/or-card-collection-v3/types.ts +9 -3
- package/src/components/or-code/OrCode.vue +3 -1
- package/src/components/or-empty-state-v3/OrEmptyState.vue +16 -10
- package/src/components/or-input-box-v3/OrInputBox.vue +1 -2
- package/src/components/or-menu-v3/OrMenu.stories3.ts +1 -1
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +2 -0
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +32 -6
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorNode.ts +40 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/codemirrorView.ts +257 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/index.ts +1 -0
- package/src/components/or-rich-text-editor-v3/utils/codemirror/types.ts +22 -0
- package/src/components/or-rich-text-editor-v3/utils/markdown.ts +2 -0
- package/src/components/or-search-v3/OrSearch.stories3.ts +1 -1
- package/src/components/or-search-v3/OrSearch.vue +8 -2
- package/src/components/or-teleport-v3/OrTeleport.stories3.ts +1 -1
- package/dist/bundled/v2/OrCardCollection-a9a779ea.js +0 -228
- package/dist/bundled/v2/OrCode-0cd991a1.js +0 -29579
- package/dist/bundled/v2/index.es-3f39f316.js +0 -115
- package/dist/bundled/v3/OrCardCollection.vue_vue_type_script_lang-3993a015.js +0 -164
- package/dist/bundled/v3/OrCode.vue_vue_type_script_lang-6c5f94a6.js +0 -29457
- package/dist/bundled/v3/index.es-3f39f316.js +0 -115
- package/dist/esm/v2/OrCardCollection-4f001551.js +0 -227
- package/dist/esm/v3/OrCardCollection-5a0febaf.js +0 -198
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="contentStyles">
|
|
3
|
+
<slot
|
|
4
|
+
v-for="(item, index) in items"
|
|
5
|
+
:key="item.key || index"
|
|
6
|
+
name="item"
|
|
7
|
+
v-bind="{
|
|
8
|
+
item,
|
|
9
|
+
mode,
|
|
10
|
+
}"
|
|
11
|
+
>
|
|
12
|
+
{{ item.key }}
|
|
13
|
+
</slot>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<script lang="ts">
|
|
17
|
+
import { defineComponent, computed, PropType } from 'vue-demi';
|
|
18
|
+
import { CardCollectionContent, CardCollectionContentViews } from './styles';
|
|
19
|
+
import { CardCollectionItem } from './types';
|
|
20
|
+
import { DefaultCardCollectionViews } from './props';
|
|
21
|
+
|
|
22
|
+
export default defineComponent({
|
|
23
|
+
name: 'OrCardCollectionView',
|
|
24
|
+
props: {
|
|
25
|
+
items: {
|
|
26
|
+
type: Array as PropType<CardCollectionItem[]>,
|
|
27
|
+
default: [] as CardCollectionItem[],
|
|
28
|
+
},
|
|
29
|
+
mode: {
|
|
30
|
+
type: String as PropType<DefaultCardCollectionViews>,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
setup(props) {
|
|
35
|
+
const contentStyles = computed(() => [
|
|
36
|
+
...CardCollectionContent,
|
|
37
|
+
...CardCollectionContentViews[props.mode],
|
|
38
|
+
]);
|
|
39
|
+
return { contentStyles };
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { ViewMode } from './types';
|
|
2
|
+
|
|
3
|
+
export enum DefaultCardCollectionViews {
|
|
2
4
|
Grid = 'grid',
|
|
3
5
|
List = 'list',
|
|
4
6
|
}
|
|
7
|
+
|
|
8
|
+
export const gridView: ViewMode = {
|
|
9
|
+
view: DefaultCardCollectionViews.Grid,
|
|
10
|
+
icon: 'grid_view',
|
|
11
|
+
};
|
|
12
|
+
export const listView: ViewMode = {
|
|
13
|
+
view: DefaultCardCollectionViews.List,
|
|
14
|
+
icon: 'view_agenda',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const defaultViewModes = [gridView, listView];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DefaultCardCollectionViews } from './props';
|
|
2
2
|
|
|
3
3
|
export const CardCollectionRoot: string[] = [
|
|
4
4
|
// Layout
|
|
@@ -25,7 +25,7 @@ export const CardCollectionToolbarPanel: string[] = [
|
|
|
25
25
|
'layout-row',
|
|
26
26
|
|
|
27
27
|
// Spacing
|
|
28
|
-
'gap-
|
|
28
|
+
'gap-lg+',
|
|
29
29
|
];
|
|
30
30
|
|
|
31
31
|
export const CardCollectionContent: string[] = [
|
|
@@ -36,7 +36,7 @@ export const CardCollectionContent: string[] = [
|
|
|
36
36
|
'gap-sm md:gap-md',
|
|
37
37
|
];
|
|
38
38
|
|
|
39
|
-
export const CardCollectionContentViews: Record<
|
|
39
|
+
export const CardCollectionContentViews: Record<DefaultCardCollectionViews, string[]> = {
|
|
40
40
|
'grid': [
|
|
41
41
|
// Layout
|
|
42
42
|
'sm:grid-cols-1',
|
|
@@ -45,5 +45,7 @@ export const CardCollectionContentViews: Record<CardCollectionView, string[]> =
|
|
|
45
45
|
'xl:grid-cols-6',
|
|
46
46
|
],
|
|
47
47
|
|
|
48
|
-
'list': [
|
|
48
|
+
'list': [
|
|
49
|
+
'grid-cols-1',
|
|
50
|
+
],
|
|
49
51
|
};
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
export interface CardCollectionItem {
|
|
2
|
-
|
|
2
|
+
key?: string;
|
|
3
|
+
[key: string|number]: any;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
|
-
export interface
|
|
6
|
-
|
|
6
|
+
export interface ViewMode {
|
|
7
|
+
view: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SortOption {
|
|
7
12
|
label: string;
|
|
13
|
+
value: string;
|
|
8
14
|
}
|
|
@@ -83,7 +83,8 @@
|
|
|
83
83
|
<script lang="ts">
|
|
84
84
|
import { Language, LanguageSupport } from '@codemirror/language';
|
|
85
85
|
import { EditorState, Extension, Transaction } from '@codemirror/state';
|
|
86
|
-
import { ViewUpdate } from '@codemirror/view';
|
|
86
|
+
import { ViewUpdate, keymap } from '@codemirror/view';
|
|
87
|
+
import { indentWithTab } from '@codemirror/commands';
|
|
87
88
|
import { useElementHover } from '@vueuse/core';
|
|
88
89
|
import { basicSetup, EditorView } from 'codemirror';
|
|
89
90
|
import _ from 'lodash';
|
|
@@ -257,6 +258,7 @@ export default defineComponent({
|
|
|
257
258
|
}),
|
|
258
259
|
// line wrapping
|
|
259
260
|
lineWrapping ? EditorView.lineWrapping : undefined,
|
|
261
|
+
keymap.of([indentWithTab]),
|
|
260
262
|
]) as Extension[];
|
|
261
263
|
|
|
262
264
|
// Append Extensions (such as basic-setup)
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
3
|
ref="root"
|
|
4
|
-
:class="rootClasses"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
:class="rootClasses"
|
|
5
|
+
>
|
|
6
|
+
<img
|
|
7
|
+
v-if="imageSrc"
|
|
8
|
+
:src="imageSrc"
|
|
9
|
+
:class="imageClasses"
|
|
10
|
+
alt=""
|
|
11
|
+
>
|
|
9
12
|
<div :class="headingClasses">
|
|
10
13
|
{{ heading }}
|
|
11
14
|
</div>
|
|
12
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
v-if="$slots.default"
|
|
17
|
+
:class="slotClasses"
|
|
18
|
+
>
|
|
13
19
|
<!-- @slot Additional content can be inserted via default slot. The slot uses the same font as a `text` prop. -->
|
|
14
|
-
<slot/>
|
|
20
|
+
<slot />
|
|
15
21
|
</div>
|
|
16
22
|
<div :class="textClasses">
|
|
17
23
|
{{ text }}
|
|
@@ -21,7 +27,7 @@
|
|
|
21
27
|
|
|
22
28
|
<script lang="ts">
|
|
23
29
|
import { computed, defineComponent, PropType, ref } from 'vue-demi';
|
|
24
|
-
import { EmptyStateSize } from '
|
|
30
|
+
import { EmptyStateSize } from './props';
|
|
25
31
|
import {
|
|
26
32
|
EmptyStateContent,
|
|
27
33
|
EmptyStateContentSizes,
|
|
@@ -31,7 +37,7 @@ import {
|
|
|
31
37
|
EmptyStateImageSizes,
|
|
32
38
|
EmptyStateRoot,
|
|
33
39
|
EmptyStateText,
|
|
34
|
-
EmptyStateTextSizes
|
|
40
|
+
EmptyStateTextSizes,
|
|
35
41
|
} from './styles';
|
|
36
42
|
|
|
37
43
|
/**
|
|
@@ -110,7 +116,7 @@ export default defineComponent({
|
|
|
110
116
|
headingClasses,
|
|
111
117
|
textClasses,
|
|
112
118
|
slotClasses,
|
|
113
|
-
}
|
|
119
|
+
};
|
|
114
120
|
},
|
|
115
121
|
});
|
|
116
122
|
</script>
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
<script lang="ts">
|
|
15
15
|
import { computed, defineComponent, PropType, ref } from 'vue-demi';
|
|
16
|
-
import { InputBoxVariant } from '.';
|
|
17
16
|
import { useClassAttribute } from '../../hooks';
|
|
18
|
-
import { InputBoxSize } from './props';
|
|
17
|
+
import { InputBoxSize, InputBoxVariant } from './props';
|
|
19
18
|
import { InputBoxRoot, InputBoxRootSizes, InputBoxRootVariants } from './styles';
|
|
20
19
|
|
|
21
20
|
export default defineComponent({
|
|
@@ -94,6 +94,8 @@ import Highlight from '@tiptap/extension-highlight';
|
|
|
94
94
|
import Heading, { Level } from '@tiptap/extension-heading';
|
|
95
95
|
import Placeholder from '@tiptap/extension-placeholder';
|
|
96
96
|
|
|
97
|
+
import codemirrorNode from './utils/codemirror/codemirrorNode';
|
|
98
|
+
|
|
97
99
|
export default defineComponent({
|
|
98
100
|
name: 'OrRichTextEditor',
|
|
99
101
|
|
|
@@ -213,7 +215,6 @@ export default defineComponent({
|
|
|
213
215
|
},
|
|
214
216
|
onCreate: ({ editor }) => {
|
|
215
217
|
if (props.markdownFormat) {
|
|
216
|
-
console.log(proxyModelValue.value, 'on crete');
|
|
217
218
|
const deserialized = deserialize(editor.schema, proxyModelValue.value);
|
|
218
219
|
editor.commands.setContent(deserialized);
|
|
219
220
|
} else {
|
|
@@ -223,8 +224,10 @@ export default defineComponent({
|
|
|
223
224
|
element: editorRef.value,
|
|
224
225
|
autofocus: props.autofocus,
|
|
225
226
|
extensions: [
|
|
227
|
+
codemirrorNode,
|
|
226
228
|
StarterKit.configure({
|
|
227
229
|
heading: false,
|
|
230
|
+
codeBlock: false,
|
|
228
231
|
}),
|
|
229
232
|
Heading.configure({ levels: headingLevels }).extend({
|
|
230
233
|
levels: headingLevels,
|
|
@@ -274,12 +277,10 @@ export default defineComponent({
|
|
|
274
277
|
// Computed
|
|
275
278
|
const proxyModelValue = computed({
|
|
276
279
|
get: () => {
|
|
277
|
-
console.log('modelV: ', props.modelValue, 'v: ', props.value);
|
|
278
280
|
return props.modelValue ?? props.value; // TODO: Remove Vue 2 fallback
|
|
279
281
|
},
|
|
280
282
|
|
|
281
283
|
set: (value) => {
|
|
282
|
-
console.log(value, 'set');
|
|
283
284
|
context.emit('input', value);
|
|
284
285
|
context.emit('update:modelValue', value);
|
|
285
286
|
},
|
|
@@ -313,7 +314,13 @@ export default defineComponent({
|
|
|
313
314
|
editor?.chain().focus().toggleBlockquote().run();
|
|
314
315
|
}
|
|
315
316
|
else if (item === 'codeBlock') {
|
|
316
|
-
|
|
317
|
+
if (!isActive.value['codeBlock']) {
|
|
318
|
+
// isActive.value['codeBlock'] = true;
|
|
319
|
+
editor?.commands.setNode('code_block', { language: 'javascript' });
|
|
320
|
+
} else {
|
|
321
|
+
// isActive.value['codeBlock'] = false;
|
|
322
|
+
editor?.commands.setNode('paragraph');
|
|
323
|
+
}
|
|
317
324
|
}
|
|
318
325
|
else if (item === 'heading') {
|
|
319
326
|
if (!level) {
|
|
@@ -360,7 +367,11 @@ export default defineComponent({
|
|
|
360
367
|
const setActiveFormats = () => {
|
|
361
368
|
const toolbarList = props.toolbar.flat() as string[];
|
|
362
369
|
toolbarList.forEach((item) => {
|
|
363
|
-
|
|
370
|
+
if (item === 'codeBlock') {
|
|
371
|
+
isActive.value[item] = editor?.isActive('code_block') || false;
|
|
372
|
+
} else {
|
|
373
|
+
isActive.value[item] = editor?.isActive(item) || false;
|
|
374
|
+
}
|
|
364
375
|
});
|
|
365
376
|
};
|
|
366
377
|
|
|
@@ -414,7 +425,6 @@ export default defineComponent({
|
|
|
414
425
|
|
|
415
426
|
//Effects
|
|
416
427
|
watch(proxyModelValue, (value) => {
|
|
417
|
-
console.log(value, 'watch');
|
|
418
428
|
if (value !== editor?.getHTML() && !props.markdownFormat) {
|
|
419
429
|
editor?.commands.setContent(value as string);
|
|
420
430
|
}
|
|
@@ -482,5 +492,21 @@ export default defineComponent({
|
|
|
482
492
|
pointer-events: none;
|
|
483
493
|
float: left;
|
|
484
494
|
}
|
|
495
|
+
|
|
496
|
+
.cm-editor {
|
|
497
|
+
border: solid 1px #838990;
|
|
498
|
+
border-radius: 4px;
|
|
499
|
+
|
|
500
|
+
&.cm-focused {
|
|
501
|
+
outline: none;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.cm-line {
|
|
505
|
+
&:hover {
|
|
506
|
+
background-color: rgba(0, 95, 177, 0.08);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
}
|
|
485
511
|
}
|
|
486
512
|
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import CodeBlockView from './codemirrorView';
|
|
3
|
+
import { minimalSetup } from 'codemirror';
|
|
4
|
+
import { javascript } from '@codemirror/lang-javascript';
|
|
5
|
+
|
|
6
|
+
export default Node.create({
|
|
7
|
+
name: 'code_block',
|
|
8
|
+
content: 'text*',
|
|
9
|
+
marks: '',
|
|
10
|
+
group: 'block',
|
|
11
|
+
code: true,
|
|
12
|
+
defining: true,
|
|
13
|
+
isolating: true,
|
|
14
|
+
|
|
15
|
+
parseHTML() {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
tag: 'pre',
|
|
19
|
+
preserveWhitespace: 'full',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
renderHTML() {
|
|
25
|
+
return ['pre', ['code', 0]];
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
addNodeView() {
|
|
29
|
+
return ({ node, editor, getPos }) => {
|
|
30
|
+
return new CodeBlockView({
|
|
31
|
+
node,
|
|
32
|
+
view: editor.view,
|
|
33
|
+
getPos: getPos as () => number,
|
|
34
|
+
cmOptions: {
|
|
35
|
+
extensions: [minimalSetup, javascript()],
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { Selection, TextSelection } from 'prosemirror-state';
|
|
2
|
+
import { EditorView, NodeView } from 'prosemirror-view';
|
|
3
|
+
import { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
4
|
+
import { exitCode } from 'prosemirror-commands';
|
|
5
|
+
import { EditorState as CMState, Transaction as CMTransaction } from '@codemirror/state';
|
|
6
|
+
import { Command, EditorView as CMView, keymap } from '@codemirror/view';
|
|
7
|
+
|
|
8
|
+
import { ComputeChange, CodeMirrorViewOptions } from './types';
|
|
9
|
+
|
|
10
|
+
declare module '@tiptap/core' {
|
|
11
|
+
interface Commands<ReturnType> {
|
|
12
|
+
codeBlock: {
|
|
13
|
+
/**
|
|
14
|
+
* Set a code block
|
|
15
|
+
*/
|
|
16
|
+
setCodeBlock: (attributes?: { language: string; }) => ReturnType;
|
|
17
|
+
/**
|
|
18
|
+
* Toggle a code block
|
|
19
|
+
*/
|
|
20
|
+
toggleCodeBlock: (attributes?: { language: string; }) => ReturnType;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const computeChange = (oldVal: string, newVal: string): ComputeChange | null => {
|
|
26
|
+
if (oldVal === newVal) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let start = 0;
|
|
31
|
+
let oldEnd = oldVal.length;
|
|
32
|
+
let newEnd = newVal.length;
|
|
33
|
+
|
|
34
|
+
while (start < oldEnd && oldVal.charCodeAt(start) === newVal.charCodeAt(start)) {
|
|
35
|
+
start += 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
while (oldEnd > start && newEnd > start && oldVal.charCodeAt(oldEnd - 1) === newVal.charCodeAt(newEnd - 1)) {
|
|
39
|
+
oldEnd -= 1;
|
|
40
|
+
newEnd -= 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
from: start,
|
|
45
|
+
to: oldEnd,
|
|
46
|
+
text: newVal.slice(start, newEnd),
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
class CodeMirrorView implements NodeView {
|
|
51
|
+
name: string;
|
|
52
|
+
|
|
53
|
+
node: ProsemirrorNode;
|
|
54
|
+
|
|
55
|
+
view: EditorView;
|
|
56
|
+
|
|
57
|
+
dom: HTMLElement;
|
|
58
|
+
|
|
59
|
+
cm: CMView;
|
|
60
|
+
|
|
61
|
+
getPos: () => number;
|
|
62
|
+
|
|
63
|
+
updating = false;
|
|
64
|
+
|
|
65
|
+
constructor(options: CodeMirrorViewOptions) {
|
|
66
|
+
// Store for later
|
|
67
|
+
this.node = options.node;
|
|
68
|
+
this.view = options.view;
|
|
69
|
+
const cmExtensions = options.cmOptions?.extensions || [];
|
|
70
|
+
this.name = 'codeBlock',
|
|
71
|
+
|
|
72
|
+
this.getPos = options.getPos as () => number;
|
|
73
|
+
|
|
74
|
+
const changeFilter = CMState.changeFilter.of((tr) => {
|
|
75
|
+
if (!tr.docChanged && !this.updating) {
|
|
76
|
+
this.forwardSelection();
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Create a CodeMirror instancew
|
|
82
|
+
this.cm = new CMView({
|
|
83
|
+
dispatch: this.dispatch.bind(this),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// The editor's outer node is our DOM representation
|
|
87
|
+
this.dom = this.cm.dom;
|
|
88
|
+
|
|
89
|
+
const cmState = CMState.create({
|
|
90
|
+
doc: this.node.textContent,
|
|
91
|
+
extensions: [
|
|
92
|
+
changeFilter,
|
|
93
|
+
keymap.of([
|
|
94
|
+
{
|
|
95
|
+
key: 'ArrowUp',
|
|
96
|
+
run: this.mayBeEscape('line', -1),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
key: 'ArrowLeft',
|
|
100
|
+
run: this.mayBeEscape('char', -1),
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
key: 'ArrowDown',
|
|
104
|
+
run: this.mayBeEscape('line', 1),
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
key: 'ArrowRight',
|
|
108
|
+
run: this.mayBeEscape('char', 1),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
key: 'Ctrl-Enter',
|
|
112
|
+
run: () => {
|
|
113
|
+
if (exitCode(this.view.state, this.view.dispatch)) {
|
|
114
|
+
this.view.focus();
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
]),
|
|
121
|
+
cmExtensions,
|
|
122
|
+
],
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
this.cm.setState(cmState);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
forwardSelection() {
|
|
129
|
+
if (!this.cm.hasFocus) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const { state } = this.view;
|
|
134
|
+
const selection = this.asProseMirrorSelection(state.doc);
|
|
135
|
+
|
|
136
|
+
if (!selection.eq(state.selection)) {
|
|
137
|
+
this.view.dispatch(state.tr.setSelection(selection));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
asProseMirrorSelection(doc: ProsemirrorNode) {
|
|
142
|
+
const offset = this.getPos() + 1;
|
|
143
|
+
const { anchor, head } = this.cm.state.selection.main;
|
|
144
|
+
return TextSelection.create(doc, anchor + offset, head + offset);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
dispatch(cmTr: CMTransaction) {
|
|
148
|
+
this.cm.setState(cmTr.state);
|
|
149
|
+
|
|
150
|
+
if (cmTr.docChanged && !this.updating) {
|
|
151
|
+
const start = this.getPos() + 1;
|
|
152
|
+
|
|
153
|
+
const cmValue = cmTr.state.doc.toString();
|
|
154
|
+
const change = computeChange(this.node.textContent, cmValue);
|
|
155
|
+
|
|
156
|
+
if (!change) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const content = change.text ? this.view.state.schema.text(change.text) : null;
|
|
161
|
+
|
|
162
|
+
const tr = this.view.state.tr.replaceWith(change.from + start, change.to + start, content as ProsemirrorNode);
|
|
163
|
+
this.view.dispatch(tr);
|
|
164
|
+
this.forwardSelection();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
mayBeEscape(unit: 'char' | 'line', dir: -1 | 1): Command {
|
|
169
|
+
return (view) => {
|
|
170
|
+
const { state } = view;
|
|
171
|
+
const { selection } = state;
|
|
172
|
+
|
|
173
|
+
const offsetToPos = () => {
|
|
174
|
+
const offset = selection.main.from;
|
|
175
|
+
const line = state.doc.lineAt(offset);
|
|
176
|
+
return {
|
|
177
|
+
line: line.number,
|
|
178
|
+
ch: offset - line.from,
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const pos = offsetToPos();
|
|
183
|
+
const hasSelection = state.selection.ranges.some((r) => !r.empty);
|
|
184
|
+
|
|
185
|
+
const firstLine = 1;
|
|
186
|
+
const lastLine = state.doc.lineAt(state.doc.length).number;
|
|
187
|
+
|
|
188
|
+
if (
|
|
189
|
+
hasSelection
|
|
190
|
+
|| pos.line !== (dir < 0 ? firstLine : lastLine)
|
|
191
|
+
|| (unit === 'char' && pos.ch !== (dir < 0 ? 0 : state.doc.line(pos.line).length))
|
|
192
|
+
) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const targetPos = this.getPos() + (dir < 0 ? 0 : this.node.nodeSize);
|
|
197
|
+
const pmSelection = Selection.near(this.view.state.doc.resolve(targetPos), dir);
|
|
198
|
+
this.view.dispatch(this.view.state.tr.setSelection(pmSelection).scrollIntoView());
|
|
199
|
+
this.view.focus();
|
|
200
|
+
return true;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
update(node: ProsemirrorNode) {
|
|
205
|
+
if (node.type !== this.node.type) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
this.node = node;
|
|
210
|
+
const change = computeChange(this.cm.state.doc.toString(), node.textContent);
|
|
211
|
+
|
|
212
|
+
if (change) {
|
|
213
|
+
this.updating = true;
|
|
214
|
+
this.cm.dispatch({
|
|
215
|
+
changes: {
|
|
216
|
+
from: change.from,
|
|
217
|
+
to: change.to,
|
|
218
|
+
insert: change.text,
|
|
219
|
+
},
|
|
220
|
+
});
|
|
221
|
+
this.updating = false;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
setSelection(anchor: number, head: number): void {
|
|
228
|
+
this.focus();
|
|
229
|
+
this.updating = true;
|
|
230
|
+
this.cm.dispatch({
|
|
231
|
+
selection: {
|
|
232
|
+
anchor,
|
|
233
|
+
head,
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
this.updating = false;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
focus() {
|
|
240
|
+
this.cm.focus();
|
|
241
|
+
this.forwardSelection();
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
selectNode() {
|
|
245
|
+
this.focus();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
stopEvent() {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
destroy() {
|
|
253
|
+
this.cm.destroy();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export default CodeMirrorView;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CodeMirrorView } from './codemirrorView';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EditorView } from 'prosemirror-view';
|
|
2
|
+
import type { Node as ProsemirrorNode } from 'prosemirror-model';
|
|
3
|
+
import type { Extension } from '@codemirror/state';
|
|
4
|
+
|
|
5
|
+
export interface ComputeChange {
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CMOptions {
|
|
12
|
+
extensions: Extension;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type GetPos = () => number | undefined;
|
|
16
|
+
|
|
17
|
+
export interface CodeMirrorViewOptions {
|
|
18
|
+
node: ProsemirrorNode;
|
|
19
|
+
view: EditorView;
|
|
20
|
+
getPos: GetPos;
|
|
21
|
+
cmOptions?: CMOptions;
|
|
22
|
+
}
|
|
@@ -35,6 +35,12 @@ export default defineComponent({
|
|
|
35
35
|
inheritAttrs: false,
|
|
36
36
|
|
|
37
37
|
props: {
|
|
38
|
+
modelValue: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '',
|
|
41
|
+
required: false,
|
|
42
|
+
},
|
|
43
|
+
|
|
38
44
|
size: {
|
|
39
45
|
type: String as PropType<SearchSize>,
|
|
40
46
|
default: SearchSize.M,
|
|
@@ -42,7 +48,7 @@ export default defineComponent({
|
|
|
42
48
|
|
|
43
49
|
placeholder: {
|
|
44
50
|
type: String,
|
|
45
|
-
default:
|
|
51
|
+
default: 'Search',
|
|
46
52
|
},
|
|
47
53
|
|
|
48
54
|
debounce: {
|
|
@@ -90,7 +96,7 @@ export default defineComponent({
|
|
|
90
96
|
]);
|
|
91
97
|
|
|
92
98
|
// State
|
|
93
|
-
const localModelValue = ref('');
|
|
99
|
+
const localModelValue = ref(props.modelValue ?? '');
|
|
94
100
|
|
|
95
101
|
// Events
|
|
96
102
|
debouncedWatch(
|