@vkzstudio/muza-ui 1.0.9 → 1.0.10

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.
Files changed (134) hide show
  1. package/dist/components/Button/buttonVariants.d.ts.map +1 -1
  2. package/dist/components/Button/buttonVariants.js +0 -1
  3. package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
  4. package/dist/components/Icons/CustomIcons.d.ts +1 -0
  5. package/dist/components/Icons/CustomIcons.d.ts.map +1 -1
  6. package/dist/components/Icons/CustomIcons.js +38 -27
  7. package/dist/components/TextEditor/EditorToolbar.d.ts +18 -0
  8. package/dist/components/TextEditor/EditorToolbar.d.ts.map +1 -0
  9. package/dist/components/TextEditor/EditorToolbar.js +175 -0
  10. package/dist/components/TextEditor/LinkBubbleMenu.d.ts +52 -0
  11. package/dist/components/TextEditor/LinkBubbleMenu.d.ts.map +1 -0
  12. package/dist/components/TextEditor/LinkBubbleMenu.js +97 -0
  13. package/dist/components/TextEditor/TextEditor.d.ts +134 -0
  14. package/dist/components/TextEditor/TextEditor.d.ts.map +1 -0
  15. package/dist/components/TextEditor/TextEditor.js +240 -0
  16. package/dist/components/TextEditor/TextEditor.stories.d.ts +51 -0
  17. package/dist/components/TextEditor/TextEditor.stories.d.ts.map +1 -0
  18. package/dist/components/TextEditor/ToolbarButton.d.ts +38 -0
  19. package/dist/components/TextEditor/ToolbarButton.d.ts.map +1 -0
  20. package/dist/components/TextEditor/ToolbarButton.js +68 -0
  21. package/dist/components/TextEditor/ToolbarSeparator.d.ts +22 -0
  22. package/dist/components/TextEditor/ToolbarSeparator.d.ts.map +1 -0
  23. package/dist/components/TextEditor/ToolbarSeparator.js +23 -0
  24. package/dist/components/TextEditor/index.d.ts +4 -0
  25. package/dist/components/TextEditor/index.d.ts.map +1 -0
  26. package/dist/components/TextEditor/useLinkEditor.d.ts +37 -0
  27. package/dist/components/TextEditor/useLinkEditor.d.ts.map +1 -0
  28. package/dist/components/TextEditor/useLinkEditor.js +32 -0
  29. package/dist/components/index.d.ts +1 -0
  30. package/dist/components/index.d.ts.map +1 -1
  31. package/dist/index.js +140 -132
  32. package/dist/muza-ui.css +1 -1
  33. package/dist/node_modules/@popperjs/core/lib/createPopper.js +122 -0
  34. package/dist/node_modules/@popperjs/core/lib/dom-utils/contains.js +18 -0
  35. package/dist/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js +23 -0
  36. package/dist/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js +37 -0
  37. package/dist/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js +32 -0
  38. package/dist/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js +7 -0
  39. package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js +10 -0
  40. package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js +17 -0
  41. package/dist/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js +9 -0
  42. package/dist/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js +13 -0
  43. package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js +6 -0
  44. package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js +10 -0
  45. package/dist/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js +35 -0
  46. package/dist/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js +18 -0
  47. package/dist/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js +10 -0
  48. package/dist/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js +21 -0
  49. package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindow.js +12 -0
  50. package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js +11 -0
  51. package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js +9 -0
  52. package/dist/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js +20 -0
  53. package/dist/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js +7 -0
  54. package/dist/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js +8 -0
  55. package/dist/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js +7 -0
  56. package/dist/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js +16 -0
  57. package/dist/node_modules/@popperjs/core/lib/enums.js +31 -0
  58. package/dist/node_modules/@popperjs/core/lib/modifiers/applyStyles.js +47 -0
  59. package/dist/node_modules/@popperjs/core/lib/modifiers/arrow.js +37 -0
  60. package/dist/node_modules/@popperjs/core/lib/modifiers/computeStyles.js +99 -0
  61. package/dist/node_modules/@popperjs/core/lib/modifiers/eventListeners.js +26 -0
  62. package/dist/node_modules/@popperjs/core/lib/modifiers/flip.js +74 -0
  63. package/dist/node_modules/@popperjs/core/lib/modifiers/hide.js +44 -0
  64. package/dist/node_modules/@popperjs/core/lib/modifiers/offset.js +31 -0
  65. package/dist/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js +19 -0
  66. package/dist/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js +54 -0
  67. package/dist/node_modules/@popperjs/core/lib/popper.js +27 -0
  68. package/dist/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js +27 -0
  69. package/dist/node_modules/@popperjs/core/lib/utils/computeOffsets.js +54 -0
  70. package/dist/node_modules/@popperjs/core/lib/utils/debounce.js +13 -0
  71. package/dist/node_modules/@popperjs/core/lib/utils/detectOverflow.js +33 -0
  72. package/dist/node_modules/@popperjs/core/lib/utils/expandToHashMap.js +8 -0
  73. package/dist/node_modules/@popperjs/core/lib/utils/getAltAxis.js +6 -0
  74. package/dist/node_modules/@popperjs/core/lib/utils/getBasePlacement.js +6 -0
  75. package/dist/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js +11 -0
  76. package/dist/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js +6 -0
  77. package/dist/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js +14 -0
  78. package/dist/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js +12 -0
  79. package/dist/node_modules/@popperjs/core/lib/utils/getVariation.js +6 -0
  80. package/dist/node_modules/@popperjs/core/lib/utils/math.js +6 -0
  81. package/dist/node_modules/@popperjs/core/lib/utils/mergeByName.js +15 -0
  82. package/dist/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js +7 -0
  83. package/dist/node_modules/@popperjs/core/lib/utils/orderModifiers.js +31 -0
  84. package/dist/node_modules/@popperjs/core/lib/utils/rectToClientRect.js +11 -0
  85. package/dist/node_modules/@popperjs/core/lib/utils/userAgent.js +9 -0
  86. package/dist/node_modules/@popperjs/core/lib/utils/within.js +12 -0
  87. package/dist/node_modules/@tiptap/core/dist/index.js +2857 -0
  88. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +45 -0
  89. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +76 -0
  90. package/dist/node_modules/@tiptap/extension-bubble-menu/dist/index.js +129 -0
  91. package/dist/node_modules/@tiptap/extension-bullet-list/dist/index.js +55 -0
  92. package/dist/node_modules/@tiptap/extension-code/dist/index.js +54 -0
  93. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +136 -0
  94. package/dist/node_modules/@tiptap/extension-document/dist/index.js +10 -0
  95. package/dist/node_modules/@tiptap/extension-dropcursor/dist/index.js +21 -0
  96. package/dist/node_modules/@tiptap/extension-gapcursor/dist/index.js +25 -0
  97. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +56 -0
  98. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +55 -0
  99. package/dist/node_modules/@tiptap/extension-history/dist/index.js +36 -0
  100. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +59 -0
  101. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +75 -0
  102. package/dist/node_modules/@tiptap/extension-link/dist/index.js +272 -0
  103. package/dist/node_modules/@tiptap/extension-list-item/dist/index.js +34 -0
  104. package/dist/node_modules/@tiptap/extension-ordered-list/dist/index.js +73 -0
  105. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +34 -0
  106. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +53 -0
  107. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +64 -0
  108. package/dist/node_modules/@tiptap/extension-text/dist/index.js +9 -0
  109. package/dist/node_modules/@tiptap/react/dist/index.js +709 -0
  110. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +30 -0
  111. package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
  112. package/dist/node_modules/orderedmap/dist/index.js +103 -0
  113. package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
  114. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
  115. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
  116. package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
  117. package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
  118. package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
  119. package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
  120. package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
  121. package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
  122. package/dist/node_modules/prosemirror-view/dist/index.js +3794 -0
  123. package/dist/node_modules/rope-sequence/dist/index.js +100 -0
  124. package/dist/node_modules/tippy.js/dist/tippy.esm.js +813 -0
  125. package/dist/node_modules/w3c-keyname/index.js +93 -0
  126. package/dist/translations/locales/cs.d.ts.map +1 -1
  127. package/dist/translations/locales/cs.js +18 -0
  128. package/dist/translations/locales/en.d.ts.map +1 -1
  129. package/dist/translations/locales/en.js +18 -0
  130. package/dist/translations/locales/sk.d.ts.map +1 -1
  131. package/dist/translations/locales/sk.js +18 -0
  132. package/dist/translations/types.d.ts +22 -0
  133. package/dist/translations/types.d.ts.map +1 -1
  134. package/package.json +17 -1
