@burdenoff/microfe-support 2026.1031.2 → 2026.1114.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
|
@@ -20,11 +20,11 @@ function _(e, t, n, r, i) {
|
|
|
20
20
|
if (e == n && t == r) return !0;
|
|
21
21
|
if (t == (i < 0 ? 0 : v(e))) {
|
|
22
22
|
let n = e.parentNode;
|
|
23
|
-
if (!n || n
|
|
23
|
+
if (!n || !y(n) || te(e) || g.test(e.nodeName) || e.contentEditable == "false") return !1;
|
|
24
24
|
t = u(e) + (i < 0 ? 0 : 1), e = n;
|
|
25
|
-
} else if (e
|
|
25
|
+
} else if (y(e)) {
|
|
26
26
|
let n = e.childNodes[t + (i < 0 ? -1 : 0)];
|
|
27
|
-
if (n
|
|
27
|
+
if (y(n) && n.contentEditable == "false") {
|
|
28
28
|
if (n.pmViewDesc?.ignoreForSelection) t += i;
|
|
29
29
|
else return !1;
|
|
30
30
|
} else e = n, t = i < 0 ? v(e) : 0;
|
|
@@ -34,27 +34,36 @@ function _(e, t, n, r, i) {
|
|
|
34
34
|
function v(e) {
|
|
35
35
|
return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function y(e) {
|
|
38
|
+
return e.nodeType == 1;
|
|
39
|
+
}
|
|
40
|
+
function b(e) {
|
|
41
|
+
return e.nodeType == 3;
|
|
42
|
+
}
|
|
43
|
+
function x(e, t) {
|
|
44
|
+
return t ? e.contains(y(t) ? t : t.parentNode) : !1;
|
|
45
|
+
}
|
|
46
|
+
function S(e, t) {
|
|
38
47
|
for (;;) {
|
|
39
|
-
if (e
|
|
40
|
-
if (e
|
|
48
|
+
if (b(e) && t) return e;
|
|
49
|
+
if (y(e) && t > 0) {
|
|
41
50
|
if (e.contentEditable == "false") return null;
|
|
42
51
|
e = e.childNodes[t - 1], t = v(e);
|
|
43
|
-
} else if (e.parentNode && !
|
|
52
|
+
} else if (e.parentNode && !te(e)) t = u(e), e = e.parentNode;
|
|
44
53
|
else return null;
|
|
45
54
|
}
|
|
46
55
|
}
|
|
47
|
-
function
|
|
56
|
+
function C(e, t) {
|
|
48
57
|
for (;;) {
|
|
49
|
-
if (e
|
|
50
|
-
if (e
|
|
58
|
+
if (b(e) && t < e.nodeValue.length) return e;
|
|
59
|
+
if (y(e) && t < e.childNodes.length) {
|
|
51
60
|
if (e.contentEditable == "false") return null;
|
|
52
61
|
e = e.childNodes[t], t = 0;
|
|
53
|
-
} else if (e.parentNode && !
|
|
62
|
+
} else if (e.parentNode && !te(e)) t = u(e) + 1, e = e.parentNode;
|
|
54
63
|
else return null;
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
|
-
function
|
|
66
|
+
function ee(e, t, n) {
|
|
58
67
|
for (let r = t == 0, i = t == v(e); r || i;) {
|
|
59
68
|
if (e == n) return !0;
|
|
60
69
|
let t = u(e);
|
|
@@ -62,24 +71,24 @@ function b(e, t, n) {
|
|
|
62
71
|
r &&= t == 0, i &&= t == v(e);
|
|
63
72
|
}
|
|
64
73
|
}
|
|
65
|
-
function
|
|
74
|
+
function te(e) {
|
|
66
75
|
let t;
|
|
67
76
|
for (let n = e; n && !(t = n.pmViewDesc); n = n.parentNode);
|
|
68
77
|
return t && t.node && t.node.isBlock && (t.dom == e || t.contentDOM == e);
|
|
69
78
|
}
|
|
70
|
-
var
|
|
79
|
+
var ne = function(e) {
|
|
71
80
|
return e.focusNode && h(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset);
|
|
72
81
|
};
|
|
73
|
-
function
|
|
82
|
+
function re(e, t) {
|
|
74
83
|
let n = document.createEvent("Event");
|
|
75
84
|
return n.initEvent("keydown", !0, !0), n.keyCode = e, n.key = n.code = t, n;
|
|
76
85
|
}
|
|
77
|
-
function
|
|
86
|
+
function ie(e) {
|
|
78
87
|
let t = e.activeElement;
|
|
79
88
|
for (; t && t.shadowRoot;) t = t.shadowRoot.activeElement;
|
|
80
89
|
return t;
|
|
81
90
|
}
|
|
82
|
-
function
|
|
91
|
+
function ae(e, t, n) {
|
|
83
92
|
if (e.caretPositionFromPoint) try {
|
|
84
93
|
let r = e.caretPositionFromPoint(t, n);
|
|
85
94
|
if (r) return {
|
|
@@ -95,10 +104,10 @@ function ne(e, t, n) {
|
|
|
95
104
|
};
|
|
96
105
|
}
|
|
97
106
|
}
|
|
98
|
-
var w = typeof navigator < "u" ? navigator : null,
|
|
107
|
+
var w = typeof navigator < "u" ? navigator : null, oe = typeof document < "u" ? document : null, T = w && w.userAgent || "", se = /Edge\/(\d+)/.exec(T), ce = /MSIE \d/.exec(T), le = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(T), E = !!(ce || le || se), D = ce ? document.documentMode : le ? +le[1] : se ? +se[1] : 0, O = !E && /gecko\/(\d+)/i.test(T);
|
|
99
108
|
O && +(/Firefox\/(\d+)/.exec(T) || [0, 0])[1];
|
|
100
|
-
var
|
|
101
|
-
function
|
|
109
|
+
var ue = !E && /Chrome\/(\d+)/.exec(T), k = !!ue, de = ue ? +ue[1] : 0, A = !E && !!w && /Apple Computer/.test(w.vendor), fe = A && (/Mobile\/\w+/.test(T) || !!w && w.maxTouchPoints > 2), j = fe || (w ? /Mac/.test(w.platform) : !1), pe = w ? /Win/.test(w.platform) : !1, M = /Android \d/.test(T), me = !!oe && "webkitFontSmoothing" in oe.documentElement.style, he = me ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
110
|
+
function ge(e) {
|
|
102
111
|
let t = e.defaultView && e.defaultView.visualViewport;
|
|
103
112
|
return t ? {
|
|
104
113
|
left: 0,
|
|
@@ -112,10 +121,10 @@ function fe(e) {
|
|
|
112
121
|
bottom: e.documentElement.clientHeight
|
|
113
122
|
};
|
|
114
123
|
}
|
|
115
|
-
function
|
|
124
|
+
function N(e, t) {
|
|
116
125
|
return typeof e == "number" ? e : e[t];
|
|
117
126
|
}
|
|
118
|
-
function
|
|
127
|
+
function _e(e) {
|
|
119
128
|
let t = e.getBoundingClientRect(), n = t.width / e.offsetWidth || 1, r = t.height / e.offsetHeight || 1;
|
|
120
129
|
return {
|
|
121
130
|
left: t.left,
|
|
@@ -124,35 +133,35 @@ function pe(e) {
|
|
|
124
133
|
bottom: t.top + e.clientHeight * r
|
|
125
134
|
};
|
|
126
135
|
}
|
|
127
|
-
function
|
|
128
|
-
if (!
|
|
136
|
+
function ve(e, t, n) {
|
|
137
|
+
if (!Me(t) && t.left == 0) return;
|
|
129
138
|
let r = e.someProp("scrollThreshold") || 0, i = e.someProp("scrollMargin") || 5, a = e.dom.ownerDocument;
|
|
130
139
|
for (let o = n || e.dom; o;) {
|
|
131
|
-
if (o
|
|
140
|
+
if (!y(o)) {
|
|
132
141
|
o = d(o);
|
|
133
142
|
continue;
|
|
134
143
|
}
|
|
135
|
-
let e = o
|
|
136
|
-
if (t.top <
|
|
137
|
-
if (
|
|
144
|
+
let e = o == a.body, n = e ? ge(a) : _e(o), s = 0, c = 0;
|
|
145
|
+
if (t.top < n.top + N(r, "top") ? c = -(n.top - t.top + N(i, "top")) : t.bottom > n.bottom - N(r, "bottom") && (c = t.bottom - t.top > n.bottom - n.top ? t.top + N(i, "top") - n.top : t.bottom - n.bottom + N(i, "bottom")), t.left < n.left + N(r, "left") ? s = -(n.left - t.left + N(i, "left")) : t.right > n.right - N(r, "right") && (s = t.right - n.right + N(i, "right")), s || c) {
|
|
146
|
+
if (e) a.defaultView.scrollBy(s, c);
|
|
138
147
|
else {
|
|
139
|
-
let
|
|
140
|
-
|
|
141
|
-
let
|
|
148
|
+
let e = o.scrollLeft, n = o.scrollTop;
|
|
149
|
+
c && (o.scrollTop += c), s && (o.scrollLeft += s);
|
|
150
|
+
let r = o.scrollLeft - e, i = o.scrollTop - n;
|
|
142
151
|
t = {
|
|
143
|
-
left: t.left -
|
|
144
|
-
top: t.top -
|
|
145
|
-
right: t.right -
|
|
146
|
-
bottom: t.bottom -
|
|
152
|
+
left: t.left - r,
|
|
153
|
+
top: t.top - i,
|
|
154
|
+
right: t.right - r,
|
|
155
|
+
bottom: t.bottom - i
|
|
147
156
|
};
|
|
148
157
|
}
|
|
149
158
|
}
|
|
150
|
-
let
|
|
151
|
-
if (/^(fixed|sticky)$/.test(
|
|
152
|
-
o =
|
|
159
|
+
let l = e ? "fixed" : getComputedStyle(o).position;
|
|
160
|
+
if (/^(fixed|sticky)$/.test(l)) break;
|
|
161
|
+
o = l == "absolute" ? o.offsetParent : d(o);
|
|
153
162
|
}
|
|
154
163
|
}
|
|
155
|
-
function
|
|
164
|
+
function ye(e) {
|
|
156
165
|
let t = e.dom.getBoundingClientRect(), n = Math.max(0, t.top), r, i;
|
|
157
166
|
for (let a = (t.left + t.right) / 2, o = n + 1; o < Math.min(innerHeight, t.bottom); o += 5) {
|
|
158
167
|
let t = e.root.elementFromPoint(a, o);
|
|
@@ -166,10 +175,10 @@ function he(e) {
|
|
|
166
175
|
return {
|
|
167
176
|
refDOM: r,
|
|
168
177
|
refTop: i,
|
|
169
|
-
stack:
|
|
178
|
+
stack: be(e.dom)
|
|
170
179
|
};
|
|
171
180
|
}
|
|
172
|
-
function
|
|
181
|
+
function be(e) {
|
|
173
182
|
let t = [], n = e.ownerDocument;
|
|
174
183
|
for (let r = e; r && (t.push({
|
|
175
184
|
dom: r,
|
|
@@ -178,31 +187,31 @@ function ge(e) {
|
|
|
178
187
|
}), e != n); r = d(r));
|
|
179
188
|
return t;
|
|
180
189
|
}
|
|
181
|
-
function
|
|
190
|
+
function xe({ refDOM: e, refTop: t, stack: n }) {
|
|
182
191
|
let r = e ? e.getBoundingClientRect().top : 0;
|
|
183
|
-
|
|
192
|
+
Se(n, r == 0 ? 0 : r - t);
|
|
184
193
|
}
|
|
185
|
-
function
|
|
194
|
+
function Se(e, t) {
|
|
186
195
|
for (let n = 0; n < e.length; n++) {
|
|
187
196
|
let { dom: r, top: i, left: a } = e[n];
|
|
188
197
|
r.scrollTop != i + t && (r.scrollTop = i + t), r.scrollLeft != a && (r.scrollLeft = a);
|
|
189
198
|
}
|
|
190
199
|
}
|
|
191
|
-
var
|
|
192
|
-
function
|
|
200
|
+
var P = null;
|
|
201
|
+
function Ce(e) {
|
|
193
202
|
if (e.setActive) return e.setActive();
|
|
194
|
-
if (
|
|
195
|
-
let t =
|
|
196
|
-
e.focus(
|
|
197
|
-
return
|
|
198
|
-
} } : void 0),
|
|
203
|
+
if (P) return e.focus(P);
|
|
204
|
+
let t = be(e);
|
|
205
|
+
e.focus(P == null ? { get preventScroll() {
|
|
206
|
+
return P = { preventScroll: !0 }, !0;
|
|
207
|
+
} } : void 0), P || (P = !1, Se(t, 0));
|
|
199
208
|
}
|
|
200
|
-
function
|
|
209
|
+
function we(e, t) {
|
|
201
210
|
let n, r = 2e8, i, a = 0, o = t.top, s = t.top, c, l;
|
|
202
211
|
for (let u = e.firstChild, d = 0; u; u = u.nextSibling, d++) {
|
|
203
212
|
let e;
|
|
204
|
-
if (u
|
|
205
|
-
else if (u
|
|
213
|
+
if (y(u)) e = u.getClientRects();
|
|
214
|
+
else if (b(u)) e = p(u).getClientRects();
|
|
206
215
|
else continue;
|
|
207
216
|
for (let f = 0; f < e.length; f++) {
|
|
208
217
|
let p = e[f];
|
|
@@ -210,10 +219,10 @@ function be(e, t) {
|
|
|
210
219
|
o = Math.max(p.bottom, o), s = Math.min(p.top, s);
|
|
211
220
|
let e = p.left > t.left ? p.left - t.left : p.right < t.left ? t.left - p.right : 0;
|
|
212
221
|
if (e < r) {
|
|
213
|
-
n = u, r = e, i = e && n
|
|
222
|
+
n = u, r = e, i = e && b(n) ? {
|
|
214
223
|
left: p.right < t.left ? p.right : p.left,
|
|
215
224
|
top: t.top
|
|
216
|
-
} : t, u
|
|
225
|
+
} : t, y(u) && e && (a = d + +(t.left >= (p.left + p.right) / 2));
|
|
217
226
|
continue;
|
|
218
227
|
}
|
|
219
228
|
} else p.top > t.top && !c && p.left <= t.left && p.right >= t.left && (c = u, l = {
|
|
@@ -223,17 +232,17 @@ function be(e, t) {
|
|
|
223
232
|
!n && (t.left >= p.right && t.top >= p.top || t.left >= p.left && t.top >= p.bottom) && (a = d + 1);
|
|
224
233
|
}
|
|
225
234
|
}
|
|
226
|
-
return !n && c && (n = c, i = l, r = 0), n && n
|
|
235
|
+
return !n && c && (n = c, i = l, r = 0), n && b(n) ? Te(n, i) : !n || r ? {
|
|
227
236
|
node: e,
|
|
228
237
|
offset: a
|
|
229
|
-
} :
|
|
238
|
+
} : we(n, i);
|
|
230
239
|
}
|
|
231
|
-
function
|
|
240
|
+
function Te(e, t) {
|
|
232
241
|
let n = e.nodeValue.length, r = document.createRange(), i;
|
|
233
242
|
for (let a = 0; a < n; a++) {
|
|
234
243
|
r.setEnd(e, a + 1), r.setStart(e, a);
|
|
235
|
-
let n =
|
|
236
|
-
if (n.top != n.bottom &&
|
|
244
|
+
let n = F(r, 1);
|
|
245
|
+
if (n.top != n.bottom && Ee(t, n)) {
|
|
237
246
|
i = {
|
|
238
247
|
node: e,
|
|
239
248
|
offset: a + +(t.left >= (n.left + n.right) / 2)
|
|
@@ -246,125 +255,125 @@ function xe(e, t) {
|
|
|
246
255
|
offset: 0
|
|
247
256
|
};
|
|
248
257
|
}
|
|
249
|
-
function
|
|
258
|
+
function Ee(e, t) {
|
|
250
259
|
return e.left >= t.left - 1 && e.left <= t.right + 1 && e.top >= t.top - 1 && e.top <= t.bottom + 1;
|
|
251
260
|
}
|
|
252
|
-
function
|
|
261
|
+
function De(e, t) {
|
|
253
262
|
let n = e.parentNode;
|
|
254
263
|
return n && /^li$/i.test(n.nodeName) && t.left < e.getBoundingClientRect().left ? n : e;
|
|
255
264
|
}
|
|
256
|
-
function
|
|
257
|
-
let { node: r, offset: i } =
|
|
258
|
-
if (r
|
|
265
|
+
function Oe(e, t, n) {
|
|
266
|
+
let { node: r, offset: i } = we(t, n), a = -1;
|
|
267
|
+
if (y(r) && !r.firstChild) {
|
|
259
268
|
let e = r.getBoundingClientRect();
|
|
260
269
|
a = e.left != e.right && n.left > (e.left + e.right) / 2 ? 1 : -1;
|
|
261
270
|
}
|
|
262
271
|
return e.docView.posFromDOM(r, i, a);
|
|
263
272
|
}
|
|
264
|
-
function
|
|
273
|
+
function ke(e, t, n, r) {
|
|
265
274
|
let i = -1;
|
|
266
275
|
for (let n = t, a = !1; n != e.dom;) {
|
|
267
276
|
let t = e.docView.nearestDesc(n, !0), o;
|
|
268
277
|
if (!t) return null;
|
|
269
|
-
if (t.dom
|
|
278
|
+
if (y(t.dom) && (t.node.isBlock && t.parent || !t.contentDOM) && ((o = t.dom.getBoundingClientRect()).width || o.height) && (t.node.isBlock && t.parent && !/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName) && (!a && o.left > r.left || o.top > r.top ? i = t.posBefore : (!a && o.right < r.left || o.bottom < r.top) && (i = t.posAfter), a = !0), !t.contentDOM && i < 0 && !t.node.isText)) return (t.node.isBlock ? r.top < (o.top + o.bottom) / 2 : r.left < (o.left + o.right) / 2) ? t.posBefore : t.posAfter;
|
|
270
279
|
n = t.dom.parentNode;
|
|
271
280
|
}
|
|
272
281
|
return i > -1 ? i : e.docView.posFromDOM(t, n, -1);
|
|
273
282
|
}
|
|
274
|
-
function
|
|
283
|
+
function Ae(e, t, n) {
|
|
275
284
|
let r = e.childNodes.length;
|
|
276
285
|
if (r && n.top < n.bottom) for (let i = Math.max(0, Math.min(r - 1, Math.floor(r * (t.top - n.top) / (n.bottom - n.top)) - 2)), a = i;;) {
|
|
277
286
|
let n = e.childNodes[a];
|
|
278
|
-
if (n
|
|
287
|
+
if (y(n)) {
|
|
279
288
|
let e = n.getClientRects();
|
|
280
289
|
for (let r = 0; r < e.length; r++) {
|
|
281
290
|
let i = e[r];
|
|
282
|
-
if (
|
|
291
|
+
if (Ee(t, i)) return Ae(n, t, i);
|
|
283
292
|
}
|
|
284
293
|
}
|
|
285
294
|
if ((a = (a + 1) % r) == i) break;
|
|
286
295
|
}
|
|
287
296
|
return e;
|
|
288
297
|
}
|
|
289
|
-
function
|
|
290
|
-
let n = e.dom.ownerDocument, r, i = 0, a =
|
|
298
|
+
function je(e, t) {
|
|
299
|
+
let n = e.dom.ownerDocument, r, i = 0, a = ae(n, t.left, t.top);
|
|
291
300
|
a && ({node: r, offset: i} = a);
|
|
292
301
|
let o = (e.root.elementFromPoint ? e.root : n).elementFromPoint(t.left, t.top), s;
|
|
293
|
-
if (!o || !e.dom.contains(o
|
|
302
|
+
if (!o || !e.dom.contains(o)) {
|
|
294
303
|
let n = e.dom.getBoundingClientRect();
|
|
295
|
-
if (!
|
|
304
|
+
if (!Ee(t, n) || (o = Ae(e.dom, t, n), !o)) return null;
|
|
296
305
|
}
|
|
297
306
|
if (A) for (let e = o; r && e; e = d(e)) e.draggable && (r = void 0);
|
|
298
|
-
if (o =
|
|
299
|
-
if (O && r
|
|
307
|
+
if (o = De(o, t), r) {
|
|
308
|
+
if (O && y(r) && (i = Math.min(i, r.childNodes.length), i < r.childNodes.length)) {
|
|
300
309
|
let e = r.childNodes[i], n;
|
|
301
310
|
e.nodeName == "IMG" && (n = e.getBoundingClientRect()).right <= t.left && n.bottom > t.top && i++;
|
|
302
311
|
}
|
|
303
312
|
let n;
|
|
304
|
-
|
|
313
|
+
me && i && y(r) && y(n = r.childNodes[i - 1]) && n.contentEditable == "false" && n.getBoundingClientRect().top >= t.top && i--, r == e.dom && i == r.childNodes.length - 1 && y(r.lastChild) && t.top > r.lastChild.getBoundingClientRect().bottom ? s = e.state.doc.content.size : i != 0 && y(r) && r.childNodes[i - 1].nodeName == "BR" || (s = ke(e, r, i, t));
|
|
305
314
|
}
|
|
306
|
-
s ??=
|
|
315
|
+
s ??= Oe(e, o, t);
|
|
307
316
|
let c = e.docView.nearestDesc(o, !0);
|
|
308
317
|
return {
|
|
309
318
|
pos: s,
|
|
310
319
|
inside: c ? c.posAtStart - c.border : -1
|
|
311
320
|
};
|
|
312
321
|
}
|
|
313
|
-
function
|
|
322
|
+
function Me(e) {
|
|
314
323
|
return e.top < e.bottom || e.left < e.right;
|
|
315
324
|
}
|
|
316
|
-
function
|
|
325
|
+
function F(e, t) {
|
|
317
326
|
let n = e.getClientRects();
|
|
318
327
|
if (n.length) {
|
|
319
328
|
let e = n[t < 0 ? 0 : n.length - 1];
|
|
320
|
-
if (
|
|
329
|
+
if (Me(e)) return e;
|
|
321
330
|
}
|
|
322
|
-
return Array.prototype.find.call(n,
|
|
331
|
+
return Array.prototype.find.call(n, Me) || e.getBoundingClientRect();
|
|
323
332
|
}
|
|
324
|
-
var
|
|
325
|
-
function
|
|
326
|
-
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o =
|
|
327
|
-
if (r
|
|
328
|
-
if (o && (
|
|
329
|
-
let e =
|
|
333
|
+
var Ne = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
334
|
+
function Pe(e, t, n) {
|
|
335
|
+
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o = me || O;
|
|
336
|
+
if (b(r)) {
|
|
337
|
+
if (o && (Ne.test(r.nodeValue) || (n < 0 ? !i : i == r.nodeValue.length))) {
|
|
338
|
+
let e = F(p(r, i, i), n);
|
|
330
339
|
if (O && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
|
|
331
|
-
let t =
|
|
340
|
+
let t = F(p(r, i - 1, i - 1), -1);
|
|
332
341
|
if (t.top == e.top) {
|
|
333
|
-
let n =
|
|
334
|
-
if (n.top != e.top) return
|
|
342
|
+
let n = F(p(r, i, i + 1), -1);
|
|
343
|
+
if (n.top != e.top) return Fe(n, n.left < t.left);
|
|
335
344
|
}
|
|
336
345
|
}
|
|
337
346
|
return e;
|
|
338
347
|
}
|
|
339
348
|
{
|
|
340
349
|
let e = i, t = i, a = n < 0 ? 1 : -1;
|
|
341
|
-
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++,
|
|
350
|
+
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, Fe(F(p(r, e, t), a), a < 0);
|
|
342
351
|
}
|
|
343
352
|
}
|
|
344
353
|
if (!e.state.doc.resolve(t - (a || 0)).parent.inlineContent) {
|
|
345
354
|
if (a == null && i && (n < 0 || i == v(r))) {
|
|
346
355
|
let e = r.childNodes[i - 1];
|
|
347
|
-
if (e
|
|
356
|
+
if (y(e)) return Ie(e.getBoundingClientRect(), !1);
|
|
348
357
|
}
|
|
349
358
|
if (a == null && i < v(r)) {
|
|
350
359
|
let e = r.childNodes[i];
|
|
351
|
-
if (e
|
|
360
|
+
if (y(e)) return Ie(e.getBoundingClientRect(), !0);
|
|
352
361
|
}
|
|
353
|
-
return
|
|
362
|
+
return Ie(r.getBoundingClientRect(), n >= 0);
|
|
354
363
|
}
|
|
355
364
|
if (a == null && i && (n < 0 || i == v(r))) {
|
|
356
|
-
let e = r.childNodes[i - 1], t = e
|
|
357
|
-
if (t) return
|
|
365
|
+
let e = r.childNodes[i - 1], t = b(e) ? p(e, v(e) - +!o) : y(e) && (e.nodeName != "BR" || !e.nextSibling) ? e : null;
|
|
366
|
+
if (t) return Fe(F(t, 1), !1);
|
|
358
367
|
}
|
|
359
368
|
if (a == null && i < v(r)) {
|
|
360
369
|
let e = r.childNodes[i];
|
|
361
370
|
for (; e.pmViewDesc && e.pmViewDesc.ignoreForCoords;) e = e.nextSibling;
|
|
362
|
-
let t = e ? e
|
|
363
|
-
if (t) return
|
|
371
|
+
let t = e ? b(e) ? p(e, 0, +!o) : y(e) ? e : null : null;
|
|
372
|
+
if (t) return Fe(F(t, -1), !0);
|
|
364
373
|
}
|
|
365
|
-
return
|
|
374
|
+
return Fe(F(b(r) ? p(r) : r, -n), n >= 0);
|
|
366
375
|
}
|
|
367
|
-
function
|
|
376
|
+
function Fe(e, t) {
|
|
368
377
|
if (e.width == 0) return e;
|
|
369
378
|
let n = t ? e.left : e.right;
|
|
370
379
|
return {
|
|
@@ -374,7 +383,7 @@ function je(e, t) {
|
|
|
374
383
|
right: n
|
|
375
384
|
};
|
|
376
385
|
}
|
|
377
|
-
function
|
|
386
|
+
function Ie(e, t) {
|
|
378
387
|
if (e.height == 0) return e;
|
|
379
388
|
let n = t ? e.top : e.bottom;
|
|
380
389
|
return {
|
|
@@ -384,7 +393,7 @@ function Me(e, t) {
|
|
|
384
393
|
right: e.right
|
|
385
394
|
};
|
|
386
395
|
}
|
|
387
|
-
function
|
|
396
|
+
function Le(e, t, n) {
|
|
388
397
|
let r = e.state, i = e.root.activeElement;
|
|
389
398
|
r != t && e.updateState(t), i != e.dom && e.focus();
|
|
390
399
|
try {
|
|
@@ -393,9 +402,9 @@ function Ne(e, t, n) {
|
|
|
393
402
|
r != t && e.updateState(r), i != e.dom && i && i.focus();
|
|
394
403
|
}
|
|
395
404
|
}
|
|
396
|
-
function
|
|
405
|
+
function Re(e, t, n) {
|
|
397
406
|
let r = t.selection, i = n == "up" ? r.$from : r.$to;
|
|
398
|
-
return
|
|
407
|
+
return Le(e, t, () => {
|
|
399
408
|
let { node: t } = e.docView.domFromPos(i.pos, n == "up" ? -1 : 1);
|
|
400
409
|
for (;;) {
|
|
401
410
|
let n = e.docView.nearestDesc(t, !0);
|
|
@@ -406,11 +415,11 @@ function Pe(e, t, n) {
|
|
|
406
415
|
}
|
|
407
416
|
t = n.dom.parentNode;
|
|
408
417
|
}
|
|
409
|
-
let r =
|
|
418
|
+
let r = Pe(e, i.pos, 1);
|
|
410
419
|
for (let e = t.firstChild; e; e = e.nextSibling) {
|
|
411
420
|
let t;
|
|
412
|
-
if (e
|
|
413
|
-
else if (e
|
|
421
|
+
if (y(e)) t = e.getClientRects();
|
|
422
|
+
else if (b(e)) t = p(e, 0, e.nodeValue.length).getClientRects();
|
|
414
423
|
else continue;
|
|
415
424
|
for (let e = 0; e < t.length; e++) {
|
|
416
425
|
let i = t[e];
|
|
@@ -420,28 +429,28 @@ function Pe(e, t, n) {
|
|
|
420
429
|
return !0;
|
|
421
430
|
});
|
|
422
431
|
}
|
|
423
|
-
var
|
|
424
|
-
function
|
|
432
|
+
var ze = /[\u0590-\u08ac]/;
|
|
433
|
+
function Be(e, t, n) {
|
|
425
434
|
let { $head: r } = t.selection;
|
|
426
435
|
if (!r.parent.isTextblock) return !1;
|
|
427
436
|
let i = r.parentOffset, a = !i, o = i == r.parent.content.size, s = e.domSelection();
|
|
428
|
-
return s ? !
|
|
437
|
+
return s ? !ze.test(r.parent.textContent) || !s.modify ? n == "left" || n == "backward" ? a : o : Le(e, t, () => {
|
|
429
438
|
let { focusNode: t, focusOffset: i, anchorNode: a, anchorOffset: o } = e.domSelectionRange(), c = s.caretBidiLevel;
|
|
430
439
|
s.modify("move", n, "character");
|
|
431
|
-
let l = r.depth ? e.docView.domAfterPos(r.before()) : e.dom, { focusNode: u, focusOffset: d } = e.domSelectionRange(), f = u && !l
|
|
440
|
+
let l = r.depth ? e.docView.domAfterPos(r.before()) : e.dom, { focusNode: u, focusOffset: d } = e.domSelectionRange(), f = u && !x(l, u) || t == u && i == d;
|
|
432
441
|
try {
|
|
433
442
|
s.collapse(a, o), t && (t != a || i != o) && s.extend && s.extend(t, i);
|
|
434
443
|
} catch {}
|
|
435
444
|
return c != null && (s.caretBidiLevel = c), f;
|
|
436
445
|
}) : r.pos == r.start() || r.pos == r.end();
|
|
437
446
|
}
|
|
438
|
-
var
|
|
439
|
-
function
|
|
440
|
-
return
|
|
447
|
+
var Ve = null, He = null, Ue = !1;
|
|
448
|
+
function We(e, t, n) {
|
|
449
|
+
return Ve == t && He == n ? Ue : (Ve = t, He = n, Ue = n == "up" || n == "down" ? Re(e, t, n) : Be(e, t, n));
|
|
441
450
|
}
|
|
442
|
-
var
|
|
451
|
+
var I = 0, Ge = 1, L = 2, R = 3, Ke = class {
|
|
443
452
|
constructor(e, t, n, r) {
|
|
444
|
-
this.parent = e, this.children = t, this.dom = n, this.contentDOM = r, this.dirty =
|
|
453
|
+
this.parent = e, this.children = t, this.dom = n, this.contentDOM = r, this.dirty = I, n.pmViewDesc = this;
|
|
445
454
|
}
|
|
446
455
|
matchesWidget(e) {
|
|
447
456
|
return !1;
|
|
@@ -493,7 +502,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
493
502
|
return this.posAtStart + this.size - 2 * this.border;
|
|
494
503
|
}
|
|
495
504
|
localPosFromDOM(e, t, n) {
|
|
496
|
-
if (this.contentDOM && this.contentDOM
|
|
505
|
+
if (this.contentDOM && x(this.contentDOM, e)) {
|
|
497
506
|
if (n < 0) {
|
|
498
507
|
let n, r;
|
|
499
508
|
if (e == this.contentDOM) n = e.childNodes[t - 1];
|
|
@@ -517,8 +526,10 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
517
526
|
}
|
|
518
527
|
let r;
|
|
519
528
|
if (e == this.dom && this.contentDOM) r = t > u(this.contentDOM);
|
|
520
|
-
else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM))
|
|
521
|
-
|
|
529
|
+
else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {
|
|
530
|
+
let n = e.compareDocumentPosition(this.contentDOM);
|
|
531
|
+
r = n & 16 ? t > Array.from(e.childNodes).findIndex((e) => e.contains(this.contentDOM)) : !(n & 4);
|
|
532
|
+
} else if (this.dom.firstChild) {
|
|
522
533
|
if (t == 0) for (let t = e;; t = t.parentNode) {
|
|
523
534
|
if (t == this.dom) {
|
|
524
535
|
r = !1;
|
|
@@ -540,7 +551,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
540
551
|
for (let n = !0, r = e; r; r = r.parentNode) {
|
|
541
552
|
let i = this.getDesc(r), a;
|
|
542
553
|
if (i && (!t || i.node)) {
|
|
543
|
-
if (n && (a = i.nodeDOM) && !(a
|
|
554
|
+
if (n && (a = i.nodeDOM) && !(y(a) ? x(a, e) : a == e)) n = !1;
|
|
544
555
|
else return i;
|
|
545
556
|
}
|
|
546
557
|
}
|
|
@@ -582,14 +593,17 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
582
593
|
let n = 0, r = 0;
|
|
583
594
|
for (let t = 0; n < this.children.length; n++) {
|
|
584
595
|
let i = this.children[n], a = t + i.size;
|
|
585
|
-
if (a > e
|
|
596
|
+
if (a > e) {
|
|
586
597
|
r = e - t;
|
|
587
598
|
break;
|
|
588
599
|
}
|
|
589
600
|
t = a;
|
|
590
601
|
}
|
|
591
602
|
if (r) return this.children[n].domFromPos(r - this.children[n].border, t);
|
|
592
|
-
for (
|
|
603
|
+
for (; n > 0; n--) {
|
|
604
|
+
let e = this.children[n - 1];
|
|
605
|
+
if (e.size || !(e instanceof Qe || e instanceof qe && e.side >= 0)) break;
|
|
606
|
+
}
|
|
593
607
|
if (t <= 0) {
|
|
594
608
|
let e, r = !0;
|
|
595
609
|
for (; e = n ? this.children[n - 1] : null, e && e.dom.parentNode != this.contentDOM; n--, r = !1);
|
|
@@ -662,7 +676,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
662
676
|
}
|
|
663
677
|
domAfterPos(e) {
|
|
664
678
|
let { node: t, offset: n } = this.domFromPos(e, 0);
|
|
665
|
-
if (t
|
|
679
|
+
if (!y(t) || n == t.childNodes.length) throw RangeError("No node after pos " + e);
|
|
666
680
|
return t.childNodes[n];
|
|
667
681
|
}
|
|
668
682
|
setSelection(e, t, n, r = !1) {
|
|
@@ -675,7 +689,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
675
689
|
let o = this.domFromPos(e, e ? -1 : 1), s = t == e ? o : this.domFromPos(t, t ? -1 : 1), c = n.root.getSelection(), l = n.domSelectionRange(), d = !1;
|
|
676
690
|
if ((O || A) && e == t) {
|
|
677
691
|
let { node: e, offset: t } = o;
|
|
678
|
-
if (e
|
|
692
|
+
if (b(e)) {
|
|
679
693
|
if (d = !!(t && e.nodeValue[t - 1] == "\n"), d && t == e.nodeValue.length) for (let t = e, n; t; t = t.parentNode) {
|
|
680
694
|
if (n = t.nextSibling) {
|
|
681
695
|
n.nodeName == "BR" && (o = s = {
|
|
@@ -692,7 +706,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
692
706
|
d = n && (n.nodeName == "BR" || n.contentEditable == "false");
|
|
693
707
|
}
|
|
694
708
|
}
|
|
695
|
-
if (O && l.focusNode && l.focusNode != s.node && l.focusNode
|
|
709
|
+
if (O && l.focusNode && l.focusNode != s.node && y(l.focusNode)) {
|
|
696
710
|
let e = l.focusNode.childNodes[l.focusOffset];
|
|
697
711
|
e && e.contentEditable == "false" && (r = !0);
|
|
698
712
|
}
|
|
@@ -725,19 +739,19 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
725
739
|
if (n == a ? e <= a && t >= n : e < a && t > n) {
|
|
726
740
|
let r = n + i.border, o = a - i.border;
|
|
727
741
|
if (e >= r && t <= o) {
|
|
728
|
-
this.dirty = e == n || t == a ?
|
|
742
|
+
this.dirty = e == n || t == a ? L : Ge, e == r && t == o && (i.contentLost || i.dom.parentNode != this.contentDOM) ? i.dirty = R : i.markDirty(e - r, t - r);
|
|
729
743
|
return;
|
|
730
744
|
}
|
|
731
|
-
i.dirty = i.dom == i.contentDOM && i.dom.parentNode == this.contentDOM && !i.children.length ?
|
|
745
|
+
i.dirty = i.dom == i.contentDOM && i.dom.parentNode == this.contentDOM && !i.children.length ? L : R;
|
|
732
746
|
}
|
|
733
747
|
n = a;
|
|
734
748
|
}
|
|
735
|
-
this.dirty =
|
|
749
|
+
this.dirty = L;
|
|
736
750
|
}
|
|
737
751
|
markParentsDirty() {
|
|
738
752
|
let e = 1;
|
|
739
753
|
for (let t = this.parent; t; t = t.parent, e++) {
|
|
740
|
-
let n = e == 1 ?
|
|
754
|
+
let n = e == 1 ? L : Ge;
|
|
741
755
|
t.dirty < n && (t.dirty = n);
|
|
742
756
|
}
|
|
743
757
|
}
|
|
@@ -753,23 +767,20 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
753
767
|
isText(e) {
|
|
754
768
|
return !1;
|
|
755
769
|
}
|
|
756
|
-
},
|
|
770
|
+
}, qe = class extends Ke {
|
|
757
771
|
constructor(e, t, n, r) {
|
|
758
772
|
let i, a = t.type.toDOM;
|
|
759
773
|
if (typeof a == "function" && (a = a(n, () => {
|
|
760
774
|
if (!i) return r;
|
|
761
775
|
if (i.parent) return i.parent.posBeforeChild(i);
|
|
762
776
|
})), !t.type.spec.raw) {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
e.appendChild(a), a = e;
|
|
766
|
-
}
|
|
767
|
-
a.hasAttribute("contenteditable") || (a.contentEditable = "false"), a.classList.add("ProseMirror-widget");
|
|
777
|
+
let e = y(a) ? a : document.createElement("span");
|
|
778
|
+
e != a && (e.appendChild(a), a = e), e.hasAttribute("contenteditable") || (e.contentEditable = "false"), e.classList.add("ProseMirror-widget");
|
|
768
779
|
}
|
|
769
780
|
super(e, [], a, null), this.widget = t, this.widget = t, i = this;
|
|
770
781
|
}
|
|
771
782
|
matchesWidget(e) {
|
|
772
|
-
return this.dirty ==
|
|
783
|
+
return this.dirty == I && e.type.eq(this.widget.type);
|
|
773
784
|
}
|
|
774
785
|
parseRule() {
|
|
775
786
|
return { ignore: !0 };
|
|
@@ -793,7 +804,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
793
804
|
get side() {
|
|
794
805
|
return this.widget.type.side;
|
|
795
806
|
}
|
|
796
|
-
},
|
|
807
|
+
}, Je = class extends Ke {
|
|
797
808
|
constructor(e, t, n, r) {
|
|
798
809
|
super(e, [], t, null), this.textDOM = n, this.text = r;
|
|
799
810
|
}
|
|
@@ -812,7 +823,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
812
823
|
ignoreMutation(e) {
|
|
813
824
|
return e.type === "characterData" && e.target.nodeValue == e.oldValue;
|
|
814
825
|
}
|
|
815
|
-
},
|
|
826
|
+
}, Ye = class e extends Ke {
|
|
816
827
|
constructor(e, t, n, r, i) {
|
|
817
828
|
super(e, [], n, r), this.mark = t, this.spec = i;
|
|
818
829
|
}
|
|
@@ -821,25 +832,25 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
821
832
|
return s && s.dom || (s = a.renderSpec(document, n.type.spec.toDOM(n, r), null, n.attrs)), new e(t, n, s.dom, s.contentDOM || s.dom, s);
|
|
822
833
|
}
|
|
823
834
|
parseRule() {
|
|
824
|
-
return this.dirty &
|
|
835
|
+
return this.dirty & R || this.mark.type.spec.reparseInView ? null : {
|
|
825
836
|
mark: this.mark.type.name,
|
|
826
837
|
attrs: this.mark.attrs,
|
|
827
838
|
contentElement: this.contentDOM
|
|
828
839
|
};
|
|
829
840
|
}
|
|
830
841
|
matchesMark(e) {
|
|
831
|
-
return this.dirty !=
|
|
842
|
+
return this.dirty != R && this.mark.eq(e);
|
|
832
843
|
}
|
|
833
844
|
markDirty(e, t) {
|
|
834
|
-
if (super.markDirty(e, t), this.dirty !=
|
|
845
|
+
if (super.markDirty(e, t), this.dirty != I) {
|
|
835
846
|
let e = this.parent;
|
|
836
847
|
for (; !e.node;) e = e.parent;
|
|
837
|
-
e.dirty < this.dirty && (e.dirty = this.dirty), this.dirty =
|
|
848
|
+
e.dirty < this.dirty && (e.dirty = this.dirty), this.dirty = I;
|
|
838
849
|
}
|
|
839
850
|
}
|
|
840
851
|
slice(t, n, r) {
|
|
841
852
|
let i = e.create(this.parent, this.mark, !0, r), a = this.children, o = this.size;
|
|
842
|
-
n < o && (a =
|
|
853
|
+
n < o && (a = mt(a, n, o, r)), t > 0 && (a = mt(a, 0, t, r));
|
|
843
854
|
for (let e = 0; e < a.length; e++) a[e].parent = i;
|
|
844
855
|
return i.children = a, i;
|
|
845
856
|
}
|
|
@@ -849,7 +860,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
849
860
|
destroy() {
|
|
850
861
|
this.spec.destroy && this.spec.destroy(), super.destroy();
|
|
851
862
|
}
|
|
852
|
-
},
|
|
863
|
+
}, z = class e extends Ke {
|
|
853
864
|
constructor(e, t, n, r, i, a, o) {
|
|
854
865
|
super(e, [], i, a), this.node = t, this.outerDeco = n, this.innerDeco = r, this.nodeDOM = o;
|
|
855
866
|
}
|
|
@@ -860,14 +871,14 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
860
871
|
}, r, i), d = u && u.dom, f = u && u.contentDOM;
|
|
861
872
|
if (n.isText) {
|
|
862
873
|
if (!d) d = document.createTextNode(n.text);
|
|
863
|
-
else if (d
|
|
874
|
+
else if (!b(d)) throw RangeError("Text must be rendered as a DOM text node");
|
|
864
875
|
} else if (!d) {
|
|
865
876
|
let e = a.renderSpec(document, n.type.spec.toDOM(n), null, n.attrs);
|
|
866
877
|
({dom: d, contentDOM: f} = e);
|
|
867
878
|
}
|
|
868
879
|
!f && !n.isText && d.nodeName != "BR" && (d.hasAttribute("contenteditable") || (d.contentEditable = "false"), n.type.spec.draggable && (d.draggable = !0));
|
|
869
880
|
let p = d;
|
|
870
|
-
return d =
|
|
881
|
+
return d = at(d, r, n), u ? l = new $e(t, n, r, i, d, f || null, p, u) : n.isText ? new Ze(t, n, r, i, d, p) : new e(t, n, r, i, d, f || null, p);
|
|
871
882
|
}
|
|
872
883
|
parseRule(e) {
|
|
873
884
|
if (this.node.type.spec.reparseInView) return null;
|
|
@@ -886,14 +897,14 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
886
897
|
}
|
|
887
898
|
}
|
|
888
899
|
if (!t.contentElement) {
|
|
889
|
-
let n = e && e.find((t) => t
|
|
900
|
+
let n = e && e.find((t) => y(t) && e.indexOf(t.parentNode) < 0 && this.dom.contains(t));
|
|
890
901
|
n ? t.contentElement = n : t.getContent = () => o.empty;
|
|
891
902
|
}
|
|
892
903
|
}
|
|
893
904
|
return t;
|
|
894
905
|
}
|
|
895
906
|
matchesNode(e, t, n) {
|
|
896
|
-
return this.dirty ==
|
|
907
|
+
return this.dirty == I && e.eq(this.node) && ot(t, this.outerDeco) && n.eq(this.innerDeco);
|
|
897
908
|
}
|
|
898
909
|
get size() {
|
|
899
910
|
return this.node.nodeSize;
|
|
@@ -902,14 +913,14 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
902
913
|
return +!this.node.isLeaf;
|
|
903
914
|
}
|
|
904
915
|
updateChildren(e, t) {
|
|
905
|
-
let n = this.node.inlineContent, r = t, i = e.composing ? this.localCompositionInfo(e, t) : null, a = i && i.pos > -1 ? i : null, o = i && i.pos < 0, c = new
|
|
906
|
-
|
|
916
|
+
let n = this.node.inlineContent, r = t, i = e.composing ? this.localCompositionInfo(e, t) : null, a = i && i.pos > -1 ? i : null, o = i && i.pos < 0, c = new ct(this, a && a.node, e), l = this.node.inlineContent, u = l && this.node.isBlock;
|
|
917
|
+
dt(this.node, this.innerDeco, (t, i, a) => {
|
|
907
918
|
t.spec.marks ? c.syncToMarks(t.spec.marks, n, e, i) : t.type.side >= 0 && !a && c.syncToMarks(i == this.node.childCount ? s.none : this.node.child(i).marks, n, e, i), c.placeWidget(t, e, r);
|
|
908
|
-
}, (t, a, s,
|
|
909
|
-
c.syncToMarks(t.marks, n, e,
|
|
910
|
-
let
|
|
911
|
-
c.findNodeMatch(t, a, s,
|
|
912
|
-
}), c.syncToMarks([], n, e, 0), this.node.isTextblock && c.addTextblockHacks(), c.destroyRest(), (c.changed || this.dirty ==
|
|
919
|
+
}, (t, a, s, d) => {
|
|
920
|
+
c.syncToMarks(t.marks, n, e, d), u && t.isAtom && !t.isText && c.addHackNode("IMG", c.top);
|
|
921
|
+
let f;
|
|
922
|
+
c.findNodeMatch(t, a, s, d) || o && e.state.selection.from > r && e.state.selection.to < r + t.nodeSize && (f = c.findIndexWithChild(i.node)) > -1 && c.updateNodeAt(t, a, s, f, e) || c.updateNextNode(t, a, s, e, d, r) || c.addNode(t, a, s, e, r), r += t.nodeSize, l && (u = t.isAtom && !t.isText);
|
|
923
|
+
}), c.syncToMarks([], n, e, 0), this.node.isTextblock && c.addTextblockHacks(), c.destroyRest(), (c.changed || this.dirty == L) && (a && this.protectLocalComposition(e, a), et(this.contentDOM, this.children, e), fe && ft(this.dom));
|
|
913
924
|
}
|
|
914
925
|
localCompositionInfo(e, t) {
|
|
915
926
|
let { from: n, to: i } = e.state.selection;
|
|
@@ -917,7 +928,7 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
917
928
|
let a = e.input.compositionNode;
|
|
918
929
|
if (!a || !this.dom.contains(a.parentNode)) return null;
|
|
919
930
|
if (this.node.inlineContent) {
|
|
920
|
-
let e = a.nodeValue, r =
|
|
931
|
+
let e = a.nodeValue, r = pt(this.node.content, e, n - t, i - t);
|
|
921
932
|
return r < 0 ? null : {
|
|
922
933
|
node: a,
|
|
923
934
|
pos: r,
|
|
@@ -938,36 +949,36 @@ var L = 0, Ve = 1, R = 2, z = 3, He = class {
|
|
|
938
949
|
for (; i.nextSibling;) i.parentNode.removeChild(i.nextSibling);
|
|
939
950
|
i.pmViewDesc && (i.pmViewDesc = void 0);
|
|
940
951
|
}
|
|
941
|
-
let a = new
|
|
942
|
-
e.input.compositionNodes.push(a), this.children =
|
|
952
|
+
let a = new Je(this, i, t, r);
|
|
953
|
+
e.input.compositionNodes.push(a), this.children = mt(this.children, n, n + r.length, e, a);
|
|
943
954
|
}
|
|
944
955
|
update(e, t, n, r) {
|
|
945
|
-
return this.dirty ==
|
|
956
|
+
return this.dirty == R || !e.sameMarkup(this.node) ? !1 : (this.updateInner(e, t, n, r), !0);
|
|
946
957
|
}
|
|
947
958
|
updateInner(e, t, n, r) {
|
|
948
|
-
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(r, this.posAtStart), this.dirty =
|
|
959
|
+
this.updateOuterDeco(t), this.node = e, this.innerDeco = n, this.contentDOM && this.updateChildren(r, this.posAtStart), this.dirty = I;
|
|
949
960
|
}
|
|
950
961
|
updateOuterDeco(e) {
|
|
951
|
-
if (
|
|
952
|
-
let t = this.nodeDOM
|
|
953
|
-
this.dom =
|
|
962
|
+
if (ot(e, this.outerDeco)) return;
|
|
963
|
+
let t = !y(this.nodeDOM), n = this.dom;
|
|
964
|
+
this.dom = rt(this.dom, this.nodeDOM, nt(this.outerDeco, this.node, t), nt(e, this.node, t)), this.dom != n && (n.pmViewDesc = void 0, this.dom.pmViewDesc = this), this.outerDeco = e;
|
|
954
965
|
}
|
|
955
966
|
selectNode() {
|
|
956
|
-
this.nodeDOM
|
|
967
|
+
y(this.nodeDOM) && (this.nodeDOM.classList.add("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && (this.nodeDOM.draggable = !0));
|
|
957
968
|
}
|
|
958
969
|
deselectNode() {
|
|
959
|
-
this.nodeDOM
|
|
970
|
+
y(this.nodeDOM) && (this.nodeDOM.classList.remove("ProseMirror-selectednode"), (this.contentDOM || !this.node.type.spec.draggable) && this.nodeDOM.removeAttribute("draggable"));
|
|
960
971
|
}
|
|
961
972
|
get domAtom() {
|
|
962
973
|
return this.node.isAtom;
|
|
963
974
|
}
|
|
964
975
|
};
|
|
965
|
-
function
|
|
966
|
-
|
|
967
|
-
let a = new
|
|
976
|
+
function Xe(e, t, n, r, i) {
|
|
977
|
+
at(r, t, e);
|
|
978
|
+
let a = new z(void 0, e, t, n, r, r, r);
|
|
968
979
|
return a.contentDOM && a.updateChildren(i, 0), a;
|
|
969
980
|
}
|
|
970
|
-
var
|
|
981
|
+
var Ze = class e extends z {
|
|
971
982
|
constructor(e, t, n, r, i, a) {
|
|
972
983
|
super(e, t, n, r, i, null, a);
|
|
973
984
|
}
|
|
@@ -977,7 +988,7 @@ var qe = class e extends B {
|
|
|
977
988
|
return { skip: e || !0 };
|
|
978
989
|
}
|
|
979
990
|
update(e, t, n, r) {
|
|
980
|
-
return this.dirty ==
|
|
991
|
+
return this.dirty == R || this.dirty != I && !this.inParent() || !e.sameMarkup(this.node) ? !1 : (this.updateOuterDeco(t), (this.dirty != I || e.text != this.node.text) && e.text != this.nodeDOM.nodeValue && (this.nodeDOM.nodeValue = e.text, r.trackWrites == this.nodeDOM && (r.trackWrites = null)), this.node = e, this.dirty = I, !0);
|
|
981
992
|
}
|
|
982
993
|
inParent() {
|
|
983
994
|
let e = this.parent.contentDOM;
|
|
@@ -1001,7 +1012,7 @@ var qe = class e extends B {
|
|
|
1001
1012
|
return new e(this.parent, i, this.outerDeco, this.innerDeco, a, a);
|
|
1002
1013
|
}
|
|
1003
1014
|
markDirty(e, t) {
|
|
1004
|
-
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty =
|
|
1015
|
+
super.markDirty(e, t), this.dom != this.nodeDOM && (e == 0 || t == this.nodeDOM.nodeValue.length) && (this.dirty = R);
|
|
1005
1016
|
}
|
|
1006
1017
|
get domAtom() {
|
|
1007
1018
|
return !1;
|
|
@@ -1009,12 +1020,12 @@ var qe = class e extends B {
|
|
|
1009
1020
|
isText(e) {
|
|
1010
1021
|
return this.node.text == e;
|
|
1011
1022
|
}
|
|
1012
|
-
},
|
|
1023
|
+
}, Qe = class extends Ke {
|
|
1013
1024
|
parseRule() {
|
|
1014
1025
|
return { ignore: !0 };
|
|
1015
1026
|
}
|
|
1016
1027
|
matchesHack(e) {
|
|
1017
|
-
return this.dirty ==
|
|
1028
|
+
return this.dirty == I && this.dom.nodeName == e;
|
|
1018
1029
|
}
|
|
1019
1030
|
get domAtom() {
|
|
1020
1031
|
return !0;
|
|
@@ -1022,12 +1033,12 @@ var qe = class e extends B {
|
|
|
1022
1033
|
get ignoreForCoords() {
|
|
1023
1034
|
return this.dom.nodeName == "IMG";
|
|
1024
1035
|
}
|
|
1025
|
-
},
|
|
1036
|
+
}, $e = class extends z {
|
|
1026
1037
|
constructor(e, t, n, r, i, a, o, s) {
|
|
1027
1038
|
super(e, t, n, r, i, a, o), this.spec = s;
|
|
1028
1039
|
}
|
|
1029
1040
|
update(e, t, n, r) {
|
|
1030
|
-
if (this.dirty ==
|
|
1041
|
+
if (this.dirty == R) return !1;
|
|
1031
1042
|
if (this.spec.update && (this.node.type == e.type || this.spec.multiType)) {
|
|
1032
1043
|
let i = this.spec.update(e, t, n);
|
|
1033
1044
|
return i && this.updateInner(e, t, n, r), i;
|
|
@@ -1053,56 +1064,56 @@ var qe = class e extends B {
|
|
|
1053
1064
|
return this.spec.ignoreMutation ? this.spec.ignoreMutation(e) : super.ignoreMutation(e);
|
|
1054
1065
|
}
|
|
1055
1066
|
};
|
|
1056
|
-
function
|
|
1067
|
+
function et(e, t, n) {
|
|
1057
1068
|
let r = e.firstChild, i = !1;
|
|
1058
1069
|
for (let a = 0; a < t.length; a++) {
|
|
1059
1070
|
let o = t[a], s = o.dom;
|
|
1060
1071
|
if (s.parentNode == e) {
|
|
1061
|
-
for (; s != r;) r =
|
|
1072
|
+
for (; s != r;) r = st(r), i = !0;
|
|
1062
1073
|
r = r.nextSibling;
|
|
1063
1074
|
} else i = !0, e.insertBefore(s, r);
|
|
1064
|
-
if (o instanceof
|
|
1075
|
+
if (o instanceof Ye) {
|
|
1065
1076
|
let t = r ? r.previousSibling : e.lastChild;
|
|
1066
|
-
|
|
1077
|
+
et(o.contentDOM, o.children, n), r = t ? t.nextSibling : e.firstChild;
|
|
1067
1078
|
}
|
|
1068
1079
|
}
|
|
1069
|
-
for (; r;) r =
|
|
1080
|
+
for (; r;) r = st(r), i = !0;
|
|
1070
1081
|
i && n.trackWrites == e && (n.trackWrites = null);
|
|
1071
1082
|
}
|
|
1072
|
-
var
|
|
1083
|
+
var tt = function(e) {
|
|
1073
1084
|
e && (this.nodeName = e);
|
|
1074
1085
|
};
|
|
1075
|
-
|
|
1076
|
-
var
|
|
1077
|
-
function
|
|
1078
|
-
if (e.length == 0) return
|
|
1079
|
-
let r = n ?
|
|
1086
|
+
tt.prototype = Object.create(null);
|
|
1087
|
+
var B = [new tt()];
|
|
1088
|
+
function nt(e, t, n) {
|
|
1089
|
+
if (e.length == 0) return B;
|
|
1090
|
+
let r = n ? B[0] : new tt(), i = [r];
|
|
1080
1091
|
for (let a = 0; a < e.length; a++) {
|
|
1081
1092
|
let o = e[a].type.attrs;
|
|
1082
1093
|
if (o) {
|
|
1083
|
-
o.nodeName && i.push(r = new
|
|
1094
|
+
o.nodeName && i.push(r = new tt(o.nodeName));
|
|
1084
1095
|
for (let e in o) {
|
|
1085
1096
|
let a = o[e];
|
|
1086
|
-
a != null && (n && i.length == 1 && i.push(r = new
|
|
1097
|
+
a != null && (n && i.length == 1 && i.push(r = new tt(t.isInline ? "span" : "div")), e == "class" ? r.class = (r.class ? r.class + " " : "") + a : e == "style" ? r.style = (r.style ? r.style + ";" : "") + a : e != "nodeName" && (r[e] = a));
|
|
1087
1098
|
}
|
|
1088
1099
|
}
|
|
1089
1100
|
}
|
|
1090
1101
|
return i;
|
|
1091
1102
|
}
|
|
1092
|
-
function
|
|
1093
|
-
if (n ==
|
|
1103
|
+
function rt(e, t, n, r) {
|
|
1104
|
+
if (n == B && r == B) return t;
|
|
1094
1105
|
let i = t;
|
|
1095
1106
|
for (let t = 0; t < r.length; t++) {
|
|
1096
1107
|
let a = r[t], o = n[t];
|
|
1097
1108
|
if (t) {
|
|
1098
1109
|
let t;
|
|
1099
|
-
o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName || (t = document.createElement(a.nodeName), t.pmIsDeco = !0, t.appendChild(i), o =
|
|
1110
|
+
o && o.nodeName == a.nodeName && i != e && (t = i.parentNode) && t.nodeName.toLowerCase() == a.nodeName || (t = document.createElement(a.nodeName), t.pmIsDeco = !0, t.appendChild(i), o = B[0]), i = t;
|
|
1100
1111
|
}
|
|
1101
|
-
|
|
1112
|
+
it(i, o || B[0], a);
|
|
1102
1113
|
}
|
|
1103
1114
|
return i;
|
|
1104
1115
|
}
|
|
1105
|
-
function
|
|
1116
|
+
function it(e, t, n) {
|
|
1106
1117
|
for (let r in t) r != "class" && r != "style" && r != "nodeName" && !(r in n) && e.removeAttribute(r);
|
|
1107
1118
|
for (let r in n) r != "class" && r != "style" && r != "nodeName" && n[r] != t[r] && e.setAttribute(r, n[r]);
|
|
1108
1119
|
if (t.class != n.class) {
|
|
@@ -1119,21 +1130,21 @@ function et(e, t, n) {
|
|
|
1119
1130
|
n.style && (e.style.cssText += n.style);
|
|
1120
1131
|
}
|
|
1121
1132
|
}
|
|
1122
|
-
function
|
|
1123
|
-
return
|
|
1133
|
+
function at(e, t, n) {
|
|
1134
|
+
return rt(e, e, B, nt(t, n, !y(e)));
|
|
1124
1135
|
}
|
|
1125
|
-
function
|
|
1136
|
+
function ot(e, t) {
|
|
1126
1137
|
if (e.length != t.length) return !1;
|
|
1127
1138
|
for (let n = 0; n < e.length; n++) if (!e[n].type.eq(t[n].type)) return !1;
|
|
1128
1139
|
return !0;
|
|
1129
1140
|
}
|
|
1130
|
-
function
|
|
1141
|
+
function st(e) {
|
|
1131
1142
|
let t = e.nextSibling;
|
|
1132
1143
|
return e.parentNode.removeChild(e), t;
|
|
1133
1144
|
}
|
|
1134
|
-
var
|
|
1145
|
+
var ct = class {
|
|
1135
1146
|
constructor(e, t, n) {
|
|
1136
|
-
this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch =
|
|
1147
|
+
this.lock = t, this.view = n, this.index = 0, this.stack = [], this.changed = !1, this.top = e, this.preMatch = lt(e.node.content, e);
|
|
1137
1148
|
}
|
|
1138
1149
|
destroyBetween(e, t) {
|
|
1139
1150
|
if (e != t) {
|
|
@@ -1147,7 +1158,7 @@ var it = class {
|
|
|
1147
1158
|
syncToMarks(e, t, n, r) {
|
|
1148
1159
|
let i = 0, a = this.stack.length >> 1, o = Math.min(a, e.length);
|
|
1149
1160
|
for (; i < o && (i == a - 1 ? this.top : this.stack[i + 1 << 1]).matchesMark(e[i]) && e[i].type.spec.spanning !== !1;) i++;
|
|
1150
|
-
for (; i < a;) this.destroyRest(), this.top.dirty =
|
|
1161
|
+
for (; i < a;) this.destroyRest(), this.top.dirty = I, this.index = this.stack.pop(), this.top = this.stack.pop(), a--;
|
|
1151
1162
|
for (; a < e.length;) {
|
|
1152
1163
|
this.stack.push(this.top, this.index + 1);
|
|
1153
1164
|
let i = -1, o = this.top.children.length;
|
|
@@ -1161,11 +1172,11 @@ var it = class {
|
|
|
1161
1172
|
}
|
|
1162
1173
|
if (i < 0 && this.index < this.top.children.length) {
|
|
1163
1174
|
let t = this.top.children[this.index];
|
|
1164
|
-
t instanceof
|
|
1175
|
+
t instanceof Ye && t.dirty != R && t.mark.type == e[a].type && t.spec.update && !this.isLocked(t.dom) && t.spec.update(e[a]) && (t.mark = e[a], i = this.index, this.changed = !0);
|
|
1165
1176
|
}
|
|
1166
1177
|
if (i > -1) i > this.index && (this.changed = !0, this.destroyBetween(this.index, i)), this.top = this.top.children[this.index];
|
|
1167
1178
|
else {
|
|
1168
|
-
let r =
|
|
1179
|
+
let r = Ye.create(this.top, e[a], t, n);
|
|
1169
1180
|
this.top.children.splice(this.index, 0, r), this.top = r, this.changed = !0;
|
|
1170
1181
|
}
|
|
1171
1182
|
this.index = 0, a++;
|
|
@@ -1185,7 +1196,7 @@ var it = class {
|
|
|
1185
1196
|
}
|
|
1186
1197
|
updateNodeAt(e, t, n, r, i) {
|
|
1187
1198
|
let a = this.top.children[r];
|
|
1188
|
-
return a.dirty ==
|
|
1199
|
+
return a.dirty == R && a.dom == a.contentDOM && (a.dirty = L), a.update(e, t, n, i) ? (this.destroyBetween(this.index, r), this.index++, !0) : !1;
|
|
1189
1200
|
}
|
|
1190
1201
|
findIndexWithChild(e) {
|
|
1191
1202
|
for (;;) {
|
|
@@ -1204,20 +1215,20 @@ var it = class {
|
|
|
1204
1215
|
updateNextNode(e, t, n, r, i, a) {
|
|
1205
1216
|
for (let o = this.index; o < this.top.children.length; o++) {
|
|
1206
1217
|
let s = this.top.children[o];
|
|
1207
|
-
if (s instanceof
|
|
1218
|
+
if (s instanceof z) {
|
|
1208
1219
|
let c = this.preMatch.matched.get(s);
|
|
1209
1220
|
if (c != null && c != i) return !1;
|
|
1210
|
-
let l = s.dom, u, d = this.isLocked(l) && !(e.isText && s.node && s.node.isText && s.nodeDOM.nodeValue == e.text && s.dirty !=
|
|
1221
|
+
let l = s.dom, u, d = this.isLocked(l) && !(e.isText && s.node && s.node.isText && s.nodeDOM.nodeValue == e.text && s.dirty != R && ot(t, s.outerDeco));
|
|
1211
1222
|
if (!d && s.update(e, t, n, r)) return this.destroyBetween(this.index, o), s.dom != l && (this.changed = !0), this.index++, !0;
|
|
1212
|
-
if (!d && (u = this.recreateWrapper(s, e, t, n, r, a))) return this.destroyBetween(this.index, o), this.top.children[this.index] = u, u.contentDOM && (u.dirty =
|
|
1223
|
+
if (!d && (u = this.recreateWrapper(s, e, t, n, r, a))) return this.destroyBetween(this.index, o), this.top.children[this.index] = u, u.contentDOM && (u.dirty = L, u.updateChildren(r, a + 1), u.dirty = I), this.changed = !0, this.index++, !0;
|
|
1213
1224
|
break;
|
|
1214
1225
|
}
|
|
1215
1226
|
}
|
|
1216
1227
|
return !1;
|
|
1217
1228
|
}
|
|
1218
1229
|
recreateWrapper(e, t, n, r, i, a) {
|
|
1219
|
-
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !
|
|
1220
|
-
let o =
|
|
1230
|
+
if (e.dirty || t.isAtom || !e.children.length || !e.node.content.eq(t.content) || !ot(n, e.outerDeco) || !r.eq(e.innerDeco)) return null;
|
|
1231
|
+
let o = z.create(this.top, t, n, r, i, a);
|
|
1221
1232
|
if (o.contentDOM) {
|
|
1222
1233
|
o.children = e.children, e.children = [];
|
|
1223
1234
|
for (let e of o.children) e.parent = o;
|
|
@@ -1225,42 +1236,42 @@ var it = class {
|
|
|
1225
1236
|
return e.destroy(), o;
|
|
1226
1237
|
}
|
|
1227
1238
|
addNode(e, t, n, r, i) {
|
|
1228
|
-
let a =
|
|
1239
|
+
let a = z.create(this.top, e, t, n, r, i);
|
|
1229
1240
|
a.contentDOM && a.updateChildren(r, i + 1), this.top.children.splice(this.index++, 0, a), this.changed = !0;
|
|
1230
1241
|
}
|
|
1231
1242
|
placeWidget(e, t, n) {
|
|
1232
1243
|
let r = this.index < this.top.children.length ? this.top.children[this.index] : null;
|
|
1233
1244
|
if (r && r.matchesWidget(e) && (e == r.widget || !r.widget.type.toDOM.parentNode)) this.index++;
|
|
1234
1245
|
else {
|
|
1235
|
-
let r = new
|
|
1246
|
+
let r = new qe(this.top, e, t, n);
|
|
1236
1247
|
this.top.children.splice(this.index++, 0, r), this.changed = !0;
|
|
1237
1248
|
}
|
|
1238
1249
|
}
|
|
1239
1250
|
addTextblockHacks() {
|
|
1240
1251
|
let e = this.top.children[this.index - 1], t = this.top;
|
|
1241
|
-
for (; e instanceof
|
|
1242
|
-
(!e || !(e instanceof
|
|
1252
|
+
for (; e instanceof Ye;) t = e, e = t.children[t.children.length - 1];
|
|
1253
|
+
(!e || !(e instanceof Ze) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((A || k) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
1243
1254
|
}
|
|
1244
1255
|
addHackNode(e, t) {
|
|
1245
1256
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e)) this.index++;
|
|
1246
1257
|
else {
|
|
1247
1258
|
let n = document.createElement(e);
|
|
1248
1259
|
e == "IMG" && (n.className = "ProseMirror-separator", n.alt = ""), e == "BR" && (n.className = "ProseMirror-trailingBreak");
|
|
1249
|
-
let r = new
|
|
1260
|
+
let r = new Qe(this.top, [], n, null);
|
|
1250
1261
|
t == this.top ? t.children.splice(this.index++, 0, r) : t.children.push(r), this.changed = !0;
|
|
1251
1262
|
}
|
|
1252
1263
|
}
|
|
1253
1264
|
isLocked(e) {
|
|
1254
|
-
return this.lock && (e == this.lock || e
|
|
1265
|
+
return this.lock && (e == this.lock || y(e) && e.contains(this.lock.parentNode));
|
|
1255
1266
|
}
|
|
1256
1267
|
};
|
|
1257
|
-
function
|
|
1268
|
+
function lt(e, t) {
|
|
1258
1269
|
let n = t, r = n.children.length, i = e.childCount, a = /* @__PURE__ */ new Map(), o = [];
|
|
1259
1270
|
outer: for (; i > 0;) {
|
|
1260
1271
|
let s;
|
|
1261
1272
|
for (;;) if (r) {
|
|
1262
1273
|
let e = n.children[r - 1];
|
|
1263
|
-
if (e instanceof
|
|
1274
|
+
if (e instanceof Ye) n = e, r = e.children.length;
|
|
1264
1275
|
else {
|
|
1265
1276
|
s = e, r--;
|
|
1266
1277
|
break;
|
|
@@ -1279,10 +1290,10 @@ function at(e, t) {
|
|
|
1279
1290
|
matches: o.reverse()
|
|
1280
1291
|
};
|
|
1281
1292
|
}
|
|
1282
|
-
function
|
|
1293
|
+
function ut(e, t) {
|
|
1283
1294
|
return e.type.side - t.type.side;
|
|
1284
1295
|
}
|
|
1285
|
-
function
|
|
1296
|
+
function dt(e, t, n, r) {
|
|
1286
1297
|
let i = t.locals(e), a = 0;
|
|
1287
1298
|
if (i.length == 0) {
|
|
1288
1299
|
for (let n = 0; n < e.childCount; n++) {
|
|
@@ -1300,7 +1311,7 @@ function st(e, t, n, r) {
|
|
|
1300
1311
|
}
|
|
1301
1312
|
if (u) {
|
|
1302
1313
|
if (d) {
|
|
1303
|
-
d.sort(
|
|
1314
|
+
d.sort(ut);
|
|
1304
1315
|
for (let e = 0; e < d.length; e++) n(d[e], l, !!c);
|
|
1305
1316
|
} else n(u, l, !!c);
|
|
1306
1317
|
}
|
|
@@ -1321,13 +1332,13 @@ function st(e, t, n, r) {
|
|
|
1321
1332
|
r(f, h, t.forChild(a, f), p), a = m;
|
|
1322
1333
|
}
|
|
1323
1334
|
}
|
|
1324
|
-
function
|
|
1335
|
+
function ft(e) {
|
|
1325
1336
|
if (e.nodeName == "UL" || e.nodeName == "OL") {
|
|
1326
1337
|
let t = e.style.cssText;
|
|
1327
1338
|
e.style.cssText = t + "; list-style: square !important", window.getComputedStyle(e).listStyle, e.style.cssText = t;
|
|
1328
1339
|
}
|
|
1329
1340
|
}
|
|
1330
|
-
function
|
|
1341
|
+
function pt(e, t, n, r) {
|
|
1331
1342
|
for (let i = 0, a = 0; i < e.childCount && a <= r;) {
|
|
1332
1343
|
let o = e.child(i++), s = a;
|
|
1333
1344
|
if (a += o.nodeSize, !o.isText) continue;
|
|
@@ -1346,7 +1357,7 @@ function lt(e, t, n, r) {
|
|
|
1346
1357
|
}
|
|
1347
1358
|
return -1;
|
|
1348
1359
|
}
|
|
1349
|
-
function
|
|
1360
|
+
function mt(e, t, n, r, i) {
|
|
1350
1361
|
let a = [];
|
|
1351
1362
|
for (let o = 0, s = 0; o < e.length; o++) {
|
|
1352
1363
|
let c = e[o], l = s, u = s += c.size;
|
|
@@ -1354,44 +1365,49 @@ function ut(e, t, n, r, i) {
|
|
|
1354
1365
|
}
|
|
1355
1366
|
return a;
|
|
1356
1367
|
}
|
|
1357
|
-
function
|
|
1358
|
-
let
|
|
1359
|
-
if (!
|
|
1360
|
-
let
|
|
1361
|
-
if (
|
|
1362
|
-
let
|
|
1363
|
-
if (
|
|
1364
|
-
for (
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1368
|
+
function ht(e, r = null) {
|
|
1369
|
+
let i = e.domSelectionRange(), a = e.state.doc;
|
|
1370
|
+
if (!i.focusNode) return null;
|
|
1371
|
+
let o = e.docView.nearestDesc(i.focusNode), s = o && o.size == 0, c = e.docView.posFromDOM(i.focusNode, i.focusOffset, 1);
|
|
1372
|
+
if (c < 0) return null;
|
|
1373
|
+
let l = a.resolve(c), u, d;
|
|
1374
|
+
if (ne(i)) {
|
|
1375
|
+
for (u = c; o && !o.node;) o = o.parent;
|
|
1376
|
+
if (o && o.node.isAtom && t.isSelectable(o.node) && o.parent && !(o.node.isInline && ee(i.focusNode, i.focusOffset, o.dom))) {
|
|
1377
|
+
let e = o.posBefore;
|
|
1378
|
+
d = new t(c == e ? l : a.resolve(e));
|
|
1379
|
+
} else if (O && r == "key" && c > e.state.selection.to && y(i.focusNode) && i.focusOffset == i.focusNode.childNodes.length && o && o.posAtStart > e.state.selection.to) for (let e = i.focusNode;; e = e.parentNode) {
|
|
1380
|
+
if (getComputedStyle(e).overflow != "visible") {
|
|
1381
|
+
d = n.findFrom(a.resolve(o.posAtStart), 1);
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
if (e == o.dom || e.nextSibling || !e.parentNode || !y(e.parentNode)) break;
|
|
1369
1385
|
}
|
|
1370
1386
|
} else {
|
|
1371
|
-
if (
|
|
1372
|
-
let t =
|
|
1373
|
-
for (let
|
|
1374
|
-
let a =
|
|
1387
|
+
if (i instanceof e.dom.ownerDocument.defaultView.Selection && i.rangeCount > 1) {
|
|
1388
|
+
let t = c, n = c;
|
|
1389
|
+
for (let r = 0; r < i.rangeCount; r++) {
|
|
1390
|
+
let a = i.getRangeAt(r);
|
|
1375
1391
|
t = Math.min(t, e.docView.posFromDOM(a.startContainer, a.startOffset, 1)), n = Math.max(n, e.docView.posFromDOM(a.endContainer, a.endOffset, -1));
|
|
1376
1392
|
}
|
|
1377
1393
|
if (t < 0) return null;
|
|
1378
|
-
[
|
|
1379
|
-
} else
|
|
1380
|
-
if (
|
|
1394
|
+
[u, c] = n == e.state.selection.anchor ? [n, t] : [t, n], l = a.resolve(c);
|
|
1395
|
+
} else u = e.docView.posFromDOM(i.anchorNode, i.anchorOffset, 1);
|
|
1396
|
+
if (u < 0) return null;
|
|
1381
1397
|
}
|
|
1382
|
-
let
|
|
1383
|
-
if (!
|
|
1384
|
-
let t =
|
|
1385
|
-
|
|
1398
|
+
let f = a.resolve(u);
|
|
1399
|
+
if (!d) {
|
|
1400
|
+
let t = r == "pointer" || e.state.selection.head < l.pos && !s ? 1 : -1;
|
|
1401
|
+
d = Tt(e, f, l, t);
|
|
1386
1402
|
}
|
|
1387
|
-
return
|
|
1403
|
+
return d;
|
|
1388
1404
|
}
|
|
1389
|
-
function
|
|
1390
|
-
return e.editable ? e.hasFocus() :
|
|
1405
|
+
function gt(e) {
|
|
1406
|
+
return e.editable ? e.hasFocus() : Dt(e) && document.activeElement && document.activeElement.contains(e.dom);
|
|
1391
1407
|
}
|
|
1392
|
-
function
|
|
1408
|
+
function V(e, t = !1) {
|
|
1393
1409
|
let n = e.state.selection;
|
|
1394
|
-
if (
|
|
1410
|
+
if (Ct(e, n), !gt(e)) return;
|
|
1395
1411
|
let i = e.input.mouseDown;
|
|
1396
1412
|
if (!t && k && i) {
|
|
1397
1413
|
let t = e.domSelectionRange(), n = e.domObserver.currentSelection;
|
|
@@ -1400,202 +1416,193 @@ function H(e, t = !1) {
|
|
|
1400
1416
|
return;
|
|
1401
1417
|
}
|
|
1402
1418
|
}
|
|
1403
|
-
if (e.domObserver.disconnectSelection(), e.cursorWrapper)
|
|
1419
|
+
if (e.domObserver.disconnectSelection(), e.cursorWrapper) St(e);
|
|
1404
1420
|
else {
|
|
1405
1421
|
let { anchor: i, head: a } = n, o, s;
|
|
1406
|
-
|
|
1422
|
+
_t && !(n instanceof r) && (n.$from.parent.inlineContent || (o = vt(e, n.from)), !n.empty && !n.$from.parent.inlineContent && (s = vt(e, n.to))), e.docView.setSelection(i, a, e, t), _t && (o && bt(o), s && bt(s)), n.visible ? e.dom.classList.remove("ProseMirror-hideselection") : (e.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && xt(e));
|
|
1407
1423
|
}
|
|
1408
1424
|
e.domObserver.setCurSelection(), e.domObserver.connectSelection();
|
|
1409
1425
|
}
|
|
1410
|
-
var
|
|
1411
|
-
function
|
|
1426
|
+
var _t = A || k && de < 63;
|
|
1427
|
+
function vt(e, t) {
|
|
1412
1428
|
let { node: n, offset: r } = e.docView.domFromPos(t, 0), i = r < n.childNodes.length ? n.childNodes[r] : null, a = r ? n.childNodes[r - 1] : null;
|
|
1413
|
-
if (A && i && i.contentEditable == "false") return
|
|
1429
|
+
if (A && i && i.contentEditable == "false") return yt(i);
|
|
1414
1430
|
if ((!i || i.contentEditable == "false") && (!a || a.contentEditable == "false")) {
|
|
1415
|
-
if (i) return
|
|
1416
|
-
if (a) return
|
|
1431
|
+
if (i) return yt(i);
|
|
1432
|
+
if (a) return yt(a);
|
|
1417
1433
|
}
|
|
1418
1434
|
}
|
|
1419
|
-
function
|
|
1435
|
+
function yt(e) {
|
|
1420
1436
|
return e.contentEditable = "true", A && e.draggable && (e.draggable = !1, e.wasDraggable = !0), e;
|
|
1421
1437
|
}
|
|
1422
|
-
function
|
|
1438
|
+
function bt(e) {
|
|
1423
1439
|
e.contentEditable = "false", e.wasDraggable &&= (e.draggable = !0, null);
|
|
1424
1440
|
}
|
|
1425
|
-
function
|
|
1441
|
+
function xt(e) {
|
|
1426
1442
|
let t = e.dom.ownerDocument;
|
|
1427
1443
|
t.removeEventListener("selectionchange", e.input.hideSelectionGuard);
|
|
1428
1444
|
let n = e.domSelectionRange(), r = n.anchorNode, i = n.anchorOffset;
|
|
1429
1445
|
t.addEventListener("selectionchange", e.input.hideSelectionGuard = () => {
|
|
1430
1446
|
(n.anchorNode != r || n.anchorOffset != i) && (t.removeEventListener("selectionchange", e.input.hideSelectionGuard), setTimeout(() => {
|
|
1431
|
-
(!
|
|
1447
|
+
(!gt(e) || e.state.selection.visible) && e.dom.classList.remove("ProseMirror-hideselection");
|
|
1432
1448
|
}, 20));
|
|
1433
1449
|
});
|
|
1434
1450
|
}
|
|
1435
|
-
function
|
|
1451
|
+
function St(e) {
|
|
1436
1452
|
let t = e.domSelection();
|
|
1437
1453
|
if (!t) return;
|
|
1438
1454
|
let n = e.cursorWrapper.dom, r = n.nodeName == "IMG";
|
|
1439
1455
|
r ? t.collapse(n.parentNode, u(n) + 1) : t.collapse(n, 0), !r && !e.state.selection.visible && E && D <= 11 && (n.disabled = !0, n.disabled = !1);
|
|
1440
1456
|
}
|
|
1441
|
-
function
|
|
1457
|
+
function Ct(e, n) {
|
|
1442
1458
|
if (n instanceof t) {
|
|
1443
1459
|
let t = e.docView.descAt(n.from);
|
|
1444
|
-
t != e.lastSelectedViewDesc && (
|
|
1445
|
-
} else
|
|
1460
|
+
t != e.lastSelectedViewDesc && (wt(e), t && t.selectNode(), e.lastSelectedViewDesc = t);
|
|
1461
|
+
} else wt(e);
|
|
1446
1462
|
}
|
|
1447
|
-
function
|
|
1463
|
+
function wt(e) {
|
|
1448
1464
|
e.lastSelectedViewDesc &&= (e.lastSelectedViewDesc.parent && e.lastSelectedViewDesc.deselectNode(), void 0);
|
|
1449
1465
|
}
|
|
1450
|
-
function
|
|
1466
|
+
function Tt(e, t, n, i) {
|
|
1451
1467
|
return e.someProp("createSelectionBetween", (r) => r(e, t, n)) || r.between(t, n, i);
|
|
1452
1468
|
}
|
|
1453
|
-
function
|
|
1454
|
-
return e.editable && !e.hasFocus() ? !1 :
|
|
1469
|
+
function Et(e) {
|
|
1470
|
+
return e.editable && !e.hasFocus() ? !1 : Dt(e);
|
|
1455
1471
|
}
|
|
1456
|
-
function
|
|
1472
|
+
function Dt(e) {
|
|
1457
1473
|
let t = e.domSelectionRange();
|
|
1458
1474
|
if (!t.anchorNode) return !1;
|
|
1459
1475
|
try {
|
|
1460
|
-
return e.dom
|
|
1476
|
+
return x(e.dom, t.anchorNode) && (e.editable || x(e.dom, t.focusNode));
|
|
1461
1477
|
} catch {
|
|
1462
1478
|
return !1;
|
|
1463
1479
|
}
|
|
1464
1480
|
}
|
|
1465
|
-
function
|
|
1481
|
+
function Ot(e) {
|
|
1466
1482
|
let t = e.docView.domFromPos(e.state.selection.anchor, 0), n = e.domSelectionRange();
|
|
1467
1483
|
return h(t.node, t.offset, n.anchorNode, n.anchorOffset);
|
|
1468
1484
|
}
|
|
1469
|
-
function
|
|
1485
|
+
function kt(e, t) {
|
|
1470
1486
|
let { $anchor: r, $head: i } = e.selection, a = t > 0 ? r.max(i) : r.min(i), o = a.parent.inlineContent ? a.depth ? e.doc.resolve(t > 0 ? a.after() : a.before()) : null : a;
|
|
1471
1487
|
return o && n.findFrom(o, t);
|
|
1472
1488
|
}
|
|
1473
|
-
function
|
|
1489
|
+
function H(e, t) {
|
|
1474
1490
|
return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()), !0;
|
|
1475
1491
|
}
|
|
1476
|
-
function
|
|
1492
|
+
function At(e, n, i) {
|
|
1477
1493
|
let a = e.state.selection;
|
|
1478
1494
|
if (a instanceof r) {
|
|
1479
1495
|
if (i.indexOf("s") > -1) {
|
|
1480
1496
|
let { $head: t } = a, i = t.textOffset ? null : n < 0 ? t.nodeBefore : t.nodeAfter;
|
|
1481
1497
|
if (!i || i.isText || !i.isLeaf) return !1;
|
|
1482
1498
|
let o = e.state.doc.resolve(t.pos + i.nodeSize * (n < 0 ? -1 : 1));
|
|
1483
|
-
return
|
|
1499
|
+
return H(e, new r(a.$anchor, o));
|
|
1484
1500
|
}
|
|
1485
1501
|
if (!a.empty) return !1;
|
|
1486
1502
|
if (e.endOfTextblock(n > 0 ? "forward" : "backward")) {
|
|
1487
|
-
let r =
|
|
1488
|
-
return r && r instanceof t ?
|
|
1503
|
+
let r = kt(e.state, n);
|
|
1504
|
+
return r && r instanceof t ? H(e, r) : !1;
|
|
1489
1505
|
}
|
|
1490
|
-
if (!
|
|
1506
|
+
if (!j || i.indexOf("m") < 0) {
|
|
1491
1507
|
let i = a.$head, o = i.textOffset ? null : n < 0 ? i.nodeBefore : i.nodeAfter, s;
|
|
1492
1508
|
if (!o || o.isText) return !1;
|
|
1493
1509
|
let c = n < 0 ? i.pos - o.nodeSize : i.pos;
|
|
1494
|
-
return o.isAtom || (s = e.docView.descAt(c)) && !s.contentDOM ? t.isSelectable(o) ?
|
|
1510
|
+
return o.isAtom || (s = e.docView.descAt(c)) && !s.contentDOM ? t.isSelectable(o) ? H(e, new t(n < 0 ? e.state.doc.resolve(i.pos - o.nodeSize) : i)) : H(e, new r(e.state.doc.resolve(n < 0 ? c : c + o.nodeSize))) : !1;
|
|
1495
1511
|
}
|
|
1496
|
-
} else if (a instanceof t && a.node.isInline) return
|
|
1512
|
+
} else if (a instanceof t && a.node.isInline) return H(e, new r(n > 0 ? a.$to : a.$from));
|
|
1497
1513
|
else {
|
|
1498
|
-
let t =
|
|
1499
|
-
return t ?
|
|
1514
|
+
let t = kt(e.state, n);
|
|
1515
|
+
return t ? H(e, t) : !1;
|
|
1500
1516
|
}
|
|
1501
1517
|
}
|
|
1502
|
-
function
|
|
1503
|
-
return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
|
|
1504
|
-
}
|
|
1505
|
-
function Ot(e, t) {
|
|
1518
|
+
function jt(e, t) {
|
|
1506
1519
|
let n = e.pmViewDesc;
|
|
1507
|
-
return n
|
|
1520
|
+
return n ? n.size == 0 && (t < 0 || e.nextSibling || e.nodeName != "BR") : y(e) && e.contentEditable == "false";
|
|
1508
1521
|
}
|
|
1509
|
-
function
|
|
1510
|
-
return t < 0 ?
|
|
1522
|
+
function U(e, t) {
|
|
1523
|
+
return t < 0 ? Mt(e) : Nt(e);
|
|
1511
1524
|
}
|
|
1512
|
-
function
|
|
1525
|
+
function Mt(e) {
|
|
1513
1526
|
let t = e.domSelectionRange(), n = t.focusNode, r = t.focusOffset;
|
|
1514
1527
|
if (!n) return;
|
|
1515
1528
|
let i, a, o = !1;
|
|
1516
|
-
for (O && n
|
|
1517
|
-
if (n
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
}
|
|
1524
|
-
} else if (jt(n)) break;
|
|
1529
|
+
for (O && y(n) && r < v(n) && jt(n.childNodes[r], -1) && (o = !0);;) if (r > 0) {
|
|
1530
|
+
if (!y(n)) break;
|
|
1531
|
+
let e = n.childNodes[r - 1];
|
|
1532
|
+
if (jt(e, -1)) i = n, a = --r;
|
|
1533
|
+
else if (b(e)) n = e, r = n.nodeValue.length;
|
|
1534
|
+
else break;
|
|
1535
|
+
} else if (Pt(n)) break;
|
|
1525
1536
|
else {
|
|
1526
1537
|
let t = n.previousSibling;
|
|
1527
|
-
for (; t &&
|
|
1528
|
-
if (t) n = t, r =
|
|
1538
|
+
for (; t && jt(t, -1);) i = n.parentNode, a = u(t), t = t.previousSibling;
|
|
1539
|
+
if (t) n = t, r = v(n);
|
|
1529
1540
|
else {
|
|
1530
1541
|
if (n = n.parentNode, n == e.dom) break;
|
|
1531
1542
|
r = 0;
|
|
1532
1543
|
}
|
|
1533
1544
|
}
|
|
1534
|
-
o ?
|
|
1545
|
+
o ? Lt(e, n, r) : i && Lt(e, i, a);
|
|
1535
1546
|
}
|
|
1536
|
-
function
|
|
1547
|
+
function Nt(e) {
|
|
1537
1548
|
let t = e.domSelectionRange(), n = t.focusNode, r = t.focusOffset;
|
|
1538
1549
|
if (!n) return;
|
|
1539
|
-
let i =
|
|
1550
|
+
let i = v(n), a, o;
|
|
1540
1551
|
for (;;) if (r < i) {
|
|
1541
|
-
if (n
|
|
1552
|
+
if (!y(n)) break;
|
|
1542
1553
|
let e = n.childNodes[r];
|
|
1543
|
-
if (
|
|
1554
|
+
if (jt(e, 1)) a = n, o = ++r;
|
|
1544
1555
|
else break;
|
|
1545
|
-
} else if (
|
|
1556
|
+
} else if (Pt(n)) break;
|
|
1546
1557
|
else {
|
|
1547
1558
|
let t = n.nextSibling;
|
|
1548
|
-
for (; t &&
|
|
1549
|
-
if (t) n = t, r = 0, i =
|
|
1559
|
+
for (; t && jt(t, 1);) a = t.parentNode, o = u(t) + 1, t = t.nextSibling;
|
|
1560
|
+
if (t) n = t, r = 0, i = v(n);
|
|
1550
1561
|
else {
|
|
1551
1562
|
if (n = n.parentNode, n == e.dom) break;
|
|
1552
1563
|
r = i = 0;
|
|
1553
1564
|
}
|
|
1554
1565
|
}
|
|
1555
|
-
a &&
|
|
1566
|
+
a && Lt(e, a, o);
|
|
1556
1567
|
}
|
|
1557
|
-
function
|
|
1568
|
+
function Pt(e) {
|
|
1558
1569
|
let t = e.pmViewDesc;
|
|
1559
1570
|
return t && t.node && t.node.isBlock;
|
|
1560
1571
|
}
|
|
1561
|
-
function
|
|
1562
|
-
for (; e && t == e.childNodes.length && !
|
|
1572
|
+
function Ft(e, t) {
|
|
1573
|
+
for (; e && t == e.childNodes.length && !te(e);) t = u(e) + 1, e = e.parentNode;
|
|
1563
1574
|
for (; e && t < e.childNodes.length;) {
|
|
1564
1575
|
let n = e.childNodes[t];
|
|
1565
|
-
if (n
|
|
1566
|
-
if (n
|
|
1576
|
+
if (b(n)) return n;
|
|
1577
|
+
if (y(n) && n.contentEditable == "false") break;
|
|
1567
1578
|
e = n, t = 0;
|
|
1568
1579
|
}
|
|
1569
1580
|
}
|
|
1570
|
-
function
|
|
1571
|
-
for (; e && !t && !
|
|
1581
|
+
function It(e, t) {
|
|
1582
|
+
for (; e && !t && !te(e);) t = u(e), e = e.parentNode;
|
|
1572
1583
|
for (; e && t;) {
|
|
1573
1584
|
let n = e.childNodes[t - 1];
|
|
1574
|
-
if (n
|
|
1575
|
-
if (n
|
|
1585
|
+
if (b(n)) return n;
|
|
1586
|
+
if (y(n) && n.contentEditable == "false") break;
|
|
1576
1587
|
e = n, t = e.childNodes.length;
|
|
1577
1588
|
}
|
|
1578
1589
|
}
|
|
1579
|
-
function
|
|
1580
|
-
if (t
|
|
1590
|
+
function Lt(e, t, n) {
|
|
1591
|
+
if (!b(t)) {
|
|
1581
1592
|
let e, r;
|
|
1582
|
-
(r =
|
|
1593
|
+
(r = Ft(t, n)) ? (t = r, n = 0) : (e = It(t, n)) && (t = e, n = e.nodeValue.length);
|
|
1583
1594
|
}
|
|
1584
|
-
let r = e.domSelection();
|
|
1595
|
+
let r = e.domSelection(), i = e.domSelectionRange();
|
|
1585
1596
|
if (!r) return;
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
e.setEnd(t, n), e.setStart(t, n), r.removeAllRanges(), r.addRange(e);
|
|
1589
|
-
} else r.extend && r.extend(t, n);
|
|
1590
|
-
e.domObserver.setCurSelection();
|
|
1591
|
-
let { state: i } = e;
|
|
1597
|
+
ne(i) ? r.collapse(t, n) : r.extend && (r.collapse(i.anchorNode, i.anchorOffset), r.extend(t, n)), e.domObserver.setCurSelection();
|
|
1598
|
+
let { state: a } = e;
|
|
1592
1599
|
setTimeout(() => {
|
|
1593
|
-
e.state ==
|
|
1600
|
+
e.state == a && V(e);
|
|
1594
1601
|
}, 50);
|
|
1595
1602
|
}
|
|
1596
|
-
function
|
|
1603
|
+
function Rt(e, t) {
|
|
1597
1604
|
let n = e.state.doc.resolve(t);
|
|
1598
|
-
if (!(k ||
|
|
1605
|
+
if (!(k || pe) && n.parent.inlineContent) {
|
|
1599
1606
|
let r = e.coordsAtPos(t);
|
|
1600
1607
|
if (t > n.start()) {
|
|
1601
1608
|
let n = e.coordsAtPos(t - 1), i = (n.top + n.bottom) / 2;
|
|
@@ -1606,23 +1613,28 @@ function Ft(e, t) {
|
|
|
1606
1613
|
if (i > r.top && i < r.bottom && Math.abs(n.left - r.left) > 1) return n.left > r.left ? "ltr" : "rtl";
|
|
1607
1614
|
}
|
|
1608
1615
|
}
|
|
1609
|
-
|
|
1616
|
+
let r = e.dom;
|
|
1617
|
+
for (let t = n.depth; t > 0; t--) if (n.node(t).isBlock) {
|
|
1618
|
+
r = e.nodeDOM(n.before(t)) || r;
|
|
1619
|
+
break;
|
|
1620
|
+
}
|
|
1621
|
+
return getComputedStyle(r).direction == "rtl" ? "rtl" : "ltr";
|
|
1610
1622
|
}
|
|
1611
|
-
function
|
|
1623
|
+
function zt(i, a, o) {
|
|
1612
1624
|
let s = i.state.selection;
|
|
1613
|
-
if (s instanceof r && !s.empty || o.indexOf("s") > -1 ||
|
|
1625
|
+
if (s instanceof r && !s.empty || o.indexOf("s") > -1 || j && o.indexOf("m") > -1) return !1;
|
|
1614
1626
|
let { $from: c, $to: l } = s;
|
|
1615
1627
|
if (!c.parent.inlineContent || i.endOfTextblock(a < 0 ? "up" : "down")) {
|
|
1616
|
-
let e =
|
|
1617
|
-
if (e && e instanceof t) return
|
|
1628
|
+
let e = kt(i.state, a);
|
|
1629
|
+
if (e && e instanceof t) return H(i, e);
|
|
1618
1630
|
}
|
|
1619
1631
|
if (!c.parent.inlineContent) {
|
|
1620
1632
|
let t = a < 0 ? c : l, r = s instanceof e ? n.near(t, a) : n.findFrom(t, a);
|
|
1621
|
-
return r ?
|
|
1633
|
+
return r ? H(i, r) : !1;
|
|
1622
1634
|
}
|
|
1623
1635
|
return !1;
|
|
1624
1636
|
}
|
|
1625
|
-
function
|
|
1637
|
+
function Bt(e, t) {
|
|
1626
1638
|
if (!(e.state.selection instanceof r)) return !0;
|
|
1627
1639
|
let { $head: n, $anchor: i, empty: a } = e.state.selection;
|
|
1628
1640
|
if (!n.sameParent(i)) return !0;
|
|
@@ -1635,38 +1647,38 @@ function Lt(e, t) {
|
|
|
1635
1647
|
}
|
|
1636
1648
|
return !1;
|
|
1637
1649
|
}
|
|
1638
|
-
function
|
|
1650
|
+
function Vt(e, t, n) {
|
|
1639
1651
|
e.domObserver.stop(), t.contentEditable = n, e.domObserver.start();
|
|
1640
1652
|
}
|
|
1641
|
-
function
|
|
1653
|
+
function Ht(e) {
|
|
1642
1654
|
if (!A || e.state.selection.$head.parentOffset > 0) return !1;
|
|
1643
1655
|
let { focusNode: t, focusOffset: n } = e.domSelectionRange();
|
|
1644
|
-
if (t && t
|
|
1656
|
+
if (t && y(t) && n == 0 && t.firstChild && y(t.firstChild) && t.firstChild.contentEditable == "false") {
|
|
1645
1657
|
let n = t.firstChild;
|
|
1646
|
-
|
|
1658
|
+
Vt(e, n, "true"), setTimeout(() => Vt(e, n, "false"), 20);
|
|
1647
1659
|
}
|
|
1648
1660
|
return !1;
|
|
1649
1661
|
}
|
|
1650
|
-
function
|
|
1662
|
+
function Ut(e) {
|
|
1651
1663
|
let t = "";
|
|
1652
1664
|
return e.ctrlKey && (t += "c"), e.metaKey && (t += "m"), e.altKey && (t += "a"), e.shiftKey && (t += "s"), t;
|
|
1653
1665
|
}
|
|
1654
|
-
function
|
|
1655
|
-
let n = t.keyCode, r =
|
|
1656
|
-
if (n == 8 ||
|
|
1657
|
-
if (n == 46 && !t.shiftKey ||
|
|
1666
|
+
function Wt(e, t) {
|
|
1667
|
+
let n = t.keyCode, r = Ut(t);
|
|
1668
|
+
if (n == 8 || j && n == 72 && r == "c") return Bt(e, -1) || U(e, -1);
|
|
1669
|
+
if (n == 46 && !t.shiftKey || j && n == 68 && r == "c") return Bt(e, 1) || U(e, 1);
|
|
1658
1670
|
if (n == 13 || n == 27) return !0;
|
|
1659
|
-
if (n == 37 ||
|
|
1660
|
-
let t = n == 37 ?
|
|
1661
|
-
return
|
|
1671
|
+
if (n == 37 || j && n == 66 && r == "c") {
|
|
1672
|
+
let t = n == 37 ? Rt(e, e.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
1673
|
+
return At(e, t, r) || U(e, t);
|
|
1662
1674
|
}
|
|
1663
|
-
if (n == 39 ||
|
|
1664
|
-
let t = n == 39 ?
|
|
1665
|
-
return
|
|
1675
|
+
if (n == 39 || j && n == 70 && r == "c") {
|
|
1676
|
+
let t = n == 39 ? Rt(e, e.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
1677
|
+
return At(e, t, r) || U(e, t);
|
|
1666
1678
|
}
|
|
1667
|
-
return n == 38 ||
|
|
1679
|
+
return n == 38 || j && n == 80 && r == "c" ? zt(e, -1, r) || U(e, -1) : n == 40 || j && n == 78 && r == "c" ? Ht(e) || zt(e, 1, r) || U(e, 1) : !(r != (j ? "m" : "c") || n != 66 && n != 73 && n != 89 && n != 90);
|
|
1668
1680
|
}
|
|
1669
|
-
function
|
|
1681
|
+
function Gt(e, t) {
|
|
1670
1682
|
e.someProp("transformCopied", (n) => {
|
|
1671
1683
|
t = n(t, e);
|
|
1672
1684
|
});
|
|
@@ -1676,10 +1688,10 @@ function Ht(e, t) {
|
|
|
1676
1688
|
let e = r.firstChild;
|
|
1677
1689
|
n.push(e.type.name, e.attrs == e.type.defaultAttrs ? null : e.attrs), r = e.content;
|
|
1678
1690
|
}
|
|
1679
|
-
let s = e.someProp("clipboardSerializer") || a.fromSchema(e.state.schema), c =
|
|
1691
|
+
let s = e.someProp("clipboardSerializer") || a.fromSchema(e.state.schema), c = tn(), l = c.createElement("div");
|
|
1680
1692
|
l.appendChild(s.serializeFragment(r, { document: c }));
|
|
1681
1693
|
let u = l.firstChild, d, f = 0;
|
|
1682
|
-
for (; u && u
|
|
1694
|
+
for (; u && y(u) && (d = en[u.nodeName.toLowerCase()]);) {
|
|
1683
1695
|
for (let e = d.length - 1; e >= 0; e--) {
|
|
1684
1696
|
let t = c.createElement(d[e]);
|
|
1685
1697
|
for (; l.firstChild;) t.appendChild(l.firstChild);
|
|
@@ -1687,13 +1699,13 @@ function Ht(e, t) {
|
|
|
1687
1699
|
}
|
|
1688
1700
|
u = l.firstChild;
|
|
1689
1701
|
}
|
|
1690
|
-
return u && u
|
|
1702
|
+
return u && y(u) && u.setAttribute("data-pm-slice", `${i} ${o}${f ? ` -${f}` : ""} ${JSON.stringify(n)}`), {
|
|
1691
1703
|
dom: l,
|
|
1692
1704
|
text: e.someProp("clipboardTextSerializer", (n) => n(t, e)) || t.content.textBetween(0, t.content.size, "\n\n"),
|
|
1693
1705
|
slice: t
|
|
1694
1706
|
};
|
|
1695
1707
|
}
|
|
1696
|
-
function
|
|
1708
|
+
function Kt(e, t, n, r, s) {
|
|
1697
1709
|
let l = s.parent.type.spec.code, u, d;
|
|
1698
1710
|
if (!n && !t) return null;
|
|
1699
1711
|
let f = !!t && (r || l || !n);
|
|
@@ -1714,11 +1726,11 @@ function Ut(e, t, n, r, s) {
|
|
|
1714
1726
|
}
|
|
1715
1727
|
} else e.someProp("transformPastedHTML", (t) => {
|
|
1716
1728
|
n = t(n, e);
|
|
1717
|
-
}), u =
|
|
1729
|
+
}), u = an(n), me && on(u);
|
|
1718
1730
|
let p = u && u.querySelector("[data-pm-slice]"), m = p && /^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute("data-pm-slice") || "");
|
|
1719
1731
|
if (m && m[3]) for (let e = +m[3]; e > 0; e--) {
|
|
1720
1732
|
let e = u.firstChild;
|
|
1721
|
-
for (; e && e
|
|
1733
|
+
for (; e && !y(e);) e = e.nextSibling;
|
|
1722
1734
|
if (!e) break;
|
|
1723
1735
|
u = e;
|
|
1724
1736
|
}
|
|
@@ -1726,21 +1738,21 @@ function Ut(e, t, n, r, s) {
|
|
|
1726
1738
|
preserveWhitespace: !!(f || m),
|
|
1727
1739
|
context: s,
|
|
1728
1740
|
ruleFromNode(e) {
|
|
1729
|
-
return e.nodeName == "BR" && !e.nextSibling && e.parentNode && !
|
|
1741
|
+
return e.nodeName == "BR" && !e.nextSibling && e.parentNode && !qt.test(e.parentNode.nodeName) ? { ignore: !0 } : null;
|
|
1730
1742
|
}
|
|
1731
|
-
}), m) d =
|
|
1732
|
-
else if (d = c.maxOpen(
|
|
1743
|
+
}), m) d = sn($t(d, +m[1], +m[2]), m[4]);
|
|
1744
|
+
else if (d = c.maxOpen(Jt(d.content, s), !0), d.openStart || d.openEnd) {
|
|
1733
1745
|
let e = 0, t = 0;
|
|
1734
1746
|
for (let t = d.content.firstChild; e < d.openStart && !t.type.spec.isolating; e++, t = t.firstChild);
|
|
1735
1747
|
for (let e = d.content.lastChild; t < d.openEnd && !e.type.spec.isolating; t++, e = e.lastChild);
|
|
1736
|
-
d =
|
|
1748
|
+
d = $t(d, e, t);
|
|
1737
1749
|
}
|
|
1738
1750
|
return e.someProp("transformPasted", (t) => {
|
|
1739
1751
|
d = t(d, e, f);
|
|
1740
1752
|
}), d;
|
|
1741
1753
|
}
|
|
1742
|
-
var
|
|
1743
|
-
function
|
|
1754
|
+
var qt = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
|
|
1755
|
+
function Jt(e, t) {
|
|
1744
1756
|
if (e.childCount < 2) return e;
|
|
1745
1757
|
for (let n = t.depth; n >= 0; n--) {
|
|
1746
1758
|
let r = t.node(n).contentMatchAt(t.index(n)), i, a = [];
|
|
@@ -1748,40 +1760,40 @@ function Gt(e, t) {
|
|
|
1748
1760
|
if (!a) return;
|
|
1749
1761
|
let t = r.findWrapping(e.type), n;
|
|
1750
1762
|
if (!t) return a = null;
|
|
1751
|
-
if (n = a.length && i.length &&
|
|
1763
|
+
if (n = a.length && i.length && Xt(t, i, e, a[a.length - 1], 0)) a[a.length - 1] = n;
|
|
1752
1764
|
else {
|
|
1753
|
-
a.length && (a[a.length - 1] =
|
|
1754
|
-
let n =
|
|
1765
|
+
a.length && (a[a.length - 1] = Zt(a[a.length - 1], i.length));
|
|
1766
|
+
let n = Yt(e, t);
|
|
1755
1767
|
a.push(n), r = r.matchType(n.type), i = t;
|
|
1756
1768
|
}
|
|
1757
1769
|
}), a) return o.from(a);
|
|
1758
1770
|
}
|
|
1759
1771
|
return e;
|
|
1760
1772
|
}
|
|
1761
|
-
function
|
|
1773
|
+
function Yt(e, t, n = 0) {
|
|
1762
1774
|
for (let r = t.length - 1; r >= n; r--) e = t[r].create(null, o.from(e));
|
|
1763
1775
|
return e;
|
|
1764
1776
|
}
|
|
1765
|
-
function
|
|
1777
|
+
function Xt(e, t, n, r, i) {
|
|
1766
1778
|
if (i < e.length && i < t.length && e[i] == t[i]) {
|
|
1767
|
-
let a =
|
|
1779
|
+
let a = Xt(e, t, n, r.lastChild, i + 1);
|
|
1768
1780
|
if (a) return r.copy(r.content.replaceChild(r.childCount - 1, a));
|
|
1769
|
-
if (r.contentMatchAt(r.childCount).matchType(i == e.length - 1 ? n.type : e[i + 1])) return r.copy(r.content.append(o.from(
|
|
1781
|
+
if (r.contentMatchAt(r.childCount).matchType(i == e.length - 1 ? n.type : e[i + 1])) return r.copy(r.content.append(o.from(Yt(n, e, i + 1))));
|
|
1770
1782
|
}
|
|
1771
1783
|
}
|
|
1772
|
-
function
|
|
1784
|
+
function Zt(e, t) {
|
|
1773
1785
|
if (t == 0) return e;
|
|
1774
|
-
let n = e.content.replaceChild(e.childCount - 1,
|
|
1786
|
+
let n = e.content.replaceChild(e.childCount - 1, Zt(e.lastChild, t - 1)), r = e.contentMatchAt(e.childCount).fillBefore(o.empty, !0);
|
|
1775
1787
|
return e.copy(n.append(r));
|
|
1776
1788
|
}
|
|
1777
|
-
function
|
|
1789
|
+
function Qt(e, t, n, r, i, a) {
|
|
1778
1790
|
let s = t < 0 ? e.firstChild : e.lastChild, c = s.content;
|
|
1779
|
-
return e.childCount > 1 && (a = 0), i < r - 1 && (c =
|
|
1791
|
+
return e.childCount > 1 && (a = 0), i < r - 1 && (c = Qt(c, t, n, r, i + 1, a)), i >= n && (c = t < 0 ? s.contentMatchAt(0).fillBefore(c, a <= i).append(c) : c.append(s.contentMatchAt(s.childCount).fillBefore(o.empty, !0))), e.replaceChild(t < 0 ? 0 : e.childCount - 1, s.copy(c));
|
|
1780
1792
|
}
|
|
1781
|
-
function
|
|
1782
|
-
return t < e.openStart && (e = new c(
|
|
1793
|
+
function $t(e, t, n) {
|
|
1794
|
+
return t < e.openStart && (e = new c(Qt(e.content, -1, t, e.openStart, 0, e.openEnd), t, e.openEnd)), n < e.openEnd && (e = new c(Qt(e.content, 1, n, e.openEnd, 0, 0), e.openStart, n)), e;
|
|
1783
1795
|
}
|
|
1784
|
-
var
|
|
1796
|
+
var en = {
|
|
1785
1797
|
thead: ["table"],
|
|
1786
1798
|
tbody: ["table"],
|
|
1787
1799
|
tfoot: ["table"],
|
|
@@ -1800,26 +1812,26 @@ var Zt = {
|
|
|
1800
1812
|
"tr"
|
|
1801
1813
|
]
|
|
1802
1814
|
};
|
|
1803
|
-
function
|
|
1815
|
+
function tn() {
|
|
1804
1816
|
return document.implementation.createHTMLDocument("title");
|
|
1805
1817
|
}
|
|
1806
|
-
var
|
|
1807
|
-
function
|
|
1818
|
+
var nn = null;
|
|
1819
|
+
function rn(e) {
|
|
1808
1820
|
let t = window.trustedTypes;
|
|
1809
1821
|
if (!t) return e;
|
|
1810
|
-
if (
|
|
1811
|
-
if (
|
|
1812
|
-
return
|
|
1822
|
+
if (!nn) {
|
|
1823
|
+
if (nn = t.defaultPolicy) try {
|
|
1824
|
+
return nn.createHTML(e);
|
|
1813
1825
|
} catch {}
|
|
1814
|
-
|
|
1826
|
+
nn = t.createPolicy("ProseMirrorClipboard", { createHTML: (e) => e });
|
|
1815
1827
|
}
|
|
1816
|
-
return
|
|
1828
|
+
return nn.createHTML(e);
|
|
1817
1829
|
}
|
|
1818
|
-
function
|
|
1830
|
+
function an(e) {
|
|
1819
1831
|
let t = /^(\s*<meta [^>]*>)*/.exec(e);
|
|
1820
1832
|
t && (e = e.slice(t[0].length));
|
|
1821
|
-
let n =
|
|
1822
|
-
if ((a = i &&
|
|
1833
|
+
let n = tn(), r = n.body, i = /<([a-z][^>\s]+)/i.exec(e), a;
|
|
1834
|
+
if ((a = i && en[i[1].toLowerCase()]) && (e = a.map((e) => "<" + e + ">").join("") + e + a.map((e) => "</" + e + ">").reverse().join("")), r.innerHTML = rn(e), a) for (let e = 0; e < a.length; e++) r = r.querySelector(a[e]) || r;
|
|
1823
1835
|
for (let e = 0; e < n.styleSheets.length; e++) {
|
|
1824
1836
|
let t = n.styleSheets[e];
|
|
1825
1837
|
for (let e = 0; e < t.rules.length; e++) {
|
|
@@ -1832,14 +1844,14 @@ function tn(e) {
|
|
|
1832
1844
|
}
|
|
1833
1845
|
return r;
|
|
1834
1846
|
}
|
|
1835
|
-
function
|
|
1847
|
+
function on(e) {
|
|
1836
1848
|
let t = e.querySelectorAll(k ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
1837
1849
|
for (let n = 0; n < t.length; n++) {
|
|
1838
1850
|
let r = t[n];
|
|
1839
1851
|
r.childNodes.length == 1 && r.textContent == "\xA0" && r.parentNode && r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "), r);
|
|
1840
1852
|
}
|
|
1841
1853
|
}
|
|
1842
|
-
function
|
|
1854
|
+
function sn(e, t) {
|
|
1843
1855
|
if (!e.size) return e;
|
|
1844
1856
|
let n = e.content.firstChild.type.schema, r;
|
|
1845
1857
|
try {
|
|
@@ -1852,20 +1864,20 @@ function rn(e, t) {
|
|
|
1852
1864
|
let t = n.nodes[r[e]];
|
|
1853
1865
|
if (!t || t.hasRequiredAttrs()) break;
|
|
1854
1866
|
try {
|
|
1855
|
-
t.
|
|
1867
|
+
i = o.from(t.create(r[e + 1], i));
|
|
1856
1868
|
} catch {
|
|
1857
1869
|
break;
|
|
1858
1870
|
}
|
|
1859
|
-
|
|
1871
|
+
a++, s++;
|
|
1860
1872
|
}
|
|
1861
1873
|
return new c(i, a, s);
|
|
1862
1874
|
}
|
|
1863
|
-
var
|
|
1875
|
+
var W = {}, G = {}, cn = {
|
|
1864
1876
|
touchstart: !0,
|
|
1865
1877
|
touchmove: !0
|
|
1866
|
-
},
|
|
1878
|
+
}, ln = class {
|
|
1867
1879
|
constructor() {
|
|
1868
|
-
this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastClick = {
|
|
1880
|
+
this.shiftKey = !1, this.mouseDown = null, this.lastKeyCode = null, this.lastKeyCodeTime = 0, this.lastKeyDispatched = !1, this.lastClick = {
|
|
1869
1881
|
time: 0,
|
|
1870
1882
|
x: 0,
|
|
1871
1883
|
y: 0,
|
|
@@ -1874,58 +1886,62 @@ var G = {}, K = {}, an = {
|
|
|
1874
1886
|
}, this.lastSelectionOrigin = null, this.lastSelectionTime = 0, this.lastIOSEnter = 0, this.lastIOSEnterFallbackTimeout = -1, this.lastFocus = 0, this.lastTouch = 0, this.lastChromeDelete = 0, this.composing = !1, this.compositionNode = null, this.composingTimeout = -1, this.compositionNodes = [], this.compositionEndedAt = -2e8, this.compositionID = 1, this.badSafariComposition = !1, this.compositionPendingChanges = 0, this.domChangeCount = 0, this.eventHandlers = Object.create(null), this.hideSelectionGuard = null;
|
|
1875
1887
|
}
|
|
1876
1888
|
};
|
|
1877
|
-
function
|
|
1878
|
-
for (let t in
|
|
1879
|
-
let n =
|
|
1889
|
+
function un(e) {
|
|
1890
|
+
for (let t in W) {
|
|
1891
|
+
let n = W[t];
|
|
1880
1892
|
e.dom.addEventListener(t, e.input.eventHandlers[t] = (t) => {
|
|
1881
|
-
|
|
1882
|
-
},
|
|
1893
|
+
mn(e, t) && !pn(e, t) && (e.editable || !(t.type in G)) && n(e, t);
|
|
1894
|
+
}, cn[t] ? { passive: !0 } : void 0);
|
|
1883
1895
|
}
|
|
1884
|
-
A && e.dom.addEventListener("input", () => null),
|
|
1896
|
+
A && e.dom.addEventListener("input", () => null), fn(e);
|
|
1885
1897
|
}
|
|
1886
|
-
function
|
|
1898
|
+
function K(e, t) {
|
|
1887
1899
|
e.input.lastSelectionOrigin = t, e.input.lastSelectionTime = Date.now();
|
|
1888
1900
|
}
|
|
1889
|
-
function
|
|
1901
|
+
function dn(e) {
|
|
1890
1902
|
e.input.mouseDown && e.input.mouseDown.done(), e.domObserver.stop();
|
|
1891
1903
|
for (let t in e.input.eventHandlers) e.dom.removeEventListener(t, e.input.eventHandlers[t]);
|
|
1892
1904
|
clearTimeout(e.input.composingTimeout), clearTimeout(e.input.lastIOSEnterFallbackTimeout);
|
|
1893
1905
|
}
|
|
1894
|
-
function
|
|
1906
|
+
function fn(e) {
|
|
1895
1907
|
e.someProp("handleDOMEvents", (t) => {
|
|
1896
|
-
for (let n in t) e.input.eventHandlers[n] || e.dom.addEventListener(n, e.input.eventHandlers[n] = (t) =>
|
|
1908
|
+
for (let n in t) e.input.eventHandlers[n] || e.dom.addEventListener(n, e.input.eventHandlers[n] = (t) => pn(e, t));
|
|
1897
1909
|
});
|
|
1898
1910
|
}
|
|
1899
|
-
function
|
|
1911
|
+
function pn(e, t) {
|
|
1900
1912
|
return e.someProp("handleDOMEvents", (n) => {
|
|
1901
1913
|
let r = n[t.type];
|
|
1902
1914
|
return r ? r(e, t) || t.defaultPrevented : !1;
|
|
1903
1915
|
});
|
|
1904
1916
|
}
|
|
1905
|
-
function
|
|
1917
|
+
function mn(e, t) {
|
|
1906
1918
|
if (!t.bubbles) return !0;
|
|
1907
1919
|
if (t.defaultPrevented) return !1;
|
|
1908
1920
|
for (let n = t.target; n != e.dom; n = n.parentNode) if (!n || n.nodeType == 11 || n.pmViewDesc && n.pmViewDesc.stopEvent(t)) return !1;
|
|
1909
1921
|
return !0;
|
|
1910
1922
|
}
|
|
1911
|
-
function
|
|
1912
|
-
!
|
|
1923
|
+
function hn(e, t) {
|
|
1924
|
+
!pn(e, t) && W[t.type] && (e.editable || !(t.type in G)) && W[t.type](e, t);
|
|
1925
|
+
}
|
|
1926
|
+
function q(e, t) {
|
|
1927
|
+
let { input: n } = e;
|
|
1928
|
+
return n.lastKeyDispatched || e.composing ? !1 : (n.lastKeyDispatched = !0, typeof t == "string" && (t = re(t == "Backspace" ? 8 : 13, t)), e.someProp("handleKeyDown", (n) => n(e, t)));
|
|
1913
1929
|
}
|
|
1914
|
-
|
|
1930
|
+
G.keydown = (e, t) => {
|
|
1915
1931
|
let n = t;
|
|
1916
|
-
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !
|
|
1917
|
-
if (n.keyCode != 229 && e.domObserver.forceFlush(),
|
|
1932
|
+
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !Mn(e) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), e.input.lastKeyDispatched = !1, !(M && k && n.keyCode == 13))) {
|
|
1933
|
+
if (n.keyCode != 229 && e.domObserver.forceFlush(), fe && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
|
|
1918
1934
|
let t = Date.now();
|
|
1919
1935
|
e.input.lastIOSEnter = t, e.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
1920
|
-
e.input.lastIOSEnter == t && (
|
|
1936
|
+
e.input.lastIOSEnter == t && (q(e, "Enter"), e.input.lastIOSEnter = 0);
|
|
1921
1937
|
}, 200);
|
|
1922
|
-
} else
|
|
1938
|
+
} else q(e, n) || Wt(e, n) ? n.preventDefault() : K(e, "key");
|
|
1923
1939
|
}
|
|
1924
|
-
},
|
|
1940
|
+
}, G.keyup = (e, t) => {
|
|
1925
1941
|
t.keyCode == 16 && (e.input.shiftKey = !1);
|
|
1926
|
-
},
|
|
1942
|
+
}, G.keypress = (e, t) => {
|
|
1927
1943
|
let n = t;
|
|
1928
|
-
if (
|
|
1944
|
+
if (Mn(e) || !n.charCode || n.ctrlKey && !n.altKey || j && n.metaKey) return;
|
|
1929
1945
|
if (e.someProp("handleKeyPress", (t) => t(e, n))) {
|
|
1930
1946
|
n.preventDefault();
|
|
1931
1947
|
return;
|
|
@@ -1936,33 +1952,33 @@ K.keydown = (e, t) => {
|
|
|
1936
1952
|
!/[\r\n]/.test(t) && !e.someProp("handleTextInput", (n) => n(e, i.$from.pos, i.$to.pos, t, r)) && e.dispatch(r()), n.preventDefault();
|
|
1937
1953
|
}
|
|
1938
1954
|
};
|
|
1939
|
-
function
|
|
1955
|
+
function gn(e) {
|
|
1940
1956
|
return {
|
|
1941
1957
|
left: e.clientX,
|
|
1942
1958
|
top: e.clientY
|
|
1943
1959
|
};
|
|
1944
1960
|
}
|
|
1945
|
-
function
|
|
1961
|
+
function _n(e, t) {
|
|
1946
1962
|
let n = t.x - e.clientX, r = t.y - e.clientY;
|
|
1947
1963
|
return n * n + r * r < 100;
|
|
1948
1964
|
}
|
|
1949
|
-
function
|
|
1965
|
+
function vn(e, t, n, r, i) {
|
|
1950
1966
|
if (r == -1) return !1;
|
|
1951
1967
|
let a = e.state.doc.resolve(r);
|
|
1952
1968
|
for (let r = a.depth + 1; r > 0; r--) if (e.someProp(t, (t) => r > a.depth ? t(e, n, a.nodeAfter, a.before(r), i, !0) : t(e, n, a.node(r), a.before(r), i, !1))) return !0;
|
|
1953
1969
|
return !1;
|
|
1954
1970
|
}
|
|
1955
|
-
function
|
|
1971
|
+
function yn(e, t, n) {
|
|
1956
1972
|
if (e.focused || e.focus(), e.state.selection.eq(t)) return;
|
|
1957
1973
|
let r = e.state.tr.setSelection(t);
|
|
1958
|
-
|
|
1974
|
+
r.setMeta("pointer", !0), e.dispatch(r);
|
|
1959
1975
|
}
|
|
1960
|
-
function
|
|
1976
|
+
function bn(e, n) {
|
|
1961
1977
|
if (n == -1) return !1;
|
|
1962
1978
|
let r = e.state.doc.resolve(n), i = r.nodeAfter;
|
|
1963
|
-
return i && i.isAtom && t.isSelectable(i) ? (
|
|
1979
|
+
return i && i.isAtom && t.isSelectable(i) ? (yn(e, new t(r)), !0) : !1;
|
|
1964
1980
|
}
|
|
1965
|
-
function
|
|
1981
|
+
function xn(e, n) {
|
|
1966
1982
|
if (n == -1) return !1;
|
|
1967
1983
|
let r = e.state.selection, i, a;
|
|
1968
1984
|
r instanceof t && (i = r.node);
|
|
@@ -1974,23 +1990,23 @@ function vn(e, n) {
|
|
|
1974
1990
|
break;
|
|
1975
1991
|
}
|
|
1976
1992
|
}
|
|
1977
|
-
return a != null && (
|
|
1993
|
+
return a != null && (yn(e, t.create(e.state.doc, a)), !0);
|
|
1978
1994
|
}
|
|
1979
|
-
function
|
|
1980
|
-
return
|
|
1995
|
+
function Sn(e, t, n, r, i) {
|
|
1996
|
+
return vn(e, "handleClickOn", t, n, r) || e.someProp("handleClick", (n) => n(e, t, r)) || (i ? xn(e, n) : bn(e, n));
|
|
1981
1997
|
}
|
|
1982
|
-
function
|
|
1983
|
-
return
|
|
1998
|
+
function Cn(e, t, n, r) {
|
|
1999
|
+
return vn(e, "handleDoubleClickOn", t, n, r) || e.someProp("handleDoubleClick", (n) => n(e, t, r));
|
|
1984
2000
|
}
|
|
1985
|
-
function
|
|
1986
|
-
return
|
|
2001
|
+
function wn(e, t, n, r) {
|
|
2002
|
+
return vn(e, "handleTripleClickOn", t, n, r) || e.someProp("handleTripleClick", (n) => n(e, t, r)) || Tn(e, n, r);
|
|
1987
2003
|
}
|
|
1988
|
-
function
|
|
2004
|
+
function Tn(e, t, n) {
|
|
1989
2005
|
if (n.button != 0) return !1;
|
|
1990
|
-
let i =
|
|
1991
|
-
return i ? (
|
|
2006
|
+
let i = En(e, t, !0), a = e.state.doc;
|
|
2007
|
+
return i ? (yn(e, i), i instanceof r && a.eq(e.state.doc) && (e.input.mouseDown = new jn(e, i)), !0) : !1;
|
|
1992
2008
|
}
|
|
1993
|
-
function
|
|
2009
|
+
function En(e, n, i) {
|
|
1994
2010
|
let a = e.state.doc;
|
|
1995
2011
|
if (n == -1) return a.inlineContent ? r.create(a, 0, a.content.size) : null;
|
|
1996
2012
|
let o = a.resolve(n);
|
|
@@ -2001,25 +2017,25 @@ function Cn(e, n, i) {
|
|
|
2001
2017
|
}
|
|
2002
2018
|
return null;
|
|
2003
2019
|
}
|
|
2004
|
-
function
|
|
2005
|
-
return
|
|
2020
|
+
function Dn(e) {
|
|
2021
|
+
return Rn(e);
|
|
2006
2022
|
}
|
|
2007
|
-
var
|
|
2008
|
-
|
|
2023
|
+
var On = j ? "metaKey" : "ctrlKey";
|
|
2024
|
+
W.mousedown = (e, t) => {
|
|
2009
2025
|
let n = t;
|
|
2010
2026
|
e.input.shiftKey = n.shiftKey;
|
|
2011
|
-
let r =
|
|
2012
|
-
i - e.input.lastClick.time < 500 &&
|
|
2027
|
+
let r = Dn(e), i = Date.now(), a = "singleClick";
|
|
2028
|
+
i - e.input.lastClick.time < 500 && _n(n, e.input.lastClick) && !n[On] && e.input.lastClick.button == n.button && (e.input.lastClick.type == "singleClick" ? a = "doubleClick" : e.input.lastClick.type == "doubleClick" && (a = "tripleClick")), e.input.lastClick = {
|
|
2013
2029
|
time: i,
|
|
2014
2030
|
x: n.clientX,
|
|
2015
2031
|
y: n.clientY,
|
|
2016
2032
|
type: a,
|
|
2017
2033
|
button: n.button
|
|
2018
2034
|
}, e.input.mouseDown && e.input.mouseDown.done();
|
|
2019
|
-
let o = e.posAtCoords(
|
|
2020
|
-
o && (a == "singleClick" ? e.input.mouseDown = new
|
|
2035
|
+
let o = e.posAtCoords(gn(n));
|
|
2036
|
+
o && (a == "singleClick" ? e.input.mouseDown = new An(e, o, n, !!r) : (a == "doubleClick" ? Cn : wn)(e, o.pos, o.inside, n) ? n.preventDefault() : K(e, "pointer"));
|
|
2021
2037
|
};
|
|
2022
|
-
var
|
|
2038
|
+
var kn = class {
|
|
2023
2039
|
constructor(e) {
|
|
2024
2040
|
this.view = e, this.mightDrag = null, e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this));
|
|
2025
2041
|
}
|
|
@@ -2035,9 +2051,9 @@ var En = class {
|
|
|
2035
2051
|
delaySelUpdate() {
|
|
2036
2052
|
return !1;
|
|
2037
2053
|
}
|
|
2038
|
-
},
|
|
2054
|
+
}, An = class extends kn {
|
|
2039
2055
|
constructor(e, n, r, i) {
|
|
2040
|
-
super(e), this.pos = n, this.event = r, this.flushed = i, this.delayedSelectionSync = !1, this.startDoc = e.state.doc, this.selectNode = !!r[
|
|
2056
|
+
super(e), this.pos = n, this.event = r, this.flushed = i, this.delayedSelectionSync = !1, this.startDoc = e.state.doc, this.selectNode = !!r[On], this.allowDefault = r.shiftKey;
|
|
2041
2057
|
let a, o;
|
|
2042
2058
|
if (n.inside > -1) a = e.state.doc.nodeAt(n.inside), o = n.inside;
|
|
2043
2059
|
else {
|
|
@@ -2045,7 +2061,7 @@ var En = class {
|
|
|
2045
2061
|
a = t.parent, o = t.depth ? t.before() : 0;
|
|
2046
2062
|
}
|
|
2047
2063
|
let s = i ? null : r.target, c = s ? e.docView.nearestDesc(s, !0) : null;
|
|
2048
|
-
this.target = c && c.nodeDOM
|
|
2064
|
+
this.target = c && y(c.nodeDOM) ? c.nodeDOM : null;
|
|
2049
2065
|
let { selection: l } = e.state;
|
|
2050
2066
|
r.button == 0 && (a.type.spec.draggable && a.type.spec.selectable !== !1 || l instanceof t && l.from <= o && l.to > o) && (this.mightDrag = {
|
|
2051
2067
|
node: a,
|
|
@@ -2054,20 +2070,20 @@ var En = class {
|
|
|
2054
2070
|
setUneditable: !!(this.target && O && !this.target.hasAttribute("contentEditable"))
|
|
2055
2071
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
2056
2072
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
2057
|
-
}, 20), this.view.domObserver.start()),
|
|
2073
|
+
}, 20), this.view.domObserver.start()), K(e, "pointer");
|
|
2058
2074
|
}
|
|
2059
2075
|
done() {
|
|
2060
2076
|
super.done(), this.mightDrag && this.target && (this.view.domObserver.stop(), this.mightDrag.addAttr && this.target.removeAttribute("draggable"), this.mightDrag.setUneditable && this.target.removeAttribute("contentEditable"), this.view.domObserver.start()), this.delayedSelectionSync && setTimeout(() => {
|
|
2061
|
-
this.view.isDestroyed ||
|
|
2077
|
+
this.view.isDestroyed || V(this.view);
|
|
2062
2078
|
});
|
|
2063
2079
|
}
|
|
2064
2080
|
up(e) {
|
|
2065
2081
|
if (this.done(), !this.view.dom.contains(e.target)) return;
|
|
2066
2082
|
let t = this.pos;
|
|
2067
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(
|
|
2083
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(gn(e))), this.updateAllowDefault(e), this.allowDefault || !t ? K(this.view, "pointer") : Sn(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || A && this.mightDrag && !this.mightDrag.node.isAtom || k && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (yn(this.view, n.near(this.view.state.doc.resolve(t.pos))), e.preventDefault()) : K(this.view, "pointer");
|
|
2068
2084
|
}
|
|
2069
2085
|
move(e) {
|
|
2070
|
-
this.updateAllowDefault(e),
|
|
2086
|
+
this.updateAllowDefault(e), K(this.view, "pointer"), super.move(e);
|
|
2071
2087
|
}
|
|
2072
2088
|
updateAllowDefault(e) {
|
|
2073
2089
|
!this.allowDefault && (Math.abs(this.event.x - e.clientX) > 4 || Math.abs(this.event.y - e.clientY) > 4) && (this.allowDefault = !0);
|
|
@@ -2075,7 +2091,7 @@ var En = class {
|
|
|
2075
2091
|
delaySelUpdate() {
|
|
2076
2092
|
return this.allowDefault ? (this.delayedSelectionSync = !0, !0) : !1;
|
|
2077
2093
|
}
|
|
2078
|
-
},
|
|
2094
|
+
}, jn = class extends kn {
|
|
2079
2095
|
constructor(e, t) {
|
|
2080
2096
|
super(e), this.startSelection = t, this.startDoc = e.state.doc;
|
|
2081
2097
|
}
|
|
@@ -2084,33 +2100,33 @@ var En = class {
|
|
|
2084
2100
|
this.done();
|
|
2085
2101
|
return;
|
|
2086
2102
|
}
|
|
2087
|
-
e.preventDefault(),
|
|
2088
|
-
let t = this.view.posAtCoords(
|
|
2103
|
+
e.preventDefault(), K(this.view, "pointer");
|
|
2104
|
+
let t = this.view.posAtCoords(gn(e)), n = t && En(this.view, t.inside, !1);
|
|
2089
2105
|
if (!n) return;
|
|
2090
2106
|
let { doc: i } = this.view.state, a = this.startSelection, [o, s] = n.from < a.from ? [a.to, n.from] : [a.from, n.to];
|
|
2091
|
-
|
|
2107
|
+
yn(this.view, r.create(i, o, s));
|
|
2092
2108
|
}
|
|
2093
2109
|
};
|
|
2094
|
-
|
|
2095
|
-
e.input.lastTouch = Date.now(),
|
|
2096
|
-
},
|
|
2097
|
-
e.input.lastTouch = Date.now(),
|
|
2098
|
-
},
|
|
2099
|
-
function
|
|
2110
|
+
W.touchstart = (e) => {
|
|
2111
|
+
e.input.lastTouch = Date.now(), Dn(e), K(e, "pointer");
|
|
2112
|
+
}, W.touchmove = (e) => {
|
|
2113
|
+
e.input.lastTouch = Date.now(), K(e, "pointer");
|
|
2114
|
+
}, W.contextmenu = (e) => Dn(e);
|
|
2115
|
+
function Mn(e, t) {
|
|
2100
2116
|
return e.composing ? !0 : A && Math.abs(Date.now() - e.input.compositionEndedAt) < 500 ? (e.input.compositionEndedAt = -2e8, !0) : !1;
|
|
2101
2117
|
}
|
|
2102
|
-
var
|
|
2103
|
-
|
|
2118
|
+
var Nn = M ? 5e3 : -1;
|
|
2119
|
+
G.compositionstart = G.compositionupdate = (e) => {
|
|
2104
2120
|
if (!e.composing) {
|
|
2105
2121
|
e.domObserver.flush();
|
|
2106
2122
|
let { state: t } = e, n = t.selection.$to;
|
|
2107
|
-
if (t.selection instanceof r && (t.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((e) => e.type.spec.inclusive === !1) || k &&
|
|
2108
|
-
else if (
|
|
2123
|
+
if (t.selection instanceof r && t.selection.empty && (t.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((e) => e.type.spec.inclusive === !1) || k && pe && Pn(e))) e.markCursor = e.state.storedMarks || n.marks(), Rn(e, !0), e.markCursor = null;
|
|
2124
|
+
else if (Rn(e, !t.selection.empty), O && t.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
|
|
2109
2125
|
let t = e.domSelectionRange();
|
|
2110
|
-
for (let n = t.focusNode, r = t.focusOffset; n && n
|
|
2126
|
+
for (let n = t.focusNode, r = t.focusOffset; n && y(n) && r != 0;) {
|
|
2111
2127
|
let t = r < 0 ? n.lastChild : n.childNodes[r - 1];
|
|
2112
2128
|
if (!t) break;
|
|
2113
|
-
if (t
|
|
2129
|
+
if (b(t)) {
|
|
2114
2130
|
let n = e.domSelection();
|
|
2115
2131
|
n && n.collapse(t, t.nodeValue.length);
|
|
2116
2132
|
break;
|
|
@@ -2120,27 +2136,27 @@ K.compositionstart = K.compositionupdate = (e) => {
|
|
|
2120
2136
|
}
|
|
2121
2137
|
e.input.composing = !0;
|
|
2122
2138
|
}
|
|
2123
|
-
|
|
2139
|
+
Fn(e, Nn);
|
|
2124
2140
|
};
|
|
2125
|
-
function
|
|
2141
|
+
function Pn(e) {
|
|
2126
2142
|
let { focusNode: t, focusOffset: n } = e.domSelectionRange();
|
|
2127
|
-
if (!t || t
|
|
2143
|
+
if (!t || !y(t) || n >= t.childNodes.length) return !1;
|
|
2128
2144
|
let r = t.childNodes[n];
|
|
2129
|
-
return r
|
|
2145
|
+
return y(r) && r.contentEditable == "false";
|
|
2130
2146
|
}
|
|
2131
|
-
|
|
2132
|
-
e.composing && (e.input.composing = !1, e.input.compositionEndedAt = Date.now(), e.input.compositionPendingChanges = e.domObserver.pendingRecords().length ? e.input.compositionID : 0, e.input.compositionNode = null, e.input.badSafariComposition ? e.domObserver.forceFlush() : e.input.compositionPendingChanges && Promise.resolve().then(() => e.domObserver.flush()), e.input.compositionID++,
|
|
2147
|
+
G.compositionend = (e, t) => {
|
|
2148
|
+
e.composing && (e.input.composing = !1, e.input.compositionEndedAt = Date.now(), e.input.compositionPendingChanges = e.domObserver.pendingRecords().length ? e.input.compositionID : 0, e.input.compositionNode = null, e.input.badSafariComposition ? e.domObserver.forceFlush() : e.input.compositionPendingChanges && Promise.resolve().then(() => e.domObserver.flush()), e.input.compositionID++, Fn(e, 20));
|
|
2133
2149
|
};
|
|
2134
|
-
function
|
|
2135
|
-
clearTimeout(e.input.composingTimeout), t > -1 && (e.input.composingTimeout = setTimeout(() =>
|
|
2150
|
+
function Fn(e, t) {
|
|
2151
|
+
clearTimeout(e.input.composingTimeout), t > -1 && (e.input.composingTimeout = setTimeout(() => Rn(e), t));
|
|
2136
2152
|
}
|
|
2137
|
-
function
|
|
2153
|
+
function In(e) {
|
|
2138
2154
|
for (e.composing && (e.input.composing = !1, e.input.compositionEndedAt = Date.now()); e.input.compositionNodes.length > 0;) e.input.compositionNodes.pop().markParentsDirty();
|
|
2139
2155
|
}
|
|
2140
|
-
function
|
|
2156
|
+
function Ln(e) {
|
|
2141
2157
|
let t = e.domSelectionRange();
|
|
2142
2158
|
if (!t.focusNode) return null;
|
|
2143
|
-
let n =
|
|
2159
|
+
let n = S(t.focusNode, t.focusOffset), r = C(t.focusNode, t.focusOffset);
|
|
2144
2160
|
if (n && r && n != r) {
|
|
2145
2161
|
let t = r.pmViewDesc, i = e.domObserver.lastChangedTextNode;
|
|
2146
2162
|
if (n == i || r == i) return i;
|
|
@@ -2152,16 +2168,16 @@ function Pn(e) {
|
|
|
2152
2168
|
}
|
|
2153
2169
|
return n || r;
|
|
2154
2170
|
}
|
|
2155
|
-
function
|
|
2156
|
-
if (!(
|
|
2157
|
-
if (e.domObserver.forceFlush(),
|
|
2158
|
-
let n =
|
|
2171
|
+
function Rn(e, t = !1) {
|
|
2172
|
+
if (!(M && e.domObserver.flushingSoon >= 0)) {
|
|
2173
|
+
if (e.domObserver.forceFlush(), In(e), t || e.docView && e.docView.dirty) {
|
|
2174
|
+
let n = ht(e), r = e.state.selection;
|
|
2159
2175
|
return n && !n.eq(r) ? e.dispatch(e.state.tr.setSelection(n)) : (e.markCursor || t) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? e.dispatch(e.state.tr.deleteSelection()) : e.updateState(e.state), !0;
|
|
2160
2176
|
}
|
|
2161
2177
|
return !1;
|
|
2162
2178
|
}
|
|
2163
2179
|
}
|
|
2164
|
-
function
|
|
2180
|
+
function zn(e, t) {
|
|
2165
2181
|
if (!e.dom.parentNode) return;
|
|
2166
2182
|
let n = e.dom.parentNode.appendChild(document.createElement("div"));
|
|
2167
2183
|
n.appendChild(t), n.style.cssText = "position: fixed; left: -10000px; top: 10px";
|
|
@@ -2170,89 +2186,89 @@ function In(e, t) {
|
|
|
2170
2186
|
n.parentNode && n.parentNode.removeChild(n), e.focus();
|
|
2171
2187
|
}, 50);
|
|
2172
2188
|
}
|
|
2173
|
-
var
|
|
2174
|
-
|
|
2189
|
+
var Bn = E && D < 15 || fe && he < 604;
|
|
2190
|
+
W.copy = G.cut = (e, t) => {
|
|
2175
2191
|
let n = t, r = e.state.selection, i = n.type == "cut";
|
|
2176
2192
|
if (r.empty) return;
|
|
2177
|
-
let a =
|
|
2178
|
-
a ? (n.preventDefault(), a.clearData(), a.setData("text/html", o.innerHTML), a.setData("text/plain", s)) :
|
|
2193
|
+
let a = Bn ? null : n.clipboardData, { dom: o, text: s } = Gt(e, r.content());
|
|
2194
|
+
a ? (n.preventDefault(), a.clearData(), a.setData("text/html", o.innerHTML), a.setData("text/plain", s)) : zn(e, o), i && e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
|
|
2179
2195
|
};
|
|
2180
|
-
function
|
|
2196
|
+
function Vn(e) {
|
|
2181
2197
|
return e.openStart == 0 && e.openEnd == 0 && e.content.childCount == 1 ? e.content.firstChild : null;
|
|
2182
2198
|
}
|
|
2183
|
-
function
|
|
2199
|
+
function Hn(e, t) {
|
|
2184
2200
|
if (!e.dom.parentNode) return;
|
|
2185
2201
|
let n = e.input.shiftKey || e.state.selection.$from.parent.type.spec.code, r = e.dom.parentNode.appendChild(document.createElement(n ? "textarea" : "div"));
|
|
2186
2202
|
n || (r.contentEditable = "true"), r.style.cssText = "position: fixed; left: -10000px; top: 10px", r.focus();
|
|
2187
2203
|
let i = e.input.shiftKey && e.input.lastKeyCode != 45;
|
|
2188
2204
|
setTimeout(() => {
|
|
2189
|
-
e.focus(), r.parentNode && r.parentNode.removeChild(r), n ?
|
|
2205
|
+
e.focus(), r.parentNode && r.parentNode.removeChild(r), n ? Un(e, r.value, null, i, t) : Un(e, r.textContent, r.innerHTML, i, t);
|
|
2190
2206
|
}, 50);
|
|
2191
2207
|
}
|
|
2192
|
-
function
|
|
2193
|
-
let a =
|
|
2208
|
+
function Un(e, t, n, r, i) {
|
|
2209
|
+
let a = Kt(e, t, n, r, e.state.selection.$from);
|
|
2194
2210
|
if (e.someProp("handlePaste", (t) => t(e, i, a || c.empty))) return !0;
|
|
2195
2211
|
if (!a) return !1;
|
|
2196
|
-
let o =
|
|
2212
|
+
let o = Vn(a), s = o ? e.state.tr.replaceSelectionWith(o, r) : e.state.tr.replaceSelection(a);
|
|
2197
2213
|
return e.dispatch(s.scrollIntoView().setMeta("paste", !0).setMeta("uiEvent", "paste")), !0;
|
|
2198
2214
|
}
|
|
2199
|
-
function
|
|
2215
|
+
function Wn(e) {
|
|
2200
2216
|
let t = e.getData("text/plain") || e.getData("Text");
|
|
2201
2217
|
if (t) return t;
|
|
2202
2218
|
let n = e.getData("text/uri-list");
|
|
2203
2219
|
return n ? n.replace(/\r?\n/g, " ") : "";
|
|
2204
2220
|
}
|
|
2205
|
-
|
|
2221
|
+
G.paste = (e, t) => {
|
|
2206
2222
|
let n = t;
|
|
2207
|
-
if (e.composing && !
|
|
2208
|
-
let r =
|
|
2209
|
-
r &&
|
|
2223
|
+
if (e.composing && !M) return;
|
|
2224
|
+
let r = Bn ? null : n.clipboardData, i = e.input.shiftKey && e.input.lastKeyCode != 45;
|
|
2225
|
+
r && Un(e, Wn(r), r.getData("text/html"), i, n) ? n.preventDefault() : Hn(e, n);
|
|
2210
2226
|
};
|
|
2211
|
-
var
|
|
2227
|
+
var Gn = class {
|
|
2212
2228
|
constructor(e, t, n) {
|
|
2213
2229
|
this.slice = e, this.move = t, this.node = n;
|
|
2214
2230
|
}
|
|
2215
|
-
},
|
|
2216
|
-
function
|
|
2231
|
+
}, Kn = j ? "altKey" : "ctrlKey";
|
|
2232
|
+
function qn(e, t) {
|
|
2217
2233
|
let n;
|
|
2218
2234
|
return e.someProp("dragCopies", (e) => {
|
|
2219
2235
|
n ||= e(t);
|
|
2220
|
-
}), n == null ? !t[
|
|
2236
|
+
}), n == null ? !t[Kn] : !n;
|
|
2221
2237
|
}
|
|
2222
|
-
|
|
2238
|
+
W.dragstart = (e, n) => {
|
|
2223
2239
|
let r = n, i = e.input.mouseDown;
|
|
2224
2240
|
if (i && i.done(), !r.dataTransfer) return;
|
|
2225
|
-
let a = e.state.selection, o = a.empty ? null : e.posAtCoords(
|
|
2241
|
+
let a = e.state.selection, o = a.empty ? null : e.posAtCoords(gn(r)), s;
|
|
2226
2242
|
if (!(o && o.pos >= a.from && o.pos <= (a instanceof t ? a.to - 1 : a.to))) {
|
|
2227
2243
|
if (i && i.mightDrag) s = t.create(e.state.doc, i.mightDrag.pos);
|
|
2228
|
-
else if (r.target && r.target
|
|
2244
|
+
else if (r.target && y(r.target)) {
|
|
2229
2245
|
let n = e.docView.nearestDesc(r.target, !0);
|
|
2230
2246
|
n && n.node.type.spec.draggable && n != e.docView && (s = t.create(e.state.doc, n.posBefore));
|
|
2231
2247
|
}
|
|
2232
2248
|
}
|
|
2233
|
-
let { dom: c, text: l, slice: u } =
|
|
2234
|
-
(!r.dataTransfer.files.length || !k ||
|
|
2235
|
-
},
|
|
2249
|
+
let { dom: c, text: l, slice: u } = Gt(e, (s || e.state.selection).content());
|
|
2250
|
+
(!r.dataTransfer.files.length || !k || de > 120) && r.dataTransfer.clearData(), r.dataTransfer.setData(Bn ? "Text" : "text/html", c.innerHTML), r.dataTransfer.effectAllowed = "copyMove", Bn || r.dataTransfer.setData("text/plain", l), e.dragging = new Gn(u, qn(e, r), s);
|
|
2251
|
+
}, W.dragend = (e) => {
|
|
2236
2252
|
let t = e.dragging;
|
|
2237
2253
|
window.setTimeout(() => {
|
|
2238
2254
|
e.dragging == t && (e.dragging = null);
|
|
2239
2255
|
}, 50);
|
|
2240
|
-
},
|
|
2256
|
+
}, G.dragover = G.dragenter = (e, t) => t.preventDefault(), G.drop = (e, t) => {
|
|
2241
2257
|
try {
|
|
2242
|
-
|
|
2258
|
+
Jn(e, t, e.dragging);
|
|
2243
2259
|
} finally {
|
|
2244
2260
|
e.dragging = null;
|
|
2245
2261
|
}
|
|
2246
2262
|
};
|
|
2247
|
-
function
|
|
2263
|
+
function Jn(e, n, r) {
|
|
2248
2264
|
if (!n.dataTransfer) return;
|
|
2249
|
-
let i = e.posAtCoords(
|
|
2265
|
+
let i = e.posAtCoords(gn(n));
|
|
2250
2266
|
if (!i) return;
|
|
2251
2267
|
let a = e.state.doc.resolve(i.pos), o = r && r.slice;
|
|
2252
2268
|
o ? e.someProp("transformPasted", (t) => {
|
|
2253
2269
|
o = t(o, e, !1);
|
|
2254
|
-
}) : o =
|
|
2255
|
-
let s = !!(r &&
|
|
2270
|
+
}) : o = Kt(e, Wn(n.dataTransfer), Bn ? null : n.dataTransfer.getData("text/html"), !1, a);
|
|
2271
|
+
let s = !!(r && qn(e, n));
|
|
2256
2272
|
if (e.someProp("handleDrop", (t) => t(e, n, o || c.empty, s))) {
|
|
2257
2273
|
n.preventDefault();
|
|
2258
2274
|
return;
|
|
@@ -2272,36 +2288,56 @@ function Gn(e, n, r) {
|
|
|
2272
2288
|
if (p && t.isSelectable(o.content.firstChild) && h.nodeAfter && h.nodeAfter.sameMarkup(o.content.firstChild)) d.setSelection(new t(h));
|
|
2273
2289
|
else {
|
|
2274
2290
|
let t = d.mapping.map(u);
|
|
2275
|
-
d.mapping.maps[d.mapping.maps.length - 1].forEach((e, n, r, i) => t = i), d.setSelection(
|
|
2291
|
+
d.mapping.maps[d.mapping.maps.length - 1].forEach((e, n, r, i) => t = i), d.setSelection(Tt(e, h, d.doc.resolve(t)));
|
|
2276
2292
|
}
|
|
2277
2293
|
e.focus(), e.dispatch(d.setMeta("uiEvent", "drop"));
|
|
2278
2294
|
}
|
|
2279
|
-
|
|
2280
|
-
e.input.lastFocus = Date.now(), e.focused
|
|
2281
|
-
e.
|
|
2282
|
-
|
|
2283
|
-
|
|
2295
|
+
W.focus = (e) => {
|
|
2296
|
+
if (e.input.lastFocus = Date.now(), !e.focused) {
|
|
2297
|
+
e.domObserver.stop(), e.dom.classList.add("ProseMirror-focused"), e.domObserver.start(), e.focused = !0;
|
|
2298
|
+
let t = e.domSelectionRange();
|
|
2299
|
+
if (!e.domObserver.currentSelection.eq(t)) {
|
|
2300
|
+
let { focusNode: n, focusOffset: r } = t;
|
|
2301
|
+
setTimeout(() => {
|
|
2302
|
+
let t = e.domSelectionRange();
|
|
2303
|
+
t.focusNode == n && t.focusOffset == r && e.docView && e.hasFocus() && V(e);
|
|
2304
|
+
}, 20);
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
}, W.blur = (e, t) => {
|
|
2284
2308
|
let n = t;
|
|
2285
2309
|
e.focused &&= (e.domObserver.stop(), e.dom.classList.remove("ProseMirror-focused"), e.domObserver.start(), n.relatedTarget && e.dom.contains(n.relatedTarget) && e.domObserver.currentSelection.clear(), !1);
|
|
2286
|
-
},
|
|
2287
|
-
if (
|
|
2310
|
+
}, W.beforeinput = (e, t) => {
|
|
2311
|
+
if (M && t.inputType == "deleteContentBackward") {
|
|
2288
2312
|
e.domObserver.flushSoon();
|
|
2289
2313
|
let { domChangeCount: t } = e.input;
|
|
2290
2314
|
setTimeout(() => {
|
|
2291
|
-
if (e.input.domChangeCount != t || (e.dom.blur(), e.focus(),
|
|
2315
|
+
if (e.input.domChangeCount != t || e.domObserver.pendingRecords().length || (e.dom.blur(), e.focus(), q(e, "Backspace"))) return;
|
|
2292
2316
|
let { $cursor: n } = e.state.selection;
|
|
2293
2317
|
n && n.pos > 0 && e.dispatch(e.state.tr.delete(n.pos - 1, n.pos).scrollIntoView());
|
|
2294
2318
|
}, 50);
|
|
2295
2319
|
}
|
|
2296
2320
|
};
|
|
2297
|
-
for (let e in
|
|
2298
|
-
function
|
|
2321
|
+
for (let e in G) W[e] = G[e];
|
|
2322
|
+
function Yn(e, t) {
|
|
2299
2323
|
if (e == t) return !0;
|
|
2300
2324
|
for (let n in e) if (e[n] !== t[n]) return !1;
|
|
2301
2325
|
for (let n in t) if (!(n in e)) return !1;
|
|
2302
2326
|
return !0;
|
|
2303
2327
|
}
|
|
2304
|
-
var
|
|
2328
|
+
var Xn = class {
|
|
2329
|
+
constructor(e) {
|
|
2330
|
+
this.frag = e, this.index = 0, this.off = 0;
|
|
2331
|
+
}
|
|
2332
|
+
nodeAt(e) {
|
|
2333
|
+
for (; this.off <= e && this.index < this.frag.childCount;) {
|
|
2334
|
+
let t = this.frag.child(this.index);
|
|
2335
|
+
if (this.off == e) return t;
|
|
2336
|
+
this.off += t.nodeSize, this.index++;
|
|
2337
|
+
}
|
|
2338
|
+
return null;
|
|
2339
|
+
}
|
|
2340
|
+
}, Zn = class e {
|
|
2305
2341
|
constructor(e, t) {
|
|
2306
2342
|
this.toDOM = e, this.spec = t || X, this.side = this.spec.side || 0;
|
|
2307
2343
|
}
|
|
@@ -2313,12 +2349,12 @@ var qn = class e {
|
|
|
2313
2349
|
return !0;
|
|
2314
2350
|
}
|
|
2315
2351
|
eq(t) {
|
|
2316
|
-
return this == t || t instanceof e && (this.spec.key && this.spec.key == t.spec.key || this.toDOM == t.toDOM &&
|
|
2352
|
+
return this == t || t instanceof e && (this.spec.key && this.spec.key == t.spec.key || this.toDOM == t.toDOM && Yn(this.spec, t.spec));
|
|
2317
2353
|
}
|
|
2318
2354
|
destroy(e) {
|
|
2319
2355
|
this.spec.destroy && this.spec.destroy(e);
|
|
2320
2356
|
}
|
|
2321
|
-
},
|
|
2357
|
+
}, Qn = class e {
|
|
2322
2358
|
constructor(e, t) {
|
|
2323
2359
|
this.attrs = e, this.spec = t || X;
|
|
2324
2360
|
}
|
|
@@ -2330,13 +2366,13 @@ var qn = class e {
|
|
|
2330
2366
|
return t.from < t.to;
|
|
2331
2367
|
}
|
|
2332
2368
|
eq(t) {
|
|
2333
|
-
return this == t || t instanceof e &&
|
|
2369
|
+
return this == t || t instanceof e && Yn(this.attrs, t.attrs) && Yn(this.spec, t.spec);
|
|
2334
2370
|
}
|
|
2335
2371
|
static is(t) {
|
|
2336
2372
|
return t.type instanceof e;
|
|
2337
2373
|
}
|
|
2338
2374
|
destroy() {}
|
|
2339
|
-
},
|
|
2375
|
+
}, $n = class e {
|
|
2340
2376
|
constructor(e, t) {
|
|
2341
2377
|
this.attrs = e, this.spec = t || X;
|
|
2342
2378
|
}
|
|
@@ -2346,12 +2382,12 @@ var qn = class e {
|
|
|
2346
2382
|
let a = e.mapResult(t.to + r, -1);
|
|
2347
2383
|
return a.deleted || a.pos <= i.pos ? null : new J(i.pos - n, a.pos - n, this);
|
|
2348
2384
|
}
|
|
2349
|
-
valid(e, t) {
|
|
2350
|
-
let
|
|
2351
|
-
return r
|
|
2385
|
+
valid(e, t, n) {
|
|
2386
|
+
let r = n.nodeAt(t.from);
|
|
2387
|
+
return !!r && !r.isText && t.from + r.nodeSize == t.to;
|
|
2352
2388
|
}
|
|
2353
2389
|
eq(t) {
|
|
2354
|
-
return this == t || t instanceof e &&
|
|
2390
|
+
return this == t || t instanceof e && Yn(this.attrs, t.attrs) && Yn(this.spec, t.spec);
|
|
2355
2391
|
}
|
|
2356
2392
|
destroy() {}
|
|
2357
2393
|
}, J = class e {
|
|
@@ -2368,29 +2404,29 @@ var qn = class e {
|
|
|
2368
2404
|
return this.type.map(e, this, t, n);
|
|
2369
2405
|
}
|
|
2370
2406
|
static widget(t, n, r) {
|
|
2371
|
-
return new e(t, t, new
|
|
2407
|
+
return new e(t, t, new Zn(n, r));
|
|
2372
2408
|
}
|
|
2373
2409
|
static inline(t, n, r, i) {
|
|
2374
|
-
return new e(t, n, new
|
|
2410
|
+
return new e(t, n, new Qn(r, i));
|
|
2375
2411
|
}
|
|
2376
2412
|
static node(t, n, r, i) {
|
|
2377
|
-
return new e(t, n, new
|
|
2413
|
+
return new e(t, n, new $n(r, i));
|
|
2378
2414
|
}
|
|
2379
2415
|
get spec() {
|
|
2380
2416
|
return this.type.spec;
|
|
2381
2417
|
}
|
|
2382
2418
|
get inline() {
|
|
2383
|
-
return this.type instanceof
|
|
2419
|
+
return this.type instanceof Qn;
|
|
2384
2420
|
}
|
|
2385
2421
|
get widget() {
|
|
2386
|
-
return this.type instanceof
|
|
2422
|
+
return this.type instanceof Zn;
|
|
2387
2423
|
}
|
|
2388
2424
|
}, Y = [], X = {}, Z = class e {
|
|
2389
2425
|
constructor(e, t) {
|
|
2390
2426
|
this.local = e.length ? e : Y, this.children = t.length ? t : Y;
|
|
2391
2427
|
}
|
|
2392
2428
|
static create(e, t) {
|
|
2393
|
-
return t.length ?
|
|
2429
|
+
return t.length ? or(t, e, 0, X) : Q;
|
|
2394
2430
|
}
|
|
2395
2431
|
find(e, t, n) {
|
|
2396
2432
|
let r = [];
|
|
@@ -2411,11 +2447,14 @@ var qn = class e {
|
|
|
2411
2447
|
}
|
|
2412
2448
|
mapInner(t, n, r, i, a) {
|
|
2413
2449
|
let o;
|
|
2414
|
-
|
|
2415
|
-
let
|
|
2416
|
-
|
|
2450
|
+
if (this.local.length) {
|
|
2451
|
+
let e = new Xn(n.content);
|
|
2452
|
+
for (let s = 0; s < this.local.length; s++) {
|
|
2453
|
+
let c = this.local[s].map(t, r, i);
|
|
2454
|
+
c && c.type.valid(n, c, e) ? (o ||= []).push(c) : a.onRemove && a.onRemove(this.local[s].spec);
|
|
2455
|
+
}
|
|
2417
2456
|
}
|
|
2418
|
-
return this.children.length ?
|
|
2457
|
+
return this.children.length ? tr(this.children, o || [], t, n, r, i, a) : o ? new e(o.sort($), Y) : Q;
|
|
2419
2458
|
}
|
|
2420
2459
|
add(t, n) {
|
|
2421
2460
|
return n.length ? this == Q ? e.create(t, n) : this.addInner(t, n, 0) : this;
|
|
@@ -2424,13 +2463,16 @@ var qn = class e {
|
|
|
2424
2463
|
let i, a = 0;
|
|
2425
2464
|
t.forEach((e, t) => {
|
|
2426
2465
|
let o = t + r, s;
|
|
2427
|
-
if (s =
|
|
2466
|
+
if (s = ir(n, e, o)) {
|
|
2428
2467
|
for (i ||= this.children.slice(); a < i.length && i[a] < t;) a += 3;
|
|
2429
|
-
i[a] == t ? i[a + 2] = i[a + 2].addInner(e, s, o + 1) : i.splice(a, 0, t, t + e.nodeSize,
|
|
2468
|
+
i[a] == t ? i[a + 2] = i[a + 2].addInner(e, s, o + 1) : i.splice(a, 0, t, t + e.nodeSize, or(s, e, o + 1, X)), a += 3;
|
|
2430
2469
|
}
|
|
2431
2470
|
});
|
|
2432
|
-
let o =
|
|
2433
|
-
|
|
2471
|
+
let o = nr(a ? ar(n) : n, -r);
|
|
2472
|
+
if (o.length) {
|
|
2473
|
+
let e = new Xn(t.content);
|
|
2474
|
+
for (let n = 0; n < o.length; n++) o[n].type.valid(t, o[n], e) || o.splice(n--, 1);
|
|
2475
|
+
}
|
|
2434
2476
|
return new e(o.length ? this.local.concat(o).sort($) : this.local, i || this.children);
|
|
2435
2477
|
}
|
|
2436
2478
|
remove(e) {
|
|
@@ -2462,14 +2504,14 @@ var qn = class e {
|
|
|
2462
2504
|
let a = t + 1, o = a + n.content.size;
|
|
2463
2505
|
for (let e = 0; e < this.local.length; e++) {
|
|
2464
2506
|
let t = this.local[e];
|
|
2465
|
-
if (t.from < o && t.to > a && t.type instanceof
|
|
2507
|
+
if (t.from < o && t.to > a && t.type instanceof Qn) {
|
|
2466
2508
|
let e = Math.max(a, t.from) - a, n = Math.min(o, t.to) - a;
|
|
2467
2509
|
e < n && (i ||= []).push(t.copy(e, n));
|
|
2468
2510
|
}
|
|
2469
2511
|
}
|
|
2470
2512
|
if (i) {
|
|
2471
2513
|
let t = new e(i.sort($), Y);
|
|
2472
|
-
return r ? new
|
|
2514
|
+
return r ? new er([t, r]) : t;
|
|
2473
2515
|
}
|
|
2474
2516
|
return r || Q;
|
|
2475
2517
|
}
|
|
@@ -2481,21 +2523,21 @@ var qn = class e {
|
|
|
2481
2523
|
return !0;
|
|
2482
2524
|
}
|
|
2483
2525
|
locals(e) {
|
|
2484
|
-
return
|
|
2526
|
+
return sr(this.localsInner(e));
|
|
2485
2527
|
}
|
|
2486
2528
|
localsInner(e) {
|
|
2487
2529
|
if (this == Q) return Y;
|
|
2488
|
-
if (e.inlineContent || !this.local.some(
|
|
2530
|
+
if (e.inlineContent || !this.local.some(Qn.is)) return this.local;
|
|
2489
2531
|
let t = [];
|
|
2490
|
-
for (let e = 0; e < this.local.length; e++) this.local[e].type instanceof
|
|
2532
|
+
for (let e = 0; e < this.local.length; e++) this.local[e].type instanceof Qn || t.push(this.local[e]);
|
|
2491
2533
|
return t;
|
|
2492
2534
|
}
|
|
2493
2535
|
forEachSet(e) {
|
|
2494
2536
|
e(this);
|
|
2495
2537
|
}
|
|
2496
2538
|
};
|
|
2497
|
-
Z.empty = new Z([], []), Z.removeOverlap =
|
|
2498
|
-
var Q = Z.empty,
|
|
2539
|
+
Z.empty = new Z([], []), Z.removeOverlap = sr;
|
|
2540
|
+
var Q = Z.empty, er = class e {
|
|
2499
2541
|
constructor(e) {
|
|
2500
2542
|
this.members = e;
|
|
2501
2543
|
}
|
|
@@ -2529,7 +2571,7 @@ var Q = Z.empty, Xn = class e {
|
|
|
2529
2571
|
}
|
|
2530
2572
|
}
|
|
2531
2573
|
}
|
|
2532
|
-
return t ?
|
|
2574
|
+
return t ? sr(n ? t : t.sort($)) : Y;
|
|
2533
2575
|
}
|
|
2534
2576
|
static from(t) {
|
|
2535
2577
|
switch (t.length) {
|
|
@@ -2542,7 +2584,7 @@ var Q = Z.empty, Xn = class e {
|
|
|
2542
2584
|
for (let t = 0; t < this.members.length; t++) this.members[t].forEachSet(e);
|
|
2543
2585
|
}
|
|
2544
2586
|
};
|
|
2545
|
-
function
|
|
2587
|
+
function tr(e, t, n, r, i, a, o) {
|
|
2546
2588
|
let s = e.slice();
|
|
2547
2589
|
for (let e = 0, t = a; e < n.maps.length; e++) {
|
|
2548
2590
|
let r = 0;
|
|
@@ -2575,7 +2617,7 @@ function Zn(e, t, n, r, i, a, o) {
|
|
|
2575
2617
|
} else c = !0;
|
|
2576
2618
|
}
|
|
2577
2619
|
if (c) {
|
|
2578
|
-
let c =
|
|
2620
|
+
let c = or(rr(s, e, t, n, i, a, o), r, 0, o);
|
|
2579
2621
|
t = c.local;
|
|
2580
2622
|
for (let e = 0; e < s.length; e += 3) s[e + 1] < 0 && (s.splice(e, 3), e -= 3);
|
|
2581
2623
|
for (let e = 0, t = 0; e < c.children.length; e += 3) {
|
|
@@ -2586,7 +2628,7 @@ function Zn(e, t, n, r, i, a, o) {
|
|
|
2586
2628
|
}
|
|
2587
2629
|
return new Z(t.sort($), s);
|
|
2588
2630
|
}
|
|
2589
|
-
function
|
|
2631
|
+
function nr(e, t) {
|
|
2590
2632
|
if (!t || !e.length) return e;
|
|
2591
2633
|
let n = [];
|
|
2592
2634
|
for (let r = 0; r < e.length; r++) {
|
|
@@ -2595,7 +2637,7 @@ function Qn(e, t) {
|
|
|
2595
2637
|
}
|
|
2596
2638
|
return n;
|
|
2597
2639
|
}
|
|
2598
|
-
function
|
|
2640
|
+
function rr(e, t, n, r, i, a, o) {
|
|
2599
2641
|
function s(e, t) {
|
|
2600
2642
|
for (let a = 0; a < e.local.length; a++) {
|
|
2601
2643
|
let s = e.local[a].map(r, i, t);
|
|
@@ -2606,68 +2648,71 @@ function $n(e, t, n, r, i, a, o) {
|
|
|
2606
2648
|
for (let n = 0; n < e.length; n += 3) e[n + 1] == -1 && s(e[n + 2], t[n] + a + 1);
|
|
2607
2649
|
return n;
|
|
2608
2650
|
}
|
|
2609
|
-
function
|
|
2651
|
+
function ir(e, t, n) {
|
|
2610
2652
|
if (t.isLeaf) return null;
|
|
2611
2653
|
let r = n + t.nodeSize, i = null;
|
|
2612
2654
|
for (let t = 0, a; t < e.length; t++) (a = e[t]) && a.from > n && a.to < r && ((i ||= []).push(a), e[t] = null);
|
|
2613
2655
|
return i;
|
|
2614
2656
|
}
|
|
2615
|
-
function
|
|
2657
|
+
function ar(e) {
|
|
2616
2658
|
let t = [];
|
|
2617
2659
|
for (let n = 0; n < e.length; n++) e[n] != null && t.push(e[n]);
|
|
2618
2660
|
return t;
|
|
2619
2661
|
}
|
|
2620
|
-
function
|
|
2662
|
+
function or(e, t, n, r) {
|
|
2621
2663
|
let i = [], a = !1;
|
|
2622
2664
|
t.forEach((t, o) => {
|
|
2623
|
-
let s =
|
|
2665
|
+
let s = ir(e, t, o + n);
|
|
2624
2666
|
if (s) {
|
|
2625
2667
|
a = !0;
|
|
2626
|
-
let e =
|
|
2668
|
+
let e = or(s, t, n + o + 1, r);
|
|
2627
2669
|
e != Q && i.push(o, o + t.nodeSize, e);
|
|
2628
2670
|
}
|
|
2629
2671
|
});
|
|
2630
|
-
let o =
|
|
2631
|
-
|
|
2672
|
+
let o = nr(a ? ar(e) : e, -n).sort($);
|
|
2673
|
+
if (o.length) {
|
|
2674
|
+
let e = new Xn(t.content);
|
|
2675
|
+
for (let n = 0; n < o.length; n++) o[n].type.valid(t, o[n], e) || (r.onRemove && r.onRemove(o[n].spec), o.splice(n--, 1));
|
|
2676
|
+
}
|
|
2632
2677
|
return o.length || i.length ? new Z(o, i) : Q;
|
|
2633
2678
|
}
|
|
2634
2679
|
function $(e, t) {
|
|
2635
2680
|
return e.from - t.from || e.to - t.to;
|
|
2636
2681
|
}
|
|
2637
|
-
function
|
|
2682
|
+
function sr(e) {
|
|
2638
2683
|
let t = e;
|
|
2639
2684
|
for (let n = 0; n < t.length - 1; n++) {
|
|
2640
2685
|
let r = t[n];
|
|
2641
2686
|
if (r.from != r.to) for (let i = n + 1; i < t.length; i++) {
|
|
2642
2687
|
let a = t[i];
|
|
2643
|
-
if (a.from == r.from) a.to != r.to && (t == e && (t = e.slice()), t[i] = a.copy(a.from, r.to),
|
|
2688
|
+
if (a.from == r.from) a.to != r.to && (t == e && (t = e.slice()), t[i] = a.copy(a.from, r.to), cr(t, i + 1, a.copy(r.to, a.to)));
|
|
2644
2689
|
else {
|
|
2645
|
-
a.from < r.to && (t == e && (t = e.slice()), t[n] = r.copy(r.from, a.from),
|
|
2690
|
+
a.from < r.to && (t == e && (t = e.slice()), t[n] = r.copy(r.from, a.from), cr(t, i, r.copy(a.from, r.to)));
|
|
2646
2691
|
break;
|
|
2647
2692
|
}
|
|
2648
2693
|
}
|
|
2649
2694
|
}
|
|
2650
2695
|
return t;
|
|
2651
2696
|
}
|
|
2652
|
-
function
|
|
2697
|
+
function cr(e, t, n) {
|
|
2653
2698
|
for (; t < e.length && $(n, e[t]) > 0;) t++;
|
|
2654
2699
|
e.splice(t, 0, n);
|
|
2655
2700
|
}
|
|
2656
|
-
function
|
|
2701
|
+
function lr(e) {
|
|
2657
2702
|
let t = [];
|
|
2658
2703
|
return e.someProp("decorations", (n) => {
|
|
2659
2704
|
let r = n(e.state);
|
|
2660
2705
|
r && r != Q && t.push(r);
|
|
2661
|
-
}), e.cursorWrapper && t.push(Z.create(e.state.doc, [e.cursorWrapper.deco])),
|
|
2706
|
+
}), e.cursorWrapper && t.push(Z.create(e.state.doc, [e.cursorWrapper.deco])), er.from(t);
|
|
2662
2707
|
}
|
|
2663
|
-
var
|
|
2708
|
+
var ur = {
|
|
2664
2709
|
childList: !0,
|
|
2665
2710
|
characterData: !0,
|
|
2666
2711
|
characterDataOldValue: !0,
|
|
2667
2712
|
attributes: !0,
|
|
2668
2713
|
attributeOldValue: !0,
|
|
2669
2714
|
subtree: !0
|
|
2670
|
-
},
|
|
2715
|
+
}, dr = E && D <= 11, fr = class {
|
|
2671
2716
|
constructor() {
|
|
2672
2717
|
this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
|
|
2673
2718
|
}
|
|
@@ -2680,12 +2725,12 @@ var or = {
|
|
|
2680
2725
|
eq(e) {
|
|
2681
2726
|
return e.anchorNode == this.anchorNode && e.anchorOffset == this.anchorOffset && e.focusNode == this.focusNode && e.focusOffset == this.focusOffset;
|
|
2682
2727
|
}
|
|
2683
|
-
},
|
|
2728
|
+
}, pr = class {
|
|
2684
2729
|
constructor(e, t) {
|
|
2685
|
-
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new
|
|
2730
|
+
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new fr(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((t) => {
|
|
2686
2731
|
for (let e = 0; e < t.length; e++) this.queue.push(t[e]);
|
|
2687
2732
|
E && D <= 11 && t.some((e) => e.type == "childList" && e.removedNodes.length || e.type == "characterData" && e.oldValue.length > e.target.nodeValue.length) ? this.flushSoon() : A && e.composing && t.some((e) => e.type == "childList" && e.target.nodeName == "TR") ? (e.input.badSafariComposition = !0, this.flushSoon()) : this.flush();
|
|
2688
|
-
}),
|
|
2733
|
+
}), dr && (this.onCharData = (e) => {
|
|
2689
2734
|
this.queue.push({
|
|
2690
2735
|
target: e.target,
|
|
2691
2736
|
type: "characterData",
|
|
@@ -2702,7 +2747,7 @@ var or = {
|
|
|
2702
2747
|
this.flushingSoon > -1 && (window.clearTimeout(this.flushingSoon), this.flushingSoon = -1, this.flush());
|
|
2703
2748
|
}
|
|
2704
2749
|
start() {
|
|
2705
|
-
this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom,
|
|
2750
|
+
this.observer && (this.observer.takeRecords(), this.observer.observe(this.view.dom, ur)), this.onCharData && this.view.dom.addEventListener("DOMCharacterDataModified", this.onCharData), this.connectSelection();
|
|
2706
2751
|
}
|
|
2707
2752
|
stop() {
|
|
2708
2753
|
if (this.observer) {
|
|
@@ -2725,8 +2770,8 @@ var or = {
|
|
|
2725
2770
|
this.suppressingSelectionUpdates = !0, setTimeout(() => this.suppressingSelectionUpdates = !1, 50);
|
|
2726
2771
|
}
|
|
2727
2772
|
onSelectionChange() {
|
|
2728
|
-
if (
|
|
2729
|
-
if (this.suppressingSelectionUpdates) return
|
|
2773
|
+
if (Et(this.view)) {
|
|
2774
|
+
if (this.suppressingSelectionUpdates) return V(this.view);
|
|
2730
2775
|
if (E && D <= 11 && !this.view.state.selection.empty) {
|
|
2731
2776
|
let e = this.view.domSelectionRange();
|
|
2732
2777
|
if (e.focusNode && h(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset)) return this.flushSoon();
|
|
@@ -2748,7 +2793,7 @@ var or = {
|
|
|
2748
2793
|
let r = n && this.view.docView.nearestDesc(n);
|
|
2749
2794
|
if (r && r.ignoreMutation({
|
|
2750
2795
|
type: "selection",
|
|
2751
|
-
target: n
|
|
2796
|
+
target: b(n) ? n.parentNode : n
|
|
2752
2797
|
})) return this.setCurSelection(), !0;
|
|
2753
2798
|
}
|
|
2754
2799
|
pendingRecords() {
|
|
@@ -2760,7 +2805,9 @@ var or = {
|
|
|
2760
2805
|
if (!e.docView || this.flushingSoon > -1) return;
|
|
2761
2806
|
let t = this.pendingRecords();
|
|
2762
2807
|
t.length && (this.queue = []);
|
|
2763
|
-
let r
|
|
2808
|
+
let r, i = !1;
|
|
2809
|
+
!this.suppressingSelectionUpdates && Et(e) && (r = e.domSelectionRange(), i = !this.currentSelection.eq(r) && !this.ignoreSelectionChange(r));
|
|
2810
|
+
let a = -1, o = -1, s = !1, c = [];
|
|
2764
2811
|
if (e.editable) for (let e = 0; e < t.length; e++) {
|
|
2765
2812
|
let n = this.registerMutation(t[e], c);
|
|
2766
2813
|
n && (a = a < 0 ? n.from : Math.min(n.from, a), o = o < 0 ? n.to : Math.max(n.to, o), n.typeOver && (s = !0));
|
|
@@ -2768,7 +2815,7 @@ var or = {
|
|
|
2768
2815
|
if (c.some((e) => e.nodeName == "BR") && (e.input.lastKeyCode == 8 || e.input.lastKeyCode == 46 || k && (e.composing || e.input.compositionEndedAt > Date.now() - 50) && t.some((e) => e.type == "childList" && e.removedNodes.length))) {
|
|
2769
2816
|
for (let e of c) if (e.nodeName == "BR" && e.parentNode) {
|
|
2770
2817
|
let t = e.nextSibling;
|
|
2771
|
-
for (; t && t
|
|
2818
|
+
for (; t && y(t);) {
|
|
2772
2819
|
if (t.contentEditable == "false") {
|
|
2773
2820
|
e.parentNode.removeChild(e);
|
|
2774
2821
|
break;
|
|
@@ -2785,12 +2832,12 @@ var or = {
|
|
|
2785
2832
|
let { focusNode: n } = this.currentSelection;
|
|
2786
2833
|
for (let r of t) {
|
|
2787
2834
|
let t = r.parentNode;
|
|
2788
|
-
t && t.nodeName == "LI" && (!n ||
|
|
2835
|
+
t && t.nodeName == "LI" && (!n || yr(e, n) != t) && r.remove();
|
|
2789
2836
|
}
|
|
2790
2837
|
}
|
|
2791
2838
|
}
|
|
2792
2839
|
let l = null;
|
|
2793
|
-
a < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 &&
|
|
2840
|
+
a < 0 && i && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && ne(r) && (l = ht(e)) && l.eq(n.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, V(e), this.currentSelection.set(r), e.scrollToSelection()) : (a > -1 || i) && (a > -1 && (e.docView.markDirty(a, o), gr(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, br(e, c)), this.handleDOMChange(a, o, s, c), e.docView && e.docView.dirty ? e.updateState(e.state) : r && !this.currentSelection.eq(r) && V(e), r && this.currentSelection.set(r));
|
|
2794
2841
|
}
|
|
2795
2842
|
registerMutation(e, t) {
|
|
2796
2843
|
if (t.indexOf(e.target) > -1) return null;
|
|
@@ -2799,7 +2846,7 @@ var or = {
|
|
|
2799
2846
|
if (e.type == "childList") {
|
|
2800
2847
|
for (let n = 0; n < e.addedNodes.length; n++) {
|
|
2801
2848
|
let r = e.addedNodes[n];
|
|
2802
|
-
t.push(r), r
|
|
2849
|
+
t.push(r), b(r) && (this.lastChangedTextNode = r);
|
|
2803
2850
|
}
|
|
2804
2851
|
if (n.contentDOM && n.contentDOM != n.dom && !n.contentDOM.contains(e.target)) return {
|
|
2805
2852
|
from: n.posBefore,
|
|
@@ -2825,18 +2872,18 @@ var or = {
|
|
|
2825
2872
|
typeOver: e.target.nodeValue == e.oldValue
|
|
2826
2873
|
});
|
|
2827
2874
|
}
|
|
2828
|
-
},
|
|
2829
|
-
function
|
|
2830
|
-
if (!
|
|
2875
|
+
}, mr = /* @__PURE__ */ new WeakMap(), hr = !1;
|
|
2876
|
+
function gr(e) {
|
|
2877
|
+
if (!mr.has(e) && (mr.set(e, null), [
|
|
2831
2878
|
"normal",
|
|
2832
2879
|
"nowrap",
|
|
2833
2880
|
"pre-line"
|
|
2834
2881
|
].indexOf(getComputedStyle(e.dom).whiteSpace) !== -1)) {
|
|
2835
|
-
if (e.requiresGeckoHackNode = O,
|
|
2836
|
-
console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),
|
|
2882
|
+
if (e.requiresGeckoHackNode = O, hr) return;
|
|
2883
|
+
console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), hr = !0;
|
|
2837
2884
|
}
|
|
2838
2885
|
}
|
|
2839
|
-
function
|
|
2886
|
+
function _r(e, t) {
|
|
2840
2887
|
let n = t.startContainer, r = t.startOffset, i = t.endContainer, a = t.endOffset, o = e.domAtPos(e.state.selection.anchor);
|
|
2841
2888
|
return h(o.node, o.offset, i, a) && ([n, r, i, a] = [
|
|
2842
2889
|
i,
|
|
@@ -2850,25 +2897,25 @@ function pr(e, t) {
|
|
|
2850
2897
|
focusOffset: a
|
|
2851
2898
|
};
|
|
2852
2899
|
}
|
|
2853
|
-
function
|
|
2900
|
+
function vr(e, t) {
|
|
2854
2901
|
if (t.getComposedRanges) {
|
|
2855
2902
|
let n = t.getComposedRanges(e.root)[0];
|
|
2856
|
-
if (n) return
|
|
2903
|
+
if (n) return _r(e, n);
|
|
2857
2904
|
}
|
|
2858
2905
|
let n;
|
|
2859
2906
|
function r(e) {
|
|
2860
2907
|
e.preventDefault(), e.stopImmediatePropagation(), n = e.getTargetRanges()[0];
|
|
2861
2908
|
}
|
|
2862
|
-
return e.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), e.dom.removeEventListener("beforeinput", r, !0), n ?
|
|
2909
|
+
return e.dom.addEventListener("beforeinput", r, !0), document.execCommand("indent"), e.dom.removeEventListener("beforeinput", r, !0), n ? _r(e, n) : null;
|
|
2863
2910
|
}
|
|
2864
|
-
function
|
|
2911
|
+
function yr(e, t) {
|
|
2865
2912
|
for (let n = t.parentNode; n && n != e.dom; n = n.parentNode) {
|
|
2866
2913
|
let t = e.docView.nearestDesc(n, !0);
|
|
2867
2914
|
if (t && t.node.isBlock) return n;
|
|
2868
2915
|
}
|
|
2869
2916
|
return null;
|
|
2870
2917
|
}
|
|
2871
|
-
function
|
|
2918
|
+
function br(e, t) {
|
|
2872
2919
|
let { focusNode: n, focusOffset: r } = e.domSelectionRange();
|
|
2873
2920
|
for (let i of t) if (i.parentNode?.nodeName == "TR") {
|
|
2874
2921
|
let t = i.nextSibling;
|
|
@@ -2877,19 +2924,19 @@ function gr(e, t) {
|
|
|
2877
2924
|
let a = t;
|
|
2878
2925
|
for (;;) {
|
|
2879
2926
|
let e = a.firstChild;
|
|
2880
|
-
if (!e || e
|
|
2927
|
+
if (!e || !y(e) || e.contentEditable == "false" || /^(BR|IMG)$/.test(e.nodeName)) break;
|
|
2881
2928
|
a = e;
|
|
2882
2929
|
}
|
|
2883
2930
|
a.insertBefore(i, a.firstChild), n == i && e.domSelection().collapse(i, r);
|
|
2884
2931
|
} else i.parentNode.removeChild(i);
|
|
2885
2932
|
}
|
|
2886
2933
|
}
|
|
2887
|
-
function
|
|
2934
|
+
function xr(e, t, n, r) {
|
|
2888
2935
|
let { node: a, fromOffset: o, toOffset: s, from: c, to: l } = e.docView.parseRange(t, n), u = e.domSelectionRange(), d, f = u.anchorNode;
|
|
2889
|
-
if (f && e.dom
|
|
2936
|
+
if (f && x(e.dom, f) && (d = [{
|
|
2890
2937
|
node: f,
|
|
2891
2938
|
offset: u.anchorOffset
|
|
2892
|
-
}],
|
|
2939
|
+
}], ne(u) || d.push({
|
|
2893
2940
|
node: u.focusNode,
|
|
2894
2941
|
offset: u.focusOffset
|
|
2895
2942
|
})), k && e.input.lastKeyCode === 8) for (let e = s; e > o; e--) {
|
|
@@ -2908,7 +2955,7 @@ function _r(e, t, n, r) {
|
|
|
2908
2955
|
to: s,
|
|
2909
2956
|
preserveWhitespace: h.parent.type.whitespace != "pre" || "full",
|
|
2910
2957
|
findPositions: d,
|
|
2911
|
-
ruleFromNode:
|
|
2958
|
+
ruleFromNode: Sr(r),
|
|
2912
2959
|
context: h
|
|
2913
2960
|
});
|
|
2914
2961
|
if (d && d[0].pos != null) {
|
|
@@ -2925,7 +2972,7 @@ function _r(e, t, n, r) {
|
|
|
2925
2972
|
to: l
|
|
2926
2973
|
};
|
|
2927
2974
|
}
|
|
2928
|
-
var
|
|
2975
|
+
var Sr = (e) => (t) => {
|
|
2929
2976
|
let n = t.pmViewDesc;
|
|
2930
2977
|
if (n) return n.parseRule(e);
|
|
2931
2978
|
if (t.nodeName == "BR" && t.parentNode) {
|
|
@@ -2936,13 +2983,13 @@ var vr = (e) => (t) => {
|
|
|
2936
2983
|
if (t.parentNode.lastChild == t || A && /^(tr|table)$/i.test(t.parentNode.nodeName)) return { ignore: !0 };
|
|
2937
2984
|
} else if (t.nodeName == "IMG" && t.getAttribute("mark-placeholder")) return { ignore: !0 };
|
|
2938
2985
|
return null;
|
|
2939
|
-
},
|
|
2940
|
-
function
|
|
2986
|
+
}, Cr = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
|
|
2987
|
+
function wr(e, t, n, i, a) {
|
|
2941
2988
|
let o = e.input.compositionPendingChanges || (e.composing ? e.input.compositionID : 0);
|
|
2942
2989
|
if (e.input.compositionPendingChanges = 0, t < 0) {
|
|
2943
|
-
let t = e.input.lastSelectionTime > Date.now() - 50 ? e.input.lastSelectionOrigin : null, n =
|
|
2990
|
+
let t = e.input.lastSelectionTime > Date.now() - 50 ? e.input.lastSelectionOrigin : null, n = ht(e, t);
|
|
2944
2991
|
if (n && !e.state.selection.eq(n)) {
|
|
2945
|
-
if (k &&
|
|
2992
|
+
if (k && M && e.input.lastKeyCode === 13 && Date.now() - 100 < e.input.lastKeyCodeTime && q(e, "Enter")) return;
|
|
2946
2993
|
let r = e.state.tr.setSelection(n);
|
|
2947
2994
|
t == "pointer" ? r.setMeta("pointer", !0) : t == "key" && r.scrollIntoView(), o && r.setMeta("composition", o), e.dispatch(r);
|
|
2948
2995
|
}
|
|
@@ -2950,10 +2997,10 @@ function br(e, t, n, i, a) {
|
|
|
2950
2997
|
}
|
|
2951
2998
|
let s = e.state.doc.resolve(t), c = s.sharedDepth(n);
|
|
2952
2999
|
t = s.before(c + 1), n = e.state.doc.resolve(n).after(c + 1);
|
|
2953
|
-
let l = e.state.selection, u =
|
|
3000
|
+
let l = e.state.selection, u = xr(e, t, n, a), d = e.state.doc, f = d.slice(u.from, u.to), p, m;
|
|
2954
3001
|
e.input.lastKeyCode === 8 && Date.now() - 100 < e.input.lastKeyCodeTime ? (p = e.state.selection.to, m = "end") : (p = e.state.selection.from, m = "start"), e.input.lastKeyCode = null;
|
|
2955
|
-
let h =
|
|
2956
|
-
if (h && e.input.domChangeCount++, (
|
|
3002
|
+
let h = Ar(f.content, u.doc.content, u.from, p, m);
|
|
3003
|
+
if (h && e.input.domChangeCount++, (fe && e.input.lastIOSEnter > Date.now() - 225 || M) && a.some((e) => y(e) && !Cr.test(e.nodeName)) && (!h || h.endA >= h.endB) && q(e, "Enter")) {
|
|
2957
3004
|
e.input.lastIOSEnter = 0;
|
|
2958
3005
|
return;
|
|
2959
3006
|
}
|
|
@@ -2965,7 +3012,7 @@ function br(e, t, n, i, a) {
|
|
|
2965
3012
|
};
|
|
2966
3013
|
else {
|
|
2967
3014
|
if (u.sel) {
|
|
2968
|
-
let t =
|
|
3015
|
+
let t = Tr(e, e.state.doc, u.sel);
|
|
2969
3016
|
if (t && !t.eq(e.state.selection)) {
|
|
2970
3017
|
let n = e.state.tr.setSelection(t);
|
|
2971
3018
|
o && n.setMeta("composition", o), e.dispatch(n);
|
|
@@ -2975,46 +3022,42 @@ function br(e, t, n, i, a) {
|
|
|
2975
3022
|
}
|
|
2976
3023
|
}
|
|
2977
3024
|
e.state.selection.from < e.state.selection.to && h.start == h.endB && e.state.selection instanceof r && (h.start > e.state.selection.from && h.start <= e.state.selection.from + 2 && e.state.selection.from >= u.from ? h.start = e.state.selection.from : h.endA < e.state.selection.to && h.endA >= e.state.selection.to - 2 && e.state.selection.to <= u.to && (h.endB += e.state.selection.to - h.endA, h.endA = e.state.selection.to)), E && D <= 11 && h.endB == h.start + 1 && h.endA == h.start && h.start > u.from && u.doc.textBetween(h.start - u.from - 1, h.start - u.from + 1) == " \xA0" && (h.start--, h.endA--, h.endB--);
|
|
2978
|
-
let g = u.doc.resolveNoCache(h.start - u.from), _ = u.doc.resolveNoCache(h.endB - u.from), v = d.resolve(h.start),
|
|
2979
|
-
if ((
|
|
3025
|
+
let g = u.doc.resolveNoCache(h.start - u.from), _ = u.doc.resolveNoCache(h.endB - u.from), v = d.resolve(h.start), b = g.sameParent(_) && g.parent.inlineContent && v.end() >= h.endA;
|
|
3026
|
+
if ((fe && e.input.lastIOSEnter > Date.now() - 225 && (!b || a.some((e) => e.nodeName == "DIV" || e.nodeName == "P")) || !b && Or(u.doc, g.pos, _.pos)) && q(e, "Enter")) {
|
|
2980
3027
|
e.input.lastIOSEnter = 0;
|
|
2981
3028
|
return;
|
|
2982
3029
|
}
|
|
2983
|
-
if (e.state.selection.anchor > h.start &&
|
|
2984
|
-
|
|
3030
|
+
if (e.state.selection.anchor > h.start && (b ? h.endA > h.start && h.endB == h.start : Dr(d, h.start, h.endA, g, _)) && q(e, "Backspace")) {
|
|
3031
|
+
M && k && e.domObserver.suppressSelectionUpdates();
|
|
2985
3032
|
return;
|
|
2986
3033
|
}
|
|
2987
|
-
k && h.endB == h.start && (e.input.lastChromeDelete = Date.now()),
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
});
|
|
2991
|
-
}, 20));
|
|
2992
|
-
let y = h.start, b = h.endA, x = (t) => {
|
|
2993
|
-
let n = t || e.state.tr.replace(y, b, u.doc.slice(h.start - u.from, h.endB - u.from));
|
|
3034
|
+
k && h.endB == h.start && (e.input.lastChromeDelete = Date.now()), M && !b && g.start() != _.start() && _.parentOffset == 0 && g.depth == _.depth && u.sel && u.sel.anchor == u.sel.head && u.sel.head == h.endA && (h.endB -= 2, _ = u.doc.resolveNoCache(h.endB - u.from), setTimeout(() => q(e, "Enter"), 20));
|
|
3035
|
+
let x = h.start, S = h.endA, C = (t) => {
|
|
3036
|
+
let n = t || e.state.tr.replace(x, S, u.doc.slice(h.start - u.from, h.endB - u.from));
|
|
2994
3037
|
if (u.sel) {
|
|
2995
|
-
let t =
|
|
2996
|
-
t && !(k && e.composing && t.empty && (h.start != h.endB || e.input.lastChromeDelete < Date.now() - 100) && (t.head ==
|
|
3038
|
+
let t = Tr(e, n.doc, u.sel);
|
|
3039
|
+
t && !(k && e.composing && t.empty && (h.start != h.endB || e.input.lastChromeDelete < Date.now() - 100) && (t.head == x || t.head == n.mapping.map(S) - 1) || E && t.empty && t.head == x) && n.setSelection(t);
|
|
2997
3040
|
}
|
|
2998
3041
|
return o && n.setMeta("composition", o), n.scrollIntoView();
|
|
2999
|
-
},
|
|
3000
|
-
if (
|
|
3042
|
+
}, ee;
|
|
3043
|
+
if (b) {
|
|
3001
3044
|
if (g.pos == _.pos) {
|
|
3002
|
-
E && D <= 11 && g.parentOffset == 0 && (e.domObserver.suppressSelectionUpdates(), setTimeout(() =>
|
|
3003
|
-
let t =
|
|
3045
|
+
E && D <= 11 && g.parentOffset == 0 && (e.domObserver.suppressSelectionUpdates(), setTimeout(() => V(e), 20));
|
|
3046
|
+
let t = C(e.state.tr.delete(x, S)), n = d.resolve(h.start).marksAcross(d.resolve(h.endA));
|
|
3004
3047
|
n && t.ensureMarks(n), e.dispatch(t);
|
|
3005
|
-
} else if (h.endA == h.endB && (
|
|
3006
|
-
let t =
|
|
3007
|
-
|
|
3048
|
+
} else if (h.endA == h.endB && (ee = Er(g.parent.content.cut(g.parentOffset, _.parentOffset), v.parent.content.cut(v.parentOffset, h.endA - v.start())))) {
|
|
3049
|
+
let t = C(e.state.tr);
|
|
3050
|
+
ee.type == "add" ? t.addMark(x, S, ee.mark) : t.removeMark(x, S, ee.mark), e.dispatch(t);
|
|
3008
3051
|
} else if (g.parent.child(g.index()).isText && g.index() == _.index() - +!_.textOffset) {
|
|
3009
|
-
let t = g.parent.textBetween(g.parentOffset, _.parentOffset), n = () =>
|
|
3010
|
-
e.someProp("handleTextInput", (r) => r(e,
|
|
3011
|
-
} else e.dispatch(
|
|
3012
|
-
} else e.dispatch(
|
|
3052
|
+
let t = g.parent.textBetween(g.parentOffset, _.parentOffset), n = () => C(e.state.tr.insertText(t, x, S));
|
|
3053
|
+
e.someProp("handleTextInput", (r) => r(e, x, S, t, n)) || e.dispatch(n());
|
|
3054
|
+
} else e.dispatch(C());
|
|
3055
|
+
} else e.dispatch(C());
|
|
3013
3056
|
}
|
|
3014
|
-
function
|
|
3015
|
-
return Math.max(n.anchor, n.head) > t.content.size ? null :
|
|
3057
|
+
function Tr(e, t, n) {
|
|
3058
|
+
return Math.max(n.anchor, n.head) > t.content.size ? null : Tt(e, t.resolve(n.anchor), t.resolve(n.head));
|
|
3016
3059
|
}
|
|
3017
|
-
function
|
|
3060
|
+
function Er(e, t) {
|
|
3018
3061
|
let n = e.firstChild.marks, r = t.firstChild.marks, i = n, a = r, s, c, l;
|
|
3019
3062
|
for (let e = 0; e < r.length; e++) i = r[e].removeFromSet(i);
|
|
3020
3063
|
for (let e = 0; e < n.length; e++) a = n[e].removeFromSet(a);
|
|
@@ -3028,18 +3071,24 @@ function Sr(e, t) {
|
|
|
3028
3071
|
type: s
|
|
3029
3072
|
};
|
|
3030
3073
|
}
|
|
3031
|
-
function
|
|
3032
|
-
if (n - t <= i.pos - r.pos ||
|
|
3074
|
+
function Dr(e, t, n, r, i) {
|
|
3075
|
+
if (n - t <= i.pos - r.pos || kr(r, !0, !1) < i.pos) return !1;
|
|
3033
3076
|
let a = e.resolve(t);
|
|
3034
|
-
if (!r.parent.
|
|
3077
|
+
if (!r.parent.inlineContent) {
|
|
3035
3078
|
let e = a.nodeAfter;
|
|
3036
3079
|
return e != null && n == t + e.nodeSize;
|
|
3037
3080
|
}
|
|
3038
3081
|
if (a.parentOffset < a.parent.content.size || !a.parent.isTextblock) return !1;
|
|
3039
|
-
let o = e.resolve(
|
|
3040
|
-
return !o.parent.isTextblock || o.pos > n ||
|
|
3082
|
+
let o = e.resolve(kr(a, !0, !0));
|
|
3083
|
+
return !o.parent.isTextblock || o.pos > n || kr(o, !0, !1) < n ? !1 : r.parent.content.cut(r.parentOffset).eq(o.parent.content);
|
|
3084
|
+
}
|
|
3085
|
+
function Or(e, t, n) {
|
|
3086
|
+
let r = 0, i = 0;
|
|
3087
|
+
return e.nodesBetween(t, n, (e, a) => {
|
|
3088
|
+
e.isTextblock && a >= t && a < n ? r++ : (e.isText ? /\S/.test(e.text.slice(Math.max(0, t - a), Math.min(e.nodeSize, n - a))) : e.isLeaf) && i++;
|
|
3089
|
+
}), i == 0 && r == 1;
|
|
3041
3090
|
}
|
|
3042
|
-
function
|
|
3091
|
+
function kr(e, t, n) {
|
|
3043
3092
|
let r = e.depth, i = t ? e.end() : e.pos;
|
|
3044
3093
|
for (; r > 0 && (t || e.indexAfter(r) == e.node(r).childCount);) r--, i++, t = !1;
|
|
3045
3094
|
if (n) {
|
|
@@ -3048,7 +3097,7 @@ function wr(e, t, n) {
|
|
|
3048
3097
|
}
|
|
3049
3098
|
return i;
|
|
3050
3099
|
}
|
|
3051
|
-
function
|
|
3100
|
+
function Ar(e, t, n, r, i) {
|
|
3052
3101
|
let a = e.findDiffStart(t, n), o = n + e.size, s = n + t.size;
|
|
3053
3102
|
if (a == null) return null;
|
|
3054
3103
|
let { a: c, b: l } = e.findDiffEnd(t, o, s);
|
|
@@ -3069,9 +3118,9 @@ function Tr(e, t, n, r, i) {
|
|
|
3069
3118
|
endB: l
|
|
3070
3119
|
};
|
|
3071
3120
|
}
|
|
3072
|
-
var
|
|
3121
|
+
var jr = class {
|
|
3073
3122
|
constructor(e, t) {
|
|
3074
|
-
this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new
|
|
3123
|
+
this._root = null, this.focused = !1, this.trackWrites = null, this.mounted = !1, this.markCursor = null, this.cursorWrapper = null, this.lastSelectedViewDesc = void 0, this.input = new ln(), this.prevDirectPlugins = [], this.pluginViews = [], this.requiresGeckoHackNode = !1, this.dragging = null, this._props = t, this.state = t.state, this.directPlugins = t.plugins || [], this.directPlugins.forEach(Rr), this.dispatch = this.dispatch.bind(this), this.dom = e && e.mount || document.createElement("div"), e && (e.appendChild ? e.appendChild(this.dom) : typeof e == "function" ? e(this.dom) : e.mount && (this.mounted = !0)), this.editable = Pr(this), Nr(this), this.nodeViews = Ir(this), this.docView = Xe(this.state.doc, Mr(this), lr(this), this.dom, this), this.domObserver = new pr(this, (e, t, n, r) => wr(this, e, t, n, r)), this.domObserver.start(), un(this), this.updatePluginViews();
|
|
3075
3124
|
}
|
|
3076
3125
|
get composing() {
|
|
3077
3126
|
return this.input.composing;
|
|
@@ -3086,9 +3135,9 @@ var Er = class {
|
|
|
3086
3135
|
return this._props;
|
|
3087
3136
|
}
|
|
3088
3137
|
update(e) {
|
|
3089
|
-
e.handleDOMEvents != this._props.handleDOMEvents &&
|
|
3138
|
+
e.handleDOMEvents != this._props.handleDOMEvents && fn(this);
|
|
3090
3139
|
let t = this._props;
|
|
3091
|
-
this._props = e, e.plugins && (e.plugins.forEach(
|
|
3140
|
+
this._props = e, e.plugins && (e.plugins.forEach(Rr), this.directPlugins = e.plugins), this.updateStateInner(e.state, t);
|
|
3092
3141
|
}
|
|
3093
3142
|
setProps(e) {
|
|
3094
3143
|
let t = {};
|
|
@@ -3102,35 +3151,35 @@ var Er = class {
|
|
|
3102
3151
|
}
|
|
3103
3152
|
updateStateInner(e, t) {
|
|
3104
3153
|
let n = this.state, r = !1, i = !1;
|
|
3105
|
-
e.storedMarks && this.composing && (
|
|
3154
|
+
e.storedMarks && this.composing && (In(this), i = !0), this.state = e;
|
|
3106
3155
|
let a = n.plugins != e.plugins || this._props.plugins != t.plugins;
|
|
3107
3156
|
if (a || this._props.plugins != t.plugins || this._props.nodeViews != t.nodeViews) {
|
|
3108
|
-
let e =
|
|
3109
|
-
|
|
3157
|
+
let e = Ir(this);
|
|
3158
|
+
Lr(e, this.nodeViews) && (this.nodeViews = e, r = !0);
|
|
3110
3159
|
}
|
|
3111
|
-
(a || t.handleDOMEvents != this._props.handleDOMEvents) &&
|
|
3112
|
-
let o =
|
|
3160
|
+
(a || t.handleDOMEvents != this._props.handleDOMEvents) && fn(this), this.editable = Pr(this), Nr(this);
|
|
3161
|
+
let o = lr(this), s = Mr(this), c = n.plugins != e.plugins && !n.doc.eq(e.doc) ? "reset" : e.scrollToSelection > n.scrollToSelection ? "to selection" : "preserve", l = r || !this.docView.matchesNode(e.doc, s, o);
|
|
3113
3162
|
(l || !e.selection.eq(n.selection)) && (i = !0);
|
|
3114
|
-
let u = c == "preserve" && i && this.dom.style.overflowAnchor == null &&
|
|
3163
|
+
let u = c == "preserve" && i && this.dom.style.overflowAnchor == null && ye(this);
|
|
3115
3164
|
if (i) {
|
|
3116
3165
|
this.domObserver.stop();
|
|
3117
|
-
let t = l && (E || k) && !this.composing && !n.selection.empty && !e.selection.empty &&
|
|
3166
|
+
let t = l && (E || k) && !this.composing && !n.selection.empty && !e.selection.empty && Fr(n.selection, e.selection);
|
|
3118
3167
|
if (l) {
|
|
3119
3168
|
let n = k ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
3120
|
-
this.composing && (this.input.compositionNode =
|
|
3169
|
+
this.composing && (this.input.compositionNode = Ln(this)), (r || !this.docView.update(e.doc, s, o, this)) && (this.docView.updateOuterDeco(s), this.docView.destroy(), this.docView = Xe(e.doc, s, o, this.dom, this)), !n || this.trackWrites && this.dom.contains(this.trackWrites) || (t = !0);
|
|
3121
3170
|
}
|
|
3122
3171
|
let i = this.input.mouseDown;
|
|
3123
|
-
t || !(i && this.domObserver.currentSelection.eq(this.domSelectionRange()) &&
|
|
3172
|
+
t || !(i && this.domObserver.currentSelection.eq(this.domSelectionRange()) && Ot(this) && i.delaySelUpdate()) ? V(this, t) : (Ct(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
3124
3173
|
}
|
|
3125
|
-
this.updatePluginViews(n), this.dragging?.node && !n.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, n), c == "reset" ? this.dom.scrollTop = 0 : c == "to selection" ? this.scrollToSelection() : u &&
|
|
3174
|
+
this.updatePluginViews(n), this.dragging?.node && !n.doc.eq(e.doc) && this.updateDraggedNode(this.dragging, n), c == "reset" ? this.dom.scrollTop = 0 : c == "to selection" ? this.scrollToSelection() : u && xe(u);
|
|
3126
3175
|
}
|
|
3127
3176
|
scrollToSelection() {
|
|
3128
3177
|
let e = this.domSelectionRange().focusNode;
|
|
3129
|
-
if (e && this.dom
|
|
3178
|
+
if (e && x(this.dom, e) && !this.someProp("handleScrollToSelection", (e) => e(this))) {
|
|
3130
3179
|
if (this.state.selection instanceof t) {
|
|
3131
3180
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
3132
|
-
t
|
|
3133
|
-
} else
|
|
3181
|
+
y(t) && ve(this, t.getBoundingClientRect(), e);
|
|
3182
|
+
} else ve(this, this.coordsAtPos(this.state.selection.head, 1), e);
|
|
3134
3183
|
}
|
|
3135
3184
|
}
|
|
3136
3185
|
destroyPluginViews() {
|
|
@@ -3160,7 +3209,7 @@ var Er = class {
|
|
|
3160
3209
|
let e = r.from + (this.state.doc.content.size - n.doc.content.size);
|
|
3161
3210
|
(e > 0 && e < this.state.doc.content.size && this.state.doc.nodeAt(e)) == r.node && (i = e);
|
|
3162
3211
|
}
|
|
3163
|
-
this.dragging = new
|
|
3212
|
+
this.dragging = new Gn(e.slice, e.move, i < 0 ? void 0 : t.create(this.state.doc, i));
|
|
3164
3213
|
}
|
|
3165
3214
|
someProp(e, t) {
|
|
3166
3215
|
let n = this._props && this._props[e], r;
|
|
@@ -3189,7 +3238,7 @@ var Er = class {
|
|
|
3189
3238
|
return this.root.activeElement == this.dom;
|
|
3190
3239
|
}
|
|
3191
3240
|
focus() {
|
|
3192
|
-
this.domObserver.stop(), this.editable &&
|
|
3241
|
+
this.domObserver.stop(), this.editable && Ce(this.dom), V(this), this.domObserver.start();
|
|
3193
3242
|
}
|
|
3194
3243
|
get root() {
|
|
3195
3244
|
let e = this._root;
|
|
@@ -3202,10 +3251,10 @@ var Er = class {
|
|
|
3202
3251
|
this._root = null;
|
|
3203
3252
|
}
|
|
3204
3253
|
posAtCoords(e) {
|
|
3205
|
-
return
|
|
3254
|
+
return je(this, e);
|
|
3206
3255
|
}
|
|
3207
3256
|
coordsAtPos(e, t = 1) {
|
|
3208
|
-
return
|
|
3257
|
+
return Pe(this, e, t);
|
|
3209
3258
|
}
|
|
3210
3259
|
domAtPos(e, t = 0) {
|
|
3211
3260
|
return this.docView.domFromPos(e, t);
|
|
@@ -3220,29 +3269,29 @@ var Er = class {
|
|
|
3220
3269
|
return r;
|
|
3221
3270
|
}
|
|
3222
3271
|
endOfTextblock(e, t) {
|
|
3223
|
-
return
|
|
3272
|
+
return We(this, t || this.state, e);
|
|
3224
3273
|
}
|
|
3225
3274
|
pasteHTML(e, t) {
|
|
3226
|
-
return
|
|
3275
|
+
return Un(this, "", e, !1, t || new ClipboardEvent("paste"));
|
|
3227
3276
|
}
|
|
3228
3277
|
pasteText(e, t) {
|
|
3229
|
-
return
|
|
3278
|
+
return Un(this, e, null, !0, t || new ClipboardEvent("paste"));
|
|
3230
3279
|
}
|
|
3231
3280
|
serializeForClipboard(e) {
|
|
3232
|
-
return
|
|
3281
|
+
return Gt(this, e);
|
|
3233
3282
|
}
|
|
3234
3283
|
destroy() {
|
|
3235
|
-
this.docView && (
|
|
3284
|
+
this.docView && (dn(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], lr(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, m());
|
|
3236
3285
|
}
|
|
3237
3286
|
get isDestroyed() {
|
|
3238
3287
|
return this.docView == null;
|
|
3239
3288
|
}
|
|
3240
3289
|
dispatchEvent(e) {
|
|
3241
|
-
return
|
|
3290
|
+
return hn(this, e);
|
|
3242
3291
|
}
|
|
3243
3292
|
domSelectionRange() {
|
|
3244
|
-
let e = this.domSelection();
|
|
3245
|
-
return e ? A && this.root.nodeType === 11 &&
|
|
3293
|
+
let e = this.dom.isConnected !== !1 && this.domSelection();
|
|
3294
|
+
return e ? A && this.root.nodeType === 11 && ie(this.dom.ownerDocument) == this.dom && vr(this, e) || e : {
|
|
3246
3295
|
focusNode: null,
|
|
3247
3296
|
focusOffset: 0,
|
|
3248
3297
|
anchorNode: null,
|
|
@@ -3253,17 +3302,17 @@ var Er = class {
|
|
|
3253
3302
|
return this.root.getSelection();
|
|
3254
3303
|
}
|
|
3255
3304
|
};
|
|
3256
|
-
|
|
3305
|
+
jr.prototype.dispatch = function(e) {
|
|
3257
3306
|
let t = this._props.dispatchTransaction;
|
|
3258
3307
|
t ? t.call(this, e) : this.updateState(this.state.apply(e));
|
|
3259
3308
|
};
|
|
3260
|
-
function
|
|
3309
|
+
function Mr(e) {
|
|
3261
3310
|
let t = Object.create(null);
|
|
3262
3311
|
return t.class = "ProseMirror", t.contenteditable = String(e.editable), e.someProp("attributes", (n) => {
|
|
3263
3312
|
if (typeof n == "function" && (n = n(e.state)), n) for (let e in n) e == "class" ? t.class += " " + n[e] : e == "style" ? t.style = (t.style ? t.style + ";" : "") + n[e] : !t[e] && e != "contenteditable" && e != "nodeName" && (t[e] = String(n[e]));
|
|
3264
3313
|
}), t.translate ||= "no", [J.node(0, e.state.doc.content.size, t)];
|
|
3265
3314
|
}
|
|
3266
|
-
function
|
|
3315
|
+
function Nr(e) {
|
|
3267
3316
|
if (e.markCursor) {
|
|
3268
3317
|
let t = document.createElement("img");
|
|
3269
3318
|
t.className = "ProseMirror-separator", t.setAttribute("mark-placeholder", "true"), t.setAttribute("alt", ""), e.cursorWrapper = {
|
|
@@ -3275,21 +3324,21 @@ function Or(e) {
|
|
|
3275
3324
|
};
|
|
3276
3325
|
} else e.cursorWrapper = null;
|
|
3277
3326
|
}
|
|
3278
|
-
function
|
|
3327
|
+
function Pr(e) {
|
|
3279
3328
|
return !e.someProp("editable", (t) => t(e.state) === !1);
|
|
3280
3329
|
}
|
|
3281
|
-
function
|
|
3330
|
+
function Fr(e, t) {
|
|
3282
3331
|
let n = Math.min(e.$anchor.sharedDepth(e.head), t.$anchor.sharedDepth(t.head));
|
|
3283
3332
|
return e.$anchor.start(n) != t.$anchor.start(n);
|
|
3284
3333
|
}
|
|
3285
|
-
function
|
|
3334
|
+
function Ir(e) {
|
|
3286
3335
|
let t = Object.create(null);
|
|
3287
3336
|
function n(e) {
|
|
3288
3337
|
for (let n in e) Object.prototype.hasOwnProperty.call(t, n) || (t[n] = e[n]);
|
|
3289
3338
|
}
|
|
3290
3339
|
return e.someProp("nodeViews", n), e.someProp("markViews", n), t;
|
|
3291
3340
|
}
|
|
3292
|
-
function
|
|
3341
|
+
function Lr(e, t) {
|
|
3293
3342
|
let n = 0, r = 0;
|
|
3294
3343
|
for (let r in e) {
|
|
3295
3344
|
if (e[r] != t[r]) return !0;
|
|
@@ -3298,9 +3347,9 @@ function Mr(e, t) {
|
|
|
3298
3347
|
for (let e in t) r++;
|
|
3299
3348
|
return n != r;
|
|
3300
3349
|
}
|
|
3301
|
-
function
|
|
3350
|
+
function Rr(e) {
|
|
3302
3351
|
if (e.spec.state || e.spec.filterTransaction || e.spec.appendTransaction) throw RangeError("Plugins passed directly to the view must not have a state component");
|
|
3303
3352
|
}
|
|
3304
|
-
export { J as Decoration, Z as DecorationSet,
|
|
3353
|
+
export { J as Decoration, Z as DecorationSet, jr as EditorView };
|
|
3305
3354
|
|
|
3306
3355
|
//# sourceMappingURL=index.js.map
|