@cocoar/vue-markdown-editor 1.16.0 → 1.17.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/dist/CoarMarkdownEditor.vue.d.ts.map +1 -1
- package/dist/index.js +72 -62
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoarMarkdownEditor.vue.d.ts","sourceRoot":"","sources":["../src/CoarMarkdownEditor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoarMarkdownEditor.vue.d.ts","sourceRoot":"","sources":["../src/CoarMarkdownEditor.vue"],"names":[],"mappings":"AAu4CA,OAAO,EAGL,KAAK,QAAQ,EACd,MAAM,KAAK,CAAC;AAkCb,MAAM,MAAM,6BAA6B,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAC1E,MAAM,MAAM,iCAAiC,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,MAAM,GAAG,QAAQ,GAAG,eAAe,GAAG,YAAY,GAClD,WAAW,GACX,UAAU,GACV,YAAY,GAAG,aAAa,GAAG,UAAU,GACzC,QAAQ,GAAG,SAAS,GACpB,YAAY,GAAG,gBAAgB,GAC/B,WAAW,GAAG,OAAO,GAAG,UAAU,GAClC,iBAAiB,GACjB,MAAM,GAAG,MAAM,CAAC;AAEpB;iFACiF;AACjF,eAAO,MAAM,8BAA8B,EAAE,SAAS,sBAAsB,EAU3E,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yFAAyF;IACzF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,6BAA6B,CAAC;IAC5C,eAAe,CAAC,EAAE,iCAAiC,CAAC;IACpD;;;;OAIG;IACH,KAAK,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+/BkC,QAAQ,CAAC,6BAA6B,CAAC;;;;cACnC,QAAQ,CAAC,iCAAiC,CAAC;;;;cACtD,QAAQ,CAAC,sBAAsB,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAF3B,QAAQ,CAAC,6BAA6B,CAAC;;;;cACnC,QAAQ,CAAC,iCAAiC,CAAC;;;;cACtD,QAAQ,CAAC,sBAAsB,EAAE,CAAC;;;;;;;;;;;;;;;;;AAZ9D,wBAmDG"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, h as u, inject as d, markRaw as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as ee, onMounted as te, openBlock as h, ref as g, renderList as _, shallowRef as
|
|
1
|
+
import { Fragment as e, Teleport as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, h as u, inject as d, markRaw as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as ee, onMounted as te, openBlock as h, ref as g, renderList as _, shallowRef as ne, unref as v, useId as y, useTemplateRef as b, vModelText as x, vShow as S, watch as C, withDirectives as w, withModifiers as T } from "vue";
|
|
2
2
|
import { Editor as E, commandsCtx as D, defaultValueCtx as O, editorViewCtx as k, editorViewOptionsCtx as A, rootCtx as j } from "@milkdown/core";
|
|
3
3
|
import { Milkdown as re, MilkdownProvider as M, useEditor as N, useInstance as P } from "@milkdown/vue";
|
|
4
4
|
import { CoarCodeBlock as F, CoarIcon as I, CoarSelect as L, CoarSidebar as ie, CoarSidebarDivider as R, CoarSidebarGroup as ae, CoarSidebarItem as z, FORM_FIELD_INJECTION_KEY as B, menuPreset as oe, useOverlay as se } from "@cocoar/vue-ui";
|
|
5
|
-
import { codeBlockSchema as V, commonmark as
|
|
6
|
-
import { Plugin as
|
|
7
|
-
import { $markSchema as
|
|
5
|
+
import { codeBlockSchema as V, commonmark as ce, createCodeBlockCommand as le, insertHrCommand as ue, liftListItemCommand as H, sinkListItemCommand as de, toggleEmphasisCommand as fe, toggleInlineCodeCommand as pe, toggleStrongCommand as me, turnIntoTextCommand as U, wrapInBlockquoteCommand as he, wrapInBulletListCommand as W, wrapInHeadingCommand as G, wrapInOrderedListCommand as ge } from "@milkdown/preset-commonmark";
|
|
6
|
+
import { Plugin as _e, TextSelection as K } from "@milkdown/prose/state";
|
|
7
|
+
import { $markSchema as ve, $prose as ye, $remark as be, $view as xe, replaceAll as q } from "@milkdown/utils";
|
|
8
8
|
import { isColorSpanClose as Se, parseColorSpanOpen as J, sanitizeColor as Y, serializeColorSpanClose as Ce, serializeColorSpanOpen as we } from "@cocoar/vue-markdown-core";
|
|
9
9
|
import { addColAfterCommand as Te, addColBeforeCommand as Ee, addRowAfterCommand as De, addRowBeforeCommand as Oe, deleteSelectedCellsCommand as ke, gfm as Ae, insertTableCommand as je, toggleStrikethroughCommand as Me } from "@milkdown/preset-gfm";
|
|
10
10
|
import { history as Ne, redoCommand as Pe, undoCommand as Fe } from "@milkdown/plugin-history";
|
|
@@ -69,7 +69,7 @@ var Be = { class: "coar-md-code-render" }, Ve = { class: "coar-md-code-edit" },
|
|
|
69
69
|
}, {
|
|
70
70
|
immediate: !0,
|
|
71
71
|
flush: "post"
|
|
72
|
-
}), (t, n) => (h(), o("div", { class: p(["coar-md-code-host", { "coar-md-code-host--editing": e.editing }]) }, [w(s("div", Be, [c(
|
|
72
|
+
}), (t, n) => (h(), o("div", { class: p(["coar-md-code-host", { "coar-md-code-host--editing": e.editing }]) }, [w(s("div", Be, [c(v(F), {
|
|
73
73
|
code: e.text,
|
|
74
74
|
language: e.language || "text",
|
|
75
75
|
collapsible: !1,
|
|
@@ -79,10 +79,10 @@ var Be = { class: "coar-md-code-render" }, Ve = { class: "coar-md-code-edit" },
|
|
|
79
79
|
type: "button",
|
|
80
80
|
title: "Edit code block",
|
|
81
81
|
onMousedown: n[0] ||= T((e) => r("enterEdit"), ["prevent"])
|
|
82
|
-
}, [c(
|
|
82
|
+
}, [c(v(I), {
|
|
83
83
|
name: "pencil",
|
|
84
84
|
size: "xs"
|
|
85
|
-
}), n[2] ||= s("span", null, "Edit", -1)], 32)], 512), [[S, !e.editing]]), w(s("div", Ve, [s("div", He, [c(
|
|
85
|
+
}), n[2] ||= s("span", null, "Edit", -1)], 32)], 512), [[S, !e.editing]]), w(s("div", Ve, [s("div", He, [c(v(L), {
|
|
86
86
|
class: "coar-md-code-lang-select",
|
|
87
87
|
"model-value": e.language,
|
|
88
88
|
options: i,
|
|
@@ -146,13 +146,13 @@ var Be = { class: "coar-md-code-render" }, Ve = { class: "coar-md-code-edit" },
|
|
|
146
146
|
let e = this.getPos();
|
|
147
147
|
if (e == null) return;
|
|
148
148
|
let { tr: t } = this.view.state;
|
|
149
|
-
t.setSelection(
|
|
149
|
+
t.setSelection(K.create(this.view.state.doc, e + 1)), this.view.dispatch(t), this.view.focus();
|
|
150
150
|
};
|
|
151
151
|
handleLanguageChange = (e) => {
|
|
152
152
|
let t = this.getPos();
|
|
153
153
|
t != null && this.view.dispatch(this.view.state.tr.setNodeAttribute(t, "language", e));
|
|
154
154
|
};
|
|
155
|
-
}, Ge = [
|
|
155
|
+
}, Ge = [xe(V.node, () => (e, t, n) => new We(e, t, n)), ye(() => new _e({ view: () => ({ update(e, t) {
|
|
156
156
|
e.state.selection.eq(t.selection) || Z.forEach((t) => {
|
|
157
157
|
t.view === e && t.notifySelectionChanged();
|
|
158
158
|
});
|
|
@@ -221,7 +221,7 @@ function Je(e) {
|
|
|
221
221
|
}
|
|
222
222
|
return t;
|
|
223
223
|
}
|
|
224
|
-
var Ye = [
|
|
224
|
+
var Ye = [be("textColor", () => Ke), ve("text_color", () => ({
|
|
225
225
|
attrs: { color: { default: "" } },
|
|
226
226
|
inclusive: !0,
|
|
227
227
|
parseDOM: [{
|
|
@@ -321,7 +321,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
321
321
|
class: "coar-md-color-picker",
|
|
322
322
|
role: "menu",
|
|
323
323
|
onMousedown: c[2] ||= T(() => {}, ["stop"])
|
|
324
|
-
}, [s("div", Ze, [(h(!0), o(e, null, _(
|
|
324
|
+
}, [s("div", Ze, [(h(!0), o(e, null, _(v(Xe), (e) => (h(), o("button", {
|
|
325
325
|
key: e.value || "default",
|
|
326
326
|
type: "button",
|
|
327
327
|
class: p([
|
|
@@ -333,7 +333,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
333
333
|
title: e.name,
|
|
334
334
|
"aria-label": e.name,
|
|
335
335
|
onMousedown: T((n) => t.pick(e.value === "" ? null : e.value), ["prevent"])
|
|
336
|
-
}, [e.value === "" ? (h(), i(
|
|
336
|
+
}, [e.value === "" ? (h(), i(v(I), {
|
|
337
337
|
key: 0,
|
|
338
338
|
name: "ban",
|
|
339
339
|
size: "s"
|
|
@@ -369,48 +369,48 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
369
369
|
"undo",
|
|
370
370
|
"redo"
|
|
371
371
|
], $ = {
|
|
372
|
-
bold: { command:
|
|
373
|
-
italic: { command:
|
|
372
|
+
bold: { command: me },
|
|
373
|
+
italic: { command: fe },
|
|
374
374
|
strike: { command: Me },
|
|
375
|
-
code: { command:
|
|
376
|
-
bulletList: { command:
|
|
377
|
-
orderedList: { command:
|
|
378
|
-
blockquote: { command:
|
|
379
|
-
hr: { command:
|
|
380
|
-
codeBlock: { command:
|
|
375
|
+
code: { command: pe },
|
|
376
|
+
bulletList: { command: W },
|
|
377
|
+
orderedList: { command: ge },
|
|
378
|
+
blockquote: { command: he },
|
|
379
|
+
hr: { command: ue },
|
|
380
|
+
codeBlock: { command: le },
|
|
381
381
|
table: { command: je },
|
|
382
382
|
undo: { command: Fe },
|
|
383
383
|
redo: { command: Pe },
|
|
384
|
-
paragraph: { command:
|
|
384
|
+
paragraph: { command: U },
|
|
385
385
|
addRowBefore: { command: Oe },
|
|
386
386
|
addRowAfter: { command: De },
|
|
387
387
|
addColBefore: { command: Ee },
|
|
388
388
|
addColAfter: { command: Te },
|
|
389
389
|
deleteCell: { command: ke },
|
|
390
|
-
indent: { command:
|
|
391
|
-
outdent: { command:
|
|
390
|
+
indent: { command: de },
|
|
391
|
+
outdent: { command: H },
|
|
392
392
|
h1: {
|
|
393
|
-
command:
|
|
393
|
+
command: G,
|
|
394
394
|
payload: 1
|
|
395
395
|
},
|
|
396
396
|
h2: {
|
|
397
|
-
command:
|
|
397
|
+
command: G,
|
|
398
398
|
payload: 2
|
|
399
399
|
},
|
|
400
400
|
h3: {
|
|
401
|
-
command:
|
|
401
|
+
command: G,
|
|
402
402
|
payload: 3
|
|
403
403
|
},
|
|
404
404
|
h4: {
|
|
405
|
-
command:
|
|
405
|
+
command: G,
|
|
406
406
|
payload: 4
|
|
407
407
|
},
|
|
408
408
|
h5: {
|
|
409
|
-
command:
|
|
409
|
+
command: G,
|
|
410
410
|
payload: 5
|
|
411
411
|
},
|
|
412
412
|
h6: {
|
|
413
|
-
command:
|
|
413
|
+
command: G,
|
|
414
414
|
payload: 6
|
|
415
415
|
}
|
|
416
416
|
}, nt = l({
|
|
@@ -477,14 +477,24 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
477
477
|
})), r.get(X).markdownUpdated((n, r) => {
|
|
478
478
|
r !== t.value && (t.value = r, e.onMarkdownChange(r));
|
|
479
479
|
});
|
|
480
|
-
}).use(
|
|
481
|
-
let [,
|
|
480
|
+
}).use(ce).use(Ae).use(Ne).use(Ie).use(Le).use(Ye).use(Ge));
|
|
481
|
+
let [n, r] = P(), i = g(null);
|
|
482
482
|
return C(() => e.externalValue.value, (e) => {
|
|
483
483
|
if (e === t.value) return;
|
|
484
|
-
let
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
484
|
+
let n = r();
|
|
485
|
+
if (!n) {
|
|
486
|
+
i.value = e;
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
i.value = null, t.value = e, n.action(q(e));
|
|
490
|
+
}), C(n, (e) => {
|
|
491
|
+
if (e || i.value === null) return;
|
|
492
|
+
let n = r();
|
|
493
|
+
if (!n) return;
|
|
494
|
+
let a = i.value;
|
|
495
|
+
i.value = null, a !== t.value && (t.value = a, n.action(q(a)));
|
|
496
|
+
}, { immediate: !0 }), C(() => e.readonly, () => {
|
|
497
|
+
let t = r();
|
|
488
498
|
t && t.action((t) => {
|
|
489
499
|
t.update(A, (t) => ({
|
|
490
500
|
...t,
|
|
@@ -581,16 +591,16 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
581
591
|
inOrderedList: m.value.ordered_list
|
|
582
592
|
});
|
|
583
593
|
if (r === "lift") {
|
|
584
|
-
h({ command:
|
|
594
|
+
h({ command: H });
|
|
585
595
|
return;
|
|
586
596
|
}
|
|
587
|
-
r === "switch" && h({ command:
|
|
597
|
+
r === "switch" && h({ command: H }), h(n);
|
|
588
598
|
}
|
|
589
|
-
let
|
|
590
|
-
function
|
|
591
|
-
return Re(e,
|
|
599
|
+
let ne = n(() => e.tools ? new Set(e.tools) : void 0);
|
|
600
|
+
function v(e) {
|
|
601
|
+
return Re(e, ne.value);
|
|
592
602
|
}
|
|
593
|
-
function
|
|
603
|
+
function y(t) {
|
|
594
604
|
if (e.readonly) return;
|
|
595
605
|
let n = r();
|
|
596
606
|
if (!n) return;
|
|
@@ -628,7 +638,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
628
638
|
},
|
|
629
639
|
inputs: {
|
|
630
640
|
currentColor: m.value.text_color,
|
|
631
|
-
pick: (e) =>
|
|
641
|
+
pick: (e) => y(e)
|
|
632
642
|
}
|
|
633
643
|
}), p.afterClosed.then(() => {
|
|
634
644
|
p?.isClosed && (p = null);
|
|
@@ -645,7 +655,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
645
655
|
let t = e.get(k), { state: n } = t, r = n.tr, { from: i, to: a, empty: o } = n.selection;
|
|
646
656
|
o ? r = r.setStoredMarks([]) : Object.values(n.schema.marks).forEach((e) => {
|
|
647
657
|
r = r.removeMark(i, a, e);
|
|
648
|
-
}), t.dispatch(r), e.get(D).call(
|
|
658
|
+
}), t.dispatch(r), e.get(D).call(U.key);
|
|
649
659
|
});
|
|
650
660
|
}
|
|
651
661
|
function C() {
|
|
@@ -661,7 +671,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
661
671
|
return;
|
|
662
672
|
}
|
|
663
673
|
}
|
|
664
|
-
e.get(D).call(
|
|
674
|
+
e.get(D).call(W.key), queueMicrotask(() => {
|
|
665
675
|
t.action((e) => {
|
|
666
676
|
let t = e.get(k), { $from: n } = t.state.selection;
|
|
667
677
|
for (let e = n.depth; e > 0; e--) if (n.node(e).type.name === "list_item") {
|
|
@@ -728,7 +738,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
728
738
|
a && (t.preventDefault(), a.action((e) => {
|
|
729
739
|
let t = e.get(k);
|
|
730
740
|
t.focus();
|
|
731
|
-
let n = t.state.tr.setSelection(
|
|
741
|
+
let n = t.state.tr.setSelection(K.atEnd(t.state.doc));
|
|
732
742
|
t.dispatch(n);
|
|
733
743
|
}));
|
|
734
744
|
}
|
|
@@ -838,7 +848,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
838
848
|
function V() {
|
|
839
849
|
let t = m.value, n = t.heading != null;
|
|
840
850
|
function r(e, t, n) {
|
|
841
|
-
|
|
851
|
+
v(t) && e.push(n);
|
|
842
852
|
}
|
|
843
853
|
function i(e) {
|
|
844
854
|
e.length !== 0 && e[e.length - 1]?.type !== R && e.push(u(R));
|
|
@@ -908,7 +918,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
908
918
|
})), r(a, "taskList", B("clipboard-check", "Task List", $.bulletList, {
|
|
909
919
|
active: t.task_list,
|
|
910
920
|
onClick: C
|
|
911
|
-
})), r(a, "outdent", B("indent-decrease", "Outdent", $.outdent, { disabled: t.list_item_depth < 2 })), r(a, "indent", B("indent-increase", "Indent", $.indent, { disabled: t.list_item_depth < 1 })), r(a, "blockquote", B("text-quote", "Blockquote", $.blockquote, { active: t.blockquote })), r(a, "horizontalRule", B("minus", "Horizontal Rule", $.hr)), i(a), r(a, "codeBlock", B("square-code", "Code Block", $.codeBlock, { active: t.code_block })), r(a, "table", B("table", "Insert Table", $.table, { active: t.table })), t.table &&
|
|
921
|
+
})), r(a, "outdent", B("indent-decrease", "Outdent", $.outdent, { disabled: t.list_item_depth < 2 })), r(a, "indent", B("indent-increase", "Indent", $.indent, { disabled: t.list_item_depth < 1 })), r(a, "blockquote", B("text-quote", "Blockquote", $.blockquote, { active: t.blockquote })), r(a, "horizontalRule", B("minus", "Horizontal Rule", $.hr)), i(a), r(a, "codeBlock", B("square-code", "Code Block", $.codeBlock, { active: t.code_block })), r(a, "table", B("table", "Insert Table", $.table, { active: t.table })), t.table && v("tableOps") && (i(a), a.push(B("between-vertical-start", "Insert Row Above", $.addRowBefore)), a.push(B("between-vertical-end", "Insert Row Below", $.addRowAfter)), a.push(B("between-horizontal-start", "Insert Column Left", $.addColBefore)), a.push(B("between-horizontal-end", "Insert Column Right", $.addColAfter)), a.push(B("trash-2", "Delete Cell", $.deleteCell))), v("clearFormatting") && (i(a), a.push(B("eraser", "Clear Formatting", $.bold, { onClick: S }))), i(a), r(a, "undo", B("undo-2", "Undo", $.undo)), r(a, "redo", B("redo-2", "Redo", $.redo)), a[a.length - 1]?.type === R && a.pop(), u("div", {
|
|
912
922
|
key: "sidebar",
|
|
913
923
|
class: "coar-md-sidebar-wrap",
|
|
914
924
|
onMousedown: (e) => e.preventDefault()
|
|
@@ -920,7 +930,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
920
930
|
borderless: !0
|
|
921
931
|
}, { default: () => a })]);
|
|
922
932
|
}
|
|
923
|
-
function
|
|
933
|
+
function ce() {
|
|
924
934
|
let e = (e, t, n, r = {}) => u("button", {
|
|
925
935
|
class: [
|
|
926
936
|
"coar-md-float-btn",
|
|
@@ -938,13 +948,13 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
938
948
|
size: "s"
|
|
939
949
|
})]), n = () => u("div", { class: "coar-md-float-sep" }), r = m.value;
|
|
940
950
|
function i(e, t, n) {
|
|
941
|
-
|
|
951
|
+
v(t) && e.push(n);
|
|
942
952
|
}
|
|
943
953
|
function a(e) {
|
|
944
954
|
e.length !== 0 && e[e.length - 1]?.props?.class !== "coar-md-float-sep" && e.push(n());
|
|
945
955
|
}
|
|
946
956
|
let l = [];
|
|
947
|
-
if (i(l, "bold", e("bold", "Bold", $.bold, { isActive: r.strong })), i(l, "italic", e("italic", "Italic", $.italic, { isActive: r.emphasis })), i(l, "strikethrough", e("strikethrough", "Strikethrough", $.strike, { isActive: r.strike_through })), i(l, "inlineCode", e("code", "Inline Code", $.code, { isActive: r.inlineCode })),
|
|
957
|
+
if (i(l, "bold", e("bold", "Bold", $.bold, { isActive: r.strong })), i(l, "italic", e("italic", "Italic", $.italic, { isActive: r.emphasis })), i(l, "strikethrough", e("strikethrough", "Strikethrough", $.strike, { isActive: r.strike_through })), i(l, "inlineCode", e("code", "Inline Code", $.code, { isActive: r.inlineCode })), v("textColor")) {
|
|
948
958
|
let e = r.text_color !== null;
|
|
949
959
|
l.push(u("button", {
|
|
950
960
|
class: ["coar-md-float-btn", e ? "coar-md-float-btn--active" : ""],
|
|
@@ -959,7 +969,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
959
969
|
size: "s"
|
|
960
970
|
})]));
|
|
961
971
|
}
|
|
962
|
-
|
|
972
|
+
v("headings") && (a(l), l.push(u("div", { class: "coar-md-float-dropdown" }, [u("button", {
|
|
963
973
|
class: ["coar-md-float-btn", c.value || r.heading != null ? "coar-md-float-btn--active" : ""],
|
|
964
974
|
title: r.heading == null ? "Headings" : `Heading ${r.heading}`,
|
|
965
975
|
type: "button",
|
|
@@ -1030,10 +1040,10 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
1030
1040
|
})), i(l, "taskList", e("clipboard-check", "Task List", $.bulletList, {
|
|
1031
1041
|
isActive: r.task_list,
|
|
1032
1042
|
onClick: C
|
|
1033
|
-
})), i(l, "outdent", e("indent-decrease", "Outdent", $.outdent, { disabled: r.list_item_depth < 2 })), i(l, "indent", e("indent-increase", "Indent", $.indent, { disabled: r.list_item_depth < 1 })), a(l), i(l, "blockquote", e("text-quote", "Blockquote", $.blockquote, { isActive: r.blockquote })),
|
|
1043
|
+
})), i(l, "outdent", e("indent-decrease", "Outdent", $.outdent, { disabled: r.list_item_depth < 2 })), i(l, "indent", e("indent-increase", "Indent", $.indent, { disabled: r.list_item_depth < 1 })), a(l), i(l, "blockquote", e("text-quote", "Blockquote", $.blockquote, { isActive: r.blockquote })), v("clearFormatting") && (a(l), l.push(e("eraser", "Clear Formatting", $.bold, { onClick: S }))), l[l.length - 1]?.props?.class === "coar-md-float-sep" && l.pop();
|
|
1034
1044
|
let d = {
|
|
1035
1045
|
text: l,
|
|
1036
|
-
table:
|
|
1046
|
+
table: v("tableOps") ? [
|
|
1037
1047
|
e("between-vertical-start", "Insert Row Above", $.addRowBefore),
|
|
1038
1048
|
e("between-vertical-end", "Insert Row Below", $.addRowAfter),
|
|
1039
1049
|
n(),
|
|
@@ -1041,18 +1051,18 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
1041
1051
|
e("between-horizontal-end", "Insert Column Right", $.addColAfter),
|
|
1042
1052
|
n(),
|
|
1043
1053
|
e("trash-2", "Delete", $.deleteCell),
|
|
1044
|
-
...
|
|
1045
|
-
...
|
|
1046
|
-
...
|
|
1047
|
-
...
|
|
1054
|
+
...v("bold") || v("italic") || v("inlineCode") ? [n()] : [],
|
|
1055
|
+
...v("bold") ? [e("bold", "Bold", $.bold)] : [],
|
|
1056
|
+
...v("italic") ? [e("italic", "Italic", $.italic)] : [],
|
|
1057
|
+
...v("inlineCode") ? [e("code", "Code", $.code)] : []
|
|
1048
1058
|
] : l,
|
|
1049
|
-
"col-selection":
|
|
1059
|
+
"col-selection": v("tableOps") ? [
|
|
1050
1060
|
e("between-horizontal-start", "Insert Column Left", $.addColBefore),
|
|
1051
1061
|
e("between-horizontal-end", "Insert Column Right", $.addColAfter),
|
|
1052
1062
|
n(),
|
|
1053
1063
|
e("trash-2", "Delete Column", $.deleteCell)
|
|
1054
1064
|
] : l,
|
|
1055
|
-
"row-selection":
|
|
1065
|
+
"row-selection": v("tableOps") ? [
|
|
1056
1066
|
e("between-vertical-start", "Insert Row Above", $.addRowBefore),
|
|
1057
1067
|
e("between-vertical-end", "Insert Row Below", $.addRowAfter),
|
|
1058
1068
|
n(),
|
|
@@ -1070,7 +1080,7 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
1070
1080
|
key: "area",
|
|
1071
1081
|
class: ["coar-md-area", "coar-markdown"],
|
|
1072
1082
|
onMousedown: T
|
|
1073
|
-
}, [u(re)])), t && s && r.push(V()), a.value && n && r.push(
|
|
1083
|
+
}, [u(re)])), t && s && r.push(V()), a.value && n && r.push(ce()), u("div", {
|
|
1074
1084
|
class: {
|
|
1075
1085
|
"coar-md-root": !0,
|
|
1076
1086
|
[`coar-md-root--toolbar-${e.toolbarPosition}`]: !0,
|
|
@@ -1135,11 +1145,11 @@ var Ye = [ye("textColor", () => Ke), _e("text_color", () => ({
|
|
|
1135
1145
|
},
|
|
1136
1146
|
emits: ["update:modelValue"],
|
|
1137
1147
|
setup(e, { emit: t }) {
|
|
1138
|
-
let r = e.modelValue, i =
|
|
1148
|
+
let r = e.modelValue, i = ne({ value: e.modelValue });
|
|
1139
1149
|
C(() => e.modelValue, (e) => {
|
|
1140
1150
|
i.value = { value: e };
|
|
1141
1151
|
});
|
|
1142
|
-
let a = d(B, void 0), o = `coar-markdown-editor-${
|
|
1152
|
+
let a = d(B, void 0), o = `coar-markdown-editor-${y()}`, s = n(() => e.id || a?.inputId.value || o), c = n(() => e.error || (a?.hasError.value ?? !1)), l = n(() => a?.messageId.value), f = n(() => e.disabled || (a?.disabled.value ?? !1)), p = n(() => e.readonly || f.value);
|
|
1143
1153
|
return () => u(M, null, () => u(nt, {
|
|
1144
1154
|
initialValue: r,
|
|
1145
1155
|
externalValue: i.value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocoar/vue-markdown-editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0-beta.3",
|
|
4
4
|
"description": "WYSIWYG Markdown editor for Vue 3 based on Milkdown, with Cocoar Design System styling",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -39,12 +39,13 @@
|
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "vite build",
|
|
41
41
|
"test": "vitest run",
|
|
42
|
-
"lint": "eslint src/"
|
|
42
|
+
"lint": "eslint src/",
|
|
43
|
+
"typecheck": "vue-tsc --noEmit"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
|
-
"@cocoar/vue-markdown": "1.
|
|
46
|
-
"@cocoar/vue-markdown-core": "1.
|
|
47
|
-
"@cocoar/vue-ui": "1.
|
|
46
|
+
"@cocoar/vue-markdown": "1.17.0-beta.3",
|
|
47
|
+
"@cocoar/vue-markdown-core": "1.17.0-beta.3",
|
|
48
|
+
"@cocoar/vue-ui": "1.17.0-beta.3",
|
|
48
49
|
"vue": "^3.5.0"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|