@burdenoff/microfe-support 2026.1031.1 → 2026.1109.1
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/_virtual/_rolldown/runtime.js +6 -0
- package/dist/dev/main.d.ts +0 -0
- package/dist/generated/global-operations.d.ts +60 -60
- package/dist/node_modules/@tiptap/core/dist/index.js +949 -674
- package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code/dist/index.js +14 -3
- package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +1 -3
- package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js +4 -1
- package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-link/dist/index.js +76 -51
- package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-list/dist/index.js +143 -127
- package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +3 -2
- package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js +21 -11
- package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/extensions/dist/index.js +8 -9
- package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/react/dist/index.js +70 -49
- package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +108 -76
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/node_modules/linkifyjs/dist/linkify.js +127 -113
- package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +1 -1
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-history/dist/index.js +21 -14
- package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-model/dist/index.js +98 -105
- package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-schema-list/dist/index.js +37 -34
- package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-transform/dist/index.js +153 -101
- package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -1
- package/dist/node_modules/prosemirror-view/dist/index.js +742 -693
- package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -1
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +96 -17
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +55 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +53 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +53 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +45 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +11 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -0
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js +11 -0
- package/dist/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -0
- package/dist/support/SupportAdminRoot.d.ts +2 -2
- package/dist/support/SupportAdminRoutes.d.ts +1 -1
- package/dist/support/SupportUserRoot.d.ts +2 -2
- package/dist/support/SupportUserRoutes.d.ts +1 -1
- package/dist/support/components/NotificationToast.d.ts +2 -2
- package/dist/support/components/PageLayout.d.ts +4 -4
- package/dist/support/components/RouteHelpers.d.ts +1 -1
- package/dist/support/components/analytics/CategoryBreakdown.d.ts +1 -1
- package/dist/support/components/analytics/MetricCard.d.ts +1 -1
- package/dist/support/components/analytics/PriorityBreakdown.d.ts +1 -1
- package/dist/support/components/analytics/SLAReport.d.ts +1 -1
- package/dist/support/components/analytics/SatisfactionDistribution.d.ts +1 -1
- package/dist/support/components/analytics/TopAgents.d.ts +1 -1
- package/dist/support/components/analytics/TrendChart.d.ts +1 -1
- package/dist/support/components/careers/BulkCandidateActionGuidance.d.ts +1 -1
- package/dist/support/components/careers/BulkCandidateDialogs.d.ts +7 -7
- package/dist/support/components/careers/BulkOperationFeedback.d.ts +8 -8
- package/dist/support/components/careers/BulkSelectionSummary.d.ts +2 -2
- package/dist/support/components/careers/RichTextEditor.d.ts +1 -2
- package/dist/support/components/careers/RichTextEditor.js.map +1 -1
- package/dist/support/components/kb/ArticleForm.d.ts +1 -1
- package/dist/support/components/settings/CannedResponsesSettings.d.ts +1 -1
- package/dist/support/components/settings/SLAPoliciesSettings.d.ts +1 -1
- package/dist/support/components/settings/TicketCategoriesSettings.d.ts +1 -1
- package/dist/support/components/tickets/AttachmentList.d.ts +1 -1
- package/dist/support/components/tickets/MarkdownContent.d.ts +1 -1
- package/dist/support/components/tickets/MessageComposer.d.ts +1 -1
- package/dist/support/components/tickets/MessageThread.d.ts +2 -2
- package/dist/support/components/tickets/TicketDetailHeader.d.ts +2 -2
- package/dist/support/components/tickets/TicketHeader.d.ts +2 -2
- package/dist/support/components/tickets/TicketSidebar.d.ts +2 -2
- package/dist/support/components/tickets/TriagePanel.d.ts +2 -2
- package/dist/support/constants/pipeline.d.ts +0 -6
- package/dist/support/events/rybbit.d.ts +1 -1
- package/dist/support/hooks/useAnalyticsOperations.d.ts +10 -25
- package/dist/support/hooks/useAnalyticsOperations.js +40 -39
- package/dist/support/hooks/useAnalyticsOperations.js.map +1 -1
- package/dist/support/hooks/useAttachmentsFailedToast.d.ts +1 -1
- package/dist/support/hooks/useChatOperations.d.ts +2 -2
- package/dist/support/hooks/useKnowledgeBaseOperations.d.ts +7 -13
- package/dist/support/hooks/useKnowledgeBaseOperations.js +84 -83
- package/dist/support/hooks/useKnowledgeBaseOperations.js.map +1 -1
- package/dist/support/hooks/useRegisterFooter.d.ts +1 -1
- package/dist/support/hooks/useSettingsOperations.d.ts +7 -16
- package/dist/support/hooks/useSupportAttachments.d.ts +1 -1
- package/dist/support/hooks/useTicketListOperations.d.ts +3 -6
- package/dist/support/hooks/useTicketOperations.d.ts +5 -11
- package/dist/support/hooks/useTicketOperations.js +80 -79
- package/dist/support/hooks/useTicketOperations.js.map +1 -1
- package/dist/support/pages/AnalyticsPage.d.ts +1 -1
- package/dist/support/pages/ArticleDetailAdminPage.d.ts +1 -1
- package/dist/support/pages/ArticleDetailUserPage.d.ts +1 -1
- package/dist/support/pages/ContactInquiriesPage.d.ts +1 -1
- package/dist/support/pages/ContactInquiryDetailPage.d.ts +1 -1
- package/dist/support/pages/CreateArticlePage.d.ts +1 -1
- package/dist/support/pages/CreateTicketPage.d.ts +1 -1
- package/dist/support/pages/EditArticlePage.d.ts +1 -1
- package/dist/support/pages/InterviewersPage.d.ts +1 -1
- package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -2
- package/dist/support/pages/JobApplicationsPage.d.ts +1 -1
- package/dist/support/pages/JobPostingDetailPage.d.ts +1 -1
- package/dist/support/pages/JobPostingsPage.d.ts +1 -1
- package/dist/support/pages/KnowledgeBaseAdminPage.d.ts +1 -1
- package/dist/support/pages/KnowledgeBaseUserPage.d.ts +1 -1
- package/dist/support/pages/SettingsPage.d.ts +1 -1
- package/dist/support/pages/SettingsPage.js.map +1 -1
- package/dist/support/pages/TicketDetailAdminPage.d.ts +1 -1
- package/dist/support/pages/TicketDetailUserPage.d.ts +1 -1
- package/dist/support/pages/TicketDetailUserPage.js.map +1 -1
- package/dist/support/pages/TicketListPage.d.ts +1 -1
- package/dist/support/providers/SupportProvider.d.ts +2 -2
- package/dist/support/store/supportStore.d.ts +2 -2
- package/dist/support/utils/bulkCandidateTargetQuery.d.ts +1 -1
- package/dist/support/utils/cn.d.ts +1 -1
- package/dist/support/utils/index.d.ts +1 -1
- package/dist/support/utils/markdown.d.ts +0 -1
- package/dist/support/utils/refetch.d.ts +12 -0
- package/dist/support/utils/refetch.js +7 -0
- package/dist/support/utils/refetch.js.map +1 -0
- package/dist/support/utils/ticketFilters.d.ts +2 -2
- package/dist/support/utils/uiTokens.d.ts +1 -1
- package/dist/test/dom.d.ts +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/package.json +65 -54
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { t as e } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { RemoveMarkStep as t, ReplaceAroundStep as n, ReplaceStep as r, Transform as i, canJoin as a, canSplit as o, findWrapping as s, joinPoint as c, liftTarget as l } from "../../../prosemirror-transform/dist/index.js";
|
|
3
|
-
import { createParagraphNear as u, exitCode as d, joinBackward as f, joinDown as p, joinForward as m, joinTextblockBackward as h, joinTextblockForward as g, joinUp as _, lift as
|
|
4
|
-
import { AllSelection as
|
|
5
|
-
import { DOMParser as
|
|
6
|
-
import { liftListItem as
|
|
7
|
-
import { DecorationSet as
|
|
8
|
-
import { keymap as
|
|
3
|
+
import { createParagraphNear as u, exitCode as d, joinBackward as f, joinDown as p, joinForward as m, joinTextblockBackward as h, joinTextblockForward as g, joinUp as _, lift as v, liftEmptyBlock as y, newlineInCode as ee, selectNodeBackward as te, selectNodeForward as ne, selectParentNode as re, selectTextblockEnd as ie, selectTextblockStart as ae, setBlockType as b, wrapIn as oe } from "../../../prosemirror-commands/dist/index.js";
|
|
4
|
+
import { AllSelection as se, EditorState as ce, NodeSelection as le, Plugin as x, PluginKey as S, Selection as C, TextSelection as w } from "../../../prosemirror-state/dist/index.js";
|
|
5
|
+
import { DOMParser as ue, DOMSerializer as de, Fragment as T, Schema as fe, Slice as pe } from "../../../prosemirror-model/dist/index.js";
|
|
6
|
+
import { liftListItem as me, sinkListItem as he, wrapInList as ge } from "../../../prosemirror-schema-list/dist/index.js";
|
|
7
|
+
import { DecorationSet as E, EditorView as _e } from "../../../prosemirror-view/dist/index.js";
|
|
8
|
+
import { keymap as ve } from "../../../prosemirror-keymap/dist/index.js";
|
|
9
|
+
import { closeHistory as ye } from "../../../prosemirror-history/dist/index.js";
|
|
9
10
|
// node_modules/@tiptap/core/dist/index.js
|
|
10
|
-
function
|
|
11
|
+
function D(e) {
|
|
11
12
|
let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
|
|
12
13
|
return {
|
|
13
14
|
...t,
|
|
@@ -31,7 +32,7 @@ function E(e) {
|
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
|
-
var
|
|
35
|
+
var O = class e {
|
|
35
36
|
constructor(e) {
|
|
36
37
|
this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
|
|
37
38
|
}
|
|
@@ -91,7 +92,7 @@ var D = class e {
|
|
|
91
92
|
tr: e,
|
|
92
93
|
editor: r,
|
|
93
94
|
view: a,
|
|
94
|
-
state:
|
|
95
|
+
state: D({
|
|
95
96
|
state: i,
|
|
96
97
|
transaction: e
|
|
97
98
|
}),
|
|
@@ -109,26 +110,36 @@ var D = class e {
|
|
|
109
110
|
var n;
|
|
110
111
|
t.dom.blur(), (n = window) == null || (n = n.getSelection()) == null || n.removeAllRanges();
|
|
111
112
|
}
|
|
112
|
-
}), !0), xe = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Se = () => ({
|
|
113
|
-
let { selection:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (e.type.isTextblock) {
|
|
121
|
-
let { defaultType: e } = a.parent.contentMatchAt(a.index());
|
|
122
|
-
t.setNodeMarkup(s.start, e);
|
|
123
|
-
}
|
|
124
|
-
(c || c === 0) && t.lift(s, c);
|
|
113
|
+
}), !0), xe = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Se = () => ({ tr: e, dispatch: t }) => {
|
|
114
|
+
let { selection: n } = e, { ranges: r } = n;
|
|
115
|
+
if (!t) return !0;
|
|
116
|
+
let i = e.mapping.maps.length;
|
|
117
|
+
return r.forEach(({ $from: t, $to: n }) => {
|
|
118
|
+
let r = t.pos, a = n.pos, o = e.mapping.slice(i), s = 1;
|
|
119
|
+
e.doc.nodesBetween(o.map(r), o.map(a), (t, n) => {
|
|
120
|
+
s = Math.max(s, e.doc.resolve(n).depth + 1);
|
|
125
121
|
});
|
|
122
|
+
for (let t = 0; t < s; t += 1) {
|
|
123
|
+
let t = e.doc, n = e.mapping.maps.length, o = e.mapping.slice(i), s = n, c = e.mapping.slice(n), u = o.map(r), d = o.map(a);
|
|
124
|
+
if (t.nodesBetween(u, d, (t, r) => {
|
|
125
|
+
if (t.type.isText) return;
|
|
126
|
+
e.mapping.maps.length !== s && (s = e.mapping.maps.length, c = e.mapping.slice(n));
|
|
127
|
+
let i = e.doc.resolve(c.map(r)), a = e.doc.resolve(c.map(r + t.nodeSize)), o = i.blockRange(a);
|
|
128
|
+
if (!o) return;
|
|
129
|
+
let u = l(o);
|
|
130
|
+
if (t.type.isTextblock) {
|
|
131
|
+
let { defaultType: t } = i.parent.contentMatchAt(i.index()), n = e.doc.nodeAt(o.start);
|
|
132
|
+
t && n && !n.hasMarkup(t) && t.validContent(n.content) && e.setNodeMarkup(o.start, t);
|
|
133
|
+
}
|
|
134
|
+
(u || u === 0) && e.lift(o, u);
|
|
135
|
+
}), e.doc.eq(t)) break;
|
|
136
|
+
}
|
|
126
137
|
}), !0;
|
|
127
138
|
}, Ce = (e) => (t) => e(t), we = () => ({ state: e, dispatch: t }) => u(e, t), Te = (e, t) => ({ editor: n, tr: r }) => {
|
|
128
139
|
let { state: i } = n, a = i.doc.slice(e.from, e.to);
|
|
129
140
|
r.deleteRange(e.from, e.to);
|
|
130
141
|
let o = r.mapping.map(t);
|
|
131
|
-
return r.insert(o, a.content), r.setSelection(new
|
|
142
|
+
return r.insert(o, a.content), r.setSelection(new w(r.doc.resolve(Math.max(o - 1, 0)))), !0;
|
|
132
143
|
}, Ee = () => ({ tr: e, dispatch: t }) => {
|
|
133
144
|
let { selection: n } = e, r = n.$anchor.node();
|
|
134
145
|
if (r.content.size > 0) return !1;
|
|
@@ -142,7 +153,7 @@ var D = class e {
|
|
|
142
153
|
}
|
|
143
154
|
return !1;
|
|
144
155
|
};
|
|
145
|
-
function
|
|
156
|
+
function k(e, t) {
|
|
146
157
|
if (typeof e == "string") {
|
|
147
158
|
if (!t.nodes[e]) throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
|
|
148
159
|
return t.nodes[e];
|
|
@@ -150,7 +161,7 @@ function O(e, t) {
|
|
|
150
161
|
return e;
|
|
151
162
|
}
|
|
152
163
|
var De = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
153
|
-
let i =
|
|
164
|
+
let i = k(e, n.schema), a = t.selection.$anchor;
|
|
154
165
|
for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
|
|
155
166
|
if (r) {
|
|
156
167
|
let n = a.before(e), r = a.after(e);
|
|
@@ -172,28 +183,28 @@ var De = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
|
172
183
|
}), Me = () => ({ state: e, dispatch: t }) => {
|
|
173
184
|
if (e.selection.empty) return !1;
|
|
174
185
|
if (t) {
|
|
175
|
-
let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
|
|
186
|
+
let n = e.tr, { ranges: r } = e.selection, i = e.selection instanceof w ? e.selection.$from.marksAcross(e.selection.$to) : null, a = n.steps.length;
|
|
176
187
|
r.forEach((t) => {
|
|
177
|
-
let r = n.mapping.slice(
|
|
178
|
-
n.deleteRange(
|
|
179
|
-
}), n.selection.empty || n.setSelection(
|
|
188
|
+
let r = n.mapping.slice(a), { from: i, to: o } = je(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
|
|
189
|
+
n.deleteRange(i, o);
|
|
190
|
+
}), n.selection.empty || n.setSelection(w.near(n.doc.resolve(n.selection.from))), i && n.ensureMarks(i), n.scrollIntoView(), t(n);
|
|
180
191
|
}
|
|
181
192
|
return !0;
|
|
182
193
|
}, Ne = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Pe = () => ({ state: e, dispatch: t }) => d(e, t);
|
|
183
|
-
function
|
|
194
|
+
function A(e) {
|
|
184
195
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
185
196
|
}
|
|
186
|
-
function
|
|
197
|
+
function j(e, t, n = { strict: !0 }) {
|
|
187
198
|
let r = Object.keys(t);
|
|
188
|
-
return !r.length || r.every((r) => n.strict ? t[r] === e[r] :
|
|
199
|
+
return !r.length || r.every((r) => n.strict ? t[r] === e[r] : A(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
|
|
189
200
|
}
|
|
190
|
-
function
|
|
191
|
-
return e.find((e) => e.type === t &&
|
|
201
|
+
function Fe(e, t, n = {}) {
|
|
202
|
+
return e.find((e) => e.type === t && j(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
|
|
192
203
|
}
|
|
193
|
-
function
|
|
194
|
-
return !!
|
|
204
|
+
function Ie(e, t, n = {}) {
|
|
205
|
+
return !!Fe(e, t, n);
|
|
195
206
|
}
|
|
196
|
-
function
|
|
207
|
+
function Le(e, t, n) {
|
|
197
208
|
if (!e || !t) return;
|
|
198
209
|
let r = e.parent.childAfter(e.parentOffset);
|
|
199
210
|
if (r.node && r.node.marks.some((e) => e.type === t) || (r = e.parent.childBefore(e.parentOffset)), !r.node || !r.node.marks.some((e) => e.type === t)) return;
|
|
@@ -201,55 +212,55 @@ function Re(e, t, n) {
|
|
|
201
212
|
let e = r.node.marks.find((e) => e.type === t);
|
|
202
213
|
e && (n = e.attrs);
|
|
203
214
|
}
|
|
204
|
-
if (!
|
|
215
|
+
if (!Fe([...r.node.marks], t, n)) return;
|
|
205
216
|
let i = r.index, a = e.start() + r.offset, o = i + 1, s = a + r.node.nodeSize;
|
|
206
|
-
for (; i > 0 &&
|
|
207
|
-
for (; o < e.parent.childCount &&
|
|
217
|
+
for (; i > 0 && Ie([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
|
|
218
|
+
for (; o < e.parent.childCount && Ie([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
|
|
208
219
|
return {
|
|
209
220
|
from: a,
|
|
210
221
|
to: s
|
|
211
222
|
};
|
|
212
223
|
}
|
|
213
|
-
function
|
|
224
|
+
function M(e, t) {
|
|
214
225
|
if (typeof e == "string") {
|
|
215
226
|
if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
|
|
216
227
|
return t.marks[e];
|
|
217
228
|
}
|
|
218
229
|
return e;
|
|
219
230
|
}
|
|
220
|
-
var
|
|
221
|
-
let a =
|
|
231
|
+
var Re = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
232
|
+
let a = M(e, r.schema), { doc: o, selection: s } = n, { $from: c, from: l, to: u } = s;
|
|
222
233
|
if (i) {
|
|
223
|
-
let e =
|
|
234
|
+
let e = Le(c, a, t);
|
|
224
235
|
if (e && e.from <= l && e.to >= u) {
|
|
225
|
-
let t =
|
|
236
|
+
let t = w.create(o, e.from, e.to);
|
|
226
237
|
n.setSelection(t);
|
|
227
238
|
}
|
|
228
239
|
}
|
|
229
240
|
return !0;
|
|
230
|
-
},
|
|
241
|
+
}, ze = (e) => (t) => {
|
|
231
242
|
let n = typeof e == "function" ? e(t) : e;
|
|
232
243
|
for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
|
|
233
244
|
return !1;
|
|
234
245
|
};
|
|
235
|
-
function
|
|
236
|
-
return e instanceof
|
|
246
|
+
function Be(e) {
|
|
247
|
+
return e instanceof w;
|
|
237
248
|
}
|
|
238
|
-
function
|
|
249
|
+
function N(e = 0, t = 0, n = 0) {
|
|
239
250
|
return Math.min(Math.max(e, t), n);
|
|
240
251
|
}
|
|
241
|
-
function
|
|
252
|
+
function Ve(e, t = null) {
|
|
242
253
|
if (!t) return null;
|
|
243
|
-
let n =
|
|
254
|
+
let n = C.atStart(e), r = C.atEnd(e);
|
|
244
255
|
if (t === "start" || t === !0) return n;
|
|
245
256
|
if (t === "end") return r;
|
|
246
257
|
let i = n.from, a = r.to;
|
|
247
|
-
return t === "all" ?
|
|
258
|
+
return t === "all" ? w.create(e, N(0, i, a), N(e.content.size, i, a)) : w.create(e, N(t, i, a), N(t, i, a));
|
|
248
259
|
}
|
|
249
|
-
function
|
|
260
|
+
function He() {
|
|
250
261
|
return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
|
|
251
262
|
}
|
|
252
|
-
function
|
|
263
|
+
function P() {
|
|
253
264
|
return [
|
|
254
265
|
"iPad Simulator",
|
|
255
266
|
"iPhone Simulator",
|
|
@@ -259,16 +270,16 @@ function M() {
|
|
|
259
270
|
"iPod"
|
|
260
271
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
261
272
|
}
|
|
262
|
-
function
|
|
273
|
+
function Ue() {
|
|
263
274
|
return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
264
275
|
}
|
|
265
|
-
var
|
|
276
|
+
var We = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
266
277
|
t = {
|
|
267
278
|
scrollIntoView: !0,
|
|
268
279
|
...t
|
|
269
280
|
};
|
|
270
281
|
let o = () => {
|
|
271
|
-
(
|
|
282
|
+
(P() || He()) && r.dom.focus(), Ue() && !P() && !He() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
|
|
272
283
|
n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
|
|
273
284
|
});
|
|
274
285
|
};
|
|
@@ -277,33 +288,33 @@ var Ge = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
|
|
|
277
288
|
} catch {
|
|
278
289
|
return !1;
|
|
279
290
|
}
|
|
280
|
-
if (a && e === null && !
|
|
281
|
-
let s =
|
|
291
|
+
if (a && e === null && !Be(n.state.selection)) return o(), !0;
|
|
292
|
+
let s = Ve(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
|
|
282
293
|
return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
|
|
283
|
-
},
|
|
294
|
+
}, Ge = (e, t) => (n) => e.every((e, r) => t(e, {
|
|
284
295
|
...n,
|
|
285
296
|
index: r
|
|
286
|
-
})),
|
|
297
|
+
})), Ke = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
|
|
287
298
|
from: n.selection.from,
|
|
288
299
|
to: n.selection.to
|
|
289
|
-
}, e, t),
|
|
300
|
+
}, e, t), qe = (e) => {
|
|
290
301
|
let t = e.childNodes;
|
|
291
302
|
for (let n = t.length - 1; n >= 0; --n) {
|
|
292
303
|
let r = t[n];
|
|
293
|
-
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 &&
|
|
304
|
+
r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && qe(r);
|
|
294
305
|
}
|
|
295
306
|
return e;
|
|
296
307
|
};
|
|
297
|
-
function
|
|
308
|
+
function F(e) {
|
|
298
309
|
if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
|
|
299
310
|
let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
300
|
-
return
|
|
311
|
+
return qe(n);
|
|
301
312
|
}
|
|
302
|
-
function
|
|
313
|
+
function Je(e) {
|
|
303
314
|
return typeof e?.nodesBetween == "function";
|
|
304
315
|
}
|
|
305
|
-
function
|
|
306
|
-
if (
|
|
316
|
+
function I(e, t, n) {
|
|
317
|
+
if (Je(e)) return e;
|
|
307
318
|
let r = typeof e == "object" && !!e;
|
|
308
319
|
n = {
|
|
309
320
|
slice: !0,
|
|
@@ -312,16 +323,16 @@ function P(e, t, n) {
|
|
|
312
323
|
};
|
|
313
324
|
let i = typeof e == "string";
|
|
314
325
|
if (r) try {
|
|
315
|
-
if (Array.isArray(e) && e.length > 0) return
|
|
326
|
+
if (Array.isArray(e) && e.length > 0) return T.fromArray(e.map((e) => t.nodeFromJSON(e)));
|
|
316
327
|
let r = t.nodeFromJSON(e);
|
|
317
328
|
return n.errorOnInvalidContent && r.check(), r;
|
|
318
329
|
} catch (r) {
|
|
319
330
|
if (n.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: r });
|
|
320
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r),
|
|
331
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), I("", t, n);
|
|
321
332
|
}
|
|
322
333
|
if (i) {
|
|
323
334
|
if (n.errorOnInvalidContent) {
|
|
324
|
-
let r = !1, i = "", a = new
|
|
335
|
+
let r = !1, i = "", a = new fe({
|
|
325
336
|
topNode: t.spec.topNode,
|
|
326
337
|
marks: t.spec.marks,
|
|
327
338
|
nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
|
|
@@ -333,17 +344,17 @@ function P(e, t, n) {
|
|
|
333
344
|
}]
|
|
334
345
|
} })
|
|
335
346
|
});
|
|
336
|
-
if (n.slice ?
|
|
347
|
+
if (n.slice ? ue.fromSchema(a).parseSlice(F(e), n.parseOptions) : ue.fromSchema(a).parse(F(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
|
|
337
348
|
}
|
|
338
|
-
let r =
|
|
339
|
-
return n.slice ? r.parseSlice(
|
|
349
|
+
let r = ue.fromSchema(t);
|
|
350
|
+
return n.slice ? r.parseSlice(F(e), n.parseOptions).content : r.parse(F(e), n.parseOptions);
|
|
340
351
|
}
|
|
341
|
-
return
|
|
352
|
+
return I("", t, n);
|
|
342
353
|
}
|
|
343
|
-
function
|
|
354
|
+
function Ye(e) {
|
|
344
355
|
return !("type" in e);
|
|
345
356
|
}
|
|
346
|
-
function
|
|
357
|
+
function Xe(e, t, i) {
|
|
347
358
|
let a = e.steps.length - 1;
|
|
348
359
|
if (a < t) return;
|
|
349
360
|
let o = e.steps[a];
|
|
@@ -351,9 +362,9 @@ function Ze(e, t, i) {
|
|
|
351
362
|
let s = e.mapping.maps[a], c = 0;
|
|
352
363
|
s.forEach((e, t, n, r) => {
|
|
353
364
|
c === 0 && (c = r);
|
|
354
|
-
}), e.setSelection(
|
|
365
|
+
}), e.setSelection(C.near(e.doc.resolve(c), i));
|
|
355
366
|
}
|
|
356
|
-
var
|
|
367
|
+
var Ze = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
357
368
|
if (i) {
|
|
358
369
|
n = {
|
|
359
370
|
parseOptions: a.options.parseOptions,
|
|
@@ -375,7 +386,7 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
375
386
|
...n.parseOptions
|
|
376
387
|
};
|
|
377
388
|
if (!n.errorOnInvalidContent && !a.options.enableContentCheck && a.options.emitContentError) try {
|
|
378
|
-
|
|
389
|
+
I(t, a.schema, {
|
|
379
390
|
parseOptions: s,
|
|
380
391
|
errorOnInvalidContent: !0
|
|
381
392
|
});
|
|
@@ -383,7 +394,7 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
383
394
|
o(e);
|
|
384
395
|
}
|
|
385
396
|
try {
|
|
386
|
-
i =
|
|
397
|
+
i = I(t, a.schema, {
|
|
387
398
|
parseOptions: s,
|
|
388
399
|
errorOnInvalidContent: n.errorOnInvalidContent ?? a.options.enableContentCheck
|
|
389
400
|
});
|
|
@@ -396,7 +407,7 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
396
407
|
} : {
|
|
397
408
|
from: e.from,
|
|
398
409
|
to: e.to
|
|
399
|
-
}, u = !0, d = !0, f =
|
|
410
|
+
}, u = !0, d = !0, f = Ye(i) ? i.content : [i];
|
|
400
411
|
if (f.forEach((e) => {
|
|
401
412
|
e.check(), u = u ? e.isText && e.marks.length === 0 : !1, d = d ? e.isBlock : !1;
|
|
402
413
|
}), c === l && d) {
|
|
@@ -404,13 +415,13 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
404
415
|
e.isTextblock && !e.type.spec.code && !e.childCount && (--c, l += 1);
|
|
405
416
|
}
|
|
406
417
|
let p;
|
|
407
|
-
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") :
|
|
418
|
+
if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Je(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
|
|
408
419
|
else {
|
|
409
|
-
p =
|
|
420
|
+
p = T.from(f);
|
|
410
421
|
let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
|
|
411
422
|
n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
|
|
412
423
|
}
|
|
413
|
-
n.updateSelection &&
|
|
424
|
+
n.updateSelection && Xe(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
|
|
414
425
|
from: c,
|
|
415
426
|
text: p
|
|
416
427
|
}), n.applyPasteRules && r.setMeta("applyPasteRules", {
|
|
@@ -420,35 +431,38 @@ var Qe = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
|
|
|
420
431
|
}
|
|
421
432
|
return !0;
|
|
422
433
|
};
|
|
423
|
-
function
|
|
434
|
+
function Qe(e) {
|
|
424
435
|
for (let t = 0; t < e.edgeCount; t += 1) {
|
|
425
436
|
let { type: n } = e.edge(t);
|
|
426
437
|
if (n.isTextblock && !n.hasRequiredAttrs()) return n;
|
|
427
438
|
}
|
|
428
439
|
return null;
|
|
429
440
|
}
|
|
430
|
-
var
|
|
441
|
+
var $e = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
431
442
|
let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
|
|
432
443
|
c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
|
|
433
|
-
let l =
|
|
444
|
+
let l = Qe(c.parent.contentMatchAt(c.index()));
|
|
434
445
|
if (!l) return !1;
|
|
435
446
|
let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
|
|
436
447
|
if (o) {
|
|
437
|
-
let e =
|
|
448
|
+
let e = I(o, r.schema);
|
|
438
449
|
f = l.createAndFill(d, e);
|
|
439
450
|
} else f = l.createAndFill(d);
|
|
440
|
-
return f ? (n && (t.insert(c.pos, f), s &&
|
|
441
|
-
},
|
|
451
|
+
return f ? (n && (t.insert(c.pos, f), s && Xe(t, t.steps.length - 1, -1)), !0) : !1;
|
|
452
|
+
}, et = () => ({ state: e, dispatch: t }) => _(e, t), tt = () => ({ state: e, dispatch: t }) => p(e, t), nt = () => ({ state: e, dispatch: t }) => f(e, t), rt = () => ({ state: e, dispatch: t }) => m(e, t), it = (e, t) => {
|
|
453
|
+
let n = e.resolve(t), r = n.nodeBefore, i = n.nodeAfter;
|
|
454
|
+
return !r || !i ? !1 : !r.type.spec.isolating && !i.type.spec.isolating;
|
|
455
|
+
}, at = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
442
456
|
try {
|
|
443
457
|
let r = c(e.doc, e.selection.$from.pos, -1);
|
|
444
|
-
return r
|
|
458
|
+
return r == null || !it(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
445
459
|
} catch {
|
|
446
460
|
return !1;
|
|
447
461
|
}
|
|
448
462
|
}, ot = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
449
463
|
try {
|
|
450
464
|
let r = c(e.doc, e.selection.$from.pos, 1);
|
|
451
|
-
return r
|
|
465
|
+
return r == null || !it(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
452
466
|
} catch {
|
|
453
467
|
return !1;
|
|
454
468
|
}
|
|
@@ -466,7 +480,7 @@ function ut(e) {
|
|
|
466
480
|
else if (/^a(lt)?$/i.test(n)) r = !0;
|
|
467
481
|
else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
|
|
468
482
|
else if (/^s(hift)?$/i.test(n)) a = !0;
|
|
469
|
-
else if (/^mod$/i.test(n))
|
|
483
|
+
else if (/^mod$/i.test(n)) P() || lt() ? o = !0 : i = !0;
|
|
470
484
|
else throw Error(`Unrecognized modifier name: ${n}`);
|
|
471
485
|
}
|
|
472
486
|
return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
|
|
@@ -493,8 +507,8 @@ var dt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
|
|
|
493
507
|
t && i && r.maybeStep(t);
|
|
494
508
|
}), !0;
|
|
495
509
|
};
|
|
496
|
-
function
|
|
497
|
-
let { from: r, to: i, empty: a } = e.selection, o = t ?
|
|
510
|
+
function L(e, t, n = {}) {
|
|
511
|
+
let { from: r, to: i, empty: a } = e.selection, o = t ? k(t, e.schema) : null, s = [];
|
|
498
512
|
e.doc.nodesBetween(r, i, (e, t) => {
|
|
499
513
|
if (e.isText) return;
|
|
500
514
|
let n = Math.max(r, t), a = Math.min(i, t + e.nodeSize);
|
|
@@ -504,14 +518,14 @@ function F(e, t, n = {}) {
|
|
|
504
518
|
to: a
|
|
505
519
|
});
|
|
506
520
|
});
|
|
507
|
-
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) =>
|
|
521
|
+
let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => j(e.node.attrs, n, { strict: !1 }));
|
|
508
522
|
return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
|
|
509
523
|
}
|
|
510
|
-
var ft = (e, t = {}) => ({ state: n, dispatch: r }) =>
|
|
511
|
-
let r =
|
|
512
|
-
return
|
|
513
|
-
}, ht = () => ({ state: e, dispatch: t }) =>
|
|
514
|
-
function
|
|
524
|
+
var ft = (e, t = {}) => ({ state: n, dispatch: r }) => L(n, k(e, n.schema), t) ? v(n, r) : !1, pt = () => ({ state: e, dispatch: t }) => y(e, t), mt = (e) => ({ state: t, dispatch: n }) => {
|
|
525
|
+
let r = k(e, t.schema);
|
|
526
|
+
return me(r)(t, n);
|
|
527
|
+
}, ht = () => ({ state: e, dispatch: t }) => ee(e, t);
|
|
528
|
+
function R(e, t) {
|
|
515
529
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
516
530
|
}
|
|
517
531
|
function gt(e, t) {
|
|
@@ -519,9 +533,9 @@ function gt(e, t) {
|
|
|
519
533
|
return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
|
|
520
534
|
}
|
|
521
535
|
var _t = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
522
|
-
let a = null, o = null, s =
|
|
536
|
+
let a = null, o = null, s = R(typeof e == "string" ? e : e.name, r.schema);
|
|
523
537
|
if (!s) return !1;
|
|
524
|
-
s === "node" && (a =
|
|
538
|
+
s === "node" && (a = k(e, r.schema)), s === "mark" && (o = M(e, r.schema));
|
|
525
539
|
let c = !1;
|
|
526
540
|
return n.selection.ranges.forEach((e) => {
|
|
527
541
|
r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
|
|
@@ -532,24 +546,24 @@ var _t = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
532
546
|
}), c;
|
|
533
547
|
}, vt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), yt = () => ({ tr: e, dispatch: t }) => {
|
|
534
548
|
if (t) {
|
|
535
|
-
let t = new
|
|
549
|
+
let t = new se(e.doc);
|
|
536
550
|
e.setSelection(t);
|
|
537
551
|
}
|
|
538
552
|
return !0;
|
|
539
|
-
}, bt = () => ({ state: e, dispatch: t }) =>
|
|
540
|
-
function
|
|
541
|
-
return
|
|
553
|
+
}, bt = () => ({ state: e, dispatch: t }) => te(e, t), xt = () => ({ state: e, dispatch: t }) => ne(e, t), St = () => ({ state: e, dispatch: t }) => re(e, t), Ct = () => ({ state: e, dispatch: t }) => ie(e, t), wt = () => ({ state: e, dispatch: t }) => ae(e, t);
|
|
554
|
+
function Tt(e, t, n = {}, r = {}) {
|
|
555
|
+
return I(e, t, {
|
|
542
556
|
slice: !1,
|
|
543
557
|
parseOptions: n,
|
|
544
558
|
errorOnInvalidContent: r.errorOnInvalidContent
|
|
545
559
|
});
|
|
546
560
|
}
|
|
547
|
-
var
|
|
561
|
+
var Et = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: i, tr: a, dispatch: o, commands: s }) => {
|
|
548
562
|
let { doc: c } = a;
|
|
549
563
|
if (r.preserveWhitespace !== "full") {
|
|
550
|
-
let s =
|
|
564
|
+
let s = Tt(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
|
|
551
565
|
if (o) {
|
|
552
|
-
let e =
|
|
566
|
+
let e = Ye(s) ? s.content : [s];
|
|
553
567
|
a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
|
|
554
568
|
}
|
|
555
569
|
return !0;
|
|
@@ -562,15 +576,15 @@ var Tt = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
|
|
|
562
576
|
errorOnInvalidContent: t ?? i.options.enableContentCheck
|
|
563
577
|
});
|
|
564
578
|
};
|
|
565
|
-
function
|
|
566
|
-
let n =
|
|
579
|
+
function Dt(e, t) {
|
|
580
|
+
let n = M(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
|
|
567
581
|
a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
|
|
568
582
|
o.push(...e.marks);
|
|
569
583
|
});
|
|
570
584
|
let s = o.find((e) => e.type.name === n.name);
|
|
571
585
|
return s ? { ...s.attrs } : {};
|
|
572
586
|
}
|
|
573
|
-
function
|
|
587
|
+
function Ot(e, t) {
|
|
574
588
|
let n = new i(e);
|
|
575
589
|
return t.forEach((e) => {
|
|
576
590
|
e.steps.forEach((e) => {
|
|
@@ -578,7 +592,7 @@ function Dt(e, t) {
|
|
|
578
592
|
});
|
|
579
593
|
}), n;
|
|
580
594
|
}
|
|
581
|
-
function
|
|
595
|
+
function kt(e, t, n) {
|
|
582
596
|
let r = [];
|
|
583
597
|
return e.nodesBetween(t.from, t.to, (e, t) => {
|
|
584
598
|
n(e) && r.push({
|
|
@@ -587,7 +601,7 @@ function Ot(e, t, n) {
|
|
|
587
601
|
});
|
|
588
602
|
}), r;
|
|
589
603
|
}
|
|
590
|
-
function
|
|
604
|
+
function At(e, t) {
|
|
591
605
|
for (let n = e.depth; n > 0; --n) {
|
|
592
606
|
let r = e.node(n);
|
|
593
607
|
if (t(r)) return {
|
|
@@ -598,47 +612,120 @@ function kt(e, t) {
|
|
|
598
612
|
};
|
|
599
613
|
}
|
|
600
614
|
}
|
|
601
|
-
function
|
|
602
|
-
return (t) =>
|
|
615
|
+
function z(e) {
|
|
616
|
+
return (t) => At(t.$from, e);
|
|
603
617
|
}
|
|
604
|
-
function
|
|
605
|
-
return e.config[t] === void 0 && e.parent ?
|
|
618
|
+
function B(e, t, n) {
|
|
619
|
+
return e.config[t] === void 0 && e.parent ? B(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
|
|
606
620
|
...n,
|
|
607
|
-
parent: e.parent ?
|
|
621
|
+
parent: e.parent ? B(e.parent, t, n) : null
|
|
608
622
|
}) : e.config[t];
|
|
609
623
|
}
|
|
610
|
-
function
|
|
624
|
+
function jt(e) {
|
|
611
625
|
return e.map((e) => {
|
|
612
|
-
let t =
|
|
626
|
+
let t = B(e, "addExtensions", {
|
|
613
627
|
name: e.name,
|
|
614
628
|
options: e.options,
|
|
615
629
|
storage: e.storage
|
|
616
630
|
});
|
|
617
|
-
return t ? [e, ...
|
|
631
|
+
return t ? [e, ...jt(t())] : e;
|
|
618
632
|
}).flat(10);
|
|
619
633
|
}
|
|
620
|
-
function
|
|
621
|
-
let n =
|
|
634
|
+
function Mt(e, t) {
|
|
635
|
+
let n = de.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
|
|
622
636
|
return r.appendChild(n), r.innerHTML;
|
|
623
637
|
}
|
|
624
|
-
function
|
|
625
|
-
|
|
638
|
+
function Nt(e, t) {
|
|
639
|
+
let n = /* @__PURE__ */ new Map();
|
|
640
|
+
for (let t of e) {
|
|
641
|
+
let e = n.get(t.type) ?? /* @__PURE__ */ new Map();
|
|
642
|
+
e.set(t.name, t), n.set(t.type, e);
|
|
643
|
+
}
|
|
644
|
+
return [...Object.values(t.nodes), ...Object.values(t.marks)].flatMap((e) => Object.entries(e.spec.attrs ?? {}).map(([t, r]) => {
|
|
645
|
+
let i = n.get(e.name)?.get(t), a = Object.hasOwn(r, "default");
|
|
646
|
+
return {
|
|
647
|
+
type: e.name,
|
|
648
|
+
name: t,
|
|
649
|
+
attribute: {
|
|
650
|
+
rendered: !0,
|
|
651
|
+
renderHTML: null,
|
|
652
|
+
parseHTML: null,
|
|
653
|
+
keepOnSplit: !0,
|
|
654
|
+
...i?.attribute,
|
|
655
|
+
default: r.default,
|
|
656
|
+
isRequired: !a,
|
|
657
|
+
validate: r.validate
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
}));
|
|
626
661
|
}
|
|
627
|
-
|
|
628
|
-
|
|
662
|
+
var Pt = {
|
|
663
|
+
content: "string",
|
|
664
|
+
marks: "string",
|
|
665
|
+
group: "string",
|
|
666
|
+
inline: "boolean",
|
|
667
|
+
atom: "boolean",
|
|
668
|
+
selectable: "boolean",
|
|
669
|
+
draggable: "boolean",
|
|
670
|
+
code: "boolean",
|
|
671
|
+
whitespace: ["pre", "normal"],
|
|
672
|
+
definingAsContext: "boolean",
|
|
673
|
+
definingForContent: "boolean",
|
|
674
|
+
defining: "boolean",
|
|
675
|
+
isolating: "boolean",
|
|
676
|
+
linebreakReplacement: "boolean"
|
|
677
|
+
}, Ft = {
|
|
678
|
+
inclusive: "boolean",
|
|
679
|
+
excludes: "string",
|
|
680
|
+
group: "string",
|
|
681
|
+
spanning: "boolean",
|
|
682
|
+
code: "boolean"
|
|
683
|
+
};
|
|
684
|
+
function It(e, t, n) {
|
|
685
|
+
return Object.fromEntries(Object.entries(t).flatMap(([t, r]) => {
|
|
686
|
+
let i = e[t];
|
|
687
|
+
if (i === void 0) return [];
|
|
688
|
+
if (!(typeof r == "string" ? typeof i === r : typeof i == "string" && r.includes(i))) throw RangeError(`Invalid schemaSpec field '${n}.${t}'`);
|
|
689
|
+
return [[t, i]];
|
|
690
|
+
}));
|
|
629
691
|
}
|
|
630
|
-
function
|
|
631
|
-
return
|
|
692
|
+
function Lt(e, t, n, r) {
|
|
693
|
+
return {
|
|
694
|
+
...Object.fromEntries(Object.entries(t).filter(([e]) => e !== "attrs" && !Object.hasOwn(r, e))),
|
|
695
|
+
...It(n, r, e),
|
|
696
|
+
attrs: n.attrs
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
function Rt(e, t, n) {
|
|
700
|
+
for (let r of Object.keys(t)) if (!Object.hasOwn(e, r)) throw RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);
|
|
701
|
+
for (let r of Object.keys(e)) if (!Object.hasOwn(t, r)) throw RangeError(`Local ${n} extension '${r}' is not in schemaSpec`);
|
|
702
|
+
}
|
|
703
|
+
function zt(e, t) {
|
|
704
|
+
Rt(e.nodes, t.nodes, "node"), Rt(e.marks, t.marks, "mark");
|
|
705
|
+
let n = t.spec.nodes, r = t.spec.marks;
|
|
706
|
+
return t.spec.nodes.forEach((t, r) => {
|
|
707
|
+
n = n.update(t, Lt(t, e.nodes[t], r, Pt));
|
|
708
|
+
}), t.spec.marks.forEach((t, n) => {
|
|
709
|
+
r = r.update(t, Lt(t, e.marks[t], n, Ft));
|
|
710
|
+
}), {
|
|
711
|
+
topNode: t.topNodeType.name,
|
|
712
|
+
nodes: n,
|
|
713
|
+
marks: r
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
function Bt(e) {
|
|
717
|
+
let t = e.filter((t, n) => e.indexOf(t) !== n);
|
|
718
|
+
return Array.from(new Set(t));
|
|
632
719
|
}
|
|
633
|
-
function
|
|
720
|
+
function V(e) {
|
|
634
721
|
return {
|
|
635
722
|
baseExtensions: e.filter((e) => e.type === "extension"),
|
|
636
723
|
nodeExtensions: e.filter((e) => e.type === "node"),
|
|
637
724
|
markExtensions: e.filter((e) => e.type === "mark")
|
|
638
725
|
};
|
|
639
726
|
}
|
|
640
|
-
function
|
|
641
|
-
let t = [], { nodeExtensions: n, markExtensions: r } =
|
|
727
|
+
function Vt(e) {
|
|
728
|
+
let t = [], { nodeExtensions: n, markExtensions: r } = V(e), i = [...n, ...r], a = {
|
|
642
729
|
default: null,
|
|
643
730
|
validate: void 0,
|
|
644
731
|
rendered: !0,
|
|
@@ -648,7 +735,7 @@ function Nt(e) {
|
|
|
648
735
|
isRequired: !1
|
|
649
736
|
}, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
|
|
650
737
|
return e.forEach((e) => {
|
|
651
|
-
let n =
|
|
738
|
+
let n = B(e, "addGlobalAttributes", {
|
|
652
739
|
name: e.name,
|
|
653
740
|
options: e.options,
|
|
654
741
|
storage: e.storage,
|
|
@@ -670,7 +757,7 @@ function Nt(e) {
|
|
|
670
757
|
});
|
|
671
758
|
});
|
|
672
759
|
}), i.forEach((e) => {
|
|
673
|
-
let n =
|
|
760
|
+
let n = B(e, "addAttributes", {
|
|
674
761
|
name: e.name,
|
|
675
762
|
options: e.options,
|
|
676
763
|
storage: e.storage
|
|
@@ -690,7 +777,16 @@ function Nt(e) {
|
|
|
690
777
|
});
|
|
691
778
|
}), t;
|
|
692
779
|
}
|
|
693
|
-
function
|
|
780
|
+
function Ht(e) {
|
|
781
|
+
return typeof e == "function";
|
|
782
|
+
}
|
|
783
|
+
function H(e, t = void 0, ...n) {
|
|
784
|
+
return Ht(e) ? t ? e.bind(t)(...n) : e(...n) : e;
|
|
785
|
+
}
|
|
786
|
+
function Ut(e = {}) {
|
|
787
|
+
return Object.keys(e).length === 0 && e.constructor === Object;
|
|
788
|
+
}
|
|
789
|
+
function Wt(e) {
|
|
694
790
|
let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
|
|
695
791
|
for (let s = 0; s < o; s += 1) {
|
|
696
792
|
let o = e[s];
|
|
@@ -716,8 +812,8 @@ function Pt(e) {
|
|
|
716
812
|
}
|
|
717
813
|
return n && t.push(n), t;
|
|
718
814
|
}
|
|
719
|
-
function
|
|
720
|
-
let t = [], n =
|
|
815
|
+
function Gt(e) {
|
|
816
|
+
let t = [], n = Wt(e || ""), r = n.length;
|
|
721
817
|
for (let e = 0; e < r; e += 1) {
|
|
722
818
|
let r = n[e], i = r.indexOf(":");
|
|
723
819
|
if (i === -1) continue;
|
|
@@ -726,7 +822,7 @@ function Ft(e) {
|
|
|
726
822
|
}
|
|
727
823
|
return t;
|
|
728
824
|
}
|
|
729
|
-
function
|
|
825
|
+
function Kt(...e) {
|
|
730
826
|
return e.filter((e) => !!e).reduce((e, t) => {
|
|
731
827
|
let n = { ...e };
|
|
732
828
|
return Object.entries(t).forEach(([e, t]) => {
|
|
@@ -741,26 +837,26 @@ function It(...e) {
|
|
|
741
837
|
let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
|
|
742
838
|
n[e] = [...i, ...a].join(" ");
|
|
743
839
|
} else if (e === "style") {
|
|
744
|
-
let r = new Map([...
|
|
840
|
+
let r = new Map([...Gt(n[e]), ...Gt(t)]);
|
|
745
841
|
n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
|
|
746
842
|
} else n[e] = t;
|
|
747
843
|
}), n;
|
|
748
844
|
}, {});
|
|
749
845
|
}
|
|
750
846
|
function U(e, t) {
|
|
751
|
-
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) =>
|
|
847
|
+
return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => Kt(e, t), {});
|
|
752
848
|
}
|
|
753
|
-
function
|
|
849
|
+
function qt(e) {
|
|
754
850
|
return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
|
|
755
851
|
}
|
|
756
|
-
function
|
|
852
|
+
function Jt(e, t) {
|
|
757
853
|
return "style" in e ? e : {
|
|
758
854
|
...e,
|
|
759
855
|
getAttrs: (n) => {
|
|
760
856
|
let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
|
|
761
857
|
if (r === !1) return !1;
|
|
762
858
|
let i = t.reduce((e, t) => {
|
|
763
|
-
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) :
|
|
859
|
+
let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : qt(n.getAttribute(t.name));
|
|
764
860
|
return r == null ? e : {
|
|
765
861
|
...e,
|
|
766
862
|
[t.name]: r
|
|
@@ -773,100 +869,103 @@ function Rt(e, t) {
|
|
|
773
869
|
}
|
|
774
870
|
};
|
|
775
871
|
}
|
|
776
|
-
function
|
|
777
|
-
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" &&
|
|
872
|
+
function Yt(e) {
|
|
873
|
+
return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Ut(t) ? !1 : t != null));
|
|
778
874
|
}
|
|
779
|
-
function
|
|
875
|
+
function Xt(e) {
|
|
780
876
|
var t, n;
|
|
781
877
|
let r = {};
|
|
782
878
|
return !(e != null && (t = e.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
|
|
783
879
|
}
|
|
784
|
-
function
|
|
785
|
-
let
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}
|
|
880
|
+
function Zt(e, t, n = Vt(e)) {
|
|
881
|
+
let { nodeExtensions: r, markExtensions: i } = V(e);
|
|
882
|
+
return {
|
|
883
|
+
topNode: r.find((e) => B(e, "topNode"))?.name,
|
|
884
|
+
nodes: Object.fromEntries(r.map((r) => {
|
|
885
|
+
let i = n.filter((e) => e.type === r.name), a = {
|
|
886
|
+
name: r.name,
|
|
887
|
+
options: r.options,
|
|
888
|
+
storage: r.storage,
|
|
889
|
+
editor: t
|
|
890
|
+
}, o = Yt({
|
|
891
|
+
...e.reduce((e, t) => {
|
|
892
|
+
let n = B(t, "extendNodeSchema", a);
|
|
893
|
+
return {
|
|
894
|
+
...e,
|
|
895
|
+
...n ? n(r) : {}
|
|
896
|
+
};
|
|
897
|
+
}, {}),
|
|
898
|
+
content: H(B(r, "content", a)),
|
|
899
|
+
marks: H(B(r, "marks", a)),
|
|
900
|
+
group: H(B(r, "group", a)),
|
|
901
|
+
inline: H(B(r, "inline", a)),
|
|
902
|
+
atom: H(B(r, "atom", a)),
|
|
903
|
+
selectable: H(B(r, "selectable", a)),
|
|
904
|
+
draggable: H(B(r, "draggable", a)),
|
|
905
|
+
code: H(B(r, "code", a)),
|
|
906
|
+
whitespace: H(B(r, "whitespace", a)),
|
|
907
|
+
linebreakReplacement: H(B(r, "linebreakReplacement", a)),
|
|
908
|
+
defining: H(B(r, "defining", a)),
|
|
909
|
+
isolating: H(B(r, "isolating", a)),
|
|
910
|
+
attrs: Object.fromEntries(i.map(Xt))
|
|
911
|
+
}), s = H(B(r, "parseHTML", a));
|
|
912
|
+
s && (o.parseDOM = s.map((e) => Jt(e, i)));
|
|
913
|
+
let c = B(r, "renderHTML", a);
|
|
914
|
+
c && (o.toDOM = (e) => c({
|
|
915
|
+
node: e,
|
|
916
|
+
HTMLAttributes: U(e, i)
|
|
917
|
+
}));
|
|
918
|
+
let l = B(r, "renderText", a);
|
|
919
|
+
return l && (o.toText = l), [r.name, o];
|
|
920
|
+
})),
|
|
921
|
+
marks: Object.fromEntries(i.map((r) => {
|
|
922
|
+
let i = n.filter((e) => e.type === r.name), a = {
|
|
923
|
+
name: r.name,
|
|
924
|
+
options: r.options,
|
|
925
|
+
storage: r.storage,
|
|
926
|
+
editor: t
|
|
927
|
+
}, o = Yt({
|
|
928
|
+
...e.reduce((e, t) => {
|
|
929
|
+
let n = B(t, "extendMarkSchema", a);
|
|
930
|
+
return {
|
|
931
|
+
...e,
|
|
932
|
+
...n ? n(r) : {}
|
|
933
|
+
};
|
|
934
|
+
}, {}),
|
|
935
|
+
inclusive: H(B(r, "inclusive", a)),
|
|
936
|
+
excludes: H(B(r, "excludes", a)),
|
|
937
|
+
group: H(B(r, "group", a)),
|
|
938
|
+
spanning: H(B(r, "spanning", a)),
|
|
939
|
+
code: H(B(r, "code", a)),
|
|
940
|
+
attrs: Object.fromEntries(i.map(Xt))
|
|
941
|
+
}), s = H(B(r, "parseHTML", a));
|
|
942
|
+
s && (o.parseDOM = s.map((e) => Jt(e, i)));
|
|
943
|
+
let c = B(r, "renderHTML", a);
|
|
944
|
+
return c && (o.toDOM = (e) => c({
|
|
945
|
+
mark: e,
|
|
946
|
+
HTMLAttributes: U(e, i)
|
|
947
|
+
})), [r.name, o];
|
|
948
|
+
}))
|
|
949
|
+
};
|
|
854
950
|
}
|
|
855
|
-
function
|
|
856
|
-
|
|
857
|
-
|
|
951
|
+
function Qt(e, t, n) {
|
|
952
|
+
if (n === void 0) return new fe(Zt(e, t));
|
|
953
|
+
let r = Bt(e.filter((e) => e.type !== "extension").map((e) => e.name));
|
|
954
|
+
if (r.length) throw RangeError(`Duplicate local schema types: ${r.join(", ")}`);
|
|
955
|
+
let i = new fe(n), a = Zt(e, t, Nt(Vt(e), i));
|
|
956
|
+
return new fe(zt(a, i));
|
|
858
957
|
}
|
|
859
958
|
function W(e) {
|
|
860
959
|
return e.sort((e, t) => {
|
|
861
|
-
let n =
|
|
960
|
+
let n = B(e, "priority") || 100, r = B(t, "priority") || 100;
|
|
862
961
|
return n > r ? -1 : +(n < r);
|
|
863
962
|
});
|
|
864
963
|
}
|
|
865
|
-
function
|
|
866
|
-
let t = W(
|
|
964
|
+
function $t(e) {
|
|
965
|
+
let t = W(jt(e)), n = Bt(t.map((e) => e.name));
|
|
867
966
|
return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
|
|
868
967
|
}
|
|
869
|
-
function
|
|
968
|
+
function en(e, t, n) {
|
|
870
969
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
871
970
|
return e.nodesBetween(r, i, (e, n, c, l) => {
|
|
872
971
|
e.isBlock && n > r && (s += a);
|
|
@@ -884,75 +983,76 @@ function Wt(e, t, n) {
|
|
|
884
983
|
}
|
|
885
984
|
}), s;
|
|
886
985
|
}
|
|
887
|
-
function
|
|
888
|
-
return
|
|
986
|
+
function tn(e, t) {
|
|
987
|
+
return en(e, {
|
|
889
988
|
from: 0,
|
|
890
989
|
to: e.content.size
|
|
891
990
|
}, t);
|
|
892
991
|
}
|
|
893
|
-
function
|
|
992
|
+
function nn(e) {
|
|
894
993
|
return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
|
|
895
994
|
}
|
|
896
|
-
function
|
|
897
|
-
let n =
|
|
995
|
+
function rn(e, t) {
|
|
996
|
+
let n = k(t, e.schema), { from: r, to: i } = e.selection, a = [];
|
|
898
997
|
e.doc.nodesBetween(r, i, (e) => {
|
|
899
998
|
a.push(e);
|
|
900
999
|
});
|
|
901
1000
|
let o = a.reverse().find((e) => e.type.name === n.name);
|
|
902
1001
|
return o ? { ...o.attrs } : {};
|
|
903
1002
|
}
|
|
904
|
-
function
|
|
905
|
-
let n =
|
|
906
|
-
return n === "node" ?
|
|
1003
|
+
function an(e, t) {
|
|
1004
|
+
let n = R(typeof t == "string" ? t : t.name, e.schema);
|
|
1005
|
+
return n === "node" ? rn(e, t) : n === "mark" ? Dt(e, t) : {};
|
|
907
1006
|
}
|
|
908
|
-
function
|
|
1007
|
+
function on(e, t = JSON.stringify) {
|
|
909
1008
|
let n = {};
|
|
910
1009
|
return e.filter((e) => {
|
|
911
1010
|
let r = t(e);
|
|
912
1011
|
return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
|
|
913
1012
|
});
|
|
914
1013
|
}
|
|
915
|
-
function
|
|
916
|
-
let t =
|
|
1014
|
+
function sn(e) {
|
|
1015
|
+
let t = on(e);
|
|
917
1016
|
return t.length === 1 ? t : t.filter((e, n) => !t.filter((e, t) => t !== n).some((t) => e.oldRange.from >= t.oldRange.from && e.oldRange.to <= t.oldRange.to && e.newRange.from >= t.newRange.from && e.newRange.to <= t.newRange.to));
|
|
918
1017
|
}
|
|
919
|
-
function
|
|
920
|
-
let { mapping: t, steps: n } = e, r = [];
|
|
921
|
-
return t.maps.forEach((e,
|
|
922
|
-
let
|
|
1018
|
+
function cn(e) {
|
|
1019
|
+
let { mapping: t, steps: n } = e, r = [], i = t.invert();
|
|
1020
|
+
return t.maps.forEach((e, a) => {
|
|
1021
|
+
let o = [];
|
|
923
1022
|
if (e.ranges.length) e.forEach((e, t) => {
|
|
924
|
-
|
|
1023
|
+
o.push({
|
|
925
1024
|
from: e,
|
|
926
1025
|
to: t
|
|
927
1026
|
});
|
|
928
1027
|
});
|
|
929
1028
|
else {
|
|
930
|
-
let { from: e, to: t } = n[
|
|
1029
|
+
let { from: e, to: t } = n[a];
|
|
931
1030
|
if (e === void 0 || t === void 0) return;
|
|
932
|
-
|
|
1031
|
+
o.push({
|
|
933
1032
|
from: e,
|
|
934
1033
|
to: t
|
|
935
1034
|
});
|
|
936
1035
|
}
|
|
937
|
-
|
|
938
|
-
|
|
1036
|
+
let s = t.slice(a);
|
|
1037
|
+
o.forEach(({ from: e, to: t }) => {
|
|
1038
|
+
let n = s.map(e, -1), a = s.map(t), o = i.map(n, -1), c = i.map(a);
|
|
939
1039
|
r.push({
|
|
940
1040
|
oldRange: {
|
|
941
|
-
from:
|
|
1041
|
+
from: o,
|
|
942
1042
|
to: c
|
|
943
1043
|
},
|
|
944
1044
|
newRange: {
|
|
945
|
-
from:
|
|
946
|
-
to:
|
|
1045
|
+
from: n,
|
|
1046
|
+
to: a
|
|
947
1047
|
}
|
|
948
1048
|
});
|
|
949
1049
|
});
|
|
950
|
-
}),
|
|
1050
|
+
}), sn(r);
|
|
951
1051
|
}
|
|
952
|
-
function
|
|
1052
|
+
function ln(e, t, n) {
|
|
953
1053
|
let r = [];
|
|
954
1054
|
return e === t ? n.resolve(e).marks().forEach((t) => {
|
|
955
|
-
let i =
|
|
1055
|
+
let i = Le(n.resolve(e), t.type);
|
|
956
1056
|
i && r.push({
|
|
957
1057
|
mark: t,
|
|
958
1058
|
...i
|
|
@@ -965,14 +1065,14 @@ function Qt(e, t, n) {
|
|
|
965
1065
|
})));
|
|
966
1066
|
}), r;
|
|
967
1067
|
}
|
|
968
|
-
var
|
|
1068
|
+
var un = (e, t, n, r = 20) => {
|
|
969
1069
|
let i = e.doc.resolve(n), a = r, o = null;
|
|
970
1070
|
for (; a > 0 && o === null;) {
|
|
971
1071
|
let e = i.node(a);
|
|
972
1072
|
e?.type.name === t ? o = e : --a;
|
|
973
1073
|
}
|
|
974
1074
|
return [o, a];
|
|
975
|
-
},
|
|
1075
|
+
}, dn = (e) => {
|
|
976
1076
|
let t = e.depth - 1;
|
|
977
1077
|
if (t < 0) return null;
|
|
978
1078
|
let n = e.index(t);
|
|
@@ -987,7 +1087,7 @@ function K(e, t, n) {
|
|
|
987
1087
|
return r ? r.attribute.keepOnSplit : !1;
|
|
988
1088
|
}));
|
|
989
1089
|
}
|
|
990
|
-
var
|
|
1090
|
+
var fn = (e, t = 500) => {
|
|
991
1091
|
let n = "", r = e.parentOffset;
|
|
992
1092
|
return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
|
|
993
1093
|
var o;
|
|
@@ -1000,9 +1100,9 @@ var tn = (e, t = 500) => {
|
|
|
1000
1100
|
n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
|
|
1001
1101
|
}), n;
|
|
1002
1102
|
};
|
|
1003
|
-
function
|
|
1004
|
-
let { empty: r, ranges: i } = e.selection, a = t ?
|
|
1005
|
-
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) =>
|
|
1103
|
+
function pn(e, t, n = {}) {
|
|
1104
|
+
let { empty: r, ranges: i } = e.selection, a = t ? M(t, e.schema) : null;
|
|
1105
|
+
if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => j(e.attrs, n, { strict: !1 }));
|
|
1006
1106
|
let o = 0, s = [];
|
|
1007
1107
|
if (i.forEach(({ $from: t, $to: n }) => {
|
|
1008
1108
|
let r = t.pos, i = n.pos;
|
|
@@ -1017,41 +1117,41 @@ function nn(e, t, n = {}) {
|
|
|
1017
1117
|
})));
|
|
1018
1118
|
});
|
|
1019
1119
|
}), o === 0) return !1;
|
|
1020
|
-
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) =>
|
|
1120
|
+
let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => j(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
|
|
1021
1121
|
return (c > 0 ? c + l : c) >= o;
|
|
1022
1122
|
}
|
|
1023
|
-
function
|
|
1024
|
-
if (!t) return
|
|
1025
|
-
let r =
|
|
1026
|
-
return r === "node" ?
|
|
1123
|
+
function mn(e, t, n = {}) {
|
|
1124
|
+
if (!t) return L(e, null, n) || pn(e, null, n);
|
|
1125
|
+
let r = R(t, e.schema);
|
|
1126
|
+
return r === "node" ? L(e, t, n) : r === "mark" && pn(e, t, n);
|
|
1027
1127
|
}
|
|
1028
|
-
var
|
|
1128
|
+
var hn = (e, t) => {
|
|
1029
1129
|
let { $from: n, $to: r, $anchor: i } = e.selection;
|
|
1030
1130
|
if (t) {
|
|
1031
|
-
let n =
|
|
1131
|
+
let n = z((e) => e.type.name === t)(e.selection);
|
|
1032
1132
|
if (!n) return !1;
|
|
1033
1133
|
let r = e.doc.resolve(n.pos + 1);
|
|
1034
1134
|
return i.pos + 1 === r.end();
|
|
1035
1135
|
}
|
|
1036
1136
|
return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
|
|
1037
|
-
},
|
|
1137
|
+
}, gn = (e) => {
|
|
1038
1138
|
let { $from: t, $to: n } = e.selection;
|
|
1039
1139
|
return !(t.parentOffset > 0 || t.pos !== n.pos);
|
|
1040
1140
|
};
|
|
1041
|
-
function
|
|
1141
|
+
function _n(e, t) {
|
|
1042
1142
|
return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
|
|
1043
1143
|
}
|
|
1044
1144
|
function q(e, t) {
|
|
1045
|
-
let { nodeExtensions: n } =
|
|
1145
|
+
let { nodeExtensions: n } = V(t), r = n.find((t) => t.name === e);
|
|
1046
1146
|
if (!r) return !1;
|
|
1047
|
-
let i =
|
|
1147
|
+
let i = H(B(r, "group", {
|
|
1048
1148
|
name: r.name,
|
|
1049
1149
|
options: r.options,
|
|
1050
1150
|
storage: r.storage
|
|
1051
1151
|
}));
|
|
1052
1152
|
return typeof i == "string" && i.split(" ").includes("list");
|
|
1053
1153
|
}
|
|
1054
|
-
function
|
|
1154
|
+
function vn(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
1055
1155
|
if (n) {
|
|
1056
1156
|
if (e.type.name === "hardBreak") return !0;
|
|
1057
1157
|
if (e.isText) return !/\S/.test(e.text ?? "");
|
|
@@ -1062,7 +1162,7 @@ function cn(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1062
1162
|
if (t) {
|
|
1063
1163
|
let r = !0;
|
|
1064
1164
|
return e.content.forEach((e) => {
|
|
1065
|
-
r !== !1 && (
|
|
1165
|
+
r !== !1 && (vn(e, {
|
|
1066
1166
|
ignoreWhitespace: n,
|
|
1067
1167
|
checkChildren: t
|
|
1068
1168
|
}) || (r = !1));
|
|
@@ -1070,10 +1170,22 @@ function cn(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
1070
1170
|
}
|
|
1071
1171
|
return !1;
|
|
1072
1172
|
}
|
|
1073
|
-
function
|
|
1074
|
-
return e instanceof
|
|
1173
|
+
function yn(e) {
|
|
1174
|
+
return e instanceof le;
|
|
1075
1175
|
}
|
|
1076
|
-
|
|
1176
|
+
function bn(e) {
|
|
1177
|
+
if (typeof e != "object" || !e) return !1;
|
|
1178
|
+
let t = e;
|
|
1179
|
+
return typeof t.apply == "function" && typeof t.getMap == "function" && typeof t.invert == "function" && typeof t.map == "function" && typeof t.merge == "function" && typeof t.toJSON == "function";
|
|
1180
|
+
}
|
|
1181
|
+
function xn(e) {
|
|
1182
|
+
if (typeof e != "object" || !e) return !1;
|
|
1183
|
+
let t = e;
|
|
1184
|
+
if (!bn(t)) return !1;
|
|
1185
|
+
let n = t.toJSON();
|
|
1186
|
+
return !(typeof n != "object" || !n || n.stepType !== "replace");
|
|
1187
|
+
}
|
|
1188
|
+
var Sn = class e {
|
|
1077
1189
|
constructor(e) {
|
|
1078
1190
|
this.position = e;
|
|
1079
1191
|
}
|
|
@@ -1084,19 +1196,19 @@ var un = class e {
|
|
|
1084
1196
|
return { position: this.position };
|
|
1085
1197
|
}
|
|
1086
1198
|
};
|
|
1087
|
-
function
|
|
1199
|
+
function Cn(e, t) {
|
|
1088
1200
|
let n = t.mapping.mapResult(e.position);
|
|
1089
1201
|
return {
|
|
1090
|
-
position: new
|
|
1202
|
+
position: new Sn(n.pos),
|
|
1091
1203
|
mapResult: n
|
|
1092
1204
|
};
|
|
1093
1205
|
}
|
|
1094
|
-
function
|
|
1095
|
-
return new
|
|
1206
|
+
function wn(e) {
|
|
1207
|
+
return new Sn(e);
|
|
1096
1208
|
}
|
|
1097
|
-
function
|
|
1209
|
+
function Tn(e, t, n) {
|
|
1098
1210
|
let { selection: r } = t, i = null;
|
|
1099
|
-
if (
|
|
1211
|
+
if (Be(r) && (i = r.$cursor), i) {
|
|
1100
1212
|
let t = e.storedMarks ?? i.marks();
|
|
1101
1213
|
return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
|
|
1102
1214
|
}
|
|
@@ -1113,11 +1225,11 @@ function pn(e, t, n) {
|
|
|
1113
1225
|
}), i;
|
|
1114
1226
|
});
|
|
1115
1227
|
}
|
|
1116
|
-
var
|
|
1117
|
-
let { selection: a } = n, { empty: o, ranges: s } = a, c =
|
|
1228
|
+
var En = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1229
|
+
let { selection: a } = n, { empty: o, ranges: s } = a, c = M(e, r.schema);
|
|
1118
1230
|
if (i) {
|
|
1119
1231
|
if (o) {
|
|
1120
|
-
let e =
|
|
1232
|
+
let e = Dt(r, c);
|
|
1121
1233
|
n.addStoredMark(c.create({
|
|
1122
1234
|
...e,
|
|
1123
1235
|
...t
|
|
@@ -1135,23 +1247,23 @@ var mn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1135
1247
|
});
|
|
1136
1248
|
});
|
|
1137
1249
|
}
|
|
1138
|
-
return
|
|
1139
|
-
},
|
|
1140
|
-
let a =
|
|
1141
|
-
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) =>
|
|
1250
|
+
return Tn(r, n, c);
|
|
1251
|
+
}, Dn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), On = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
1252
|
+
let a = k(e, n.schema), o;
|
|
1253
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => b(a, {
|
|
1142
1254
|
...o,
|
|
1143
1255
|
...t
|
|
1144
|
-
})(n) ? !0 : e.clearNodes()).command(({ state: e }) =>
|
|
1256
|
+
})(n) ? !0 : e.clearNodes()).command(({ state: e }) => b(a, {
|
|
1145
1257
|
...o,
|
|
1146
1258
|
...t
|
|
1147
1259
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
1148
|
-
},
|
|
1260
|
+
}, kn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1149
1261
|
if (n) {
|
|
1150
|
-
let { doc: n } = t, r =
|
|
1262
|
+
let { doc: n } = t, r = N(e, 0, n.content.size), i = le.create(n, r);
|
|
1151
1263
|
t.setSelection(i);
|
|
1152
1264
|
}
|
|
1153
1265
|
return !0;
|
|
1154
|
-
},
|
|
1266
|
+
}, An = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1155
1267
|
let { selection: a } = r, o, s;
|
|
1156
1268
|
return typeof t == "number" ? (o = t, s = t) : t && "from" in t && "to" in t ? (o = t.from, s = t.to) : (o = a.from, s = a.to), i && n.doc.nodesBetween(o, s, (t, r) => {
|
|
1157
1269
|
t.isText || n.setNodeMarkup(r, void 0, {
|
|
@@ -1159,47 +1271,53 @@ var mn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
1159
1271
|
dir: e
|
|
1160
1272
|
});
|
|
1161
1273
|
}), !0;
|
|
1162
|
-
},
|
|
1274
|
+
}, jn = (e) => ({ tr: t, dispatch: n }) => {
|
|
1163
1275
|
if (n) {
|
|
1164
1276
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
1165
1277
|
from: e,
|
|
1166
1278
|
to: e
|
|
1167
|
-
} : e, a =
|
|
1279
|
+
} : e, a = w.atStart(n).from, o = w.atEnd(n).to, s = N(r, a, o), c = N(i, a, o), l = w.create(n, s, c);
|
|
1168
1280
|
t.setSelection(l);
|
|
1169
1281
|
}
|
|
1170
1282
|
return !0;
|
|
1171
|
-
},
|
|
1172
|
-
let r =
|
|
1173
|
-
return
|
|
1283
|
+
}, Mn = (e) => ({ state: t, dispatch: n }) => {
|
|
1284
|
+
let r = k(e, t.schema);
|
|
1285
|
+
return he(r)(t, n);
|
|
1174
1286
|
};
|
|
1175
|
-
function
|
|
1287
|
+
function Nn(e, t) {
|
|
1176
1288
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
1177
1289
|
if (n) {
|
|
1178
1290
|
let r = n.filter((e) => t?.includes(e.type.name));
|
|
1179
1291
|
e.tr.ensureMarks(r);
|
|
1180
1292
|
}
|
|
1181
1293
|
}
|
|
1182
|
-
var
|
|
1294
|
+
var Pn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
1183
1295
|
let { selection: a, doc: s } = t, { $from: c, $to: l } = a, u = i.extensionManager.attributes, d = K(u, c.node().type.name, c.node().attrs);
|
|
1184
|
-
if (a instanceof
|
|
1296
|
+
if (a instanceof le && a.node.isBlock) return !c.parentOffset || !o(s, c.pos) ? !1 : (r && (e && Nn(n, i.extensionManager.splittableMarks), t.split(c.pos).scrollIntoView()), !0);
|
|
1185
1297
|
if (!c.parent.isBlock) return !1;
|
|
1186
|
-
let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 :
|
|
1298
|
+
let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 : Qe(c.node(-1).contentMatchAt(c.indexAfter(-1))), m = f && p ? [{
|
|
1187
1299
|
type: p,
|
|
1188
1300
|
attrs: d
|
|
1189
|
-
}] : void 0, h =
|
|
1190
|
-
|
|
1301
|
+
}] : void 0, h = a instanceof w && !a.empty ? ce.create({
|
|
1302
|
+
doc: t.doc,
|
|
1303
|
+
selection: a
|
|
1304
|
+
}).tr.deleteSelection() : null, g = h ? h.doc : t.doc, _ = h ? h.mapping.map(c.pos) : c.pos, v = o(g, _, 1, m);
|
|
1305
|
+
if (!m && !v && o(g, _, 1, p ? [{ type: p }] : void 0) && (v = !0, m = p ? [{
|
|
1191
1306
|
type: p,
|
|
1192
1307
|
attrs: d
|
|
1193
1308
|
}] : void 0), r) {
|
|
1194
|
-
if (
|
|
1195
|
-
let e = t.
|
|
1196
|
-
|
|
1309
|
+
if (v) {
|
|
1310
|
+
let e = t.steps.length;
|
|
1311
|
+
if (a instanceof w && t.deleteSelection(), t.split(t.mapping.slice(e).map(c.pos), 1, m), p && !f && !c.parentOffset && c.parent.type !== p) {
|
|
1312
|
+
let n = t.mapping.slice(e).map(c.before()), r = t.doc.resolve(n);
|
|
1313
|
+
c.node(-1).canReplaceWith(r.index(), r.index() + 1, p) && t.setNodeMarkup(t.mapping.slice(e).map(c.before()), p);
|
|
1314
|
+
}
|
|
1197
1315
|
}
|
|
1198
|
-
e &&
|
|
1316
|
+
e && Nn(n, i.extensionManager.splittableMarks), t.scrollIntoView();
|
|
1199
1317
|
}
|
|
1200
|
-
return
|
|
1201
|
-
},
|
|
1202
|
-
let s =
|
|
1318
|
+
return v;
|
|
1319
|
+
}, Fn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
|
|
1320
|
+
let s = k(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
|
|
1203
1321
|
if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
|
|
1204
1322
|
let d = c.node(-1);
|
|
1205
1323
|
if (d.type !== s) return !1;
|
|
@@ -1207,20 +1325,20 @@ var Sn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1207
1325
|
if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
|
|
1208
1326
|
if (c.depth === 2 || c.node(-3).type !== s || c.index(-2) !== c.node(-2).childCount - 1) return !1;
|
|
1209
1327
|
if (i) {
|
|
1210
|
-
let e =
|
|
1211
|
-
for (let t = c.depth - r; t >= c.depth - 3; --t) e =
|
|
1328
|
+
let e = T.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
|
|
1329
|
+
for (let t = c.depth - r; t >= c.depth - 3; --t) e = T.from(c.node(t).copy(e));
|
|
1212
1330
|
let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
|
|
1213
1331
|
...K(f, c.node().type.name, c.node().attrs),
|
|
1214
1332
|
...t
|
|
1215
1333
|
}, o = s.contentMatch.defaultType?.createAndFill(a) || void 0;
|
|
1216
|
-
e = e.append(
|
|
1334
|
+
e = e.append(T.from(s.createAndFill(null, o) || void 0));
|
|
1217
1335
|
let l = c.before(c.depth - (r - 1));
|
|
1218
|
-
n.replace(l, c.after(-i), new
|
|
1336
|
+
n.replace(l, c.after(-i), new pe(e, 4 - r, 0));
|
|
1219
1337
|
let u = -1;
|
|
1220
1338
|
n.doc.nodesBetween(l, n.doc.content.size, (e, t) => {
|
|
1221
1339
|
if (u > -1) return !1;
|
|
1222
1340
|
e.isTextblock && e.content.size === 0 && (u = t + 1);
|
|
1223
|
-
}), u > -1 && n.setSelection(
|
|
1341
|
+
}), u > -1 && n.setSelection(w.near(n.doc.resolve(u))), n.scrollIntoView();
|
|
1224
1342
|
}
|
|
1225
1343
|
return !0;
|
|
1226
1344
|
}
|
|
@@ -1230,86 +1348,158 @@ var Sn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
1230
1348
|
}, h = {
|
|
1231
1349
|
...K(f, c.node().type.name, c.node().attrs),
|
|
1232
1350
|
...t
|
|
1233
|
-
};
|
|
1351
|
+
}, g = c.parentOffset === 0 && c.index(-1) === 0, _ = c.before(-1);
|
|
1234
1352
|
n.delete(c.pos, l.pos);
|
|
1235
|
-
let g = p ? [{
|
|
1353
|
+
let v = g ? d.attrs : m, y = p ? [{
|
|
1236
1354
|
type: s,
|
|
1237
|
-
attrs:
|
|
1355
|
+
attrs: v
|
|
1238
1356
|
}, {
|
|
1239
1357
|
type: p,
|
|
1240
1358
|
attrs: h
|
|
1241
1359
|
}] : [{
|
|
1242
1360
|
type: s,
|
|
1243
|
-
attrs:
|
|
1361
|
+
attrs: v
|
|
1244
1362
|
}];
|
|
1245
1363
|
if (!o(n.doc, c.pos, 2)) return !1;
|
|
1246
1364
|
if (i) {
|
|
1247
1365
|
let { selection: e, storedMarks: t } = r, { splittableMarks: o } = a.extensionManager, s = t || e.$to.parentOffset && e.$from.marks();
|
|
1248
|
-
if (n.split(c.pos, 2,
|
|
1366
|
+
if (n.split(c.pos, 2, y).scrollIntoView(), g && n.setNodeMarkup(_, void 0, m), !s || !i) return !0;
|
|
1249
1367
|
let l = s.filter((e) => o.includes(e.type.name));
|
|
1250
1368
|
n.ensureMarks(l);
|
|
1251
1369
|
}
|
|
1252
1370
|
return !0;
|
|
1253
1371
|
};
|
|
1254
|
-
function
|
|
1372
|
+
function In(e, t, n) {
|
|
1373
|
+
if (!e.validContent(t)) return null;
|
|
1374
|
+
try {
|
|
1375
|
+
return e.create(n, t);
|
|
1376
|
+
} catch {
|
|
1377
|
+
return null;
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
function Ln(e, t) {
|
|
1381
|
+
if (e.pendingContent.length === 0) return !0;
|
|
1382
|
+
let n = In(t, T.from(e.pendingContent));
|
|
1383
|
+
return n ? (e.items.push(n), e.pendingContent = [], !0) : !1;
|
|
1384
|
+
}
|
|
1385
|
+
function Rn(e, t, n) {
|
|
1386
|
+
return n.validContent(T.from([...t.pendingContent, e])) ? (t.pendingContent.push(e), !0) : !Ln(t, n) || !n.validContent(T.from(e)) ? !1 : (t.pendingContent.push(e), !0);
|
|
1387
|
+
}
|
|
1388
|
+
function zn(e, t, n, r) {
|
|
1389
|
+
let i = r(e, n);
|
|
1390
|
+
if (!i) return !1;
|
|
1391
|
+
let a = In(n.listType, T.from(i), e.attrs);
|
|
1392
|
+
return a ? n.itemType.validContent(T.from([...t.pendingContent, a])) ? (t.pendingContent.push(a), !0) : Ln(t, n.itemType) ? (t.items.push(...i), !0) : !1 : !1;
|
|
1393
|
+
}
|
|
1394
|
+
function Bn(e, t, n) {
|
|
1395
|
+
let r = {
|
|
1396
|
+
items: [],
|
|
1397
|
+
pendingContent: []
|
|
1398
|
+
};
|
|
1399
|
+
for (let i = 0; i < e.childCount; i += 1) {
|
|
1400
|
+
let a = e.child(i);
|
|
1401
|
+
if (!(t.isListNode(a) ? zn(a, r, t, n) : Rn(a, r, t.itemType))) return null;
|
|
1402
|
+
}
|
|
1403
|
+
return Ln(r, t.itemType) ? r.items : null;
|
|
1404
|
+
}
|
|
1405
|
+
function Vn(e, t) {
|
|
1406
|
+
let n = [];
|
|
1407
|
+
for (let r = 0; r < e.childCount; r += 1) {
|
|
1408
|
+
let i = Bn(e.child(r), t, Vn);
|
|
1409
|
+
if (!i) return null;
|
|
1410
|
+
n.push(...i);
|
|
1411
|
+
}
|
|
1412
|
+
return n;
|
|
1413
|
+
}
|
|
1414
|
+
function Hn(e, t) {
|
|
1415
|
+
let n = null;
|
|
1416
|
+
return e.descendants((e, r) => e !== t || (n = r, !1)), n;
|
|
1417
|
+
}
|
|
1418
|
+
function Un(e) {
|
|
1255
1419
|
return !e || e === "1" ? null : e;
|
|
1256
1420
|
}
|
|
1257
|
-
function
|
|
1258
|
-
return
|
|
1421
|
+
function Wn(e, t) {
|
|
1422
|
+
return Un(e) === Un(t);
|
|
1259
1423
|
}
|
|
1260
|
-
var
|
|
1261
|
-
let n =
|
|
1424
|
+
var Gn = (e, t) => {
|
|
1425
|
+
let n = z((e) => e.type === t)(e.selection);
|
|
1262
1426
|
if (!n) return !0;
|
|
1263
1427
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
1264
1428
|
if (r === void 0) return !0;
|
|
1265
1429
|
let i = e.doc.nodeAt(r);
|
|
1266
|
-
return !(n.node.type === i?.type && a(e.doc, n.pos)) || !
|
|
1267
|
-
},
|
|
1268
|
-
let n =
|
|
1430
|
+
return !(n.node.type === i?.type && a(e.doc, n.pos)) || !Wn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
|
|
1431
|
+
}, Kn = (e, t) => {
|
|
1432
|
+
let n = z((e) => e.type === t)(e.selection);
|
|
1269
1433
|
if (!n) return !0;
|
|
1270
1434
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
1271
1435
|
if (r === void 0) return !0;
|
|
1272
1436
|
let i = e.doc.nodeAt(r);
|
|
1273
|
-
return !(n.node.type === i?.type && a(e.doc, r)) || !
|
|
1437
|
+
return !(n.node.type === i?.type && a(e.doc, r)) || !Wn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
|
|
1274
1438
|
};
|
|
1275
|
-
function
|
|
1439
|
+
function qn(e) {
|
|
1276
1440
|
let t = e.doc, n = t.firstChild;
|
|
1277
1441
|
if (!n) return null;
|
|
1278
1442
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
1279
|
-
return
|
|
1443
|
+
return w.between(r, i);
|
|
1280
1444
|
}
|
|
1281
|
-
var
|
|
1282
|
-
let { extensions: d, splittableMarks: f } = i.extensionManager, p =
|
|
1283
|
-
if (!
|
|
1284
|
-
let
|
|
1285
|
-
node:
|
|
1445
|
+
var Jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
1446
|
+
let { extensions: d, splittableMarks: f } = i.extensionManager, p = k(e, o.schema), m = k(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: v } = h, y = _.blockRange(v), ee = g || h.$to.parentOffset && h.$from.marks();
|
|
1447
|
+
if (!y) return !1;
|
|
1448
|
+
let te = z((e) => q(e.type.name, d))(h), ne = h.from === 0 && h.to === o.doc.content.size, re = o.doc.content.content, ie = re.length === 1 ? re[0] : null, ae = ne && ie && q(ie.type.name, d) ? {
|
|
1449
|
+
node: ie,
|
|
1286
1450
|
pos: 0,
|
|
1287
1451
|
depth: 0
|
|
1288
|
-
} : null,
|
|
1289
|
-
if ((
|
|
1290
|
-
if (
|
|
1291
|
-
let n =
|
|
1452
|
+
} : null, b = te ?? ae, oe = !!te && y.depth >= 1 && y.depth - te.depth <= 1, se = !!ae;
|
|
1453
|
+
if ((oe || se) && b) {
|
|
1454
|
+
if (b.node.type === p) return ne && se ? c().command(({ tr: e, dispatch: t }) => {
|
|
1455
|
+
let n = qn(e);
|
|
1292
1456
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
1293
1457
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
1294
|
-
if (q(
|
|
1458
|
+
if (q(b.node.type.name, d) && p.validContent(b.node.content)) return c().command(() => (a.setNodeMarkup(b.pos, p), !0)).command(() => Gn(a, p)).command(() => Kn(a, p)).run();
|
|
1459
|
+
if (q(b.node.type.name, d)) {
|
|
1460
|
+
let e = b.node.firstChild?.type;
|
|
1461
|
+
if (e && e !== m) {
|
|
1462
|
+
let e = Vn(b.node, {
|
|
1463
|
+
listType: p,
|
|
1464
|
+
itemType: m,
|
|
1465
|
+
isListNode: (e) => q(e.type.name, d)
|
|
1466
|
+
}), t = e ? T.from(e) : null;
|
|
1467
|
+
return !t || !p.validContent(t) ? !1 : c().command(() => {
|
|
1468
|
+
let { $anchor: e, $head: n } = a.selection, i = e.parent, o = n.parent, s = e.parentOffset, c = n.parentOffset, l;
|
|
1469
|
+
try {
|
|
1470
|
+
l = p.create(r, t);
|
|
1471
|
+
} catch {
|
|
1472
|
+
return !1;
|
|
1473
|
+
}
|
|
1474
|
+
if (a.replaceWith(b.pos, b.pos + b.node.nodeSize, l), i.inlineContent && o.inlineContent) {
|
|
1475
|
+
let e = Hn(l, i), t = Hn(l, o);
|
|
1476
|
+
if (e !== null && t !== null) {
|
|
1477
|
+
let n = b.pos + e + 2 + s, r = b.pos + t + 2 + c;
|
|
1478
|
+
a.setSelection(w.create(a.doc, n, r));
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
return !0;
|
|
1482
|
+
}).command(() => Gn(a, p)).command(() => Kn(a, p)).run();
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1295
1485
|
}
|
|
1296
|
-
return !n || !
|
|
1297
|
-
let e = u().wrapInList(p, r), t =
|
|
1486
|
+
return !n || !ee || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => Gn(a, p)).command(() => Kn(a, p)).run() : c().command(() => {
|
|
1487
|
+
let e = u().wrapInList(p, r), t = ee.filter((e) => f.includes(e.type.name));
|
|
1298
1488
|
return a.ensureMarks(t), e ? !0 : l.clearNodes();
|
|
1299
|
-
}).wrapInList(p, r).command(() =>
|
|
1300
|
-
},
|
|
1301
|
-
let { extendEmptyMarkRange: a = !1 } = n, o =
|
|
1302
|
-
return
|
|
1303
|
-
},
|
|
1304
|
-
let a =
|
|
1489
|
+
}).wrapInList(p, r).command(() => Gn(a, p)).command(() => Kn(a, p)).run();
|
|
1490
|
+
}, Yn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
|
|
1491
|
+
let { extendEmptyMarkRange: a = !1 } = n, o = M(e, r.schema);
|
|
1492
|
+
return pn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
|
|
1493
|
+
}, Xn = (e, t, n = {}) => ({ state: r, commands: i }) => {
|
|
1494
|
+
let a = k(e, r.schema), o = k(t, r.schema), s = L(r, a, n), c;
|
|
1305
1495
|
return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
|
|
1306
1496
|
...c,
|
|
1307
1497
|
...n
|
|
1308
1498
|
});
|
|
1309
|
-
},
|
|
1310
|
-
let i =
|
|
1311
|
-
return
|
|
1312
|
-
},
|
|
1499
|
+
}, Zn = (e, t = {}) => ({ state: n, commands: r }) => {
|
|
1500
|
+
let i = k(e, n.schema);
|
|
1501
|
+
return L(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
|
|
1502
|
+
}, Qn = () => ({ state: e, dispatch: t }) => {
|
|
1313
1503
|
let n = e.plugins;
|
|
1314
1504
|
for (let r = 0; r < n.length; r += 1) {
|
|
1315
1505
|
let i = n[r], a;
|
|
@@ -1326,7 +1516,7 @@ var kn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1326
1516
|
}
|
|
1327
1517
|
}
|
|
1328
1518
|
return !1;
|
|
1329
|
-
},
|
|
1519
|
+
}, $n = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
|
|
1330
1520
|
let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
|
|
1331
1521
|
if (o) return !0;
|
|
1332
1522
|
let { nonClearableMarks: c } = r.extensionManager;
|
|
@@ -1337,27 +1527,27 @@ var kn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1337
1527
|
});
|
|
1338
1528
|
}
|
|
1339
1529
|
return !0;
|
|
1340
|
-
},
|
|
1341
|
-
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s =
|
|
1530
|
+
}, er = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1531
|
+
let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = M(e, r.schema), { $from: c, empty: l, ranges: u } = o;
|
|
1342
1532
|
if (!i) return !0;
|
|
1343
1533
|
if (l && a) {
|
|
1344
|
-
let { from: e, to: t } = o, r =
|
|
1534
|
+
let { from: e, to: t } = o, r = Le(c, s, c.marks().find((e) => e.type === s)?.attrs);
|
|
1345
1535
|
r && (e = r.from, t = r.to), n.removeMark(e, t, s);
|
|
1346
1536
|
} else u.forEach((e) => {
|
|
1347
1537
|
n.removeMark(e.$from.pos, e.$to.pos, s);
|
|
1348
1538
|
});
|
|
1349
1539
|
return n.removeStoredMark(s), !0;
|
|
1350
|
-
},
|
|
1540
|
+
}, tr = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
1351
1541
|
let { selection: i } = n, a, o;
|
|
1352
1542
|
return typeof e == "number" ? (a = e, o = e) : e && "from" in e && "to" in e ? (a = e.from, o = e.to) : (a = i.from, o = i.to), r && t.doc.nodesBetween(a, o, (e, n) => {
|
|
1353
1543
|
if (e.isText) return;
|
|
1354
1544
|
let r = { ...e.attrs };
|
|
1355
1545
|
delete r.dir, t.setNodeMarkup(n, void 0, r);
|
|
1356
1546
|
}), !0;
|
|
1357
|
-
},
|
|
1358
|
-
let a = null, o = null, s =
|
|
1547
|
+
}, nr = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
1548
|
+
let a = null, o = null, s = R(typeof e == "string" ? e : e.name, r.schema);
|
|
1359
1549
|
if (!s) return !1;
|
|
1360
|
-
s === "node" && (a =
|
|
1550
|
+
s === "node" && (a = k(e, r.schema)), s === "mark" && (o = M(e, r.schema));
|
|
1361
1551
|
let c = !1;
|
|
1362
1552
|
return n.selection.ranges.forEach((e) => {
|
|
1363
1553
|
let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
|
|
@@ -1386,16 +1576,16 @@ var kn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1386
1576
|
}));
|
|
1387
1577
|
}));
|
|
1388
1578
|
}), c;
|
|
1389
|
-
}, J = new
|
|
1579
|
+
}, J = new S("__tiptap_decorations__"), rr = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(J, {
|
|
1390
1580
|
type: "force",
|
|
1391
1581
|
name: e
|
|
1392
|
-
}), !0),
|
|
1393
|
-
let i =
|
|
1394
|
-
return
|
|
1395
|
-
},
|
|
1396
|
-
let i =
|
|
1397
|
-
return
|
|
1398
|
-
},
|
|
1582
|
+
}), !0), ir = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1583
|
+
let i = k(e, n.schema);
|
|
1584
|
+
return oe(i, t)(n, r);
|
|
1585
|
+
}, ar = (e, t = {}) => ({ state: n, dispatch: r }) => {
|
|
1586
|
+
let i = k(e, n.schema);
|
|
1587
|
+
return ge(i, t)(n, r);
|
|
1588
|
+
}, or = /* @__PURE__ */ e({
|
|
1399
1589
|
blur: () => be,
|
|
1400
1590
|
clearContent: () => xe,
|
|
1401
1591
|
clearNodes: () => Se,
|
|
@@ -1408,21 +1598,21 @@ var kn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1408
1598
|
deleteSelection: () => Me,
|
|
1409
1599
|
enter: () => Ne,
|
|
1410
1600
|
exitCode: () => Pe,
|
|
1411
|
-
extendMarkRange: () =>
|
|
1412
|
-
first: () =>
|
|
1413
|
-
focus: () =>
|
|
1414
|
-
forEach: () =>
|
|
1415
|
-
insertContent: () =>
|
|
1416
|
-
insertContentAt: () =>
|
|
1417
|
-
insertDefaultBlock: () =>
|
|
1418
|
-
joinBackward: () =>
|
|
1419
|
-
joinDown: () =>
|
|
1420
|
-
joinForward: () =>
|
|
1601
|
+
extendMarkRange: () => Re,
|
|
1602
|
+
first: () => ze,
|
|
1603
|
+
focus: () => We,
|
|
1604
|
+
forEach: () => Ge,
|
|
1605
|
+
insertContent: () => Ke,
|
|
1606
|
+
insertContentAt: () => Ze,
|
|
1607
|
+
insertDefaultBlock: () => $e,
|
|
1608
|
+
joinBackward: () => nt,
|
|
1609
|
+
joinDown: () => tt,
|
|
1610
|
+
joinForward: () => rt,
|
|
1421
1611
|
joinItemBackward: () => at,
|
|
1422
1612
|
joinItemForward: () => ot,
|
|
1423
1613
|
joinTextblockBackward: () => st,
|
|
1424
1614
|
joinTextblockForward: () => ct,
|
|
1425
|
-
joinUp: () =>
|
|
1615
|
+
joinUp: () => et,
|
|
1426
1616
|
keyboardShortcut: () => dt,
|
|
1427
1617
|
lift: () => ft,
|
|
1428
1618
|
liftEmptyBlock: () => pt,
|
|
@@ -1436,30 +1626,30 @@ var kn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
1436
1626
|
selectParentNode: () => St,
|
|
1437
1627
|
selectTextblockEnd: () => Ct,
|
|
1438
1628
|
selectTextblockStart: () => wt,
|
|
1439
|
-
setContent: () =>
|
|
1440
|
-
setMark: () =>
|
|
1441
|
-
setMeta: () =>
|
|
1442
|
-
setNode: () =>
|
|
1443
|
-
setNodeSelection: () =>
|
|
1444
|
-
setTextDirection: () =>
|
|
1445
|
-
setTextSelection: () =>
|
|
1446
|
-
sinkListItem: () =>
|
|
1447
|
-
splitBlock: () =>
|
|
1448
|
-
splitListItem: () =>
|
|
1449
|
-
toggleList: () =>
|
|
1450
|
-
toggleMark: () =>
|
|
1451
|
-
toggleNode: () =>
|
|
1452
|
-
toggleWrap: () =>
|
|
1453
|
-
undoInputRule: () =>
|
|
1454
|
-
unsetAllMarks: () =>
|
|
1455
|
-
unsetMark: () =>
|
|
1456
|
-
unsetTextDirection: () =>
|
|
1457
|
-
updateAttributes: () =>
|
|
1458
|
-
updateDecorations: () =>
|
|
1459
|
-
wrapIn: () =>
|
|
1460
|
-
wrapInList: () =>
|
|
1629
|
+
setContent: () => Et,
|
|
1630
|
+
setMark: () => En,
|
|
1631
|
+
setMeta: () => Dn,
|
|
1632
|
+
setNode: () => On,
|
|
1633
|
+
setNodeSelection: () => kn,
|
|
1634
|
+
setTextDirection: () => An,
|
|
1635
|
+
setTextSelection: () => jn,
|
|
1636
|
+
sinkListItem: () => Mn,
|
|
1637
|
+
splitBlock: () => Pn,
|
|
1638
|
+
splitListItem: () => Fn,
|
|
1639
|
+
toggleList: () => Jn,
|
|
1640
|
+
toggleMark: () => Yn,
|
|
1641
|
+
toggleNode: () => Xn,
|
|
1642
|
+
toggleWrap: () => Zn,
|
|
1643
|
+
undoInputRule: () => Qn,
|
|
1644
|
+
unsetAllMarks: () => $n,
|
|
1645
|
+
unsetMark: () => er,
|
|
1646
|
+
unsetTextDirection: () => tr,
|
|
1647
|
+
updateAttributes: () => nr,
|
|
1648
|
+
updateDecorations: () => rr,
|
|
1649
|
+
wrapIn: () => ir,
|
|
1650
|
+
wrapInList: () => ar
|
|
1461
1651
|
}), Y = /* @__PURE__ */ new WeakMap();
|
|
1462
|
-
function
|
|
1652
|
+
function sr(e, t) {
|
|
1463
1653
|
Y.set(e, (Y.get(e) ?? 0) + 1);
|
|
1464
1654
|
try {
|
|
1465
1655
|
return t();
|
|
@@ -1468,10 +1658,10 @@ function Hn(e, t) {
|
|
|
1468
1658
|
t > 0 ? Y.set(e, t) : Y.delete(e);
|
|
1469
1659
|
}
|
|
1470
1660
|
}
|
|
1471
|
-
function
|
|
1661
|
+
function cr(e) {
|
|
1472
1662
|
return Y.has(e);
|
|
1473
1663
|
}
|
|
1474
|
-
var
|
|
1664
|
+
var lr = class {
|
|
1475
1665
|
constructor() {
|
|
1476
1666
|
this.callbacks = {};
|
|
1477
1667
|
}
|
|
@@ -1495,44 +1685,44 @@ var Wn = class {
|
|
|
1495
1685
|
removeAllListeners() {
|
|
1496
1686
|
this.callbacks = {};
|
|
1497
1687
|
}
|
|
1498
|
-
},
|
|
1499
|
-
function
|
|
1688
|
+
}, ur = typeof process < "u" && process.env.NODE_ENV !== "production";
|
|
1689
|
+
function dr(e) {
|
|
1500
1690
|
return e.kind === "widget";
|
|
1501
1691
|
}
|
|
1502
|
-
function
|
|
1692
|
+
function fr(e, t) {
|
|
1503
1693
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
1504
|
-
for (let i of e) i.kind === "widget" &&
|
|
1694
|
+
for (let i of e) i.kind === "widget" && dr(i) && r.add(i.key), n.push(i.toPMDecoration(t));
|
|
1505
1695
|
return {
|
|
1506
1696
|
decorations: n,
|
|
1507
1697
|
widgetKeys: r
|
|
1508
1698
|
};
|
|
1509
1699
|
}
|
|
1510
|
-
function
|
|
1511
|
-
let { decorations: r, widgetKeys: i } =
|
|
1700
|
+
function pr(e, t, n) {
|
|
1701
|
+
let { decorations: r, widgetKeys: i } = fr(t, n);
|
|
1512
1702
|
return {
|
|
1513
|
-
set:
|
|
1703
|
+
set: E.create(e, r),
|
|
1514
1704
|
widgetKeys: i
|
|
1515
1705
|
};
|
|
1516
1706
|
}
|
|
1517
|
-
function
|
|
1707
|
+
function mr({ position: e, from: t, to: n, docSize: r }) {
|
|
1518
1708
|
return e < t ? !1 : e < n || e === n && n === r;
|
|
1519
1709
|
}
|
|
1520
|
-
function
|
|
1521
|
-
return e.filter((e) =>
|
|
1710
|
+
function hr({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
|
|
1711
|
+
return e.filter((e) => mr({
|
|
1522
1712
|
position: e.anchor,
|
|
1523
1713
|
from: t,
|
|
1524
1714
|
to: n,
|
|
1525
1715
|
docSize: r
|
|
1526
1716
|
}) ? !0 : (e.anchor === n || a.has(i) || (a.add(i), console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)), !1));
|
|
1527
1717
|
}
|
|
1528
|
-
function
|
|
1718
|
+
function gr(e) {
|
|
1529
1719
|
let t = e.spec?.key;
|
|
1530
1720
|
return typeof t == "string" ? t : void 0;
|
|
1531
1721
|
}
|
|
1532
|
-
function
|
|
1722
|
+
function _r(e) {
|
|
1533
1723
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
1534
1724
|
for (let r of e.find()) {
|
|
1535
|
-
let e =
|
|
1725
|
+
let e = gr(r);
|
|
1536
1726
|
if (!e) continue;
|
|
1537
1727
|
let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
|
|
1538
1728
|
a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
|
|
@@ -1542,18 +1732,18 @@ function Qn(e) {
|
|
|
1542
1732
|
extensions: t
|
|
1543
1733
|
})).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
|
|
1544
1734
|
}
|
|
1545
|
-
function
|
|
1735
|
+
function vr(e) {
|
|
1546
1736
|
return e.jsonID === "attr";
|
|
1547
1737
|
}
|
|
1548
|
-
function
|
|
1738
|
+
function yr(e) {
|
|
1549
1739
|
let t = !1;
|
|
1550
1740
|
if (e.getMap().forEach(() => {
|
|
1551
1741
|
t = !0;
|
|
1552
|
-
}), t ||
|
|
1742
|
+
}), t || vr(e)) return !0;
|
|
1553
1743
|
let n = e;
|
|
1554
1744
|
return typeof n.from == "number" && typeof n.to == "number";
|
|
1555
1745
|
}
|
|
1556
|
-
function
|
|
1746
|
+
function br(e, t) {
|
|
1557
1747
|
let n = null, r = 0, i = 0;
|
|
1558
1748
|
for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
|
|
1559
1749
|
let o = i + e.child(a).nodeSize;
|
|
@@ -1564,11 +1754,11 @@ function tr(e, t) {
|
|
|
1564
1754
|
to: r
|
|
1565
1755
|
};
|
|
1566
1756
|
}
|
|
1567
|
-
function
|
|
1568
|
-
if (e.steps.some((e) => !
|
|
1569
|
-
let n =
|
|
1757
|
+
function xr(e, t) {
|
|
1758
|
+
if (e.steps.some((e) => !yr(e))) return { type: "full" };
|
|
1759
|
+
let n = cn(e).map(({ newRange: e }) => e);
|
|
1570
1760
|
e.steps.forEach((t, r) => {
|
|
1571
|
-
if (
|
|
1761
|
+
if (!vr(t)) return;
|
|
1572
1762
|
let i = e.mapping.slice(r);
|
|
1573
1763
|
n.push({
|
|
1574
1764
|
from: i.map(t.pos, -1),
|
|
@@ -1577,7 +1767,7 @@ function nr(e, t) {
|
|
|
1577
1767
|
});
|
|
1578
1768
|
let r = [];
|
|
1579
1769
|
for (let e of n) {
|
|
1580
|
-
let n =
|
|
1770
|
+
let n = br(t, e);
|
|
1581
1771
|
n && r.push(n);
|
|
1582
1772
|
}
|
|
1583
1773
|
r.sort((e, t) => e.from - t.from);
|
|
@@ -1591,29 +1781,29 @@ function nr(e, t) {
|
|
|
1591
1781
|
ranges: i
|
|
1592
1782
|
};
|
|
1593
1783
|
}
|
|
1594
|
-
function
|
|
1784
|
+
function Sr(e, t, n, r) {
|
|
1595
1785
|
return e.map(t, n, { onRemove: (e) => {
|
|
1596
1786
|
let t = e?.key;
|
|
1597
1787
|
typeof t == "string" && r.delete(t);
|
|
1598
1788
|
} });
|
|
1599
1789
|
}
|
|
1600
|
-
function
|
|
1601
|
-
let r = t.decorationSetsByExtension[e] ??
|
|
1790
|
+
function Cr(e, t, n) {
|
|
1791
|
+
let r = t.decorationSetsByExtension[e] ?? E.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
|
|
1602
1792
|
return {
|
|
1603
|
-
set:
|
|
1793
|
+
set: Sr(r, n.mapping, n.doc, i),
|
|
1604
1794
|
widgetKeys: i
|
|
1605
1795
|
};
|
|
1606
1796
|
}
|
|
1607
|
-
function
|
|
1797
|
+
function wr(e, t) {
|
|
1608
1798
|
let n = Object.values(t).flatMap((e) => e.find());
|
|
1609
|
-
return
|
|
1799
|
+
return E.create(e, n);
|
|
1610
1800
|
}
|
|
1611
|
-
function
|
|
1801
|
+
function Tr(e) {
|
|
1612
1802
|
let t = /* @__PURE__ */ new Set();
|
|
1613
1803
|
for (let n of Object.values(e)) for (let e of n) t.add(e);
|
|
1614
1804
|
return t;
|
|
1615
1805
|
}
|
|
1616
|
-
function
|
|
1806
|
+
function Er(e, t) {
|
|
1617
1807
|
switch (t.update ?? "document") {
|
|
1618
1808
|
case "document":
|
|
1619
1809
|
if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
|
|
@@ -1628,21 +1818,21 @@ function sr(e, t) {
|
|
|
1628
1818
|
default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
|
|
1629
1819
|
}
|
|
1630
1820
|
}
|
|
1631
|
-
function
|
|
1821
|
+
function Dr(e, t, n) {
|
|
1632
1822
|
return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
|
|
1633
1823
|
}
|
|
1634
|
-
var
|
|
1824
|
+
var Or = /* @__PURE__ */ new Set(), kr = class {
|
|
1635
1825
|
constructor(e) {
|
|
1636
1826
|
this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
|
|
1637
1827
|
let t = J.getState(e);
|
|
1638
1828
|
t && this.warnDuplicateWidgetKeys(t);
|
|
1639
|
-
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) =>
|
|
1829
|
+
}, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => Er(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
|
|
1640
1830
|
}
|
|
1641
1831
|
destroy() {
|
|
1642
1832
|
this.editor.off("beforeTransaction", this.handleBeforeTransaction);
|
|
1643
1833
|
}
|
|
1644
1834
|
liveWidgetKeys() {
|
|
1645
|
-
return J.getState(this.editor.state)?.widgetKeys ??
|
|
1835
|
+
return J.getState(this.editor.state)?.widgetKeys ?? Or;
|
|
1646
1836
|
}
|
|
1647
1837
|
get mountedView() {
|
|
1648
1838
|
return this.editor.isDestroyed ? null : this.editor.view;
|
|
@@ -1660,7 +1850,7 @@ var lr = /* @__PURE__ */ new Set(), ur = class {
|
|
|
1660
1850
|
}
|
|
1661
1851
|
createPlugin() {
|
|
1662
1852
|
let { editor: e, entries: t } = this;
|
|
1663
|
-
return new
|
|
1853
|
+
return new x({
|
|
1664
1854
|
key: J,
|
|
1665
1855
|
state: {
|
|
1666
1856
|
init: (e, n) => {
|
|
@@ -1673,22 +1863,22 @@ var lr = /* @__PURE__ */ new Set(), ur = class {
|
|
|
1673
1863
|
decorationSetsByExtension: r,
|
|
1674
1864
|
widgetKeysByExtension: i,
|
|
1675
1865
|
mergedDecorationSet: this.buildMergedSet(n.doc, r),
|
|
1676
|
-
widgetKeys:
|
|
1866
|
+
widgetKeys: Tr(i)
|
|
1677
1867
|
};
|
|
1678
1868
|
return this.warnDuplicateWidgetKeys(a), a;
|
|
1679
1869
|
},
|
|
1680
1870
|
apply: (n, r, i, a) => {
|
|
1681
1871
|
let o = n.getMeta(J), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
|
|
1682
|
-
return
|
|
1872
|
+
return sr(e, () => {
|
|
1683
1873
|
for (let { name: o, spec: f } of t) {
|
|
1684
1874
|
let t = s || c === o;
|
|
1685
|
-
if (!
|
|
1875
|
+
if (!Dr(f, {
|
|
1686
1876
|
editor: e,
|
|
1687
1877
|
tr: n,
|
|
1688
1878
|
oldState: i,
|
|
1689
1879
|
newState: a
|
|
1690
1880
|
}, t)) {
|
|
1691
|
-
let e =
|
|
1881
|
+
let e = Cr(o, r, n);
|
|
1692
1882
|
l[o] = e.set, u[o] = e.widgetKeys;
|
|
1693
1883
|
} else if (f.update === "changedRanges" && n.docChanged && !t) {
|
|
1694
1884
|
let e = this.applyChangedRangesRecompute(o, f, r, n, a);
|
|
@@ -1708,34 +1898,34 @@ var lr = /* @__PURE__ */ new Set(), ur = class {
|
|
|
1708
1898
|
decorationSetsByExtension: l,
|
|
1709
1899
|
recomputedNames: d
|
|
1710
1900
|
}),
|
|
1711
|
-
widgetKeys:
|
|
1901
|
+
widgetKeys: Tr(u)
|
|
1712
1902
|
};
|
|
1713
1903
|
}
|
|
1714
1904
|
},
|
|
1715
1905
|
props: { decorations(e) {
|
|
1716
|
-
return J.getState(e)?.mergedDecorationSet ??
|
|
1906
|
+
return J.getState(e)?.mergedDecorationSet ?? E.empty;
|
|
1717
1907
|
} }
|
|
1718
1908
|
});
|
|
1719
1909
|
}
|
|
1720
1910
|
applyChangedRangesRecompute(e, t, n, r, i) {
|
|
1721
|
-
let a =
|
|
1911
|
+
let a = xr(r, i.doc);
|
|
1722
1912
|
return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
|
|
1723
1913
|
}
|
|
1724
1914
|
rebuildRanges(e, t, n, r, i, a) {
|
|
1725
|
-
let o = n.decorationSetsByExtension[e] ??
|
|
1915
|
+
let o = n.decorationSetsByExtension[e] ?? E.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = Sr(o, r.mapping, r.doc, s), l = i.doc.content.size;
|
|
1726
1916
|
for (let { from: n, to: r } of a) {
|
|
1727
|
-
let a = c.find(n, r).filter((e) =>
|
|
1917
|
+
let a = c.find(n, r).filter((e) => mr({
|
|
1728
1918
|
position: e.from,
|
|
1729
1919
|
from: n,
|
|
1730
1920
|
to: r,
|
|
1731
1921
|
docSize: l
|
|
1732
1922
|
}));
|
|
1733
1923
|
for (let e of a) {
|
|
1734
|
-
let t =
|
|
1924
|
+
let t = gr(e);
|
|
1735
1925
|
t && s.delete(t);
|
|
1736
1926
|
}
|
|
1737
1927
|
c = c.remove(a);
|
|
1738
|
-
let { decorations: o, widgetKeys: u } =
|
|
1928
|
+
let { decorations: o, widgetKeys: u } = fr(hr({
|
|
1739
1929
|
decorations: this.runCreate(e, "createInRange", () => t.createInRange({
|
|
1740
1930
|
editor: this.editor,
|
|
1741
1931
|
state: i,
|
|
@@ -1763,7 +1953,7 @@ var lr = /* @__PURE__ */ new Set(), ur = class {
|
|
|
1763
1953
|
state: n,
|
|
1764
1954
|
view: this.mountedView
|
|
1765
1955
|
}));
|
|
1766
|
-
return
|
|
1956
|
+
return pr(n.doc, r, e);
|
|
1767
1957
|
}
|
|
1768
1958
|
runCreate(e, t, n) {
|
|
1769
1959
|
try {
|
|
@@ -1773,12 +1963,12 @@ var lr = /* @__PURE__ */ new Set(), ur = class {
|
|
|
1773
1963
|
}
|
|
1774
1964
|
}
|
|
1775
1965
|
warnDuplicateWidgetKeys(e) {
|
|
1776
|
-
if (!
|
|
1966
|
+
if (!ur) return;
|
|
1777
1967
|
if (e.widgetKeys.size === 0) {
|
|
1778
1968
|
this.warnedWidgetKeys.clear();
|
|
1779
1969
|
return;
|
|
1780
1970
|
}
|
|
1781
|
-
let t =
|
|
1971
|
+
let t = _r(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
|
|
1782
1972
|
for (let { key: e, extensions: n } of t) {
|
|
1783
1973
|
if (this.warnedWidgetKeys.has(e)) continue;
|
|
1784
1974
|
let t = Array.from(n).map((e) => `"${e}"`).join(", ");
|
|
@@ -1788,15 +1978,15 @@ var lr = /* @__PURE__ */ new Set(), ur = class {
|
|
|
1788
1978
|
}
|
|
1789
1979
|
buildMergedSet(e, t) {
|
|
1790
1980
|
let n = Object.keys(t);
|
|
1791
|
-
return n.length === 1 ? t[n[0]] :
|
|
1981
|
+
return n.length === 1 ? t[n[0]] : wr(e, t);
|
|
1792
1982
|
}
|
|
1793
1983
|
mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
|
|
1794
|
-
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) :
|
|
1984
|
+
return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : wr(n.doc, r);
|
|
1795
1985
|
}
|
|
1796
1986
|
};
|
|
1797
|
-
function
|
|
1987
|
+
function Ar(e, t) {
|
|
1798
1988
|
let { selection: n } = e, { $from: r } = n;
|
|
1799
|
-
if (n instanceof
|
|
1989
|
+
if (n instanceof le) {
|
|
1800
1990
|
let e = r.index();
|
|
1801
1991
|
return r.parent.canReplaceWith(e, e + 1, t);
|
|
1802
1992
|
}
|
|
@@ -1808,22 +1998,44 @@ function dr(e, t) {
|
|
|
1808
1998
|
}
|
|
1809
1999
|
return !1;
|
|
1810
2000
|
}
|
|
1811
|
-
function
|
|
2001
|
+
function jr(e, t, n) {
|
|
1812
2002
|
let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
|
|
1813
2003
|
if (r !== null) return r;
|
|
1814
2004
|
let i = document.createElement("style");
|
|
1815
2005
|
return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
|
|
1816
2006
|
}
|
|
1817
|
-
function
|
|
2007
|
+
function Mr(e) {
|
|
1818
2008
|
return typeof e == "number";
|
|
1819
2009
|
}
|
|
1820
|
-
function
|
|
2010
|
+
function Nr(e) {
|
|
1821
2011
|
return Object.prototype.toString.call(e).slice(8, -1);
|
|
1822
2012
|
}
|
|
1823
2013
|
function X(e) {
|
|
1824
|
-
return
|
|
2014
|
+
return Nr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
|
|
2015
|
+
}
|
|
2016
|
+
function Pr(e, t) {
|
|
2017
|
+
return e.replace(/^[ \t]*/, (e) => {
|
|
2018
|
+
let n = 0;
|
|
2019
|
+
for (let t of e) n += t === " " ? 4 - n % 4 : 1;
|
|
2020
|
+
return " ".repeat(Math.max(0, n - t));
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
function Fr(e, t) {
|
|
2024
|
+
let n = `text\n${e}\n`, r = t(n)[0];
|
|
2025
|
+
return (r?.type === "paragraph" || r?.type === "text") && r.raw === n;
|
|
1825
2026
|
}
|
|
1826
|
-
function
|
|
2027
|
+
function Ir(e, t, n) {
|
|
2028
|
+
let r = t.split("\n"), i = n.isParagraphContinuation ?? ((e) => Fr(e, n.blockTokens)), a = 0;
|
|
2029
|
+
for (let e of r) {
|
|
2030
|
+
if (!e.trim() || !i(e)) break;
|
|
2031
|
+
a += 1;
|
|
2032
|
+
}
|
|
2033
|
+
return {
|
|
2034
|
+
mainContent: [e, ...r.slice(0, a).map((e) => e.trimStart())].join("\n"),
|
|
2035
|
+
nestedContent: r.slice(a).join("\n")
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
function Lr(e, t, n) {
|
|
1827
2039
|
let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
|
|
1828
2040
|
for (; o < r.length;) {
|
|
1829
2041
|
let e = r[o], u = e.match(t.itemPattern);
|
|
@@ -1856,35 +2068,47 @@ function hr(e, t, n) {
|
|
|
1856
2068
|
}
|
|
1857
2069
|
let h, g = m.slice(1);
|
|
1858
2070
|
if (g.length > 0) {
|
|
1859
|
-
let e = g.map((e) => e
|
|
1860
|
-
|
|
2071
|
+
let e = Ir(p, g.map((e) => Pr(e, f + s)).join("\n"), n);
|
|
2072
|
+
d.mainContent = e.mainContent;
|
|
2073
|
+
let r = e.nestedContent;
|
|
2074
|
+
r.trim() && (h = t.customNestedParser ? t.customNestedParser(r) : n.blockTokens(r));
|
|
1861
2075
|
}
|
|
1862
2076
|
let _ = t.createToken(d, h);
|
|
1863
2077
|
i.push(_);
|
|
1864
2078
|
}
|
|
1865
2079
|
if (i.length !== 0) return {
|
|
1866
2080
|
items: i,
|
|
1867
|
-
raw: a
|
|
2081
|
+
raw: a.slice(0, e.length)
|
|
1868
2082
|
};
|
|
1869
2083
|
}
|
|
1870
|
-
|
|
2084
|
+
var Rr = 4;
|
|
2085
|
+
function zr(e) {
|
|
2086
|
+
let t = 0;
|
|
2087
|
+
for (let n of e) t = n === " " ? t + Rr - t % Rr : t + 1;
|
|
2088
|
+
return t;
|
|
2089
|
+
}
|
|
2090
|
+
function Br(e, t, n, r, i) {
|
|
1871
2091
|
if (!e || !Array.isArray(e.content)) return "";
|
|
1872
|
-
let
|
|
1873
|
-
return
|
|
2092
|
+
let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = t.renderChildren([o]), l = `${a}${i?.indentMainContent ? c.split("\n").map((e, n) => n === 0 ? e : t.indent(e)).join("\n") : c}`;
|
|
2093
|
+
return s && s.length > 0 && s.forEach((e, n) => {
|
|
1874
2094
|
let r = t.renderChild?.call(t, e, n + 1) ?? t.renderChildren([e]);
|
|
1875
2095
|
if (r != null) {
|
|
1876
|
-
let n =
|
|
1877
|
-
|
|
2096
|
+
let n = (e) => {
|
|
2097
|
+
if (!i?.alignNestedToPrefix) return t.indent(e);
|
|
2098
|
+
let n = t.indent(""), r = zr(a);
|
|
2099
|
+
return (zr(n) >= r ? n : " ".repeat(r)) + e;
|
|
2100
|
+
}, o = r.split("\n").map((e) => n(e || "")).join("\n");
|
|
2101
|
+
l += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
|
|
1878
2102
|
}
|
|
1879
|
-
}),
|
|
2103
|
+
}), l;
|
|
1880
2104
|
}
|
|
1881
|
-
function
|
|
2105
|
+
function Vr(e, t) {
|
|
1882
2106
|
let n = { ...e };
|
|
1883
2107
|
return X(e) && X(t) && Object.keys(t).forEach((r) => {
|
|
1884
|
-
X(t[r]) && X(e[r]) ? n[r] =
|
|
2108
|
+
X(t[r]) && X(e[r]) ? n[r] = Vr(e[r], t[r]) : n[r] = t[r];
|
|
1885
2109
|
}), n;
|
|
1886
2110
|
}
|
|
1887
|
-
function
|
|
2111
|
+
function Hr(e, t, n = {}) {
|
|
1888
2112
|
let { state: r } = t, { doc: i, tr: a } = r, o = e;
|
|
1889
2113
|
i.descendants((t, r) => {
|
|
1890
2114
|
let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
|
|
@@ -1908,55 +2132,89 @@ var Z = class {
|
|
|
1908
2132
|
constructor(e) {
|
|
1909
2133
|
this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
|
|
1910
2134
|
}
|
|
1911
|
-
},
|
|
1912
|
-
if (
|
|
2135
|
+
}, Ur = (e, t) => {
|
|
2136
|
+
if (A(t)) return t.exec(e);
|
|
1913
2137
|
let n = t(e);
|
|
1914
2138
|
if (!n) return null;
|
|
1915
2139
|
let r = [n.text];
|
|
1916
2140
|
return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn("[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\"."), r.push(n.replaceWith)), r;
|
|
1917
2141
|
};
|
|
1918
|
-
function
|
|
1919
|
-
let { editor: t, from: n, to: r, text: i,
|
|
1920
|
-
if (
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
2142
|
+
function Wr(e) {
|
|
2143
|
+
let { editor: t, from: n, to: r, text: i, insertText: a } = e;
|
|
2144
|
+
if (!a) return {
|
|
2145
|
+
inputTransaction: null,
|
|
2146
|
+
tr: t.view.state.tr
|
|
2147
|
+
};
|
|
2148
|
+
let o = t.view.state.tr.insertText(i, n, r);
|
|
2149
|
+
return {
|
|
2150
|
+
inputTransaction: o,
|
|
2151
|
+
tr: ce.create({
|
|
2152
|
+
doc: o.doc,
|
|
2153
|
+
selection: o.selection,
|
|
2154
|
+
storedMarks: o.storedMarks
|
|
2155
|
+
}).tr
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
function Gr(e) {
|
|
2159
|
+
let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } = Wr({
|
|
2160
|
+
editor: t,
|
|
2161
|
+
from: n,
|
|
2162
|
+
to: r,
|
|
2163
|
+
text: i,
|
|
2164
|
+
insertText: c
|
|
2165
|
+
}), f = u ? n + i.length : r, p = D({
|
|
2166
|
+
state: l.state,
|
|
2167
|
+
transaction: d
|
|
2168
|
+
}), m = {
|
|
2169
|
+
from: n - (o[0].length - i.length),
|
|
2170
|
+
to: f
|
|
2171
|
+
}, { commands: h, chain: g, can: _ } = new O({
|
|
2172
|
+
editor: t,
|
|
2173
|
+
state: p
|
|
2174
|
+
});
|
|
2175
|
+
return a.handler({
|
|
2176
|
+
state: p,
|
|
2177
|
+
range: m,
|
|
2178
|
+
match: o,
|
|
2179
|
+
commands: h,
|
|
2180
|
+
chain: g,
|
|
2181
|
+
can: _
|
|
2182
|
+
}) === null || !d.steps.length ? !1 : (u && (l.dispatch(u), !l.state.doc.eq(u.doc)) || (ye(d), d.setMeta("inputRule", !0), a.undoable && d.setMeta(s, {
|
|
2183
|
+
transform: d,
|
|
2184
|
+
from: n,
|
|
2185
|
+
to: f,
|
|
2186
|
+
text: i
|
|
2187
|
+
}), l.dispatch(d)), !0);
|
|
2188
|
+
}
|
|
2189
|
+
function Kr(e, t, n) {
|
|
2190
|
+
let r = t[0].length - n.length;
|
|
2191
|
+
if (r <= 0) return !0;
|
|
2192
|
+
let i = e.parentOffset - r;
|
|
2193
|
+
return i >= 0 && e.parent.textBetween(i, e.parentOffset) === t[0].slice(0, r);
|
|
2194
|
+
}
|
|
2195
|
+
function qr(e) {
|
|
2196
|
+
let { editor: t, from: n, to: r, text: i, rules: a, plugin: o, insertText: s } = e, { view: c } = t;
|
|
2197
|
+
if (c.composing) return !1;
|
|
2198
|
+
let l = c.state.doc.resolve(n);
|
|
2199
|
+
if (l.parent.type.spec.code || (l.nodeBefore || l.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
|
|
2200
|
+
let u = fn(l) + i;
|
|
2201
|
+
for (let e of a) {
|
|
2202
|
+
let a = Ur(u, e.find);
|
|
2203
|
+
if (a && Kr(l, a, i) && Gr({
|
|
1940
2204
|
editor: t,
|
|
1941
|
-
state: p
|
|
1942
|
-
});
|
|
1943
|
-
e.handler({
|
|
1944
|
-
state: p,
|
|
1945
|
-
range: m,
|
|
1946
|
-
match: a,
|
|
1947
|
-
commands: h,
|
|
1948
|
-
chain: g,
|
|
1949
|
-
can: _
|
|
1950
|
-
}) !== null && f.steps.length && (e.undoable && f.setMeta(o, {
|
|
1951
|
-
transform: f,
|
|
1952
2205
|
from: n,
|
|
1953
2206
|
to: r,
|
|
1954
|
-
text: i
|
|
1955
|
-
|
|
1956
|
-
|
|
2207
|
+
text: i,
|
|
2208
|
+
rule: e,
|
|
2209
|
+
match: a,
|
|
2210
|
+
plugin: o,
|
|
2211
|
+
insertText: s
|
|
2212
|
+
})) return !0;
|
|
2213
|
+
}
|
|
2214
|
+
return !1;
|
|
1957
2215
|
}
|
|
1958
|
-
function
|
|
1959
|
-
let { editor: t, rules: n } = e, r = new
|
|
2216
|
+
function Jr(e) {
|
|
2217
|
+
let { editor: t, rules: n } = e, r = new x({
|
|
1960
2218
|
state: {
|
|
1961
2219
|
init() {
|
|
1962
2220
|
return null;
|
|
@@ -1967,9 +2225,9 @@ function xr(e) {
|
|
|
1967
2225
|
let s = e.getMeta("applyInputRules");
|
|
1968
2226
|
return s && setTimeout(() => {
|
|
1969
2227
|
let { text: e } = s;
|
|
1970
|
-
e = typeof e == "string" ? e :
|
|
2228
|
+
e = typeof e == "string" ? e : Mt(T.from(e), a.schema);
|
|
1971
2229
|
let { from: i } = s, o = i + e.length;
|
|
1972
|
-
|
|
2230
|
+
qr({
|
|
1973
2231
|
editor: t,
|
|
1974
2232
|
from: i,
|
|
1975
2233
|
to: o,
|
|
@@ -1982,18 +2240,19 @@ function xr(e) {
|
|
|
1982
2240
|
},
|
|
1983
2241
|
props: {
|
|
1984
2242
|
handleTextInput(e, i, a, o) {
|
|
1985
|
-
return
|
|
2243
|
+
return qr({
|
|
1986
2244
|
editor: t,
|
|
1987
2245
|
from: i,
|
|
1988
2246
|
to: a,
|
|
1989
2247
|
text: o,
|
|
1990
2248
|
rules: n,
|
|
1991
|
-
plugin: r
|
|
2249
|
+
plugin: r,
|
|
2250
|
+
insertText: !0
|
|
1992
2251
|
});
|
|
1993
2252
|
},
|
|
1994
2253
|
handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
|
|
1995
2254
|
let { $cursor: i } = e.state.selection;
|
|
1996
|
-
i &&
|
|
2255
|
+
i && qr({
|
|
1997
2256
|
editor: t,
|
|
1998
2257
|
from: i.pos,
|
|
1999
2258
|
to: i.pos,
|
|
@@ -2005,7 +2264,7 @@ function xr(e) {
|
|
|
2005
2264
|
handleKeyDown(e, i) {
|
|
2006
2265
|
if (i.key !== "Enter") return !1;
|
|
2007
2266
|
let { $cursor: a } = e.state.selection;
|
|
2008
|
-
return a ?
|
|
2267
|
+
return a ? qr({
|
|
2009
2268
|
editor: t,
|
|
2010
2269
|
from: a.pos,
|
|
2011
2270
|
to: a.pos,
|
|
@@ -2019,7 +2278,7 @@ function xr(e) {
|
|
|
2019
2278
|
});
|
|
2020
2279
|
return r;
|
|
2021
2280
|
}
|
|
2022
|
-
var
|
|
2281
|
+
var Yr = class {
|
|
2023
2282
|
constructor(e = {}) {
|
|
2024
2283
|
this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
|
|
2025
2284
|
...this.config,
|
|
@@ -2027,10 +2286,10 @@ var Sr = class {
|
|
|
2027
2286
|
}, this.name = this.config.name;
|
|
2028
2287
|
}
|
|
2029
2288
|
get options() {
|
|
2030
|
-
return { ...
|
|
2289
|
+
return { ...H(B(this, "addOptions", { name: this.name })) };
|
|
2031
2290
|
}
|
|
2032
2291
|
get storage() {
|
|
2033
|
-
return { ...
|
|
2292
|
+
return { ...H(B(this, "addStorage", {
|
|
2034
2293
|
name: this.name,
|
|
2035
2294
|
options: this.options
|
|
2036
2295
|
})) };
|
|
@@ -2038,7 +2297,7 @@ var Sr = class {
|
|
|
2038
2297
|
configure(e = {}) {
|
|
2039
2298
|
let t = this.extend({
|
|
2040
2299
|
...this.config,
|
|
2041
|
-
addOptions: () =>
|
|
2300
|
+
addOptions: () => Vr(this.options, e)
|
|
2042
2301
|
});
|
|
2043
2302
|
return t.name = this.name, t.parent = this.parent, this.child = null, t;
|
|
2044
2303
|
}
|
|
@@ -2049,7 +2308,7 @@ var Sr = class {
|
|
|
2049
2308
|
});
|
|
2050
2309
|
return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
|
|
2051
2310
|
}
|
|
2052
|
-
},
|
|
2311
|
+
}, Xr = class e extends Yr {
|
|
2053
2312
|
constructor(...e) {
|
|
2054
2313
|
super(...e), this.type = "mark";
|
|
2055
2314
|
}
|
|
@@ -2074,20 +2333,20 @@ var Sr = class {
|
|
|
2074
2333
|
let t = typeof e == "function" ? e() : e;
|
|
2075
2334
|
return super.extend(t);
|
|
2076
2335
|
}
|
|
2077
|
-
},
|
|
2336
|
+
}, Zr = class {
|
|
2078
2337
|
constructor(e) {
|
|
2079
2338
|
this.find = e.find, this.handler = e.handler;
|
|
2080
2339
|
}
|
|
2081
|
-
},
|
|
2082
|
-
if (
|
|
2340
|
+
}, Qr = (e, t, n) => {
|
|
2341
|
+
if (A(t)) return [...e.matchAll(t)];
|
|
2083
2342
|
let r = t(e, n);
|
|
2084
2343
|
return r ? r.map((t) => {
|
|
2085
2344
|
let n = [t.text];
|
|
2086
2345
|
return n.index = t.index, n.input = e, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\"."), n.push(t.replaceWith)), n;
|
|
2087
2346
|
}) : [];
|
|
2088
2347
|
};
|
|
2089
|
-
function
|
|
2090
|
-
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new
|
|
2348
|
+
function $r(e) {
|
|
2349
|
+
let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new O({
|
|
2091
2350
|
editor: t,
|
|
2092
2351
|
state: n
|
|
2093
2352
|
}), d = [];
|
|
@@ -2095,7 +2354,7 @@ function Er(e) {
|
|
|
2095
2354
|
var f;
|
|
2096
2355
|
if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
|
|
2097
2356
|
let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
|
|
2098
|
-
m >= h ||
|
|
2357
|
+
m >= h || Qr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
|
|
2099
2358
|
if (e.index === void 0) return;
|
|
2100
2359
|
let t = m + e.index + 1, r = t + e[0].length, i = {
|
|
2101
2360
|
from: n.tr.mapping.map(t),
|
|
@@ -2114,12 +2373,12 @@ function Er(e) {
|
|
|
2114
2373
|
});
|
|
2115
2374
|
}), d.every((e) => e !== null);
|
|
2116
2375
|
}
|
|
2117
|
-
var
|
|
2376
|
+
var Q = null, ei = (e) => {
|
|
2118
2377
|
var t;
|
|
2119
2378
|
let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
|
|
2120
2379
|
return (t = n.clipboardData) == null || t.setData("text/html", e), n;
|
|
2121
2380
|
};
|
|
2122
|
-
function
|
|
2381
|
+
function ti(e) {
|
|
2123
2382
|
let { editor: t, rules: n } = e, r = null, i = !1, a = !1, o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, s;
|
|
2124
2383
|
try {
|
|
2125
2384
|
s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
|
|
@@ -2127,11 +2386,11 @@ function kr(e) {
|
|
|
2127
2386
|
s = null;
|
|
2128
2387
|
}
|
|
2129
2388
|
let c = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
|
|
2130
|
-
let c = e.tr, l =
|
|
2389
|
+
let c = e.tr, l = D({
|
|
2131
2390
|
state: e,
|
|
2132
2391
|
transaction: c
|
|
2133
2392
|
});
|
|
2134
|
-
if (
|
|
2393
|
+
if ($r({
|
|
2135
2394
|
editor: t,
|
|
2136
2395
|
state: l,
|
|
2137
2396
|
from: Math.max(n - 1, 0),
|
|
@@ -2148,12 +2407,14 @@ function kr(e) {
|
|
|
2148
2407
|
return o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
|
|
2149
2408
|
}
|
|
2150
2409
|
};
|
|
2151
|
-
return
|
|
2410
|
+
return t.on("destroy", () => {
|
|
2411
|
+
Q === t && (Q = null);
|
|
2412
|
+
}), n.map((e) => new x({
|
|
2152
2413
|
view(e) {
|
|
2153
2414
|
let n = (n) => {
|
|
2154
|
-
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (
|
|
2415
|
+
r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (Q = t);
|
|
2155
2416
|
}, i = () => {
|
|
2156
|
-
|
|
2417
|
+
Q &&= null;
|
|
2157
2418
|
};
|
|
2158
2419
|
return window.addEventListener("dragstart", n), window.addEventListener("dragend", i), { destroy() {
|
|
2159
2420
|
window.removeEventListener("dragstart", n), window.removeEventListener("dragend", i);
|
|
@@ -2162,8 +2423,9 @@ function kr(e) {
|
|
|
2162
2423
|
props: { handleDOMEvents: {
|
|
2163
2424
|
drop: (e, t) => {
|
|
2164
2425
|
if (a = r === e.dom.parentElement, s = t, !a) {
|
|
2165
|
-
let e =
|
|
2426
|
+
let e = Q;
|
|
2166
2427
|
e?.isEditable && setTimeout(() => {
|
|
2428
|
+
if (e.isDestroyed) return;
|
|
2167
2429
|
let t = e.state.selection;
|
|
2168
2430
|
t && e.commands.deleteRange({
|
|
2169
2431
|
from: t.from,
|
|
@@ -2183,8 +2445,8 @@ function kr(e) {
|
|
|
2183
2445
|
if (!l && !u && !f) return;
|
|
2184
2446
|
if (f) {
|
|
2185
2447
|
let { text: t } = d;
|
|
2186
|
-
t = typeof t == "string" ? t :
|
|
2187
|
-
let { from: n } = d, i = n + t.length, a =
|
|
2448
|
+
t = typeof t == "string" ? t : Mt(T.from(t), r.schema);
|
|
2449
|
+
let { from: n } = d, i = n + t.length, a = ei(t);
|
|
2188
2450
|
return c({
|
|
2189
2451
|
rule: e,
|
|
2190
2452
|
state: r,
|
|
@@ -2194,7 +2456,7 @@ function kr(e) {
|
|
|
2194
2456
|
});
|
|
2195
2457
|
}
|
|
2196
2458
|
let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
|
|
2197
|
-
if (
|
|
2459
|
+
if (Mr(p) && m && p !== m.b) return c({
|
|
2198
2460
|
rule: e,
|
|
2199
2461
|
state: r,
|
|
2200
2462
|
from: p,
|
|
@@ -2204,13 +2466,13 @@ function kr(e) {
|
|
|
2204
2466
|
}
|
|
2205
2467
|
}));
|
|
2206
2468
|
}
|
|
2207
|
-
var
|
|
2469
|
+
var ni = class {
|
|
2208
2470
|
constructor(e, t) {
|
|
2209
|
-
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions =
|
|
2471
|
+
this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = $t(e), this.hasSchemaSpec = t.options.schemaSpec !== void 0, this.schema = Qt(this.extensions, t, t.options.schemaSpec), this.setupExtensions();
|
|
2210
2472
|
}
|
|
2211
2473
|
get commands() {
|
|
2212
2474
|
return this.extensions.reduce((e, t) => {
|
|
2213
|
-
let n =
|
|
2475
|
+
let n = B(t, "addCommands", {
|
|
2214
2476
|
name: t.name,
|
|
2215
2477
|
options: t.options,
|
|
2216
2478
|
storage: this.editor.extensionStorage[t.name],
|
|
@@ -2231,8 +2493,8 @@ var Q = class {
|
|
|
2231
2493
|
storage: this.editor.extensionStorage[t.name],
|
|
2232
2494
|
editor: e,
|
|
2233
2495
|
type: G(t.name, this.schema)
|
|
2234
|
-
}, r = [], i =
|
|
2235
|
-
if (t.type === "mark" &&
|
|
2496
|
+
}, r = [], i = B(t, "addKeyboardShortcuts", n), a = {};
|
|
2497
|
+
if (t.type === "mark" && B(t, "exitable", n) && (a.ArrowRight = () => Xr.handleExit({
|
|
2236
2498
|
editor: e,
|
|
2237
2499
|
mark: t
|
|
2238
2500
|
})), i) {
|
|
@@ -2242,31 +2504,31 @@ var Q = class {
|
|
|
2242
2504
|
...t
|
|
2243
2505
|
};
|
|
2244
2506
|
}
|
|
2245
|
-
let o =
|
|
2507
|
+
let o = ve(a);
|
|
2246
2508
|
r.push(o);
|
|
2247
|
-
let s =
|
|
2248
|
-
if (
|
|
2509
|
+
let s = B(t, "addInputRules", n);
|
|
2510
|
+
if (_n(t, e.options.enableInputRules) && s) {
|
|
2249
2511
|
let t = s();
|
|
2250
2512
|
if (t && t.length) {
|
|
2251
|
-
let n =
|
|
2513
|
+
let n = Jr({
|
|
2252
2514
|
editor: e,
|
|
2253
2515
|
rules: t
|
|
2254
2516
|
}), i = Array.isArray(n) ? n : [n];
|
|
2255
2517
|
r.push(...i);
|
|
2256
2518
|
}
|
|
2257
2519
|
}
|
|
2258
|
-
let c =
|
|
2259
|
-
if (
|
|
2520
|
+
let c = B(t, "addPasteRules", n);
|
|
2521
|
+
if (_n(t, e.options.enablePasteRules) && c) {
|
|
2260
2522
|
let t = c();
|
|
2261
2523
|
if (t && t.length) {
|
|
2262
|
-
let n =
|
|
2524
|
+
let n = ti({
|
|
2263
2525
|
editor: e,
|
|
2264
2526
|
rules: t
|
|
2265
2527
|
});
|
|
2266
2528
|
r.push(...n);
|
|
2267
2529
|
}
|
|
2268
2530
|
}
|
|
2269
|
-
let l =
|
|
2531
|
+
let l = B(t, "addProseMirrorPlugins", n);
|
|
2270
2532
|
if (l) {
|
|
2271
2533
|
let e = l();
|
|
2272
2534
|
r.push(...e);
|
|
@@ -2281,7 +2543,7 @@ var Q = class {
|
|
|
2281
2543
|
(e = this.decorationManager) == null || e.destroy();
|
|
2282
2544
|
let n = [];
|
|
2283
2545
|
return this.extensions.forEach((e) => {
|
|
2284
|
-
let r =
|
|
2546
|
+
let r = B(e, "addDecorations", {
|
|
2285
2547
|
name: e.name,
|
|
2286
2548
|
options: e.options,
|
|
2287
2549
|
storage: this.editor.extensionStorage[e.name],
|
|
@@ -2292,23 +2554,24 @@ var Q = class {
|
|
|
2292
2554
|
name: e.name,
|
|
2293
2555
|
addDecorations: r
|
|
2294
2556
|
});
|
|
2295
|
-
}), this.decorationManager = new
|
|
2557
|
+
}), this.decorationManager = new kr({
|
|
2296
2558
|
editor: t,
|
|
2297
2559
|
entries: n
|
|
2298
2560
|
}), this.decorationManager.plugin;
|
|
2299
2561
|
}
|
|
2300
2562
|
get attributes() {
|
|
2301
|
-
|
|
2563
|
+
let e = Vt(this.extensions);
|
|
2564
|
+
return this.hasSchemaSpec ? Nt(e, this.schema) : e;
|
|
2302
2565
|
}
|
|
2303
2566
|
get nodeViews() {
|
|
2304
|
-
let { editor: e } = this, { nodeExtensions: t } =
|
|
2305
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2306
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2567
|
+
let { editor: e } = this, { nodeExtensions: t } = V(this.extensions);
|
|
2568
|
+
return Object.fromEntries(t.filter((e) => !!B(e, "addNodeView")).map((t) => {
|
|
2569
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = B(t, "addNodeView", {
|
|
2307
2570
|
name: t.name,
|
|
2308
2571
|
options: t.options,
|
|
2309
2572
|
storage: this.editor.extensionStorage[t.name],
|
|
2310
2573
|
editor: e,
|
|
2311
|
-
type:
|
|
2574
|
+
type: k(t.name, this.schema)
|
|
2312
2575
|
});
|
|
2313
2576
|
if (!r) return [];
|
|
2314
2577
|
let i = r();
|
|
@@ -2336,7 +2599,7 @@ var Q = class {
|
|
|
2336
2599
|
storage: this.editor.extensionStorage[n.name],
|
|
2337
2600
|
editor: t,
|
|
2338
2601
|
type: G(n.name, this.schema)
|
|
2339
|
-
}, i =
|
|
2602
|
+
}, i = B(n, "dispatchTransaction", r);
|
|
2340
2603
|
return i ? (t) => {
|
|
2341
2604
|
i.call(r, {
|
|
2342
2605
|
transaction: t,
|
|
@@ -2354,7 +2617,7 @@ var Q = class {
|
|
|
2354
2617
|
storage: this.editor.extensionStorage[n.name],
|
|
2355
2618
|
editor: t,
|
|
2356
2619
|
type: G(n.name, this.schema)
|
|
2357
|
-
}, i =
|
|
2620
|
+
}, i = B(n, "transformPastedHTML", r);
|
|
2358
2621
|
return i ? (t, n) => {
|
|
2359
2622
|
let a = e(t, n);
|
|
2360
2623
|
return i.call(r, a);
|
|
@@ -2362,14 +2625,14 @@ var Q = class {
|
|
|
2362
2625
|
}, e || ((e) => e));
|
|
2363
2626
|
}
|
|
2364
2627
|
get markViews() {
|
|
2365
|
-
let { editor: e } = this, { markExtensions: t } =
|
|
2366
|
-
return Object.fromEntries(t.filter((e) => !!
|
|
2367
|
-
let n = this.attributes.filter((e) => e.type === t.name), r =
|
|
2628
|
+
let { editor: e } = this, { markExtensions: t } = V(this.extensions);
|
|
2629
|
+
return Object.fromEntries(t.filter((e) => !!B(e, "addMarkView")).map((t) => {
|
|
2630
|
+
let n = this.attributes.filter((e) => e.type === t.name), r = B(t, "addMarkView", {
|
|
2368
2631
|
name: t.name,
|
|
2369
2632
|
options: t.options,
|
|
2370
2633
|
storage: this.editor.extensionStorage[t.name],
|
|
2371
2634
|
editor: e,
|
|
2372
|
-
type:
|
|
2635
|
+
type: M(t.name, this.schema)
|
|
2373
2636
|
});
|
|
2374
2637
|
return r ? [t.name, (i, a, o) => {
|
|
2375
2638
|
let s = U(i, n);
|
|
@@ -2381,7 +2644,7 @@ var Q = class {
|
|
|
2381
2644
|
extension: t,
|
|
2382
2645
|
HTMLAttributes: s,
|
|
2383
2646
|
updateAttributes: (t) => {
|
|
2384
|
-
|
|
2647
|
+
Hr(i, e, t);
|
|
2385
2648
|
}
|
|
2386
2649
|
});
|
|
2387
2650
|
}] : [];
|
|
@@ -2407,14 +2670,14 @@ var Q = class {
|
|
|
2407
2670
|
editor: this.editor,
|
|
2408
2671
|
type: G(e.name, this.schema)
|
|
2409
2672
|
};
|
|
2410
|
-
e.type === "mark" && ((
|
|
2411
|
-
let n =
|
|
2673
|
+
e.type === "mark" && ((H(B(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (H(B(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
|
|
2674
|
+
let n = B(e, "onBeforeCreate", t), r = B(e, "onCreate", t), i = B(e, "onUpdate", t), a = B(e, "onSelectionUpdate", t), o = B(e, "onTransaction", t), s = B(e, "onFocus", t), c = B(e, "onBlur", t), l = B(e, "onDestroy", t);
|
|
2412
2675
|
n && this.editor.on("beforeCreate", n), r && this.editor.on("create", r), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), o && this.editor.on("transaction", o), s && this.editor.on("focus", s), c && this.editor.on("blur", c), l && this.editor.on("destroy", l);
|
|
2413
2676
|
});
|
|
2414
2677
|
}
|
|
2415
2678
|
};
|
|
2416
|
-
|
|
2417
|
-
var $ = class e extends
|
|
2679
|
+
ni.resolve = $t, ni.sort = W, ni.flatten = jt;
|
|
2680
|
+
var $ = class e extends Yr {
|
|
2418
2681
|
constructor(...e) {
|
|
2419
2682
|
super(...e), this.type = "extension";
|
|
2420
2683
|
}
|
|
@@ -2429,40 +2692,40 @@ var $ = class e extends Sr {
|
|
|
2429
2692
|
let t = typeof e == "function" ? e() : e;
|
|
2430
2693
|
return super.extend(t);
|
|
2431
2694
|
}
|
|
2432
|
-
},
|
|
2695
|
+
}, ri = $.create({
|
|
2433
2696
|
name: "clipboardTextSerializer",
|
|
2434
2697
|
addOptions() {
|
|
2435
2698
|
return { blockSeparator: void 0 };
|
|
2436
2699
|
},
|
|
2437
2700
|
addProseMirrorPlugins() {
|
|
2438
|
-
return [new
|
|
2439
|
-
key: new
|
|
2701
|
+
return [new x({
|
|
2702
|
+
key: new S("clipboardTextSerializer"),
|
|
2440
2703
|
props: { clipboardTextSerializer: () => {
|
|
2441
|
-
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a =
|
|
2704
|
+
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = nn(n), { blockSeparator: o } = this.options, s = {
|
|
2442
2705
|
...o === void 0 ? {} : { blockSeparator: o },
|
|
2443
2706
|
textSerializers: a
|
|
2444
2707
|
};
|
|
2445
|
-
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) =>
|
|
2708
|
+
return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => en(r, {
|
|
2446
2709
|
from: e.pos,
|
|
2447
2710
|
to: t.pos
|
|
2448
2711
|
}, s)).join(o ?? "\n\n");
|
|
2449
2712
|
} }
|
|
2450
2713
|
})];
|
|
2451
2714
|
}
|
|
2452
|
-
}),
|
|
2715
|
+
}), ii = $.create({
|
|
2453
2716
|
name: "commands",
|
|
2454
2717
|
addCommands() {
|
|
2455
|
-
return { ...
|
|
2718
|
+
return { ...or };
|
|
2456
2719
|
}
|
|
2457
|
-
}),
|
|
2720
|
+
}), ai = $.create({
|
|
2458
2721
|
name: "delete",
|
|
2459
2722
|
onUpdate({ transaction: e, appendedTransactions: n }) {
|
|
2460
2723
|
var r;
|
|
2461
2724
|
let i = () => {
|
|
2462
2725
|
var r, i;
|
|
2463
2726
|
if (((r = this.editor.options.coreExtensionOptions) == null || (r = r.delete) == null || (i = r.filterTransaction) == null ? void 0 : i.call(r, e)) ?? e.getMeta("y-sync$")) return;
|
|
2464
|
-
let a =
|
|
2465
|
-
|
|
2727
|
+
let a = Ot(e.before, [e, ...n]);
|
|
2728
|
+
cn(a).forEach((t) => {
|
|
2466
2729
|
a.mapping.mapResult(t.oldRange.from).deletedAfter && a.mapping.mapResult(t.oldRange.to).deletedBefore && a.before.nodesBetween(t.oldRange.from, t.oldRange.to, (n, r) => {
|
|
2467
2730
|
let i = r + n.nodeSize - 2, o = t.oldRange.from <= r && i <= t.oldRange.to;
|
|
2468
2731
|
this.editor.emit("delete", {
|
|
@@ -2508,11 +2771,11 @@ var $ = class e extends Sr {
|
|
|
2508
2771
|
};
|
|
2509
2772
|
((r = this.editor.options.coreExtensionOptions) == null || (r = r.delete) == null ? void 0 : r.async) ?? !0 ? setTimeout(i, 0) : i();
|
|
2510
2773
|
}
|
|
2511
|
-
}),
|
|
2774
|
+
}), oi = $.create({
|
|
2512
2775
|
name: "drop",
|
|
2513
2776
|
addProseMirrorPlugins() {
|
|
2514
|
-
return [new
|
|
2515
|
-
key: new
|
|
2777
|
+
return [new x({
|
|
2778
|
+
key: new S("tiptapDrop"),
|
|
2516
2779
|
props: { handleDrop: (e, t, n, r) => {
|
|
2517
2780
|
this.editor.emit("drop", {
|
|
2518
2781
|
editor: this.editor,
|
|
@@ -2523,20 +2786,20 @@ var $ = class e extends Sr {
|
|
|
2523
2786
|
} }
|
|
2524
2787
|
})];
|
|
2525
2788
|
}
|
|
2526
|
-
}),
|
|
2789
|
+
}), si = $.create({
|
|
2527
2790
|
name: "editable",
|
|
2528
2791
|
addProseMirrorPlugins() {
|
|
2529
|
-
return [new
|
|
2530
|
-
key: new
|
|
2792
|
+
return [new x({
|
|
2793
|
+
key: new S("editable"),
|
|
2531
2794
|
props: { editable: () => this.editor.options.editable }
|
|
2532
2795
|
})];
|
|
2533
2796
|
}
|
|
2534
|
-
}),
|
|
2797
|
+
}), ci = new S("focusEvents"), li = $.create({
|
|
2535
2798
|
name: "focusEvents",
|
|
2536
2799
|
addProseMirrorPlugins() {
|
|
2537
2800
|
let { editor: e } = this;
|
|
2538
|
-
return [new
|
|
2539
|
-
key:
|
|
2801
|
+
return [new x({
|
|
2802
|
+
key: ci,
|
|
2540
2803
|
props: { handleDOMEvents: {
|
|
2541
2804
|
focus: (t, n) => {
|
|
2542
2805
|
e.isFocused = !0;
|
|
@@ -2551,13 +2814,13 @@ var $ = class e extends Sr {
|
|
|
2551
2814
|
} }
|
|
2552
2815
|
})];
|
|
2553
2816
|
}
|
|
2554
|
-
}),
|
|
2817
|
+
}), ui = $.create({
|
|
2555
2818
|
name: "keymap",
|
|
2556
2819
|
addKeyboardShortcuts() {
|
|
2557
2820
|
let e = () => this.editor.commands.first(({ commands: e }) => [
|
|
2558
2821
|
() => e.undoInputRule(),
|
|
2559
2822
|
() => e.command(({ tr: t }) => {
|
|
2560
|
-
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos :
|
|
2823
|
+
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos : C.atStart(r).from === o;
|
|
2561
2824
|
return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
|
|
2562
2825
|
}),
|
|
2563
2826
|
() => e.deleteSelection(),
|
|
@@ -2593,21 +2856,21 @@ var $ = class e extends Sr {
|
|
|
2593
2856
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
2594
2857
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
2595
2858
|
};
|
|
2596
|
-
return
|
|
2859
|
+
return P() || lt() ? i : r;
|
|
2597
2860
|
},
|
|
2598
2861
|
addProseMirrorPlugins() {
|
|
2599
|
-
return [new
|
|
2600
|
-
key: new
|
|
2862
|
+
return [new x({
|
|
2863
|
+
key: new S("clearDocument"),
|
|
2601
2864
|
appendTransaction: (e, t, n) => {
|
|
2602
2865
|
if (e.some((e) => e.getMeta("composition"))) return;
|
|
2603
2866
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
2604
2867
|
if (!r || i) return;
|
|
2605
|
-
let { empty: a, from: o, to: s } = t.selection, c =
|
|
2606
|
-
if (a || o !== c || s !== l || !
|
|
2607
|
-
let u = n.tr, d =
|
|
2868
|
+
let { empty: a, from: o, to: s } = t.selection, c = C.atStart(t.doc).from, l = C.atEnd(t.doc).to;
|
|
2869
|
+
if (a || o !== c || s !== l || !vn(n.doc)) return;
|
|
2870
|
+
let u = n.tr, d = D({
|
|
2608
2871
|
state: n,
|
|
2609
2872
|
transaction: u
|
|
2610
|
-
}), { commands: f } = new
|
|
2873
|
+
}), { commands: f } = new O({
|
|
2611
2874
|
editor: this.editor,
|
|
2612
2875
|
state: d
|
|
2613
2876
|
});
|
|
@@ -2615,11 +2878,11 @@ var $ = class e extends Sr {
|
|
|
2615
2878
|
}
|
|
2616
2879
|
})];
|
|
2617
2880
|
}
|
|
2618
|
-
}),
|
|
2881
|
+
}), di = $.create({
|
|
2619
2882
|
name: "paste",
|
|
2620
2883
|
addProseMirrorPlugins() {
|
|
2621
|
-
return [new
|
|
2622
|
-
key: new
|
|
2884
|
+
return [new x({
|
|
2885
|
+
key: new S("tiptapPaste"),
|
|
2623
2886
|
props: { handlePaste: (e, t, n) => {
|
|
2624
2887
|
this.editor.emit("paste", {
|
|
2625
2888
|
editor: this.editor,
|
|
@@ -2629,25 +2892,25 @@ var $ = class e extends Sr {
|
|
|
2629
2892
|
} }
|
|
2630
2893
|
})];
|
|
2631
2894
|
}
|
|
2632
|
-
}),
|
|
2895
|
+
}), fi = $.create({
|
|
2633
2896
|
name: "tabindex",
|
|
2634
2897
|
addOptions() {
|
|
2635
2898
|
return { value: void 0 };
|
|
2636
2899
|
},
|
|
2637
2900
|
addProseMirrorPlugins() {
|
|
2638
|
-
return [new
|
|
2639
|
-
key: new
|
|
2901
|
+
return [new x({
|
|
2902
|
+
key: new S("tabindex"),
|
|
2640
2903
|
props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
|
|
2641
2904
|
})];
|
|
2642
2905
|
}
|
|
2643
|
-
}),
|
|
2906
|
+
}), pi = $.create({
|
|
2644
2907
|
name: "textDirection",
|
|
2645
2908
|
addOptions() {
|
|
2646
2909
|
return { direction: void 0 };
|
|
2647
2910
|
},
|
|
2648
2911
|
addGlobalAttributes() {
|
|
2649
2912
|
if (!this.options.direction) return [];
|
|
2650
|
-
let { nodeExtensions: e } =
|
|
2913
|
+
let { nodeExtensions: e } = V(this.extensions);
|
|
2651
2914
|
return [{
|
|
2652
2915
|
types: e.filter((e) => e.name !== "text").map((e) => e.name),
|
|
2653
2916
|
attributes: { dir: {
|
|
@@ -2661,30 +2924,32 @@ var $ = class e extends Sr {
|
|
|
2661
2924
|
}];
|
|
2662
2925
|
},
|
|
2663
2926
|
addProseMirrorPlugins() {
|
|
2664
|
-
return [new
|
|
2665
|
-
key: new
|
|
2927
|
+
return [new x({
|
|
2928
|
+
key: new S("textDirection"),
|
|
2666
2929
|
props: { attributes: () => {
|
|
2667
2930
|
let e = this.options.direction;
|
|
2668
2931
|
return e ? { dir: e } : {};
|
|
2669
2932
|
} }
|
|
2670
2933
|
})];
|
|
2671
2934
|
}
|
|
2672
|
-
}),
|
|
2673
|
-
function
|
|
2674
|
-
if (
|
|
2675
|
-
|
|
2935
|
+
}), mi = !1;
|
|
2936
|
+
function hi(e) {
|
|
2937
|
+
if (mi) return;
|
|
2938
|
+
mi = !0;
|
|
2676
2939
|
let t;
|
|
2677
2940
|
try {
|
|
2678
|
-
|
|
2941
|
+
let n = r.fromJSON(e, {
|
|
2679
2942
|
from: 0,
|
|
2680
2943
|
to: 0
|
|
2681
|
-
})
|
|
2944
|
+
});
|
|
2945
|
+
if (!xn(n)) return;
|
|
2946
|
+
t = n.slice.content;
|
|
2682
2947
|
} catch {
|
|
2683
2948
|
return;
|
|
2684
2949
|
}
|
|
2685
|
-
t instanceof
|
|
2950
|
+
t instanceof T || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
|
|
2686
2951
|
}
|
|
2687
|
-
var
|
|
2952
|
+
var gi = class e {
|
|
2688
2953
|
get name() {
|
|
2689
2954
|
return this.node.type.name;
|
|
2690
2955
|
}
|
|
@@ -2806,7 +3071,7 @@ var Ur = class e {
|
|
|
2806
3071
|
...e
|
|
2807
3072
|
}), this.editor.view.dispatch(t);
|
|
2808
3073
|
}
|
|
2809
|
-
},
|
|
3074
|
+
}, _i = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", vi = class extends lr {
|
|
2810
3075
|
constructor(e = {}) {
|
|
2811
3076
|
super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.hasWarnedStaleDecorationRead = !1, this.options = {
|
|
2812
3077
|
element: typeof document < "u" ? document.createElement("div") : null,
|
|
@@ -2843,19 +3108,19 @@ var Ur = class e {
|
|
|
2843
3108
|
onDelete: () => null,
|
|
2844
3109
|
enableExtensionDispatchTransaction: !0
|
|
2845
3110
|
}, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
|
|
2846
|
-
getUpdatedPosition:
|
|
2847
|
-
createMappablePosition:
|
|
3111
|
+
getUpdatedPosition: Cn,
|
|
3112
|
+
createMappablePosition: wn
|
|
2848
3113
|
}, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
|
|
2849
3114
|
let t = this.createDoc();
|
|
2850
3115
|
if (!this.editorState) {
|
|
2851
|
-
let e =
|
|
2852
|
-
this.editorState =
|
|
3116
|
+
let e = Ve(t, this.options.autofocus);
|
|
3117
|
+
this.editorState = ce.create({
|
|
2853
3118
|
doc: t,
|
|
2854
3119
|
schema: this.schema,
|
|
2855
3120
|
selection: e || void 0
|
|
2856
3121
|
});
|
|
2857
3122
|
}
|
|
2858
|
-
|
|
3123
|
+
hi(this.schema), this.options.element && this.mount(this.options.element);
|
|
2859
3124
|
}
|
|
2860
3125
|
mount(e) {
|
|
2861
3126
|
if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
|
|
@@ -2883,19 +3148,22 @@ var Ur = class e {
|
|
|
2883
3148
|
return this.commandManager.commands;
|
|
2884
3149
|
}
|
|
2885
3150
|
chain() {
|
|
2886
|
-
return this.commandManager ? this.commandManager.chain() :
|
|
3151
|
+
return this.commandManager ? this.commandManager.chain() : O.createFakeChain();
|
|
2887
3152
|
}
|
|
2888
3153
|
can() {
|
|
2889
|
-
return this.commandManager ? this.commandManager.can() :
|
|
3154
|
+
return this.commandManager ? this.commandManager.can() : O.createFallbackCan();
|
|
2890
3155
|
}
|
|
2891
3156
|
injectCSS() {
|
|
2892
|
-
this.options.injectCSS && typeof document < "u" && (this.css =
|
|
3157
|
+
this.options.injectCSS && typeof document < "u" && (this.css = jr(_i, this.options.injectNonce));
|
|
2893
3158
|
}
|
|
2894
3159
|
setOptions(e = {}) {
|
|
2895
3160
|
this.options = {
|
|
2896
3161
|
...this.options,
|
|
2897
3162
|
...e
|
|
2898
|
-
}, this.editorView && this.state && !this.isDestroyed && (this.options.editorProps && this.view.setProps(
|
|
3163
|
+
}, this.editorView && this.state && !this.isDestroyed && (this.options.editorProps && this.view.setProps({
|
|
3164
|
+
...this.options.editorProps,
|
|
3165
|
+
attributes: this.getEditorViewAttributes()
|
|
3166
|
+
}), this.view.updateState(this.state));
|
|
2899
3167
|
}
|
|
2900
3168
|
setEditable(e, t = !0) {
|
|
2901
3169
|
this.setOptions({ editable: e }), t && this.emit("update", {
|
|
@@ -2928,10 +3196,10 @@ var Ur = class e {
|
|
|
2928
3196
|
} });
|
|
2929
3197
|
}
|
|
2930
3198
|
get state() {
|
|
2931
|
-
return
|
|
3199
|
+
return ur && !this.hasWarnedStaleDecorationRead && cr(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
|
|
2932
3200
|
}
|
|
2933
3201
|
registerPlugin(e, t) {
|
|
2934
|
-
let n =
|
|
3202
|
+
let n = Ht(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
|
|
2935
3203
|
return this.view.updateState(r), r;
|
|
2936
3204
|
}
|
|
2937
3205
|
unregisterPlugin(e) {
|
|
@@ -2947,25 +3215,25 @@ var Ur = class e {
|
|
|
2947
3215
|
createExtensionManager() {
|
|
2948
3216
|
var e, t;
|
|
2949
3217
|
let n = [...this.options.enableCoreExtensions ? [
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3218
|
+
si,
|
|
3219
|
+
ri.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
|
|
3220
|
+
ii,
|
|
3221
|
+
li,
|
|
3222
|
+
ui,
|
|
3223
|
+
fi.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
|
|
3224
|
+
oi,
|
|
3225
|
+
di,
|
|
3226
|
+
ai,
|
|
3227
|
+
pi.configure({ direction: this.options.textDirection })
|
|
2960
3228
|
].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
|
|
2961
3229
|
"extension",
|
|
2962
3230
|
"node",
|
|
2963
3231
|
"mark"
|
|
2964
3232
|
].includes(e?.type));
|
|
2965
|
-
this.extensionManager = new
|
|
3233
|
+
this.extensionManager = new ni(n, this);
|
|
2966
3234
|
}
|
|
2967
3235
|
createCommandManager() {
|
|
2968
|
-
this.commandManager = new
|
|
3236
|
+
this.commandManager = new O({ editor: this });
|
|
2969
3237
|
}
|
|
2970
3238
|
createSchema() {
|
|
2971
3239
|
this.schema = this.extensionManager.schema;
|
|
@@ -2973,14 +3241,14 @@ var Ur = class e {
|
|
|
2973
3241
|
createDoc() {
|
|
2974
3242
|
let e;
|
|
2975
3243
|
try {
|
|
2976
|
-
e =
|
|
3244
|
+
e = Tt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
|
|
2977
3245
|
} catch (e) {
|
|
2978
3246
|
if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
|
|
2979
|
-
let t =
|
|
2980
|
-
return this.editorState =
|
|
3247
|
+
let t = Tt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
|
|
3248
|
+
return this.editorState = ce.create({
|
|
2981
3249
|
doc: t,
|
|
2982
3250
|
schema: this.schema,
|
|
2983
|
-
selection:
|
|
3251
|
+
selection: Ve(t, this.options.autofocus) || void 0
|
|
2984
3252
|
}), this.emit("contentError", {
|
|
2985
3253
|
editor: this,
|
|
2986
3254
|
error: e,
|
|
@@ -2991,14 +3259,21 @@ var Ur = class e {
|
|
|
2991
3259
|
}
|
|
2992
3260
|
return e;
|
|
2993
3261
|
}
|
|
3262
|
+
getEditorViewAttributes() {
|
|
3263
|
+
let e = this.options.editorProps?.attributes;
|
|
3264
|
+
return Ht(e) ? (t) => ({
|
|
3265
|
+
role: "textbox",
|
|
3266
|
+
...e(t)
|
|
3267
|
+
}) : {
|
|
3268
|
+
role: "textbox",
|
|
3269
|
+
...e
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
2994
3272
|
createView(e) {
|
|
2995
3273
|
let { editorProps: t, enableExtensionDispatchTransaction: n } = this.options, r = t.dispatchTransaction || this.dispatchTransaction.bind(this), i = n ? this.extensionManager.dispatchTransaction(r) : r, a = t.transformPastedHTML, o = this.extensionManager.transformPastedHTML(a);
|
|
2996
|
-
this.editorView = new
|
|
3274
|
+
this.editorView = new _e(e, {
|
|
2997
3275
|
...t,
|
|
2998
|
-
attributes:
|
|
2999
|
-
role: "textbox",
|
|
3000
|
-
...t?.attributes
|
|
3001
|
-
},
|
|
3276
|
+
attributes: this.getEditorViewAttributes(),
|
|
3002
3277
|
dispatchTransaction: i,
|
|
3003
3278
|
transformPastedHTML: o,
|
|
3004
3279
|
state: this.editorState,
|
|
@@ -3064,30 +3339,30 @@ var Ur = class e {
|
|
|
3064
3339
|
});
|
|
3065
3340
|
}
|
|
3066
3341
|
getAttributes(e) {
|
|
3067
|
-
return
|
|
3342
|
+
return an(this.state, e);
|
|
3068
3343
|
}
|
|
3069
3344
|
isActive(e, t) {
|
|
3070
3345
|
let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
|
|
3071
|
-
return
|
|
3346
|
+
return mn(this.state, n, r);
|
|
3072
3347
|
}
|
|
3073
3348
|
getJSON() {
|
|
3074
3349
|
return this.state.doc.toJSON();
|
|
3075
3350
|
}
|
|
3076
3351
|
getHTML() {
|
|
3077
|
-
return
|
|
3352
|
+
return Mt(this.state.doc.content, this.schema);
|
|
3078
3353
|
}
|
|
3079
3354
|
getText(e) {
|
|
3080
3355
|
let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
|
|
3081
|
-
return
|
|
3356
|
+
return tn(this.state.doc, {
|
|
3082
3357
|
blockSeparator: t,
|
|
3083
3358
|
textSerializers: {
|
|
3084
|
-
...
|
|
3359
|
+
...nn(this.schema),
|
|
3085
3360
|
...n
|
|
3086
3361
|
}
|
|
3087
3362
|
});
|
|
3088
3363
|
}
|
|
3089
3364
|
get isEmpty() {
|
|
3090
|
-
return
|
|
3365
|
+
return vn(this.state.doc);
|
|
3091
3366
|
}
|
|
3092
3367
|
destroy() {
|
|
3093
3368
|
this.destroyed || (this.destroyed = !0, this.emit("destroy"), this.unmount(), this.removeAllListeners(), this.extensionManager.destroy(), this.extensionManager = null, this.schema = null, this.commandManager = null, this.extensionStorage = {});
|
|
@@ -3103,22 +3378,22 @@ var Ur = class e {
|
|
|
3103
3378
|
}
|
|
3104
3379
|
$pos(e) {
|
|
3105
3380
|
let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
|
|
3106
|
-
return new
|
|
3381
|
+
return new gi(t, this, !1, n);
|
|
3107
3382
|
}
|
|
3108
3383
|
get $doc() {
|
|
3109
3384
|
return this.$pos(0);
|
|
3110
3385
|
}
|
|
3111
3386
|
};
|
|
3112
|
-
function
|
|
3387
|
+
function yi(e) {
|
|
3113
3388
|
return new Z({
|
|
3114
3389
|
find: e.find,
|
|
3115
3390
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3116
|
-
let i =
|
|
3391
|
+
let i = H(e.getAttributes, void 0, r);
|
|
3117
3392
|
if (i === !1 || i === null) return null;
|
|
3118
3393
|
let { tr: a } = t, o = r[r.length - 1], s = r[0];
|
|
3119
3394
|
if (o) {
|
|
3120
3395
|
let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
|
|
3121
|
-
if (
|
|
3396
|
+
if (ln(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
|
|
3122
3397
|
l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
|
|
3123
3398
|
let u = n.from + r + o.length;
|
|
3124
3399
|
a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
|
|
@@ -3127,11 +3402,11 @@ function Kr(e) {
|
|
|
3127
3402
|
undoable: e.undoable
|
|
3128
3403
|
});
|
|
3129
3404
|
}
|
|
3130
|
-
function
|
|
3405
|
+
function bi(e) {
|
|
3131
3406
|
return new Z({
|
|
3132
3407
|
find: e.find,
|
|
3133
3408
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3134
|
-
let i =
|
|
3409
|
+
let i = H(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
|
|
3135
3410
|
if (r[1]) {
|
|
3136
3411
|
let e = o + r[0].lastIndexOf(r[1]);
|
|
3137
3412
|
e > s ? e = s : s = e + r[1].length;
|
|
@@ -3146,22 +3421,22 @@ function qr(e) {
|
|
|
3146
3421
|
undoable: e.undoable
|
|
3147
3422
|
});
|
|
3148
3423
|
}
|
|
3149
|
-
function
|
|
3424
|
+
function xi(e) {
|
|
3150
3425
|
return new Z({
|
|
3151
3426
|
find: e.find,
|
|
3152
3427
|
handler: ({ state: t, range: n, match: r }) => {
|
|
3153
|
-
let i = t.doc.resolve(n.from), a =
|
|
3428
|
+
let i = t.doc.resolve(n.from), a = H(e.getAttributes, void 0, r) || {};
|
|
3154
3429
|
if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
|
|
3155
3430
|
t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
|
|
3156
3431
|
},
|
|
3157
3432
|
undoable: e.undoable
|
|
3158
3433
|
});
|
|
3159
3434
|
}
|
|
3160
|
-
function
|
|
3435
|
+
function Si(e) {
|
|
3161
3436
|
return new Z({
|
|
3162
3437
|
find: e.find,
|
|
3163
3438
|
handler: ({ state: t, range: n, match: r, chain: i }) => {
|
|
3164
|
-
let o =
|
|
3439
|
+
let o = H(e.getAttributes, void 0, r) || {}, c = t.tr.delete(n.from, n.to), l = c.doc.resolve(n.from).blockRange(), u = l && s(l, e.type, o);
|
|
3165
3440
|
if (!u) return null;
|
|
3166
3441
|
if (c.wrap(l, u), e.keepMarks && e.editor) {
|
|
3167
3442
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -3180,7 +3455,7 @@ function Yr(e) {
|
|
|
3180
3455
|
undoable: e.undoable
|
|
3181
3456
|
});
|
|
3182
3457
|
}
|
|
3183
|
-
var
|
|
3458
|
+
var Ci = class e extends Yr {
|
|
3184
3459
|
constructor(...e) {
|
|
3185
3460
|
super(...e), this.type = "node";
|
|
3186
3461
|
}
|
|
@@ -3196,21 +3471,21 @@ var Xr = class e extends Sr {
|
|
|
3196
3471
|
return super.extend(t);
|
|
3197
3472
|
}
|
|
3198
3473
|
};
|
|
3199
|
-
function
|
|
3200
|
-
return new
|
|
3474
|
+
function wi(e) {
|
|
3475
|
+
return new Zr({
|
|
3201
3476
|
find: e.find,
|
|
3202
3477
|
handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
|
|
3203
|
-
let a =
|
|
3478
|
+
let a = H(e.getAttributes, void 0, r, i);
|
|
3204
3479
|
if (a === !1 || a === null) return null;
|
|
3205
3480
|
let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
|
|
3206
3481
|
if (s) {
|
|
3207
3482
|
let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
|
|
3208
|
-
if (
|
|
3483
|
+
if (ln(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
|
|
3209
3484
|
d < n.to && o.delete(d, n.to), u > n.from && o.delete(n.from + i, u), l = n.from + i + s.length, o.addMark(n.from + i, l, e.type.create(a || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || o.removeStoredMark(e.type);
|
|
3210
3485
|
}
|
|
3211
3486
|
}
|
|
3212
3487
|
});
|
|
3213
3488
|
}
|
|
3214
|
-
export {
|
|
3489
|
+
export { O as CommandManager, J as DECORATION_MANAGER_PLUGIN_KEY, kr as DecorationManager, vi as Editor, Yr as Extendable, $ as Extension, Z as InputRule, Sn as MappablePosition, Xr as Mark, Ci as Node, gi as NodePos, Zr as PasteRule, H as callOrReturn, Ar as canInsertNode, Ot as combineTransactionSteps, or as commands, D as createChainableState, Tt as createDocument, wn as createMappablePosition, I as createNodeFromContent, jr as createStyleTag, Qe as defaultBlockAt, gt as deleteProps, F as elementFromString, kt as findChildrenInRange, Bt as findDuplicates, z as findParentNode, At as findParentNodeClosestToPos, jt as flattenExtensions, qt as fromString, an as getAttributes, Vt as getAttributesFromExtensions, cn as getChangedRanges, B as getExtensionField, Mt as getHTMLFromFragment, Dt as getMarkAttributes, Le as getMarkRange, M as getMarkType, ln as getMarksBetween, un as getNodeAtPosition, rn as getNodeAttributes, k as getNodeType, dn as getPreviousBlockSibling, U as getRenderedAttributes, Qt as getSchemaByResolvedExtensions, G as getSchemaTypeByName, R as getSchemaTypeNameByName, K as getSplittedAttributes, tn as getText, en as getTextBetween, fn as getTextContentFromNodes, nn as getTextSerializersFromSchema, Cn as getUpdatedPosition, Jt as injectExtensionAttributesToParseRule, Jr as inputRulesPlugin, mn as isActive, He as isAndroid, hn as isAtEndOfNode, gn as isAtStartOfNode, Ut as isEmptyObject, _n as isExtensionRulesEnabled, Ht as isFunction, q as isList, lt as isMacOS, pn as isMarkActive, L as isNodeActive, vn as isNodeEmpty, yn as isNodeSelection, Mr as isNumber, X as isPlainObject, xn as isProseMirrorReplaceStep, bn as isProseMirrorStep, A as isRegExp, Ue as isSafari, Be as isTextSelection, P as isiOS, yi as markInputRule, wi as markPasteRule, Kt as mergeAttributes, Vr as mergeDeep, N as minMax, bi as nodeInputRule, j as objectIncludes, Lr as parseIndentedBlocks, ti as pasteRulesPlugin, on as removeDuplicates, Br as renderNestedMarkdownContent, $t as resolveExtensions, Ve as resolveFocusPosition, Xe as selectionToInsertionEnd, W as sortExtensions, V as splitExtensions, xi as textblockTypeInputRule, Hr as updateMarkViewAttributes, Si as wrappingInputRule };
|
|
3215
3490
|
|
|
3216
3491
|
//# sourceMappingURL=index.js.map
|