@@ -0,0 +1,36 @@
1
+ import { Extension as d } from "../../core/dist/index.js";
2
+ import { history as t, redo as e, undo as n } from "../../../prosemirror-history/dist/index.js";
3
+ const m = d.create({
4
+ name: "history",
5
+ addOptions() {
6
+ return {
7
+ depth: 100,
8
+ newGroupDelay: 500
9
+ };
10
+ },
11
+ addCommands() {
12
+ return {
13
+ undo: () => ({ state: o, dispatch: r }) => n(o, r),
14
+ redo: () => ({ state: o, dispatch: r }) => e(o, r)
15
+ };
16
+ },
17
+ addProseMirrorPlugins() {
18
+ return [
19
+ t(this.options)
20
+ ];
21
+ },
22
+ addKeyboardShortcuts() {
23
+ return {
24
+ "Mod-z": () => this.editor.commands.undo(),
25
+ "Shift-Mod-z": () => this.editor.commands.redo(),
26
+ "Mod-y": () => this.editor.commands.redo(),
27
+ // Russian keyboard layouts
28
+ "Mod-я": () => this.editor.commands.undo(),
29
+ "Shift-Mod-я": () => this.editor.commands.redo()
30
+ };
31
+ }
32
+ });
33
+ export {
34
+ m as History,
35
+ m as default
36
+ };
@@ -0,0 +1,59 @@
1
+ import { Node as f, nodeInputRule as m, canInsertNode as h, isNodeSelection as A, mergeAttributes as T } from "../../core/dist/index.js";
2
+ import { TextSelection as i, NodeSelection as y } from "../../../prosemirror-state/dist/index.js";
3
+ const M = f.create({
4
+ name: "horizontalRule",
5
+ addOptions() {
6
+ return {
7
+ HTMLAttributes: {}
8
+ };
9
+ },
10
+ group: "block",
11
+ parseHTML() {
12
+ return [{ tag: "hr" }];
13
+ },
14
+ renderHTML({ HTMLAttributes: n }) {
15
+ return ["hr", T(this.options.HTMLAttributes, n)];
16
+ },
17
+ addCommands() {
18
+ return {
19
+ setHorizontalRule: () => ({ chain: n, state: s }) => {
20
+ if (!h(s, s.schema.nodes[this.name]))
21
+ return !1;
22
+ const { selection: c } = s, { $from: a, $to: l } = c, o = n();
23
+ return a.parentOffset === 0 ? o.insertContentAt({
24
+ from: Math.max(a.pos - 1, 0),
25
+ to: l.pos
26
+ }, {
27
+ type: this.name
28
+ }) : A(c) ? o.insertContentAt(l.pos, {
29
+ type: this.name
30
+ }) : o.insertContent({ type: this.name }), o.command(({ tr: e, dispatch: u }) => {
31
+ var r;
32
+ if (u) {
33
+ const { $to: t } = e.selection, d = t.end();
34
+ if (t.nodeAfter)
35
+ t.nodeAfter.isTextblock ? e.setSelection(i.create(e.doc, t.pos + 1)) : t.nodeAfter.isBlock ? e.setSelection(y.create(e.doc, t.pos)) : e.setSelection(i.create(e.doc, t.pos));
36
+ else {
37
+ const p = (r = t.parent.type.contentMatch.defaultType) === null || r === void 0 ? void 0 : r.create();
38
+ p && (e.insert(d, p), e.setSelection(i.create(e.doc, d + 1)));
39
+ }
40
+ e.scrollIntoView();
41
+ }
42
+ return !0;
43
+ }).run();
44
+ }
45
+ };
46
+ },
47
+ addInputRules() {
48
+ return [
49
+ m({
50
+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,
51
+ type: this.type
52
+ })
53
+ ];
54
+ }
55
+ });
56
+ export {
57
+ M as HorizontalRule,
58
+ M as default
59
+ };
@@ -0,0 +1,75 @@
1
+ import { Mark as r, markPasteRule as e, markInputRule as s, mergeAttributes as a } from "../../core/dist/index.js";
2
+ const n = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, i = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, o = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, l = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, d = r.create({
3
+ name: "italic",
4
+ addOptions() {
5
+ return {
6
+ HTMLAttributes: {}
7
+ };
8
+ },
9
+ parseHTML() {
10
+ return [
11
+ {
12
+ tag: "em"
13
+ },
14
+ {
15
+ tag: "i",
16
+ getAttrs: (t) => t.style.fontStyle !== "normal" && null
17
+ },
18
+ {
19
+ style: "font-style=normal",
20
+ clearMark: (t) => t.type.name === this.name
21
+ },
22
+ {
23
+ style: "font-style=italic"
24
+ }
25
+ ];
26
+ },
27
+ renderHTML({ HTMLAttributes: t }) {
28
+ return ["em", a(this.options.HTMLAttributes, t), 0];
29
+ },
30
+ addCommands() {
31
+ return {
32
+ setItalic: () => ({ commands: t }) => t.setMark(this.name),
33
+ toggleItalic: () => ({ commands: t }) => t.toggleMark(this.name),
34
+ unsetItalic: () => ({ commands: t }) => t.unsetMark(this.name)
35
+ };
36
+ },
37
+ addKeyboardShortcuts() {
38
+ return {
39
+ "Mod-i": () => this.editor.commands.toggleItalic(),
40
+ "Mod-I": () => this.editor.commands.toggleItalic()
41
+ };
42
+ },
43
+ addInputRules() {
44
+ return [
45
+ s({
46
+ find: n,
47
+ type: this.type
48
+ }),
49
+ s({
50
+ find: o,
51
+ type: this.type
52
+ })
53
+ ];
54
+ },
55
+ addPasteRules() {
56
+ return [
57
+ e({
58
+ find: i,
59
+ type: this.type
60
+ }),
61
+ e({
62
+ find: l,
63
+ type: this.type
64
+ })
65
+ ];
66
+ }
67
+ });
68
+ export {
69
+ d as Italic,
70
+ d as default,
71
+ n as starInputRegex,
72
+ i as starPasteRegex,
73
+ o as underscoreInputRegex,
74
+ l as underscorePasteRegex
75
+ };
@@ -0,0 +1,272 @@
1
+ import { Mark as x, markPasteRule as T, mergeAttributes as v, combineTransactionSteps as b, getChangedRanges as w, findChildrenInRange as H, getMarksBetween as O, getAttributes as _ } from "../../core/dist/index.js";
2
+ import { registerCustomProtocol as y, tokenize as R, find as C, reset as B } from "../../../linkifyjs/dist/linkify.js";
3
+ import { Plugin as m, PluginKey as A } from "../../../prosemirror-state/dist/index.js";
4
+ const P = "[\0-   ᠎ -\u2029  ]", I = new RegExp(P), U = new RegExp(`${P}$`), N = new RegExp(P, "g");
5
+ function V(t) {
6
+ return t.length === 1 ? t[0].isLink : t.length === 3 && t[1].isLink ? ["()", "[]"].includes(t[0].value + t[2].value) : !1;
7
+ }
8
+ function W(t) {
9
+ return new m({
10
+ key: new A("autolink"),
11
+ appendTransaction: (e, s, o) => {
12
+ const i = e.some((r) => r.docChanged) && !s.doc.eq(o.doc), l = e.some((r) => r.getMeta("preventAutolink"));
13
+ if (!i || l)
14
+ return;
15
+ const { tr: a } = o, d = b(s.doc, [...e]);
16
+ if (w(d).forEach(({ newRange: r }) => {
17
+ const f = H(o.doc, r, (p) => p.isTextblock);
18
+ let u, c;
19
+ if (f.length > 1)
20
+ u = f[0], c = o.doc.textBetween(u.pos, u.pos + u.node.nodeSize, void 0, " ");
21
+ else if (f.length) {
22
+ const p = o.doc.textBetween(r.from, r.to, " ", " ");
23
+ if (!U.test(p))
24
+ return;
25
+ u = f[0], c = o.doc.textBetween(u.pos, r.to, void 0, " ");
26
+ }
27
+ if (u && c) {
28
+ const p = c.split(I).filter(Boolean);
29
+ if (p.length <= 0)
30
+ return !1;
31
+ const k = p[p.length - 1], E = u.pos + c.lastIndexOf(k);
32
+ if (!k)
33
+ return !1;
34
+ const L = R(k).map((n) => n.toObject(t.defaultProtocol));
35
+ if (!V(L))
36
+ return !1;
37
+ L.filter((n) => n.isLink).map((n) => ({
38
+ ...n,
39
+ from: E + n.start + 1,
40
+ to: E + n.end + 1
41
+ })).filter((n) => o.schema.marks.code ? !o.doc.rangeHasMark(n.from, n.to, o.schema.marks.code) : !0).filter((n) => t.validate(n.value)).filter((n) => t.shouldAutoLink(n.value)).forEach((n) => {
42
+ O(n.from, n.to, o.doc).some((M) => M.mark.type === t.type) || a.addMark(n.from, n.to, t.type.create({
43
+ href: n.href
44
+ }));
45
+ });
46
+ }
47
+ }), !!a.steps.length)
48
+ return a;
49
+ }
50
+ });
51
+ }
52
+ function D(t) {
53
+ return new m({
54
+ key: new A("handleClickLink"),
55
+ props: {
56
+ handleClick: (e, s, o) => {
57
+ var i, l;
58
+ if (o.button !== 0 || !e.editable)
59
+ return !1;
60
+ let a = o.target;
61
+ const d = [];
62
+ for (; a.nodeName !== "DIV"; )
63
+ d.push(a), a = a.parentNode;
64
+ if (!d.find((c) => c.nodeName === "A"))
65
+ return !1;
66
+ const g = _(e.state, t.type.name), r = o.target, f = (i = r == null ? void 0 : r.href) !== null && i !== void 0 ? i : g.href, u = (l = r == null ? void 0 : r.target) !== null && l !== void 0 ? l : g.target;
67
+ return r && f ? (window.open(f, u), !0) : !1;
68
+ }
69
+ }
70
+ });
71
+ }
72
+ function z(t) {
73
+ return new m({
74
+ key: new A("handlePasteLink"),
75
+ props: {
76
+ handlePaste: (e, s, o) => {
77
+ const { state: i } = e, { selection: l } = i, { empty: a } = l;
78
+ if (a)
79
+ return !1;
80
+ let d = "";
81
+ o.content.forEach((r) => {
82
+ d += r.textContent;
83
+ });
84
+ const g = C(d, { defaultProtocol: t.defaultProtocol }).find((r) => r.isLink && r.value === d);
85
+ return !d || !g ? !1 : t.editor.commands.setMark(t.type, {
86
+ href: g.href
87
+ });
88
+ }
89
+ }
90
+ });
91
+ }
92
+ function h(t, e) {
93
+ const s = [
94
+ "http",
95
+ "https",
96
+ "ftp",
97
+ "ftps",
98
+ "mailto",
99
+ "tel",
100
+ "callto",
101
+ "sms",
102
+ "cid",
103
+ "xmpp"
104
+ ];
105
+ return e && e.forEach((o) => {
106
+ const i = typeof o == "string" ? o : o.scheme;
107
+ i && s.push(i);
108
+ }), !t || t.replace(N, "").match(new RegExp(
109
+ // eslint-disable-next-line no-useless-escape
110
+ `^(?:(?:${s.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,
111
+ "i"
112
+ ));
113
+ }
114
+ const j = x.create({
115
+ name: "link",
116
+ priority: 1e3,
117
+ keepOnSplit: !1,
118
+ exitable: !0,
119
+ onCreate() {
120
+ this.options.validate && !this.options.shouldAutoLink && (this.options.shouldAutoLink = this.options.validate, console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")), this.options.protocols.forEach((t) => {
121
+ if (typeof t == "string") {
122
+ y(t);
123
+ return;
124
+ }
125
+ y(t.scheme, t.optionalSlashes);
126
+ });
127
+ },
128
+ onDestroy() {
129
+ B();
130
+ },
131
+ inclusive() {
132
+ return this.options.autolink;
133
+ },
134
+ addOptions() {
135
+ return {
136
+ openOnClick: !0,
137
+ linkOnPaste: !0,
138
+ autolink: !0,
139
+ protocols: [],
140
+ defaultProtocol: "http",
141
+ HTMLAttributes: {
142
+ target: "_blank",
143
+ rel: "noopener noreferrer nofollow",
144
+ class: null
145
+ },
146
+ isAllowedUri: (t, e) => !!h(t, e.protocols),
147
+ validate: (t) => !!t,
148
+ shouldAutoLink: (t) => !!t
149
+ };
150
+ },
151
+ addAttributes() {
152
+ return {
153
+ href: {
154
+ default: null,
155
+ parseHTML(t) {
156
+ return t.getAttribute("href");
157
+ }
158
+ },
159
+ target: {
160
+ default: this.options.HTMLAttributes.target
161
+ },
162
+ rel: {
163
+ default: this.options.HTMLAttributes.rel
164
+ },
165
+ class: {
166
+ default: this.options.HTMLAttributes.class
167
+ }
168
+ };
169
+ },
170
+ parseHTML() {
171
+ return [
172
+ {
173
+ tag: "a[href]",
174
+ getAttrs: (t) => {
175
+ const e = t.getAttribute("href");
176
+ return !e || !this.options.isAllowedUri(e, {
177
+ defaultValidate: (s) => !!h(s, this.options.protocols),
178
+ protocols: this.options.protocols,
179
+ defaultProtocol: this.options.defaultProtocol
180
+ }) ? !1 : null;
181
+ }
182
+ }
183
+ ];
184
+ },
185
+ renderHTML({ HTMLAttributes: t }) {
186
+ return this.options.isAllowedUri(t.href, {
187
+ defaultValidate: (e) => !!h(e, this.options.protocols),
188
+ protocols: this.options.protocols,
189
+ defaultProtocol: this.options.defaultProtocol
190
+ }) ? ["a", v(this.options.HTMLAttributes, t), 0] : [
191
+ "a",
192
+ v(this.options.HTMLAttributes, { ...t, href: "" }),
193
+ 0
194
+ ];
195
+ },
196
+ addCommands() {
197
+ return {
198
+ setLink: (t) => ({ chain: e }) => {
199
+ const { href: s } = t;
200
+ return this.options.isAllowedUri(s, {
201
+ defaultValidate: (o) => !!h(o, this.options.protocols),
202
+ protocols: this.options.protocols,
203
+ defaultProtocol: this.options.defaultProtocol
204
+ }) ? e().setMark(this.name, t).setMeta("preventAutolink", !0).run() : !1;
205
+ },
206
+ toggleLink: (t) => ({ chain: e }) => {
207
+ const { href: s } = t;
208
+ return this.options.isAllowedUri(s, {
209
+ defaultValidate: (o) => !!h(o, this.options.protocols),
210
+ protocols: this.options.protocols,
211
+ defaultProtocol: this.options.defaultProtocol
212
+ }) ? e().toggleMark(this.name, t, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run() : !1;
213
+ },
214
+ unsetLink: () => ({ chain: t }) => t().unsetMark(this.name, { extendEmptyMarkRange: !0 }).setMeta("preventAutolink", !0).run()
215
+ };
216
+ },
217
+ addPasteRules() {
218
+ return [
219
+ T({
220
+ find: (t) => {
221
+ const e = [];
222
+ if (t) {
223
+ const { protocols: s, defaultProtocol: o } = this.options, i = C(t).filter((l) => l.isLink && this.options.isAllowedUri(l.value, {
224
+ defaultValidate: (a) => !!h(a, s),
225
+ protocols: s,
226
+ defaultProtocol: o
227
+ }));
228
+ i.length && i.forEach((l) => e.push({
229
+ text: l.value,
230
+ data: {
231
+ href: l.href
232
+ },
233
+ index: l.start
234
+ }));
235
+ }
236
+ return e;
237
+ },
238
+ type: this.type,
239
+ getAttributes: (t) => {
240
+ var e;
241
+ return {
242
+ href: (e = t.data) === null || e === void 0 ? void 0 : e.href
243
+ };
244
+ }
245
+ })
246
+ ];
247
+ },
248
+ addProseMirrorPlugins() {
249
+ const t = [], { protocols: e, defaultProtocol: s } = this.options;
250
+ return this.options.autolink && t.push(W({
251
+ type: this.type,
252
+ defaultProtocol: this.options.defaultProtocol,
253
+ validate: (o) => this.options.isAllowedUri(o, {
254
+ defaultValidate: (i) => !!h(i, e),
255
+ protocols: e,
256
+ defaultProtocol: s
257
+ }),
258
+ shouldAutoLink: this.options.shouldAutoLink
259
+ })), this.options.openOnClick === !0 && t.push(D({
260
+ type: this.type
261
+ })), this.options.linkOnPaste && t.push(z({
262
+ editor: this.editor,
263
+ defaultProtocol: this.options.defaultProtocol,
264
+ type: this.type
265
+ })), t;
266
+ }
267
+ });
268
+ export {
269
+ j as Link,
270
+ j as default,
271
+ h as isAllowedUri
272
+ };
@@ -0,0 +1,34 @@
1
+ import { Node as e, mergeAttributes as i } from "../../core/dist/index.js";
2
+ const s = e.create({
3
+ name: "listItem",
4
+ addOptions() {
5
+ return {
6
+ HTMLAttributes: {},
7
+ bulletListTypeName: "bulletList",
8
+ orderedListTypeName: "orderedList"
9
+ };
10
+ },
11
+ content: "paragraph block*",
12
+ defining: !0,
13
+ parseHTML() {
14
+ return [
15
+ {
16
+ tag: "li"
17
+ }
18
+ ];
19
+ },
20
+ renderHTML({ HTMLAttributes: t }) {
21
+ return ["li", i(this.options.HTMLAttributes, t), 0];
22
+ },
23
+ addKeyboardShortcuts() {
24
+ return {
25
+ Enter: () => this.editor.commands.splitListItem(this.name),
26
+ Tab: () => this.editor.commands.sinkListItem(this.name),
27
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
28
+ };
29
+ }
30
+ });
31
+ export {
32
+ s as ListItem,
33
+ s as default
34
+ };
@@ -0,0 +1,73 @@
1
+ import { Node as n, wrappingInputRule as r, mergeAttributes as i } from "../../core/dist/index.js";
2
+ const p = "listItem", o = "textStyle", a = /^(\d+)\.\s$/, d = n.create({
3
+ name: "orderedList",
4
+ addOptions() {
5
+ return {
6
+ itemTypeName: "listItem",
7
+ HTMLAttributes: {},
8
+ keepMarks: !1,
9
+ keepAttributes: !1
10
+ };
11
+ },
12
+ group: "block list",
13
+ content() {
14
+ return `${this.options.itemTypeName}+`;
15
+ },
16
+ addAttributes() {
17
+ return {
18
+ start: {
19
+ default: 1,
20
+ parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
21
+ },
22
+ type: {
23
+ default: null,
24
+ parseHTML: (t) => t.getAttribute("type")
25
+ }
26
+ };
27
+ },
28
+ parseHTML() {
29
+ return [
30
+ {
31
+ tag: "ol"
32
+ }
33
+ ];
34
+ },
35
+ renderHTML({ HTMLAttributes: t }) {
36
+ const { start: e, ...s } = t;
37
+ return e === 1 ? ["ol", i(this.options.HTMLAttributes, s), 0] : ["ol", i(this.options.HTMLAttributes, t), 0];
38
+ },
39
+ addCommands() {
40
+ return {
41
+ toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(p, this.editor.getAttributes(o)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
42
+ };
43
+ },
44
+ addKeyboardShortcuts() {
45
+ return {
46
+ "Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
47
+ };
48
+ },
49
+ addInputRules() {
50
+ let t = r({
51
+ find: a,
52
+ type: this.type,
53
+ getAttributes: (e) => ({ start: +e[1] }),
54
+ joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1]
55
+ });
56
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = r({
57
+ find: a,
58
+ type: this.type,
59
+ keepMarks: this.options.keepMarks,
60
+ keepAttributes: this.options.keepAttributes,
61
+ getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(o) }),
62
+ joinPredicate: (e, s) => s.childCount + s.attrs.start === +e[1],
63
+ editor: this.editor
64
+ })), [
65
+ t
66
+ ];
67
+ }
68
+ });
69
+ export {
70
+ d as OrderedList,
71
+ d as default,
72
+ a as inputRegex
73
+ };
@@ -0,0 +1,34 @@
1
+ import { Node as t, mergeAttributes as e } from "../../core/dist/index.js";
2
+ const o = t.create({
3
+ name: "paragraph",
4
+ priority: 1e3,
5
+ addOptions() {
6
+ return {
7
+ HTMLAttributes: {}
8
+ };
9
+ },
10
+ group: "block",
11
+ content: "inline*",
12
+ parseHTML() {
13
+ return [
14
+ { tag: "p" }
15
+ ];
16
+ },
17
+ renderHTML({ HTMLAttributes: r }) {
18
+ return ["p", e(this.options.HTMLAttributes, r), 0];
19
+ },
20
+ addCommands() {
21
+ return {
22
+ setParagraph: () => ({ commands: r }) => r.setNode(this.name)
23
+ };
24
+ },
25
+ addKeyboardShortcuts() {
26
+ return {
27
+ "Mod-Alt-0": () => this.editor.commands.setParagraph()
28
+ };
29
+ }
30
+ });
31
+ export {
32
+ o as Paragraph,
33
+ o as default
34
+ };
@@ -0,0 +1,53 @@
1
+ import { Extension as p, isNodeEmpty as u } from "../../core/dist/index.js";
2
+ import { Plugin as m, PluginKey as y } from "../../../prosemirror-state/dist/index.js";
3
+ import { Decoration as f, DecorationSet as E } from "../../../prosemirror-view/dist/index.js";
4
+ const P = p.create({
5
+ name: "placeholder",
6
+ addOptions() {
7
+ return {
8
+ emptyEditorClass: "is-editor-empty",
9
+ emptyNodeClass: "is-empty",
10
+ placeholder: "Write something …",
11
+ showOnlyWhenEditable: !0,
12
+ showOnlyCurrent: !0,
13
+ includeChildren: !1
14
+ };
15
+ },
16
+ addProseMirrorPlugins() {
17
+ return [
18
+ new m({
19
+ key: new y("placeholder"),
20
+ props: {
21
+ decorations: ({ doc: o, selection: l }) => {
22
+ const a = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = l, s = [];
23
+ if (!a)
24
+ return null;
25
+ const d = this.editor.isEmpty;
26
+ return o.descendants((t, e) => {
27
+ const n = i >= e && i <= e + t.nodeSize, c = !t.isLeaf && u(t);
28
+ if ((n || !this.options.showOnlyCurrent) && c) {
29
+ const r = [this.options.emptyNodeClass];
30
+ d && r.push(this.options.emptyEditorClass);
31
+ const h = f.node(e, e + t.nodeSize, {
32
+ class: r.join(" "),
33
+ "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
34
+ editor: this.editor,
35
+ node: t,
36
+ pos: e,
37
+ hasAnchor: n
38
+ }) : this.options.placeholder
39
+ });
40
+ s.push(h);
41
+ }
42
+ return this.options.includeChildren;
43
+ }), E.create(o, s);
44
+ }
45
+ }
46
+ })
47
+ ];
48
+ }
49
+ });
50
+ export {
51
+ P as Placeholder,
52
+ P as default
53
+ };
@@ -0,0 +1,64 @@
1
+ import { Mark as e, markPasteRule as r, markInputRule as s, mergeAttributes as n } from "../../core/dist/index.js";
2
+ const a = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, i = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, d = e.create({
3
+ name: "strike",
4
+ addOptions() {
5
+ return {
6
+ HTMLAttributes: {}
7
+ };
8
+ },
9
+ parseHTML() {
10
+ return [
11
+ {
12
+ tag: "s"
13
+ },
14
+ {
15
+ tag: "del"
16
+ },
17
+ {
18
+ tag: "strike"
19
+ },
20
+ {
21
+ style: "text-decoration",
22
+ consuming: !1,
23
+ getAttrs: (t) => t.includes("line-through") ? {} : !1
24
+ }
25
+ ];
26
+ },
27
+ renderHTML({ HTMLAttributes: t }) {
28
+ return ["s", n(this.options.HTMLAttributes, t), 0];
29
+ },
30
+ addCommands() {
31
+ return {
32
+ setStrike: () => ({ commands: t }) => t.setMark(this.name),
33
+ toggleStrike: () => ({ commands: t }) => t.toggleMark(this.name),
34
+ unsetStrike: () => ({ commands: t }) => t.unsetMark(this.name)
35
+ };
36
+ },
37
+ addKeyboardShortcuts() {
38
+ return {
39
+ "Mod-Shift-s": () => this.editor.commands.toggleStrike()
40
+ };
41
+ },
42
+ addInputRules() {
43
+ return [
44
+ s({
45
+ find: a,
46
+ type: this.type
47
+ })
48
+ ];
49
+ },
50
+ addPasteRules() {
51
+ return [
52
+ r({
53
+ find: i,
54
+ type: this.type
55
+ })
56
+ ];
57
+ }
58
+ });
59
+ export {
60
+ d as Strike,
61
+ d as default,
62
+ a as inputRegex,
63
+ i as pasteRegex
64
+ };