@voicenter-team/voicenter-ui-plus 4.0.0-beta.1 → 4.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION_v3.md +196 -0
- package/README.md +20 -51
- package/library/assets/assets/sass/main.css +1 -1
- package/library/assets/components/VcChatComposer/VcChatComposer.css +1 -1
- package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
- package/library/assets/components/VcMdEditor/VcMdEditorContent.css +1 -1
- package/library/assets/components/VcSoundplayer/VcSoundPlayerCompact.css +1 -0
- package/library/assets/components/VcSoundplayer/VcSoundVolume.css +1 -1
- package/library/components/VcChatComposer/VcChatComposer.vue.mjs +173 -139
- package/library/components/VcChatComposer/tiptap.mjs +45 -0
- package/library/components/VcCodeBlock/VcCodeBlock.vue.mjs +18 -5
- package/library/components/VcCodeBlock/highlight.mjs +8 -0
- package/library/components/VcEmojiPicker/VcEmojiPicker.vue.mjs +3 -4
- package/library/components/VcEmojiPicker/emojiData.mjs +16 -21
- package/library/components/VcHtmlEditor/VcHtmlEditor.vue.mjs +19 -12
- package/library/components/VcHtmlEditor/codemirror.mjs +14 -0
- package/library/components/VcImageUploader/VcImageUploader.vue.mjs +14 -8
- package/library/components/VcImageUploader/cropper.mjs +5 -0
- package/library/components/VcJsonSchema/Components/JsonCodeMirror.vue.mjs +16 -7
- package/library/components/VcJsonSchema/Components/codemirror.mjs +15 -0
- package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
- package/library/components/VcMdEditor/ParameterNode.vue2.mjs +2 -2
- package/library/components/VcMdEditor/VcMdEditor.vue.mjs +114 -108
- package/library/components/VcMdEditor/VcMdEditorContent.vue.mjs +18 -21
- package/library/components/VcMdEditor/ltrNumbersPlugin.mjs +42 -39
- package/library/components/VcMdEditor/mdEditor.config.mjs +107 -99
- package/library/components/VcMdEditor/milkdown.mjs +67 -0
- package/library/components/VcMdEditor/rtlCursorPlugin.mjs +3 -3
- package/library/components/VcPdfViewer/VcPdfDocument.vue.mjs +4 -8
- package/library/components/VcPdfViewer/pdfjslib.mjs +13 -16
- package/library/components/VcSoundplayer/VcPlayerPlayStopButton.vue.mjs +2 -1
- package/library/components/VcSoundplayer/VcSoundPlayer.vue.mjs +2 -8
- package/library/components/VcSoundplayer/VcSoundPlayerCompact.vue.mjs +197 -0
- package/library/components/VcSoundplayer/VcSoundPlayerCompact.vue3.mjs +5 -0
- package/library/components/VcSoundplayer/VcSoundPlayerProgress.vue.mjs +1 -1
- package/library/components/VcSoundplayer/VcSoundPlayerWrapper.vue.mjs +19 -7
- package/library/components/VcSoundplayer/player.options.mjs +8 -0
- package/library/components/VcSoundplayer/wavesurfer.mjs +14 -0
- package/library/index.mjs +59 -56
- package/library/index.mjs.br +0 -0
- package/library/index.mjs.gz +0 -0
- package/library/plugin-components.gen.mjs +91 -88
- package/library/plugin.mjs +59 -56
- package/library/plugin.mjs.br +0 -0
- package/library/plugin.mjs.gz +0 -0
- package/library/style.css +7 -5
- package/library/style.css.br +0 -0
- package/library/style.css.gz +0 -0
- package/library/types/components/VcChatComposer/VcChatComposer.vue.d.ts +2 -1
- package/library/types/components/VcChatComposer/tiptap.d.ts +61 -0
- package/library/types/components/VcCodeBlock/highlight.d.ts +3 -0
- package/library/types/components/VcEmojiPicker/VcEmojiPicker.vue.d.ts +1 -1
- package/library/types/components/VcEmojiPicker/emojiData.d.ts +3 -3
- package/library/types/components/VcHtmlEditor/codemirror.d.ts +8 -0
- package/library/types/components/VcImageUploader/VcImageUploader.vue.d.ts +1 -1
- package/library/types/components/VcImageUploader/cropper.d.ts +34 -0
- package/library/types/components/VcJsonSchema/Components/codemirror.d.ts +9 -0
- package/library/types/components/VcMdEditor/ltrNumbersPlugin.d.ts +7 -13
- package/library/types/components/VcMdEditor/mdEditor.config.d.ts +12 -16
- package/library/types/components/VcMdEditor/milkdown.d.ts +25 -0
- package/library/types/components/VcMdEditor/rtlCursorPlugin.d.ts +3 -2
- package/library/types/components/VcPdfViewer/VcPdfDocument.vue.d.ts +1 -1
- package/library/types/components/VcPdfViewer/VcPdfDocumentPage.vue.d.ts +1 -1
- package/library/types/components/VcPdfViewer/pdfjslib.d.ts +1 -1
- package/library/types/components/VcSoundplayer/VcPlayerPlayStopButton.vue.d.ts +11 -0
- package/library/types/components/VcSoundplayer/VcSoundPlayerCompact.vue.d.ts +75 -0
- package/library/types/components/VcSoundplayer/VcSoundPlayerWrapper.vue.d.ts +3 -1
- package/library/types/components/VcSoundplayer/player.options.d.ts +2 -0
- package/library/types/components/VcSoundplayer/wavesurfer.d.ts +8 -0
- package/library/types/components/exports.d.ts +3 -1
- package/library/types/components.gen.d.ts +1 -0
- package/library/types/types/VcSoundPlayer.types.d.ts +1 -1
- package/library/types/utils/optionalPeer.d.ts +33 -0
- package/library/utils/excelParser/helper.mjs +2 -7
- package/library/utils/optionalPeer.mjs +32 -0
- package/package.json +96 -1
- package/src/theme/index.ts +101 -101
- package/src/theme/theme.types.ts +31 -31
- package/tailwind.config.d.ts +5 -5
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { $prose } from "@milkdown/utils";
|
|
2
|
-
import { Plugin, PluginKey } from "@milkdown/kit/prose/state";
|
|
3
|
-
import { DecorationSet, Decoration } from "@milkdown/kit/prose/view";
|
|
4
1
|
import { findNumberRuns } from "../../utils/numberRuns.mjs";
|
|
5
|
-
const ltrNumbersKey = new PluginKey("VC_LTR_NUMBERS");
|
|
6
2
|
const PLACEHOLDER = "";
|
|
7
3
|
function textOfBlock(block) {
|
|
8
4
|
let text = "";
|
|
@@ -12,44 +8,51 @@ function textOfBlock(block) {
|
|
|
12
8
|
});
|
|
13
9
|
return text;
|
|
14
10
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
decorations.push(Decoration.inline(start + from, start + to, { dir: "ltr" }));
|
|
11
|
+
function createLtrNumbers(milkdown) {
|
|
12
|
+
const { Plugin, PluginKey } = milkdown.kit.proseState;
|
|
13
|
+
const { Decoration, DecorationSet } = milkdown.kit.proseView;
|
|
14
|
+
const ltrNumbersKey = new PluginKey("VC_LTR_NUMBERS");
|
|
15
|
+
function ltrNumberDecorations(doc) {
|
|
16
|
+
const decorations = [];
|
|
17
|
+
doc.descendants((node, position) => {
|
|
18
|
+
if (!node.isTextblock) {
|
|
19
|
+
return true;
|
|
25
20
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
function ltrNumbersPlugin(enabled) {
|
|
32
|
-
return $prose(() => new Plugin({
|
|
33
|
-
key: ltrNumbersKey,
|
|
34
|
-
state: {
|
|
35
|
-
init: (_, state) => enabled() ? ltrNumberDecorations(state.doc) : DecorationSet.empty,
|
|
36
|
-
apply: (transaction, decorations, _, state) => {
|
|
37
|
-
if (!transaction.docChanged && !transaction.getMeta(ltrNumbersKey)) {
|
|
38
|
-
return decorations;
|
|
21
|
+
if (!node.type.spec.code) {
|
|
22
|
+
const start = position + 1;
|
|
23
|
+
for (const [from, to] of findNumberRuns(textOfBlock(node))) {
|
|
24
|
+
decorations.push(Decoration.inline(start + from, start + to, { dir: "ltr" }));
|
|
39
25
|
}
|
|
40
|
-
return enabled() ? ltrNumberDecorations(state.doc) : DecorationSet.empty;
|
|
41
26
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
return false;
|
|
28
|
+
});
|
|
29
|
+
return DecorationSet.create(doc, decorations);
|
|
30
|
+
}
|
|
31
|
+
function ltrNumbersPlugin(enabled) {
|
|
32
|
+
return milkdown.utils.$prose(() => new Plugin({
|
|
33
|
+
key: ltrNumbersKey,
|
|
34
|
+
state: {
|
|
35
|
+
init: (_, state) => enabled() ? ltrNumberDecorations(state.doc) : DecorationSet.empty,
|
|
36
|
+
apply: (transaction, decorations, _, state) => {
|
|
37
|
+
if (!transaction.docChanged && !transaction.getMeta(ltrNumbersKey)) {
|
|
38
|
+
return decorations;
|
|
39
|
+
}
|
|
40
|
+
return enabled() ? ltrNumberDecorations(state.doc) : DecorationSet.empty;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
props: {
|
|
44
|
+
decorations: (state) => ltrNumbersKey.getState(state)
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
function refreshLtrNumbers(view) {
|
|
49
|
+
view.dispatch(view.state.tr.setMeta(ltrNumbersKey, true));
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
ltrNumbersPlugin,
|
|
53
|
+
refreshLtrNumbers
|
|
54
|
+
};
|
|
50
55
|
}
|
|
51
56
|
export {
|
|
52
|
-
|
|
53
|
-
ltrNumbersPlugin,
|
|
54
|
-
refreshLtrNumbers
|
|
57
|
+
createLtrNumbers
|
|
55
58
|
};
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { computed } from "vue";
|
|
2
2
|
import { tVU } from "../../localization/index.mjs";
|
|
3
|
-
import { Plugin, PluginKey, TextSelection } from "@milkdown/kit/prose/state";
|
|
4
|
-
import { findWrapping } from "@milkdown/kit/prose/transform";
|
|
5
|
-
import { editorViewCtx } from "@milkdown/kit/core";
|
|
6
|
-
import { codeBlockSchema, listItemSchema, orderedListSchema, bulletListSchema, hrSchema, blockquoteSchema, paragraphSchema, headingSchema } from "@milkdown/kit/preset/commonmark";
|
|
7
|
-
import { imageBlockSchema } from "@milkdown/kit/component/image-block";
|
|
8
|
-
import { createTable } from "@milkdown/kit/preset/gfm";
|
|
9
|
-
import { $prose } from "@milkdown/utils";
|
|
10
|
-
import { DecorationSet, Decoration } from "@milkdown/kit/prose/view";
|
|
11
3
|
import ParameterNode from "./ParameterNode.vue.mjs";
|
|
12
4
|
import { Heading1, Heading2, Heading3, Heading4, Heading5, Heading6, ReceiptText, Quote, Minus, List, ListOrdered, ListChecks, Image, Code, Table, SquareFunction, ListStart, ListEnd, Braces, Brackets } from "@lucide/vue";
|
|
13
5
|
const NodeParameterHiddenClass = "hidden-parameter-text";
|
|
@@ -34,30 +26,6 @@ const LIST_ITEM_SCHEMA = "listItemSchema";
|
|
|
34
26
|
const IMAGE_SCHEMA = "imageBlockSchema";
|
|
35
27
|
const CODE_BLOCK_SCHEMA = "codeBlockSchema";
|
|
36
28
|
const TABLE_SCHEMA = "tableSchema";
|
|
37
|
-
const SCHEMA_TYPES = {
|
|
38
|
-
[HEADING_SCHEMA]: headingSchema,
|
|
39
|
-
[PARAGRAPH_SCHEMA]: paragraphSchema,
|
|
40
|
-
[QUOTES_SCHEMA]: blockquoteSchema,
|
|
41
|
-
[DIVIDER_SCHEMA]: hrSchema,
|
|
42
|
-
[LIST_BULLET_SCHEMA]: bulletListSchema,
|
|
43
|
-
[LIST_ORDERED_SCHEMA]: orderedListSchema,
|
|
44
|
-
[LIST_ITEM_SCHEMA]: listItemSchema,
|
|
45
|
-
[IMAGE_SCHEMA]: imageBlockSchema,
|
|
46
|
-
[CODE_BLOCK_SCHEMA]: codeBlockSchema,
|
|
47
|
-
[TABLE_SCHEMA]: null
|
|
48
|
-
};
|
|
49
|
-
const SCHEMA_TYPE_ACTION = {
|
|
50
|
-
[HEADING_SCHEMA]: setContentBlockType,
|
|
51
|
-
[PARAGRAPH_SCHEMA]: setContentBlockType,
|
|
52
|
-
[QUOTES_SCHEMA]: setContentAndWrapInBlockType,
|
|
53
|
-
[DIVIDER_SCHEMA]: contentAddBlockType,
|
|
54
|
-
[LIST_BULLET_SCHEMA]: setContentAndWrapInBlockType,
|
|
55
|
-
[LIST_ORDERED_SCHEMA]: setContentAndWrapInBlockType,
|
|
56
|
-
[LIST_ITEM_SCHEMA]: setContentAndWrapInBlockType,
|
|
57
|
-
[IMAGE_SCHEMA]: contentAddBlockType,
|
|
58
|
-
[CODE_BLOCK_SCHEMA]: contentAddBlockType,
|
|
59
|
-
[TABLE_SCHEMA]: null
|
|
60
|
-
};
|
|
61
29
|
const headingMenuItems = computed(() => {
|
|
62
30
|
return [
|
|
63
31
|
{
|
|
@@ -170,53 +138,112 @@ const advancedMenuItems = computed(() => {
|
|
|
170
138
|
}
|
|
171
139
|
];
|
|
172
140
|
});
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
|
|
141
|
+
function createEditorActions(milkdown) {
|
|
142
|
+
const { editorViewCtx } = milkdown.kit.core;
|
|
143
|
+
const { TextSelection } = milkdown.kit.proseState;
|
|
144
|
+
const { findWrapping } = milkdown.kit.proseTransform;
|
|
145
|
+
const { createTable } = milkdown.kit.presetGfm;
|
|
146
|
+
const {
|
|
147
|
+
blockquoteSchema,
|
|
148
|
+
bulletListSchema,
|
|
149
|
+
codeBlockSchema,
|
|
150
|
+
headingSchema,
|
|
151
|
+
hrSchema,
|
|
152
|
+
listItemSchema,
|
|
153
|
+
orderedListSchema,
|
|
154
|
+
paragraphSchema
|
|
155
|
+
} = milkdown.kit.presetCommonmark;
|
|
156
|
+
const SCHEMA_TYPES = {
|
|
157
|
+
[HEADING_SCHEMA]: headingSchema,
|
|
158
|
+
[PARAGRAPH_SCHEMA]: paragraphSchema,
|
|
159
|
+
[QUOTES_SCHEMA]: blockquoteSchema,
|
|
160
|
+
[DIVIDER_SCHEMA]: hrSchema,
|
|
161
|
+
[LIST_BULLET_SCHEMA]: bulletListSchema,
|
|
162
|
+
[LIST_ORDERED_SCHEMA]: orderedListSchema,
|
|
163
|
+
[LIST_ITEM_SCHEMA]: listItemSchema,
|
|
164
|
+
[IMAGE_SCHEMA]: milkdown.kit.imageBlock.imageBlockSchema,
|
|
165
|
+
[CODE_BLOCK_SCHEMA]: codeBlockSchema,
|
|
166
|
+
[TABLE_SCHEMA]: null
|
|
167
|
+
};
|
|
168
|
+
const SCHEMA_TYPE_ACTION = {
|
|
169
|
+
[HEADING_SCHEMA]: setContentBlockType,
|
|
170
|
+
[PARAGRAPH_SCHEMA]: setContentBlockType,
|
|
171
|
+
[QUOTES_SCHEMA]: setContentAndWrapInBlockType,
|
|
172
|
+
[DIVIDER_SCHEMA]: contentAddBlockType,
|
|
173
|
+
[LIST_BULLET_SCHEMA]: setContentAndWrapInBlockType,
|
|
174
|
+
[LIST_ORDERED_SCHEMA]: setContentAndWrapInBlockType,
|
|
175
|
+
[LIST_ITEM_SCHEMA]: setContentAndWrapInBlockType,
|
|
176
|
+
[IMAGE_SCHEMA]: contentAddBlockType,
|
|
177
|
+
[CODE_BLOCK_SCHEMA]: contentAddBlockType,
|
|
178
|
+
[TABLE_SCHEMA]: null
|
|
179
|
+
};
|
|
180
|
+
function wrapInBlockType(tr, nodeType, attrs = null) {
|
|
181
|
+
const { $from, $to } = tr.selection;
|
|
182
|
+
const range = $from.blockRange($to);
|
|
183
|
+
const wrapping = range && findWrapping(range, nodeType, attrs);
|
|
184
|
+
if (!wrapping) return null;
|
|
185
|
+
return tr.wrap(range, wrapping);
|
|
176
186
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
command(state, dispatch);
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
function dispatchAdvancedEditorAction(crepeInstance, actionType) {
|
|
188
|
-
if (!crepeInstance) {
|
|
189
|
-
return;
|
|
187
|
+
function setContentAndWrapInBlockType(nodeType, attrs = null) {
|
|
188
|
+
return (state, dispatch) => {
|
|
189
|
+
const tr = wrapInBlockType(state.tr, nodeType, attrs);
|
|
190
|
+
if (!tr) return false;
|
|
191
|
+
if (dispatch) dispatch(tr.scrollIntoView());
|
|
192
|
+
return true;
|
|
193
|
+
};
|
|
190
194
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
function dispatchEditorAction(crepeInstance, actionType) {
|
|
196
|
+
if (!crepeInstance) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
crepeInstance.editor.action((ctx) => {
|
|
200
|
+
const view = ctx.get(editorViewCtx);
|
|
201
|
+
const { dispatch, state } = view;
|
|
202
|
+
const schemaType = SCHEMA_TYPES[actionType.schemaType];
|
|
203
|
+
const commandType = SCHEMA_TYPE_ACTION[actionType.schemaType];
|
|
204
|
+
if (!schemaType || !commandType) return false;
|
|
205
|
+
const command = commandType(schemaType.type(ctx), actionType.attrs);
|
|
206
|
+
command(state, dispatch);
|
|
207
|
+
});
|
|
195
208
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
209
|
+
function dispatchAdvancedEditorAction(crepeInstance, actionType) {
|
|
210
|
+
if (!crepeInstance) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (actionType.schemaType === "tableSchema") {
|
|
214
|
+
dispatchEditorTableAction(crepeInstance);
|
|
215
|
+
} else {
|
|
216
|
+
dispatchEditorAction(crepeInstance, actionType);
|
|
217
|
+
}
|
|
200
218
|
}
|
|
201
|
-
crepeInstance
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
219
|
+
function dispatchEditorTableAction(crepeInstance) {
|
|
220
|
+
if (!crepeInstance) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
crepeInstance.editor.action((ctx) => {
|
|
224
|
+
const view = ctx.get(editorViewCtx);
|
|
225
|
+
const { dispatch, state } = view;
|
|
226
|
+
let { tr } = state;
|
|
227
|
+
const from = tr.selection.from;
|
|
228
|
+
const table = createTable(ctx, 3, 3);
|
|
229
|
+
tr = tr.replaceSelectionWith(table);
|
|
230
|
+
dispatch(tr);
|
|
231
|
+
requestAnimationFrame(() => {
|
|
232
|
+
const docSize = view.state.doc.content.size;
|
|
233
|
+
const $pos = view.state.doc.resolve(
|
|
234
|
+
from > docSize ? docSize : from < 0 ? 0 : from
|
|
235
|
+
);
|
|
236
|
+
const selection = TextSelection.near($pos);
|
|
237
|
+
const tr2 = view.state.tr;
|
|
238
|
+
tr2.setSelection(selection);
|
|
239
|
+
dispatch(tr2.scrollIntoView());
|
|
240
|
+
});
|
|
218
241
|
});
|
|
219
|
-
}
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
dispatchEditorAction,
|
|
245
|
+
dispatchAdvancedEditorAction
|
|
246
|
+
};
|
|
220
247
|
}
|
|
221
248
|
function setBlockType(tr, nodeType, attrs = null) {
|
|
222
249
|
const { from, to } = tr.selection;
|
|
@@ -244,29 +271,16 @@ function contentAddBlockType(nodeType, attrs = null) {
|
|
|
244
271
|
return true;
|
|
245
272
|
};
|
|
246
273
|
}
|
|
247
|
-
function wrapInBlockType(tr, nodeType, attrs = null) {
|
|
248
|
-
const { $from, $to } = tr.selection;
|
|
249
|
-
const range = $from.blockRange($to);
|
|
250
|
-
const wrapping = range && findWrapping(range, nodeType, attrs);
|
|
251
|
-
if (!wrapping) return null;
|
|
252
|
-
return tr.wrap(range, wrapping);
|
|
253
|
-
}
|
|
254
|
-
function setContentAndWrapInBlockType(nodeType, attrs = null) {
|
|
255
|
-
return (state, dispatch) => {
|
|
256
|
-
const tr = wrapInBlockType(state.tr, nodeType, attrs);
|
|
257
|
-
if (!tr) return false;
|
|
258
|
-
if (dispatch) dispatch(tr.scrollIntoView());
|
|
259
|
-
return true;
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
274
|
const MUSTACHE_PATTERNS = {
|
|
263
275
|
ARRAY_BLOCK: /{{#(\w+)}}[^{]*{{\.}}[^{]*{{\/\1}}/g,
|
|
264
276
|
BLOCK_WITH_FIELDS: /{{#(\w+)}}(?:(?!{{[/#]).)*?:\s*{{.*?}}.*?{{\/\1}}/g,
|
|
265
277
|
SINGLE_LINE_BLOCK: /^[ \t]*{{[/#](\w+)}}[ \t]*$/gm,
|
|
266
278
|
SIMPLE_PARAMETER: /{{(\w+)}}/g
|
|
267
279
|
};
|
|
268
|
-
const useMustachePlugin = (replaceTest, widgetViewFactory) => {
|
|
269
|
-
|
|
280
|
+
const useMustachePlugin = (milkdown, replaceTest, widgetViewFactory) => {
|
|
281
|
+
const { Plugin, PluginKey } = milkdown.kit.proseState;
|
|
282
|
+
const { Decoration, DecorationSet } = milkdown.kit.proseView;
|
|
283
|
+
return milkdown.utils.$prose(() => {
|
|
270
284
|
const getParameterWidget = widgetViewFactory({
|
|
271
285
|
as: "span",
|
|
272
286
|
component: ParameterNode
|
|
@@ -359,20 +373,14 @@ export {
|
|
|
359
373
|
NodeParameterIcons,
|
|
360
374
|
PARAGRAPH_SCHEMA,
|
|
361
375
|
QUOTES_SCHEMA,
|
|
362
|
-
SCHEMA_TYPES,
|
|
363
|
-
SCHEMA_TYPE_ACTION,
|
|
364
376
|
TABLE_SCHEMA,
|
|
365
377
|
addEditorBlockType,
|
|
366
378
|
advancedMenuItems,
|
|
367
379
|
contentAddBlockType,
|
|
368
|
-
|
|
369
|
-
dispatchEditorAction,
|
|
370
|
-
dispatchEditorTableAction,
|
|
380
|
+
createEditorActions,
|
|
371
381
|
headingMenuItems,
|
|
372
382
|
listMenuItems,
|
|
373
383
|
setBlockType,
|
|
374
|
-
setContentAndWrapInBlockType,
|
|
375
384
|
setContentBlockType,
|
|
376
|
-
useMustachePlugin
|
|
377
|
-
wrapInBlockType
|
|
385
|
+
useMustachePlugin
|
|
378
386
|
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
import { cachedLoad, loadOptionalPeer } from "../../utils/optionalPeer.mjs";
|
|
3
|
+
const loadMilkdown = cachedLoad(async () => {
|
|
4
|
+
const [
|
|
5
|
+
vue,
|
|
6
|
+
core,
|
|
7
|
+
proseState,
|
|
8
|
+
proseView,
|
|
9
|
+
proseModel,
|
|
10
|
+
proseTransform,
|
|
11
|
+
presetCommonmark,
|
|
12
|
+
presetGfm,
|
|
13
|
+
imageBlock,
|
|
14
|
+
utils,
|
|
15
|
+
crepe,
|
|
16
|
+
adapter,
|
|
17
|
+
langMarkdown,
|
|
18
|
+
codemirror
|
|
19
|
+
] = await Promise.all([
|
|
20
|
+
loadOptionalPeer("@milkdown/vue", import("@milkdown/vue")),
|
|
21
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/core")),
|
|
22
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/prose/state")),
|
|
23
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/prose/view")),
|
|
24
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/prose/model")),
|
|
25
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/prose/transform")),
|
|
26
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/preset/commonmark")),
|
|
27
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/preset/gfm")),
|
|
28
|
+
loadOptionalPeer("@milkdown/kit", import("@milkdown/kit/component/image-block")),
|
|
29
|
+
loadOptionalPeer("@milkdown/utils", import("@milkdown/utils")),
|
|
30
|
+
loadOptionalPeer("@milkdown/crepe", import("@milkdown/crepe")),
|
|
31
|
+
loadOptionalPeer("@prosemirror-adapter/vue", import("@prosemirror-adapter/vue")),
|
|
32
|
+
loadOptionalPeer("@codemirror/lang-markdown", import("@codemirror/lang-markdown")),
|
|
33
|
+
loadOptionalPeer("vue-codemirror6", import("vue-codemirror6"))
|
|
34
|
+
]);
|
|
35
|
+
return {
|
|
36
|
+
vue,
|
|
37
|
+
kit: {
|
|
38
|
+
core,
|
|
39
|
+
proseState,
|
|
40
|
+
proseView,
|
|
41
|
+
proseModel,
|
|
42
|
+
proseTransform,
|
|
43
|
+
presetCommonmark,
|
|
44
|
+
presetGfm,
|
|
45
|
+
imageBlock
|
|
46
|
+
},
|
|
47
|
+
utils,
|
|
48
|
+
crepe,
|
|
49
|
+
adapter,
|
|
50
|
+
langMarkdown,
|
|
51
|
+
codemirror
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
const milkdownKey = Symbol("VcMdEditorMilkdown");
|
|
55
|
+
function injectMilkdown() {
|
|
56
|
+
var _a;
|
|
57
|
+
const milkdown = (_a = inject(milkdownKey)) == null ? void 0 : _a.value;
|
|
58
|
+
if (!milkdown) {
|
|
59
|
+
throw new Error("[VcMdEditor] milkdown is used before it is loaded");
|
|
60
|
+
}
|
|
61
|
+
return milkdown;
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
injectMilkdown,
|
|
65
|
+
loadMilkdown,
|
|
66
|
+
milkdownKey
|
|
67
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
1
|
+
const rtlCursorPlugin = (milkdown) => (ctx) => {
|
|
2
|
+
const { editorViewCtx } = milkdown.kit.core;
|
|
3
|
+
const { TextSelection } = milkdown.kit.proseState;
|
|
4
4
|
return async () => {
|
|
5
5
|
let eventHandler = null;
|
|
6
6
|
const setupRTLCursorFix = () => {
|
|
@@ -157,10 +157,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
157
157
|
};
|
|
158
158
|
pdfDocument.value = await documentLoadingTask.promise;
|
|
159
159
|
pageCount.value = ((_a = pdfDocument.value) == null ? void 0 : _a.numPages) || 0;
|
|
160
|
-
} catch (
|
|
160
|
+
} catch (error) {
|
|
161
161
|
pdfDocument.value = void 0;
|
|
162
162
|
pageCount.value = 0;
|
|
163
|
-
|
|
163
|
+
throw error;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
function onPrintDocument(dpi, pageNumberOnly) {
|
|
@@ -174,13 +174,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
174
174
|
}
|
|
175
175
|
watch(
|
|
176
176
|
() => props.document,
|
|
177
|
-
() =>
|
|
178
|
-
loadDocument();
|
|
179
|
-
}
|
|
177
|
+
() => loadDocument()
|
|
180
178
|
);
|
|
181
|
-
onMounted(() =>
|
|
182
|
-
loadDocument();
|
|
183
|
-
});
|
|
179
|
+
onMounted(() => loadDocument());
|
|
184
180
|
onBeforeUnmount(() => {
|
|
185
181
|
destroy();
|
|
186
182
|
});
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
return pdfPromise;
|
|
16
|
-
}
|
|
1
|
+
import { cachedLoad, loadOptionalPeer } from "../../utils/optionalPeer.mjs";
|
|
2
|
+
const loadPdf = cachedLoad(async () => {
|
|
3
|
+
const [pdf, { PDFLinkService }] = await Promise.all([
|
|
4
|
+
// @ts-expect-error -- no .d.ts ships beside build/pdf.js; the module is typed via the package root types.
|
|
5
|
+
loadOptionalPeer("pdfjs-dist", import("pdfjs-dist/build/pdf.js")),
|
|
6
|
+
loadOptionalPeer("pdfjs-dist", import("pdfjs-dist/web/pdf_viewer"))
|
|
7
|
+
]);
|
|
8
|
+
pdf.GlobalWorkerOptions.workerSrc = new URL("./pdf.worker.min.js", import.meta.url).toString();
|
|
9
|
+
return {
|
|
10
|
+
pdf,
|
|
11
|
+
PDFLinkService
|
|
12
|
+
};
|
|
13
|
+
});
|
|
17
14
|
export {
|
|
18
15
|
loadPdf
|
|
19
16
|
};
|
|
@@ -9,6 +9,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
9
9
|
props: {
|
|
10
10
|
disabled: { type: Boolean },
|
|
11
11
|
iconClass: { default: "icon-2xl" },
|
|
12
|
+
showStop: { type: Boolean, default: true },
|
|
12
13
|
playIcon: { default: () => CirclePlay },
|
|
13
14
|
pauseIcon: { default: () => CirclePause },
|
|
14
15
|
stopIcon: { default: () => CircleStop }
|
|
@@ -56,7 +57,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
56
57
|
class: normalizeClass(["text-action-primary", [__props.iconClass]])
|
|
57
58
|
}, null, 8, ["icon", "class"])
|
|
58
59
|
])),
|
|
59
|
-
unref(showReset) ? (openBlock(), createElementBlock("div", {
|
|
60
|
+
__props.showStop && unref(showReset) ? (openBlock(), createElementBlock("div", {
|
|
60
61
|
key: 2,
|
|
61
62
|
class: "sound-controls flex-center cursor-pointer",
|
|
62
63
|
onClick: withModifiers(onStop, ["stop"])
|
|
@@ -14,7 +14,7 @@ import _sfc_main$7 from "./VcSoundPlayerProgress.vue.mjs";
|
|
|
14
14
|
import _sfc_main$8 from "./VcSoundPlayerMarkers.vue.mjs";
|
|
15
15
|
import _sfc_main$1 from "./VcSoundPlayerWrapper.vue.mjs";
|
|
16
16
|
/* empty css */
|
|
17
|
-
import { DEFAULT_OPTIONS } from "./player.options.mjs";
|
|
17
|
+
import { DEFAULT_OPTIONS, playerIconClass } from "./player.options.mjs";
|
|
18
18
|
import _sfc_main$b from "../VcPopover/VcPopover.vue.mjs";
|
|
19
19
|
/* empty css */
|
|
20
20
|
import _sfc_main$5 from "../VcIcon/VcIcon.vue.mjs";
|
|
@@ -79,13 +79,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
79
79
|
const showDownloadButton = computed(() => {
|
|
80
80
|
return props.downloadLinks.length > 0 && props.size === "md";
|
|
81
81
|
});
|
|
82
|
-
const iconClass = computed(() =>
|
|
83
|
-
const classes = {
|
|
84
|
-
md: "icon-2xl",
|
|
85
|
-
sm: "icon-lg"
|
|
86
|
-
};
|
|
87
|
-
return classes[props.size] || "icon-2md";
|
|
88
|
-
});
|
|
82
|
+
const iconClass = computed(() => playerIconClass(props.size));
|
|
89
83
|
function onError(error) {
|
|
90
84
|
isError.value = true;
|
|
91
85
|
audioErrorMessage.value = error.message;
|