@vizel/core 0.0.1-alpha.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/index.d.ts +230 -15
- package/dist/index.js +78 -75
- package/dist/index10.js +1 -1
- package/dist/index11.js +4 -4
- package/dist/index14.js +1 -1
- package/dist/index15.js +134 -127
- package/dist/index17.js +2 -2
- package/dist/index18.js +1 -1
- package/dist/index19.js +86 -86
- package/dist/index20.js +2 -2
- package/dist/index21.js +2 -2
- package/dist/index22.js +16 -13
- package/dist/index24.js +164 -11
- package/dist/index25.js +12 -53
- package/dist/index26.js +49 -136
- package/dist/index27.js +132 -59
- package/dist/index28.js +66 -32
- package/dist/index29.js +35 -21
- package/dist/index3.js +91 -90
- package/dist/index30.js +23 -9
- package/dist/index31.js +9 -147
- package/dist/index32.js +138 -256
- package/dist/index33.js +258 -85
- package/dist/index34.js +91 -15
- package/dist/index35.js +63 -57
- package/dist/index36.js +4 -15
- package/dist/index37.js +115 -56
- package/dist/index38.js +327 -4
- package/dist/index39.js +11 -121
- package/dist/index4.js +1 -1
- package/dist/index40.js +481 -321
- package/dist/index41.js +42 -481
- package/dist/index42.js +683 -37
- package/dist/index43.js +4 -679
- package/dist/index44.js +4 -4
- package/dist/index45.js +238 -4
- package/dist/index46.js +54 -210
- package/dist/index47.js +16 -81
- package/dist/index48.js +57 -285
- package/dist/index49.js +14 -1501
- package/dist/index5.js +78 -68
- package/dist/index50.js +286 -5
- package/dist/index51.js +4 -4
- package/dist/index52.js +1408 -1467
- package/dist/index53.js +5 -723
- package/dist/index54.js +1112 -21
- package/dist/index55.js +722 -9
- package/dist/index56.js +83 -6
- package/dist/index57.js +245 -7
- package/dist/index58.js +3 -14
- package/dist/index59.js +1230 -17
- package/dist/index6.js +1 -1
- package/dist/index60.js +733 -24
- package/dist/index61.js +21 -84
- package/dist/index62.js +10 -246
- package/dist/index63.js +7 -3
- package/dist/index64.js +7 -1231
- package/dist/index65.js +11 -731
- package/dist/index66.js +17 -1059
- package/dist/index67.js +21 -51
- package/dist/index68.js +54 -3
- package/dist/index69.js +1061 -98
- package/dist/index7.js +108 -96
- package/dist/index70.js +98 -91
- package/dist/index71.js +93 -0
- package/dist/index72.js +6 -0
- package/dist/index8.js +1 -1
- package/dist/index9.js +75 -65
- package/dist/mathematics.css +1 -0
- package/dist/mathematics.css.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +90 -52
package/dist/index5.js
CHANGED
|
@@ -1,28 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return w.listLanguages().sort((t, p) => t.localeCompare(p)).map((t) => ({
|
|
1
|
+
import T from "./index37.js";
|
|
2
|
+
import { renderVizelIcon as I } from "./index22.js";
|
|
3
|
+
let C = null;
|
|
4
|
+
function E() {
|
|
5
|
+
return C ? C.listLanguages().sort((t, c) => t.localeCompare(c)).map((t) => ({
|
|
7
6
|
id: t,
|
|
8
7
|
// Capitalize first letter for display name
|
|
9
8
|
name: t.charAt(0).toUpperCase() + t.slice(1)
|
|
10
|
-
}));
|
|
9
|
+
})) : [];
|
|
11
10
|
}
|
|
12
11
|
function O() {
|
|
13
|
-
return
|
|
12
|
+
return E().map((r) => r.id);
|
|
14
13
|
}
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
17
|
-
return
|
|
14
|
+
function P(r) {
|
|
15
|
+
const t = r.toLowerCase();
|
|
16
|
+
return E().find((c) => c.id === t);
|
|
18
17
|
}
|
|
19
|
-
function
|
|
18
|
+
async function S(r = "common") {
|
|
19
|
+
try {
|
|
20
|
+
const t = await import("lowlight"), c = r === "all" ? t.all : t.common;
|
|
21
|
+
return t.createLowlight(c);
|
|
22
|
+
} catch (t) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`[Vizel] Failed to load "lowlight". Please install it for code block syntax highlighting: npm install lowlight
|
|
25
|
+
Original error: ${t instanceof Error ? t.message : String(t)}`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function q(r = {}) {
|
|
20
30
|
const {
|
|
21
31
|
defaultLanguage: t = "plaintext",
|
|
22
|
-
lineNumbers:
|
|
23
|
-
lowlight: x
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
lineNumbers: c = !1,
|
|
33
|
+
lowlight: x,
|
|
34
|
+
languages: M = "common"
|
|
35
|
+
} = r, k = x ?? await S(M);
|
|
36
|
+
return C = k, [T.extend({
|
|
26
37
|
addAttributes() {
|
|
27
38
|
return {
|
|
28
39
|
...this.parent?.(),
|
|
@@ -35,101 +46,100 @@ function q(u = {}) {
|
|
|
35
46
|
})
|
|
36
47
|
},
|
|
37
48
|
lineNumbers: {
|
|
38
|
-
default:
|
|
49
|
+
default: c,
|
|
39
50
|
parseHTML: (n) => n.getAttribute("data-line-numbers") === "true",
|
|
40
51
|
renderHTML: (n) => n.lineNumbers ? { "data-line-numbers": "true" } : {}
|
|
41
52
|
}
|
|
42
53
|
};
|
|
43
54
|
},
|
|
44
55
|
addNodeView() {
|
|
45
|
-
return ({ node: n, getPos:
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
56
|
+
return ({ node: n, getPos: h, editor: g }) => {
|
|
57
|
+
const m = document.createElement("div");
|
|
58
|
+
m.classList.add("vizel-code-block"), n.attrs.lineNumbers && m.classList.add("vizel-code-block-line-numbers");
|
|
59
|
+
const u = document.createElement("div");
|
|
60
|
+
u.classList.add("vizel-code-block-language-selector"), u.setAttribute("contenteditable", "false");
|
|
50
61
|
const l = document.createElement("input");
|
|
51
62
|
l.type = "text", l.classList.add("vizel-code-block-language-input"), l.value = n.attrs.language || t, l.placeholder = "language";
|
|
52
|
-
const
|
|
53
|
-
v.id =
|
|
54
|
-
for (const e of
|
|
63
|
+
const N = `vizel-languages-${Math.random().toString(36).slice(2, 9)}`, v = document.createElement("datalist");
|
|
64
|
+
v.id = N, l.setAttribute("list", N);
|
|
65
|
+
for (const e of E()) {
|
|
55
66
|
const a = document.createElement("option");
|
|
56
67
|
a.value = e.id, a.label = e.name, v.appendChild(a);
|
|
57
68
|
}
|
|
58
|
-
const
|
|
59
|
-
const e = typeof
|
|
69
|
+
const w = () => {
|
|
70
|
+
const e = typeof h == "function" ? h() : null;
|
|
60
71
|
if (e != null) {
|
|
61
72
|
const a = l.value.toLowerCase().trim() || t;
|
|
62
73
|
l.value = a;
|
|
63
|
-
const { tr:
|
|
64
|
-
|
|
65
|
-
...
|
|
74
|
+
const { tr: d } = g.state, s = g.state.doc.nodeAt(e);
|
|
75
|
+
s && (d.setNodeMarkup(e, void 0, {
|
|
76
|
+
...s.attrs,
|
|
66
77
|
language: a
|
|
67
|
-
}),
|
|
78
|
+
}), g.view.dispatch(d));
|
|
68
79
|
}
|
|
69
80
|
};
|
|
70
|
-
l.addEventListener("change",
|
|
71
|
-
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(),
|
|
81
|
+
l.addEventListener("change", w), l.addEventListener("blur", w), l.addEventListener("keydown", (e) => {
|
|
82
|
+
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), w(), l.blur());
|
|
72
83
|
});
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
b.classList.add(`language-${n.attrs.language || t}`),
|
|
81
|
-
const
|
|
84
|
+
const i = document.createElement("button");
|
|
85
|
+
i.type = "button", i.classList.add("vizel-code-block-line-numbers-toggle"), i.innerHTML = I("listOrdered", { width: 16, height: 16 }), n.attrs.lineNumbers && i.classList.add("active"), i.title = n.attrs.lineNumbers ? "Hide line numbers" : "Show line numbers", u.appendChild(i), u.appendChild(l), u.appendChild(v);
|
|
86
|
+
const f = document.createElement("div");
|
|
87
|
+
f.classList.add("vizel-code-block-container");
|
|
88
|
+
const o = document.createElement("div");
|
|
89
|
+
o.classList.add("vizel-code-block-gutter"), o.setAttribute("contenteditable", "false"), o.setAttribute("aria-hidden", "true");
|
|
90
|
+
const z = document.createElement("pre"), b = document.createElement("code");
|
|
91
|
+
b.classList.add(`language-${n.attrs.language || t}`), z.appendChild(b), f.appendChild(o), f.appendChild(z), m.appendChild(u), m.appendChild(f);
|
|
92
|
+
const y = () => {
|
|
82
93
|
const e = b.textContent || "", a = e.split(`
|
|
83
|
-
`),
|
|
94
|
+
`), d = e.endsWith(`
|
|
84
95
|
`) && a.length > 1 ? a.length - 1 : Math.max(1, a.length);
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
for (let
|
|
88
|
-
const
|
|
89
|
-
|
|
96
|
+
if (o.children.length !== d) {
|
|
97
|
+
o.replaceChildren();
|
|
98
|
+
for (let s = 1; s <= d; s++) {
|
|
99
|
+
const p = document.createElement("div");
|
|
100
|
+
p.classList.add("vizel-code-block-line-number"), p.textContent = String(s), o.appendChild(p);
|
|
90
101
|
}
|
|
91
102
|
}
|
|
92
103
|
};
|
|
93
|
-
n.attrs.lineNumbers && setTimeout(
|
|
94
|
-
let A = n.attrs.language,
|
|
95
|
-
|
|
104
|
+
n.attrs.lineNumbers && setTimeout(y, 0);
|
|
105
|
+
let A = n.attrs.language, L = n.attrs.lineNumbers;
|
|
106
|
+
i.addEventListener("click", (e) => {
|
|
96
107
|
e.preventDefault(), e.stopPropagation();
|
|
97
|
-
const a = typeof
|
|
108
|
+
const a = typeof h == "function" ? h() : null;
|
|
98
109
|
if (a != null) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
...
|
|
102
|
-
lineNumbers:
|
|
103
|
-
}),
|
|
110
|
+
const d = !L, { tr: s } = g.state, p = g.state.doc.nodeAt(a);
|
|
111
|
+
p && (s.setNodeMarkup(a, void 0, {
|
|
112
|
+
...p.attrs,
|
|
113
|
+
lineNumbers: d
|
|
114
|
+
}), g.view.dispatch(s));
|
|
104
115
|
}
|
|
105
116
|
});
|
|
106
|
-
const
|
|
117
|
+
const V = (e) => {
|
|
107
118
|
A = e, l.value = e || t, b.className = `language-${e || t}`;
|
|
108
|
-
},
|
|
109
|
-
|
|
119
|
+
}, H = (e) => {
|
|
120
|
+
L = e, m.classList.toggle("vizel-code-block-line-numbers", e), i.classList.toggle("active", e), i.title = e ? "Hide line numbers" : "Show line numbers";
|
|
110
121
|
};
|
|
111
122
|
return {
|
|
112
|
-
dom:
|
|
123
|
+
dom: m,
|
|
113
124
|
contentDOM: b,
|
|
114
125
|
update(e) {
|
|
115
|
-
return e.type.name !== "codeBlock" ? !1 : (e.attrs.language !== A &&
|
|
126
|
+
return e.type.name !== "codeBlock" ? !1 : (e.attrs.language !== A && V(e.attrs.language), e.attrs.lineNumbers !== L && H(e.attrs.lineNumbers), L && setTimeout(y, 0), !0);
|
|
116
127
|
},
|
|
117
128
|
ignoreMutation(e) {
|
|
118
|
-
return
|
|
129
|
+
return o.contains(e.target) || u.contains(e.target);
|
|
119
130
|
}
|
|
120
131
|
};
|
|
121
132
|
};
|
|
122
133
|
}
|
|
123
134
|
}).configure({
|
|
124
|
-
lowlight:
|
|
135
|
+
lowlight: k,
|
|
125
136
|
defaultLanguage: t
|
|
126
137
|
})];
|
|
127
138
|
}
|
|
128
139
|
export {
|
|
129
|
-
|
|
140
|
+
T as CodeBlockLowlight,
|
|
130
141
|
q as createVizelCodeBlockExtension,
|
|
131
|
-
|
|
142
|
+
P as findVizelLanguage,
|
|
132
143
|
O as getAllVizelLanguageIds,
|
|
133
|
-
|
|
134
|
-
w as lowlight
|
|
144
|
+
E as getVizelRegisteredLanguages
|
|
135
145
|
};
|
package/dist/index50.js
CHANGED
|
@@ -1,7 +1,288 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Extension as u, callOrReturn as w, getExtensionField as S, isNodeEmpty as P, isNodeSelection as v } from "@tiptap/core";
|
|
2
|
+
import { Plugin as p, PluginKey as m } from "./index40.js";
|
|
3
|
+
import { dropCursor as z } from "./index56.js";
|
|
4
|
+
import { DecorationSet as f, Decoration as g } from "./index52.js";
|
|
5
|
+
import { gapCursor as E } from "./index51.js";
|
|
6
|
+
import { history as M, redo as N, undo as O } from "./index57.js";
|
|
7
|
+
var k = u.create({
|
|
8
|
+
name: "characterCount",
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
limit: null,
|
|
12
|
+
mode: "textSize",
|
|
13
|
+
textCounter: (e) => e.length,
|
|
14
|
+
wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
addStorage() {
|
|
18
|
+
return {
|
|
19
|
+
characters: () => 0,
|
|
20
|
+
words: () => 0
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
onBeforeCreate() {
|
|
24
|
+
this.storage.characters = (e) => {
|
|
25
|
+
const t = e?.node || this.editor.state.doc;
|
|
26
|
+
if ((e?.mode || this.options.mode) === "textSize") {
|
|
27
|
+
const r = t.textBetween(0, t.content.size, void 0, " ");
|
|
28
|
+
return this.options.textCounter(r);
|
|
29
|
+
}
|
|
30
|
+
return t.nodeSize;
|
|
31
|
+
}, this.storage.words = (e) => {
|
|
32
|
+
const t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
|
|
33
|
+
return this.options.wordCounter(n);
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
addProseMirrorPlugins() {
|
|
37
|
+
let e = !1;
|
|
38
|
+
return [
|
|
39
|
+
new p({
|
|
40
|
+
key: new m("characterCount"),
|
|
41
|
+
appendTransaction: (t, n, r) => {
|
|
42
|
+
if (e)
|
|
43
|
+
return;
|
|
44
|
+
const o = this.options.limit;
|
|
45
|
+
if (o == null || o === 0) {
|
|
46
|
+
e = !0;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const s = this.storage.characters({ node: r.doc });
|
|
50
|
+
if (s > o) {
|
|
51
|
+
const i = s - o, d = 0, a = i;
|
|
52
|
+
console.warn(
|
|
53
|
+
`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`
|
|
54
|
+
);
|
|
55
|
+
const c = r.tr.deleteRange(d, a);
|
|
56
|
+
return e = !0, c;
|
|
57
|
+
}
|
|
58
|
+
e = !0;
|
|
59
|
+
},
|
|
60
|
+
filterTransaction: (t, n) => {
|
|
61
|
+
const r = this.options.limit;
|
|
62
|
+
if (!t.docChanged || r === 0 || r === null || r === void 0)
|
|
63
|
+
return !0;
|
|
64
|
+
const o = this.storage.characters({ node: n.doc }), s = this.storage.characters({ node: t.doc });
|
|
65
|
+
if (s <= r || o > r && s > r && s <= o)
|
|
66
|
+
return !0;
|
|
67
|
+
if (o > r && s > r && s > o || !t.getMeta("paste"))
|
|
68
|
+
return !1;
|
|
69
|
+
const d = t.selection.$head.pos, a = s - r, c = d - a, l = d;
|
|
70
|
+
return t.deleteRange(c, l), !(this.storage.characters({ node: t.doc }) > r);
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
u.create({
|
|
77
|
+
name: "dropCursor",
|
|
78
|
+
addOptions() {
|
|
79
|
+
return {
|
|
80
|
+
color: "currentColor",
|
|
81
|
+
width: 1,
|
|
82
|
+
class: void 0
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
addProseMirrorPlugins() {
|
|
86
|
+
return [z(this.options)];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
u.create({
|
|
90
|
+
name: "focus",
|
|
91
|
+
addOptions() {
|
|
92
|
+
return {
|
|
93
|
+
className: "has-focus",
|
|
94
|
+
mode: "all"
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
addProseMirrorPlugins() {
|
|
98
|
+
return [
|
|
99
|
+
new p({
|
|
100
|
+
key: new m("focus"),
|
|
101
|
+
props: {
|
|
102
|
+
decorations: ({ doc: e, selection: t }) => {
|
|
103
|
+
const { isEditable: n, isFocused: r } = this.editor, { anchor: o } = t, s = [];
|
|
104
|
+
if (!n || !r)
|
|
105
|
+
return f.create(e, []);
|
|
106
|
+
let i = 0;
|
|
107
|
+
this.options.mode === "deepest" && e.descendants((a, c) => {
|
|
108
|
+
if (a.isText)
|
|
109
|
+
return;
|
|
110
|
+
if (!(o >= c && o <= c + a.nodeSize - 1))
|
|
111
|
+
return !1;
|
|
112
|
+
i += 1;
|
|
113
|
+
});
|
|
114
|
+
let d = 0;
|
|
115
|
+
return e.descendants((a, c) => {
|
|
116
|
+
if (a.isText || !(o >= c && o <= c + a.nodeSize - 1))
|
|
117
|
+
return !1;
|
|
118
|
+
if (d += 1, this.options.mode === "deepest" && i - d > 0 || this.options.mode === "shallowest" && d > 1)
|
|
119
|
+
return this.options.mode === "deepest";
|
|
120
|
+
s.push(
|
|
121
|
+
g.node(c, c + a.nodeSize, {
|
|
122
|
+
class: this.options.className
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}), f.create(e, s);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
u.create({
|
|
133
|
+
name: "gapCursor",
|
|
134
|
+
addProseMirrorPlugins() {
|
|
135
|
+
return [E()];
|
|
136
|
+
},
|
|
137
|
+
extendNodeSchema(e) {
|
|
138
|
+
var t;
|
|
139
|
+
const n = {
|
|
140
|
+
name: e.name,
|
|
141
|
+
options: e.options,
|
|
142
|
+
storage: e.storage
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
allowGapCursor: (t = w(S(e, "allowGapCursor", n))) != null ? t : null
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
u.create({
|
|
150
|
+
name: "placeholder",
|
|
151
|
+
addOptions() {
|
|
152
|
+
return {
|
|
153
|
+
emptyEditorClass: "is-editor-empty",
|
|
154
|
+
emptyNodeClass: "is-empty",
|
|
155
|
+
placeholder: "Write something …",
|
|
156
|
+
showOnlyWhenEditable: !0,
|
|
157
|
+
showOnlyCurrent: !0,
|
|
158
|
+
includeChildren: !1
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
addProseMirrorPlugins() {
|
|
162
|
+
return [
|
|
163
|
+
new p({
|
|
164
|
+
key: new m("placeholder"),
|
|
165
|
+
props: {
|
|
166
|
+
decorations: ({ doc: e, selection: t }) => {
|
|
167
|
+
const n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = t, o = [];
|
|
168
|
+
if (!n)
|
|
169
|
+
return null;
|
|
170
|
+
const s = this.editor.isEmpty;
|
|
171
|
+
return e.descendants((i, d) => {
|
|
172
|
+
const a = r >= d && r <= d + i.nodeSize, c = !i.isLeaf && P(i);
|
|
173
|
+
if ((a || !this.options.showOnlyCurrent) && c) {
|
|
174
|
+
const l = [this.options.emptyNodeClass];
|
|
175
|
+
s && l.push(this.options.emptyEditorClass);
|
|
176
|
+
const h = g.node(d, d + i.nodeSize, {
|
|
177
|
+
class: l.join(" "),
|
|
178
|
+
"data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
|
|
179
|
+
editor: this.editor,
|
|
180
|
+
node: i,
|
|
181
|
+
pos: d,
|
|
182
|
+
hasAnchor: a
|
|
183
|
+
}) : this.options.placeholder
|
|
184
|
+
});
|
|
185
|
+
o.push(h);
|
|
186
|
+
}
|
|
187
|
+
return this.options.includeChildren;
|
|
188
|
+
}), f.create(e, o);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
})
|
|
192
|
+
];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
u.create({
|
|
196
|
+
name: "selection",
|
|
197
|
+
addOptions() {
|
|
198
|
+
return {
|
|
199
|
+
className: "selection"
|
|
200
|
+
};
|
|
201
|
+
},
|
|
202
|
+
addProseMirrorPlugins() {
|
|
203
|
+
const { editor: e, options: t } = this;
|
|
204
|
+
return [
|
|
205
|
+
new p({
|
|
206
|
+
key: new m("selection"),
|
|
207
|
+
props: {
|
|
208
|
+
decorations(n) {
|
|
209
|
+
return n.selection.empty || e.isFocused || !e.isEditable || v(n.selection) || e.view.dragging ? null : f.create(n.doc, [
|
|
210
|
+
g.inline(n.selection.from, n.selection.to, {
|
|
211
|
+
class: t.className
|
|
212
|
+
})
|
|
213
|
+
]);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
function C({ types: e, node: t }) {
|
|
221
|
+
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
222
|
+
}
|
|
223
|
+
u.create({
|
|
224
|
+
name: "trailingNode",
|
|
225
|
+
addOptions() {
|
|
226
|
+
return {
|
|
227
|
+
node: void 0,
|
|
228
|
+
notAfter: []
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
addProseMirrorPlugins() {
|
|
232
|
+
var e;
|
|
233
|
+
const t = new m(this.name), n = this.options.node || ((e = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : e.name) || "paragraph", r = Object.entries(this.editor.schema.nodes).map(([, o]) => o).filter((o) => (this.options.notAfter || []).concat(n).includes(o.name));
|
|
234
|
+
return [
|
|
235
|
+
new p({
|
|
236
|
+
key: t,
|
|
237
|
+
appendTransaction: (o, s, i) => {
|
|
238
|
+
const { doc: d, tr: a, schema: c } = i, l = t.getState(i), h = d.content.size, y = c.nodes[n];
|
|
239
|
+
if (l)
|
|
240
|
+
return a.insert(h, y.create());
|
|
241
|
+
},
|
|
242
|
+
state: {
|
|
243
|
+
init: (o, s) => {
|
|
244
|
+
const i = s.tr.doc.lastChild;
|
|
245
|
+
return !C({ node: i, types: r });
|
|
246
|
+
},
|
|
247
|
+
apply: (o, s) => {
|
|
248
|
+
if (!o.docChanged || o.getMeta("__uniqueIDTransaction"))
|
|
249
|
+
return s;
|
|
250
|
+
const i = o.doc.lastChild;
|
|
251
|
+
return !C({ node: i, types: r });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
})
|
|
255
|
+
];
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
u.create({
|
|
259
|
+
name: "undoRedo",
|
|
260
|
+
addOptions() {
|
|
261
|
+
return {
|
|
262
|
+
depth: 100,
|
|
263
|
+
newGroupDelay: 500
|
|
264
|
+
};
|
|
265
|
+
},
|
|
266
|
+
addCommands() {
|
|
267
|
+
return {
|
|
268
|
+
undo: () => ({ state: e, dispatch: t }) => O(e, t),
|
|
269
|
+
redo: () => ({ state: e, dispatch: t }) => N(e, t)
|
|
270
|
+
};
|
|
271
|
+
},
|
|
272
|
+
addProseMirrorPlugins() {
|
|
273
|
+
return [M(this.options)];
|
|
274
|
+
},
|
|
275
|
+
addKeyboardShortcuts() {
|
|
276
|
+
return {
|
|
277
|
+
"Mod-z": () => this.editor.commands.undo(),
|
|
278
|
+
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
279
|
+
"Mod-y": () => this.editor.commands.redo(),
|
|
280
|
+
// Russian keyboard layouts
|
|
281
|
+
"Mod-я": () => this.editor.commands.undo(),
|
|
282
|
+
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
});
|
|
5
286
|
export {
|
|
6
|
-
|
|
287
|
+
k as CharacterCount
|
|
7
288
|
};
|
package/dist/index51.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { keydownHandler as v } from "./
|
|
2
|
-
import { Plugin as w, TextSelection as m, NodeSelection as x, Selection as u } from "./
|
|
3
|
-
import { Fragment as h, Slice as g } from "./
|
|
4
|
-
import { DecorationSet as S, Decoration as A } from "./
|
|
1
|
+
import { keydownHandler as v } from "./index68.js";
|
|
2
|
+
import { Plugin as w, TextSelection as m, NodeSelection as x, Selection as u } from "./index40.js";
|
|
3
|
+
import { Fragment as h, Slice as g } from "./index59.js";
|
|
4
|
+
import { DecorationSet as S, Decoration as A } from "./index52.js";
|
|
5
5
|
class i extends u {
|
|
6
6
|
/**
|
|
7
7
|
Create a gap cursor.
|