@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.
- package/dist/components/Button/buttonVariants.d.ts.map +1 -1
- package/dist/components/Button/buttonVariants.js +0 -1
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts.map +1 -1
- package/dist/components/Icons/CustomIcons.d.ts +1 -0
- package/dist/components/Icons/CustomIcons.d.ts.map +1 -1
- package/dist/components/Icons/CustomIcons.js +38 -27
- package/dist/components/TextEditor/EditorToolbar.d.ts +18 -0
- package/dist/components/TextEditor/EditorToolbar.d.ts.map +1 -0
- package/dist/components/TextEditor/EditorToolbar.js +175 -0
- package/dist/components/TextEditor/LinkBubbleMenu.d.ts +52 -0
- package/dist/components/TextEditor/LinkBubbleMenu.d.ts.map +1 -0
- package/dist/components/TextEditor/LinkBubbleMenu.js +97 -0
- package/dist/components/TextEditor/TextEditor.d.ts +134 -0
- package/dist/components/TextEditor/TextEditor.d.ts.map +1 -0
- package/dist/components/TextEditor/TextEditor.js +240 -0
- package/dist/components/TextEditor/TextEditor.stories.d.ts +51 -0
- package/dist/components/TextEditor/TextEditor.stories.d.ts.map +1 -0
- package/dist/components/TextEditor/ToolbarButton.d.ts +38 -0
- package/dist/components/TextEditor/ToolbarButton.d.ts.map +1 -0
- package/dist/components/TextEditor/ToolbarButton.js +68 -0
- package/dist/components/TextEditor/ToolbarSeparator.d.ts +22 -0
- package/dist/components/TextEditor/ToolbarSeparator.d.ts.map +1 -0
- package/dist/components/TextEditor/ToolbarSeparator.js +23 -0
- package/dist/components/TextEditor/index.d.ts +4 -0
- package/dist/components/TextEditor/index.d.ts.map +1 -0
- package/dist/components/TextEditor/useLinkEditor.d.ts +37 -0
- package/dist/components/TextEditor/useLinkEditor.d.ts.map +1 -0
- package/dist/components/TextEditor/useLinkEditor.js +32 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +140 -132
- package/dist/muza-ui.css +1 -1
- package/dist/node_modules/@popperjs/core/lib/createPopper.js +122 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/contains.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js +23 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js +37 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js +32 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js +17 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js +9 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js +13 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeName.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js +35 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getParentNode.js +18 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js +10 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js +21 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindow.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js +11 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js +9 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/instanceOf.js +20 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js +8 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/isTableElement.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js +16 -0
- package/dist/node_modules/@popperjs/core/lib/enums.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/applyStyles.js +47 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/arrow.js +37 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/computeStyles.js +99 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/eventListeners.js +26 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/flip.js +74 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/hide.js +44 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/offset.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/popperOffsets.js +19 -0
- package/dist/node_modules/@popperjs/core/lib/modifiers/preventOverflow.js +54 -0
- package/dist/node_modules/@popperjs/core/lib/popper.js +27 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js +27 -0
- package/dist/node_modules/@popperjs/core/lib/utils/computeOffsets.js +54 -0
- package/dist/node_modules/@popperjs/core/lib/utils/debounce.js +13 -0
- package/dist/node_modules/@popperjs/core/lib/utils/detectOverflow.js +33 -0
- package/dist/node_modules/@popperjs/core/lib/utils/expandToHashMap.js +8 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getAltAxis.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getBasePlacement.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getFreshSideObject.js +11 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositePlacement.js +14 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js +12 -0
- package/dist/node_modules/@popperjs/core/lib/utils/getVariation.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/math.js +6 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergeByName.js +15 -0
- package/dist/node_modules/@popperjs/core/lib/utils/mergePaddingObject.js +7 -0
- package/dist/node_modules/@popperjs/core/lib/utils/orderModifiers.js +31 -0
- package/dist/node_modules/@popperjs/core/lib/utils/rectToClientRect.js +11 -0
- package/dist/node_modules/@popperjs/core/lib/utils/userAgent.js +9 -0
- package/dist/node_modules/@popperjs/core/lib/utils/within.js +12 -0
- package/dist/node_modules/@tiptap/core/dist/index.js +2857 -0
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +45 -0
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js +76 -0
- package/dist/node_modules/@tiptap/extension-bubble-menu/dist/index.js +129 -0
- package/dist/node_modules/@tiptap/extension-bullet-list/dist/index.js +55 -0
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +54 -0
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +136 -0
- package/dist/node_modules/@tiptap/extension-document/dist/index.js +10 -0
- package/dist/node_modules/@tiptap/extension-dropcursor/dist/index.js +21 -0
- package/dist/node_modules/@tiptap/extension-gapcursor/dist/index.js +25 -0
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +56 -0
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +55 -0
- package/dist/node_modules/@tiptap/extension-history/dist/index.js +36 -0
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +59 -0
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js +75 -0
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +272 -0
- package/dist/node_modules/@tiptap/extension-list-item/dist/index.js +34 -0
- package/dist/node_modules/@tiptap/extension-ordered-list/dist/index.js +73 -0
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +34 -0
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +53 -0
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js +64 -0
- package/dist/node_modules/@tiptap/extension-text/dist/index.js +9 -0
- package/dist/node_modules/@tiptap/react/dist/index.js +709 -0
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js +30 -0
- package/dist/node_modules/linkifyjs/dist/linkify.js +707 -0
- package/dist/node_modules/orderedmap/dist/index.js +103 -0
- package/dist/node_modules/prosemirror-commands/dist/index.js +388 -0
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
- package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
- package/dist/node_modules/prosemirror-keymap/dist/index.js +62 -0
- package/dist/node_modules/prosemirror-model/dist/index.js +2733 -0
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +88 -0
- package/dist/node_modules/prosemirror-state/dist/index.js +822 -0
- package/dist/node_modules/prosemirror-transform/dist/index.js +1520 -0
- package/dist/node_modules/prosemirror-view/dist/index.js +3794 -0
- package/dist/node_modules/rope-sequence/dist/index.js +100 -0
- package/dist/node_modules/tippy.js/dist/tippy.esm.js +813 -0
- package/dist/node_modules/w3c-keyname/index.js +93 -0
- package/dist/translations/locales/cs.d.ts.map +1 -1
- package/dist/translations/locales/cs.js +18 -0
- package/dist/translations/locales/en.d.ts.map +1 -1
- package/dist/translations/locales/en.js +18 -0
- package/dist/translations/locales/sk.d.ts.map +1 -1
- package/dist/translations/locales/sk.js +18 -0
- package/dist/translations/types.d.ts +22 -0
- package/dist/translations/types.d.ts.map +1 -1
- package/package.json +17 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Node as e, wrappingInputRule as o, mergeAttributes as r } from "../../core/dist/index.js";
|
|
2
|
+
const n = /^\s*>\s$/, s = e.create({
|
|
3
|
+
name: "blockquote",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
HTMLAttributes: {}
|
|
7
|
+
};
|
|
8
|
+
},
|
|
9
|
+
content: "block+",
|
|
10
|
+
group: "block",
|
|
11
|
+
defining: !0,
|
|
12
|
+
parseHTML() {
|
|
13
|
+
return [
|
|
14
|
+
{ tag: "blockquote" }
|
|
15
|
+
];
|
|
16
|
+
},
|
|
17
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
18
|
+
return ["blockquote", r(this.options.HTMLAttributes, t), 0];
|
|
19
|
+
},
|
|
20
|
+
addCommands() {
|
|
21
|
+
return {
|
|
22
|
+
setBlockquote: () => ({ commands: t }) => t.wrapIn(this.name),
|
|
23
|
+
toggleBlockquote: () => ({ commands: t }) => t.toggleWrap(this.name),
|
|
24
|
+
unsetBlockquote: () => ({ commands: t }) => t.lift(this.name)
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
addKeyboardShortcuts() {
|
|
28
|
+
return {
|
|
29
|
+
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote()
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
addInputRules() {
|
|
33
|
+
return [
|
|
34
|
+
o({
|
|
35
|
+
find: n,
|
|
36
|
+
type: this.type
|
|
37
|
+
})
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
export {
|
|
42
|
+
s as Blockquote,
|
|
43
|
+
s as default,
|
|
44
|
+
n as inputRegex
|
|
45
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Mark as r, markPasteRule as e, markInputRule as s, mergeAttributes as n } from "../../core/dist/index.js";
|
|
2
|
+
const o = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, a = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, d = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, u = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, l = r.create({
|
|
3
|
+
name: "bold",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
HTMLAttributes: {}
|
|
7
|
+
};
|
|
8
|
+
},
|
|
9
|
+
parseHTML() {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
tag: "strong"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
tag: "b",
|
|
16
|
+
getAttrs: (t) => t.style.fontWeight !== "normal" && null
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
style: "font-weight=400",
|
|
20
|
+
clearMark: (t) => t.type.name === this.name
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
style: "font-weight",
|
|
24
|
+
getAttrs: (t) => /^(bold(er)?|[5-9]\d{2,})$/.test(t) && null
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
},
|
|
28
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
29
|
+
return ["strong", n(this.options.HTMLAttributes, t), 0];
|
|
30
|
+
},
|
|
31
|
+
addCommands() {
|
|
32
|
+
return {
|
|
33
|
+
setBold: () => ({ commands: t }) => t.setMark(this.name),
|
|
34
|
+
toggleBold: () => ({ commands: t }) => t.toggleMark(this.name),
|
|
35
|
+
unsetBold: () => ({ commands: t }) => t.unsetMark(this.name)
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
addKeyboardShortcuts() {
|
|
39
|
+
return {
|
|
40
|
+
"Mod-b": () => this.editor.commands.toggleBold(),
|
|
41
|
+
"Mod-B": () => this.editor.commands.toggleBold()
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
addInputRules() {
|
|
45
|
+
return [
|
|
46
|
+
s({
|
|
47
|
+
find: o,
|
|
48
|
+
type: this.type
|
|
49
|
+
}),
|
|
50
|
+
s({
|
|
51
|
+
find: d,
|
|
52
|
+
type: this.type
|
|
53
|
+
})
|
|
54
|
+
];
|
|
55
|
+
},
|
|
56
|
+
addPasteRules() {
|
|
57
|
+
return [
|
|
58
|
+
e({
|
|
59
|
+
find: a,
|
|
60
|
+
type: this.type
|
|
61
|
+
}),
|
|
62
|
+
e({
|
|
63
|
+
find: u,
|
|
64
|
+
type: this.type
|
|
65
|
+
})
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
l as Bold,
|
|
71
|
+
l as default,
|
|
72
|
+
o as starInputRegex,
|
|
73
|
+
a as starPasteRegex,
|
|
74
|
+
d as underscoreInputRegex,
|
|
75
|
+
u as underscorePasteRegex
|
|
76
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { isTextSelection as C, isNodeSelection as E, posToDOMRect as T, Extension as D } from "../../core/dist/index.js";
|
|
2
|
+
import { Plugin as O, PluginKey as M } from "../../../prosemirror-state/dist/index.js";
|
|
3
|
+
import B from "../../../tippy.js/dist/tippy.esm.js";
|
|
4
|
+
class R {
|
|
5
|
+
constructor({ editor: e, element: i, view: a, tippyOptions: m = {}, updateDelay: f = 250, shouldShow: c }) {
|
|
6
|
+
this.preventHide = !1, this.shouldShow = ({ view: t, state: s, from: o, to: r }) => {
|
|
7
|
+
const { doc: l, selection: h } = s, { empty: u } = h, p = !l.textBetween(o, r).length && C(s.selection), v = this.element.contains(document.activeElement);
|
|
8
|
+
return !(!(t.hasFocus() || v) || u || p || !this.editor.isEditable);
|
|
9
|
+
}, this.mousedownHandler = () => {
|
|
10
|
+
this.preventHide = !0;
|
|
11
|
+
}, this.dragstartHandler = () => {
|
|
12
|
+
this.hide();
|
|
13
|
+
}, this.focusHandler = () => {
|
|
14
|
+
setTimeout(() => this.update(this.editor.view));
|
|
15
|
+
}, this.blurHandler = ({ event: t }) => {
|
|
16
|
+
var s;
|
|
17
|
+
if (this.preventHide) {
|
|
18
|
+
this.preventHide = !1;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
t != null && t.relatedTarget && (!((s = this.element.parentNode) === null || s === void 0) && s.contains(t.relatedTarget)) || (t == null ? void 0 : t.relatedTarget) !== this.editor.view.dom && this.hide();
|
|
22
|
+
}, this.tippyBlurHandler = (t) => {
|
|
23
|
+
this.blurHandler({ event: t });
|
|
24
|
+
}, this.handleDebouncedUpdate = (t, s) => {
|
|
25
|
+
const o = !(s != null && s.selection.eq(t.state.selection)), r = !(s != null && s.doc.eq(t.state.doc));
|
|
26
|
+
!o && !r || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
|
|
27
|
+
this.updateHandler(t, o, r, s);
|
|
28
|
+
}, this.updateDelay));
|
|
29
|
+
}, this.updateHandler = (t, s, o, r) => {
|
|
30
|
+
var l, h, u;
|
|
31
|
+
const { state: p, composing: v } = t, { selection: g } = p;
|
|
32
|
+
if (v || !s && !o)
|
|
33
|
+
return;
|
|
34
|
+
this.createTooltip();
|
|
35
|
+
const { ranges: b } = g, y = Math.min(...b.map((n) => n.$from.pos)), w = Math.max(...b.map((n) => n.$to.pos));
|
|
36
|
+
if (!((l = this.shouldShow) === null || l === void 0 ? void 0 : l.call(this, {
|
|
37
|
+
editor: this.editor,
|
|
38
|
+
element: this.element,
|
|
39
|
+
view: t,
|
|
40
|
+
state: p,
|
|
41
|
+
oldState: r,
|
|
42
|
+
from: y,
|
|
43
|
+
to: w
|
|
44
|
+
}))) {
|
|
45
|
+
this.hide();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
(h = this.tippy) === null || h === void 0 || h.setProps({
|
|
49
|
+
getReferenceClientRect: ((u = this.tippyOptions) === null || u === void 0 ? void 0 : u.getReferenceClientRect) || (() => {
|
|
50
|
+
if (E(p.selection)) {
|
|
51
|
+
let n = t.nodeDOM(y);
|
|
52
|
+
if (n) {
|
|
53
|
+
const H = n.dataset.nodeViewWrapper ? n : n.querySelector("[data-node-view-wrapper]");
|
|
54
|
+
if (H && (n = H.firstChild), n)
|
|
55
|
+
return n.getBoundingClientRect();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return T(t, y, w);
|
|
59
|
+
})
|
|
60
|
+
}), this.show();
|
|
61
|
+
}, this.editor = e, this.element = i, this.view = a, this.updateDelay = f, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = m, this.element.remove(), this.element.style.visibility = "visible";
|
|
62
|
+
}
|
|
63
|
+
createTooltip() {
|
|
64
|
+
const { element: e } = this.editor.options, i = !!e.parentElement;
|
|
65
|
+
this.element.tabIndex = 0, !(this.tippy || !i) && (this.tippy = B(e, {
|
|
66
|
+
duration: 0,
|
|
67
|
+
getReferenceClientRect: null,
|
|
68
|
+
content: this.element,
|
|
69
|
+
interactive: !0,
|
|
70
|
+
trigger: "manual",
|
|
71
|
+
placement: "top",
|
|
72
|
+
hideOnClick: "toggle",
|
|
73
|
+
...this.tippyOptions
|
|
74
|
+
}), this.tippy.popper.firstChild && this.tippy.popper.firstChild.addEventListener("blur", this.tippyBlurHandler));
|
|
75
|
+
}
|
|
76
|
+
update(e, i) {
|
|
77
|
+
const { state: a } = e, m = a.selection.from !== a.selection.to;
|
|
78
|
+
if (this.updateDelay > 0 && m) {
|
|
79
|
+
this.handleDebouncedUpdate(e, i);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const f = !(i != null && i.selection.eq(e.state.selection)), c = !(i != null && i.doc.eq(e.state.doc));
|
|
83
|
+
this.updateHandler(e, f, c, i);
|
|
84
|
+
}
|
|
85
|
+
show() {
|
|
86
|
+
var e;
|
|
87
|
+
(e = this.tippy) === null || e === void 0 || e.show();
|
|
88
|
+
}
|
|
89
|
+
hide() {
|
|
90
|
+
var e;
|
|
91
|
+
(e = this.tippy) === null || e === void 0 || e.hide();
|
|
92
|
+
}
|
|
93
|
+
destroy() {
|
|
94
|
+
var e, i;
|
|
95
|
+
!((e = this.tippy) === null || e === void 0) && e.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (i = this.tippy) === null || i === void 0 || i.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const _ = (d) => new O({
|
|
99
|
+
key: typeof d.pluginKey == "string" ? new M(d.pluginKey) : d.pluginKey,
|
|
100
|
+
view: (e) => new R({ view: e, ...d })
|
|
101
|
+
});
|
|
102
|
+
D.create({
|
|
103
|
+
name: "bubbleMenu",
|
|
104
|
+
addOptions() {
|
|
105
|
+
return {
|
|
106
|
+
element: null,
|
|
107
|
+
tippyOptions: {},
|
|
108
|
+
pluginKey: "bubbleMenu",
|
|
109
|
+
updateDelay: void 0,
|
|
110
|
+
shouldShow: null
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
addProseMirrorPlugins() {
|
|
114
|
+
return this.options.element ? [
|
|
115
|
+
_({
|
|
116
|
+
pluginKey: this.options.pluginKey,
|
|
117
|
+
editor: this.editor,
|
|
118
|
+
element: this.options.element,
|
|
119
|
+
tippyOptions: this.options.tippyOptions,
|
|
120
|
+
updateDelay: this.options.updateDelay,
|
|
121
|
+
shouldShow: this.options.shouldShow
|
|
122
|
+
})
|
|
123
|
+
] : [];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
export {
|
|
127
|
+
_ as BubbleMenuPlugin,
|
|
128
|
+
R as BubbleMenuView
|
|
129
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Node as o, wrappingInputRule as e, mergeAttributes as n } from "../../core/dist/index.js";
|
|
2
|
+
const p = "listItem", s = "textStyle", i = /^\s*([-+*])\s$/, a = o.create({
|
|
3
|
+
name: "bulletList",
|
|
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
|
+
parseHTML() {
|
|
17
|
+
return [
|
|
18
|
+
{ tag: "ul" }
|
|
19
|
+
];
|
|
20
|
+
},
|
|
21
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
22
|
+
return ["ul", n(this.options.HTMLAttributes, t), 0];
|
|
23
|
+
},
|
|
24
|
+
addCommands() {
|
|
25
|
+
return {
|
|
26
|
+
toggleBulletList: () => ({ commands: t, chain: r }) => this.options.keepAttributes ? r().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(p, this.editor.getAttributes(s)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
addKeyboardShortcuts() {
|
|
30
|
+
return {
|
|
31
|
+
"Mod-Shift-8": () => this.editor.commands.toggleBulletList()
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
addInputRules() {
|
|
35
|
+
let t = e({
|
|
36
|
+
find: i,
|
|
37
|
+
type: this.type
|
|
38
|
+
});
|
|
39
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (t = e({
|
|
40
|
+
find: i,
|
|
41
|
+
type: this.type,
|
|
42
|
+
keepMarks: this.options.keepMarks,
|
|
43
|
+
keepAttributes: this.options.keepAttributes,
|
|
44
|
+
getAttributes: () => this.editor.getAttributes(s),
|
|
45
|
+
editor: this.editor
|
|
46
|
+
})), [
|
|
47
|
+
t
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
a as BulletList,
|
|
53
|
+
a as default,
|
|
54
|
+
i as inputRegex
|
|
55
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Mark as t, markPasteRule as r, markInputRule as s, mergeAttributes as d } from "../../core/dist/index.js";
|
|
2
|
+
const n = /(^|[^`])`([^`]+)`(?!`)/, a = /(^|[^`])`([^`]+)`(?!`)/g, u = t.create({
|
|
3
|
+
name: "code",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
HTMLAttributes: {}
|
|
7
|
+
};
|
|
8
|
+
},
|
|
9
|
+
excludes: "_",
|
|
10
|
+
code: !0,
|
|
11
|
+
exitable: !0,
|
|
12
|
+
parseHTML() {
|
|
13
|
+
return [
|
|
14
|
+
{ tag: "code" }
|
|
15
|
+
];
|
|
16
|
+
},
|
|
17
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
18
|
+
return ["code", d(this.options.HTMLAttributes, e), 0];
|
|
19
|
+
},
|
|
20
|
+
addCommands() {
|
|
21
|
+
return {
|
|
22
|
+
setCode: () => ({ commands: e }) => e.setMark(this.name),
|
|
23
|
+
toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
24
|
+
unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
addKeyboardShortcuts() {
|
|
28
|
+
return {
|
|
29
|
+
"Mod-e": () => this.editor.commands.toggleCode()
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
addInputRules() {
|
|
33
|
+
return [
|
|
34
|
+
s({
|
|
35
|
+
find: n,
|
|
36
|
+
type: this.type
|
|
37
|
+
})
|
|
38
|
+
];
|
|
39
|
+
},
|
|
40
|
+
addPasteRules() {
|
|
41
|
+
return [
|
|
42
|
+
r({
|
|
43
|
+
find: a,
|
|
44
|
+
type: this.type
|
|
45
|
+
})
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
u as Code,
|
|
51
|
+
u as default,
|
|
52
|
+
n as inputRegex,
|
|
53
|
+
a as pasteRegex
|
|
54
|
+
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Node as d, textblockTypeInputRule as c, mergeAttributes as p } from "../../core/dist/index.js";
|
|
2
|
+
import { Plugin as f, PluginKey as g, TextSelection as m, Selection as h } from "../../../prosemirror-state/dist/index.js";
|
|
3
|
+
const x = /^```([a-z]+)?[\s\n]$/, y = /^~~~([a-z]+)?[\s\n]$/, C = d.create({
|
|
4
|
+
name: "codeBlock",
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
languageClassPrefix: "language-",
|
|
8
|
+
exitOnTripleEnter: !0,
|
|
9
|
+
exitOnArrowDown: !0,
|
|
10
|
+
defaultLanguage: null,
|
|
11
|
+
HTMLAttributes: {}
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
content: "text*",
|
|
15
|
+
marks: "",
|
|
16
|
+
group: "block",
|
|
17
|
+
code: !0,
|
|
18
|
+
defining: !0,
|
|
19
|
+
addAttributes() {
|
|
20
|
+
return {
|
|
21
|
+
language: {
|
|
22
|
+
default: this.options.defaultLanguage,
|
|
23
|
+
parseHTML: (e) => {
|
|
24
|
+
var t;
|
|
25
|
+
const { languageClassPrefix: s } = this.options, o = [...((t = e.firstElementChild) === null || t === void 0 ? void 0 : t.classList) || []].filter((n) => n.startsWith(s)).map((n) => n.replace(s, ""))[0];
|
|
26
|
+
return o || null;
|
|
27
|
+
},
|
|
28
|
+
rendered: !1
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
parseHTML() {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
tag: "pre",
|
|
36
|
+
preserveWhitespace: "full"
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
},
|
|
40
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
41
|
+
return [
|
|
42
|
+
"pre",
|
|
43
|
+
p(this.options.HTMLAttributes, t),
|
|
44
|
+
[
|
|
45
|
+
"code",
|
|
46
|
+
{
|
|
47
|
+
class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null
|
|
48
|
+
},
|
|
49
|
+
0
|
|
50
|
+
]
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
addCommands() {
|
|
54
|
+
return {
|
|
55
|
+
setCodeBlock: (e) => ({ commands: t }) => t.setNode(this.name, e),
|
|
56
|
+
toggleCodeBlock: (e) => ({ commands: t }) => t.toggleNode(this.name, "paragraph", e)
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
addKeyboardShortcuts() {
|
|
60
|
+
return {
|
|
61
|
+
"Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
|
|
62
|
+
// remove code block when at start of document or code block is empty
|
|
63
|
+
Backspace: () => {
|
|
64
|
+
const { empty: e, $anchor: t } = this.editor.state.selection, s = t.pos === 1;
|
|
65
|
+
return !e || t.parent.type.name !== this.name ? !1 : s || !t.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
|
|
66
|
+
},
|
|
67
|
+
// exit node on triple enter
|
|
68
|
+
Enter: ({ editor: e }) => {
|
|
69
|
+
if (!this.options.exitOnTripleEnter)
|
|
70
|
+
return !1;
|
|
71
|
+
const { state: t } = e, { selection: s } = t, { $from: r, empty: a } = s;
|
|
72
|
+
if (!a || r.parent.type !== this.type)
|
|
73
|
+
return !1;
|
|
74
|
+
const o = r.parentOffset === r.parent.nodeSize - 2, n = r.parent.textContent.endsWith(`
|
|
75
|
+
|
|
76
|
+
`);
|
|
77
|
+
return !o || !n ? !1 : e.chain().command(({ tr: i }) => (i.delete(r.pos - 2, r.pos), !0)).exitCode().run();
|
|
78
|
+
},
|
|
79
|
+
// exit node on arrow down
|
|
80
|
+
ArrowDown: ({ editor: e }) => {
|
|
81
|
+
if (!this.options.exitOnArrowDown)
|
|
82
|
+
return !1;
|
|
83
|
+
const { state: t } = e, { selection: s, doc: r } = t, { $from: a, empty: o } = s;
|
|
84
|
+
if (!o || a.parent.type !== this.type || !(a.parentOffset === a.parent.nodeSize - 2))
|
|
85
|
+
return !1;
|
|
86
|
+
const i = a.after();
|
|
87
|
+
return i === void 0 ? !1 : r.nodeAt(i) ? e.commands.command(({ tr: u }) => (u.setSelection(h.near(r.resolve(i))), !0)) : e.commands.exitCode();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
addInputRules() {
|
|
92
|
+
return [
|
|
93
|
+
c({
|
|
94
|
+
find: x,
|
|
95
|
+
type: this.type,
|
|
96
|
+
getAttributes: (e) => ({
|
|
97
|
+
language: e[1]
|
|
98
|
+
})
|
|
99
|
+
}),
|
|
100
|
+
c({
|
|
101
|
+
find: y,
|
|
102
|
+
type: this.type,
|
|
103
|
+
getAttributes: (e) => ({
|
|
104
|
+
language: e[1]
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
];
|
|
108
|
+
},
|
|
109
|
+
addProseMirrorPlugins() {
|
|
110
|
+
return [
|
|
111
|
+
// this plugin creates a code block for pasted content from VS Code
|
|
112
|
+
// we can also detect the copied code language
|
|
113
|
+
new f({
|
|
114
|
+
key: new g("codeBlockVSCodeHandler"),
|
|
115
|
+
props: {
|
|
116
|
+
handlePaste: (e, t) => {
|
|
117
|
+
if (!t.clipboardData || this.editor.isActive(this.type.name))
|
|
118
|
+
return !1;
|
|
119
|
+
const s = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), a = r ? JSON.parse(r) : void 0, o = a == null ? void 0 : a.mode;
|
|
120
|
+
if (!s || !o)
|
|
121
|
+
return !1;
|
|
122
|
+
const { tr: n, schema: i } = e.state, l = i.text(s.replace(/\r\n?/g, `
|
|
123
|
+
`));
|
|
124
|
+
return n.replaceSelectionWith(this.type.create({ language: o }, l)), n.selection.$from.parent.type !== this.type && n.setSelection(m.near(n.doc.resolve(Math.max(0, n.selection.from - 2)))), n.setMeta("paste", !0), e.dispatch(n), !0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
export {
|
|
132
|
+
C as CodeBlock,
|
|
133
|
+
x as backtickInputRegex,
|
|
134
|
+
C as default,
|
|
135
|
+
y as tildeInputRegex
|
|
136
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Extension as r } from "../../core/dist/index.js";
|
|
2
|
+
import { dropCursor as o } from "../../../prosemirror-dropcursor/dist/index.js";
|
|
3
|
+
const e = r.create({
|
|
4
|
+
name: "dropCursor",
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
color: "currentColor",
|
|
8
|
+
width: 1,
|
|
9
|
+
class: void 0
|
|
10
|
+
};
|
|
11
|
+
},
|
|
12
|
+
addProseMirrorPlugins() {
|
|
13
|
+
return [
|
|
14
|
+
o(this.options)
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
e as Dropcursor,
|
|
20
|
+
e as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Extension as t, callOrReturn as e, getExtensionField as l } from "../../core/dist/index.js";
|
|
2
|
+
import { gapCursor as n } from "../../../prosemirror-gapcursor/dist/index.js";
|
|
3
|
+
const p = t.create({
|
|
4
|
+
name: "gapCursor",
|
|
5
|
+
addProseMirrorPlugins() {
|
|
6
|
+
return [
|
|
7
|
+
n()
|
|
8
|
+
];
|
|
9
|
+
},
|
|
10
|
+
extendNodeSchema(r) {
|
|
11
|
+
var o;
|
|
12
|
+
const a = {
|
|
13
|
+
name: r.name,
|
|
14
|
+
options: r.options,
|
|
15
|
+
storage: r.storage
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
allowGapCursor: (o = e(l(r, "allowGapCursor", a))) !== null && o !== void 0 ? o : null
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
p as Gapcursor,
|
|
24
|
+
p as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Node as l, mergeAttributes as c } from "../../core/dist/index.js";
|
|
2
|
+
const M = l.create({
|
|
3
|
+
name: "hardBreak",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
keepMarks: !0,
|
|
7
|
+
HTMLAttributes: {}
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
inline: !0,
|
|
11
|
+
group: "inline",
|
|
12
|
+
selectable: !1,
|
|
13
|
+
linebreakReplacement: !0,
|
|
14
|
+
parseHTML() {
|
|
15
|
+
return [
|
|
16
|
+
{ tag: "br" }
|
|
17
|
+
];
|
|
18
|
+
},
|
|
19
|
+
renderHTML({ HTMLAttributes: e }) {
|
|
20
|
+
return ["br", c(this.options.HTMLAttributes, e)];
|
|
21
|
+
},
|
|
22
|
+
renderText() {
|
|
23
|
+
return `
|
|
24
|
+
`;
|
|
25
|
+
},
|
|
26
|
+
addCommands() {
|
|
27
|
+
return {
|
|
28
|
+
setHardBreak: () => ({ commands: e, chain: n, state: s, editor: a }) => e.first([
|
|
29
|
+
() => e.exitCode(),
|
|
30
|
+
() => e.command(() => {
|
|
31
|
+
const { selection: r, storedMarks: i } = s;
|
|
32
|
+
if (r.$from.parent.type.spec.isolating)
|
|
33
|
+
return !1;
|
|
34
|
+
const { keepMarks: o } = this.options, { splittableMarks: d } = a.extensionManager, t = i || r.$to.parentOffset && r.$from.marks();
|
|
35
|
+
return n().insertContent({ type: this.name }).command(({ tr: u, dispatch: m }) => {
|
|
36
|
+
if (m && t && o) {
|
|
37
|
+
const p = t.filter((k) => d.includes(k.type.name));
|
|
38
|
+
u.ensureMarks(p);
|
|
39
|
+
}
|
|
40
|
+
return !0;
|
|
41
|
+
}).run();
|
|
42
|
+
})
|
|
43
|
+
])
|
|
44
|
+
};
|
|
45
|
+
},
|
|
46
|
+
addKeyboardShortcuts() {
|
|
47
|
+
return {
|
|
48
|
+
"Mod-Enter": () => this.editor.commands.setHardBreak(),
|
|
49
|
+
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export {
|
|
54
|
+
M as HardBreak,
|
|
55
|
+
M as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Node as s, textblockTypeInputRule as n, mergeAttributes as r } from "../../core/dist/index.js";
|
|
2
|
+
const a = s.create({
|
|
3
|
+
name: "heading",
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
levels: [1, 2, 3, 4, 5, 6],
|
|
7
|
+
HTMLAttributes: {}
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
content: "inline*",
|
|
11
|
+
group: "block",
|
|
12
|
+
defining: !0,
|
|
13
|
+
addAttributes() {
|
|
14
|
+
return {
|
|
15
|
+
level: {
|
|
16
|
+
default: 1,
|
|
17
|
+
rendered: !1
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
parseHTML() {
|
|
22
|
+
return this.options.levels.map((e) => ({
|
|
23
|
+
tag: `h${e}`,
|
|
24
|
+
attrs: { level: e }
|
|
25
|
+
}));
|
|
26
|
+
},
|
|
27
|
+
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
28
|
+
return [`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`, r(this.options.HTMLAttributes, t), 0];
|
|
29
|
+
},
|
|
30
|
+
addCommands() {
|
|
31
|
+
return {
|
|
32
|
+
setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
|
|
33
|
+
toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
addKeyboardShortcuts() {
|
|
37
|
+
return this.options.levels.reduce((e, t) => ({
|
|
38
|
+
...e,
|
|
39
|
+
[`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
|
|
40
|
+
}), {});
|
|
41
|
+
},
|
|
42
|
+
addInputRules() {
|
|
43
|
+
return this.options.levels.map((e) => n({
|
|
44
|
+
find: new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
|
|
45
|
+
type: this.type,
|
|
46
|
+
getAttributes: {
|
|
47
|
+
level: e
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
a as Heading,
|
|
54
|
+
a as default
|
|
55
|
+
};
|