@clevertask/scribe 0.1.17 → 0.1.19
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/README.md +29 -1
- package/dist/{BarMenu-x4sf3ECS.js → BarMenu-C9tCdvyV.js} +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +64 -64
- package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -1
- package/dist/components/Menu/LinkBubbleMenu.js +16 -16
- package/dist/components/Menu/LinkEditor.d.ts.map +1 -1
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
- package/dist/components/Scribe/extension/callout.js +2 -5
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +38 -38
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts +1 -2
- package/dist/components/Scribe/extension/external-link-preview/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +20 -113
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +6 -6
- package/dist/components/Scribe/extension/external-link-preview/paste.js +5 -5
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/schema.d.ts +8 -0
- package/dist/components/Scribe/extension/external-link-preview/schema.d.ts.map +1 -0
- package/dist/components/Scribe/extension/external-link-preview/schema.js +100 -0
- package/dist/components/Scribe/extension/index.d.ts +2 -2
- package/dist/components/Scribe/extension/index.d.ts.map +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/index.js +32 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +4 -4
- package/dist/{dist-tNcpTcFT.js → dist-CkWsQ5Lj.js} +197 -185
- package/dist/{slashCommand-CtvgnL0Z.js → dist-CzXFZHMF.js} +56 -81
- package/dist/{dist-DDjaA1Pn.js → dist-DRPH9MfF.js} +1 -1
- package/dist/extension-CKcvyrIW.js +57 -0
- package/dist/{extension-link-RYtPpHwt.js → extension-link-yMrg9JOz.js} +2 -2
- package/dist/{html-to-markdown-nbQ6qHyO.js → html-to-markdown-pY8ngCXa.js} +14 -14
- package/dist/main.js +6 -6
- package/dist/{markdown-to-html-B-KKCZRs.js → markdown-to-html-COv0iaxr.js} +14 -15
- package/dist/{menus-U2HdvQnu.js → menus-D1cst_3I.js} +107 -107
- package/dist/purify.es-DGv0-Lid.js +805 -0
- package/dist/{resizable-table-m0AzovsZ.js → resizable-table-D0mls3aB.js} +2 -2
- package/dist/{extension-CwuvxVkr.js → schema-extensions-ChhE6XCo.js} +51921 -51948
- package/dist/schema-extensions.d.ts +20 -0
- package/dist/schema-extensions.d.ts.map +1 -0
- package/dist/schema-extensions.js +2 -0
- package/dist/schema.d.ts +17 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +5 -0
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +58 -52
- package/dist/purify.es-BES4pJF7.js +0 -774
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
//#region node_modules/.pnpm/@tiptap+extension-bubble-menu@3.30.
|
|
1
|
+
import { B as e, E as t, P as n, T as r, n as i } from "./dist-CkWsQ5Lj.js";
|
|
2
|
+
import { a, c as o, i as s, l as c, n as l, o as u, s as d, t as f, u as p } from "./floating-ui.dom-CmJ6iBdh.js";
|
|
3
|
+
import { a as m } from "./dist-DRPH9MfF.js";
|
|
4
|
+
import { NodeSelection as h, Plugin as g, PluginKey as _ } from "@tiptap/pm/state";
|
|
5
|
+
import { CellSelection as v } from "@tiptap/pm/tables";
|
|
6
|
+
import y, { useEffect as b, useLayoutEffect as x, useRef as S, useState as C } from "react";
|
|
7
|
+
import { createPortal as w } from "react-dom";
|
|
8
|
+
//#region node_modules/.pnpm/@tiptap+extension-bubble-menu@3.30.2_@tiptap+core@3.30.2_@tiptap+pm@3.30.2__@tiptap+pm@3.30.2/node_modules/@tiptap/extension-bubble-menu/dist/index.js
|
|
9
9
|
function T(e, t) {
|
|
10
10
|
let n = Math.min(e.top, t.top), r = Math.max(e.bottom, t.bottom), i = Math.min(e.left, t.left), a = Math.max(e.right, t.right) - i, o = r - n;
|
|
11
11
|
return new DOMRect(i, n, a, o);
|
|
12
12
|
}
|
|
13
13
|
var E = class {
|
|
14
|
-
constructor({ editor: e, element: t, view:
|
|
14
|
+
constructor({ editor: e, element: t, view: r, pluginKey: i = "bubbleMenu", updateDelay: a = 250, resizeDelay: o = 60, shouldShow: s, appendTo: c, getReferencedVirtualElement: l, options: u }) {
|
|
15
15
|
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
|
|
16
16
|
strategy: "absolute",
|
|
17
17
|
placement: "top",
|
|
@@ -27,8 +27,8 @@ var E = class {
|
|
|
27
27
|
onHide: void 0,
|
|
28
28
|
onUpdate: void 0,
|
|
29
29
|
onDestroy: void 0
|
|
30
|
-
}, this.shouldShow = ({ view: e, state: t, from:
|
|
31
|
-
let { doc: a, selection: o } = t, { empty: s } = o, c = !a.textBetween(
|
|
30
|
+
}, this.shouldShow = ({ view: e, state: t, from: r, to: i }) => {
|
|
31
|
+
let { doc: a, selection: o } = t, { empty: s } = o, c = !a.textBetween(r, i).length && n(t.selection), l = this.element.contains(document.activeElement);
|
|
32
32
|
return !(!(e.hasFocus() || l) || s || c || !this.editor.isEditable);
|
|
33
33
|
}, this.mousedownHandler = () => {
|
|
34
34
|
this.preventHide = !0;
|
|
@@ -67,32 +67,32 @@ var E = class {
|
|
|
67
67
|
}, this.transactionHandler = ({ transaction: e }) => {
|
|
68
68
|
let t = e.getMeta(this.pluginKey);
|
|
69
69
|
t === "updatePosition" ? this.updatePosition() : t && typeof t == "object" && t.type === "updateOptions" ? this.updateOptions(t.options) : t === "hide" ? this.hide() : t === "show" && (this.updatePosition(), this.show());
|
|
70
|
-
}, this.editor = e, this.element = t, this.view =
|
|
70
|
+
}, this.editor = e, this.element = t, this.view = r, this.pluginKey = i, this.updateDelay = a, this.resizeDelay = o, this.appendTo = c, this.scrollTarget = u?.scrollTarget ?? window, this.getReferencedVirtualElement = l, this.floatingUIOptions = {
|
|
71
71
|
...this.floatingUIOptions,
|
|
72
72
|
...u
|
|
73
|
-
}, this.element.tabIndex = 0, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(
|
|
73
|
+
}, this.element.tabIndex = 0, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(r, r.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
74
74
|
}
|
|
75
75
|
get middlewares() {
|
|
76
76
|
let e = [];
|
|
77
|
-
return this.floatingUIOptions.flip && e.push(
|
|
77
|
+
return this.floatingUIOptions.flip && e.push(a(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(c(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(o(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(f(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(p(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(l(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(u(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(d(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
|
|
78
78
|
}
|
|
79
79
|
get virtualElement() {
|
|
80
|
-
let { selection:
|
|
80
|
+
let { selection: t } = this.editor.state, n = this.getReferencedVirtualElement?.call(this);
|
|
81
81
|
if (n) return n;
|
|
82
82
|
if (!this.view?.dom?.parentNode) return;
|
|
83
|
-
let r =
|
|
83
|
+
let r = e(this.view, t.from, t.to), i = {
|
|
84
84
|
getBoundingClientRect: () => r,
|
|
85
85
|
getClientRects: () => [r]
|
|
86
86
|
};
|
|
87
|
-
if (
|
|
88
|
-
let
|
|
89
|
-
n && (
|
|
90
|
-
getBoundingClientRect: () =>
|
|
91
|
-
getClientRects: () => [
|
|
87
|
+
if (t instanceof h) {
|
|
88
|
+
let e = this.view.nodeDOM(t.from), n = e.dataset.nodeViewWrapper ? e : e.querySelector("[data-node-view-wrapper]");
|
|
89
|
+
n && (e = n), e && (i = {
|
|
90
|
+
getBoundingClientRect: () => e.getBoundingClientRect(),
|
|
91
|
+
getClientRects: () => [e.getBoundingClientRect()]
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
if (
|
|
95
|
-
let { $anchorCell:
|
|
94
|
+
if (t instanceof v) {
|
|
95
|
+
let { $anchorCell: e, $headCell: n } = t, r = e ? e.pos : n.pos, a = n ? n.pos : e.pos, o = this.view.nodeDOM(r), s = this.view.nodeDOM(a);
|
|
96
96
|
if (!o || !s) return;
|
|
97
97
|
let c = o === s ? o.getBoundingClientRect() : T(o.getBoundingClientRect(), s.getBoundingClientRect());
|
|
98
98
|
i = {
|
|
@@ -105,7 +105,7 @@ var E = class {
|
|
|
105
105
|
updatePosition() {
|
|
106
106
|
if (!this.isVisible) return;
|
|
107
107
|
let e = this.virtualElement;
|
|
108
|
-
e &&
|
|
108
|
+
e && s(e, this.element, {
|
|
109
109
|
placement: this.floatingUIOptions.placement,
|
|
110
110
|
strategy: this.floatingUIOptions.strategy,
|
|
111
111
|
middleware: this.middlewares
|
|
@@ -159,14 +159,14 @@ var E = class {
|
|
|
159
159
|
destroy() {
|
|
160
160
|
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
161
161
|
}
|
|
162
|
-
}, D = (e) => new
|
|
163
|
-
key: typeof e.pluginKey == "string" ? new
|
|
162
|
+
}, D = (e) => new g({
|
|
163
|
+
key: typeof e.pluginKey == "string" ? new _(e.pluginKey) : e.pluginKey,
|
|
164
164
|
view: (t) => new E({
|
|
165
165
|
view: t,
|
|
166
166
|
...e
|
|
167
167
|
})
|
|
168
168
|
});
|
|
169
|
-
|
|
169
|
+
i.create({
|
|
170
170
|
name: "bubbleMenu",
|
|
171
171
|
addOptions() {
|
|
172
172
|
return {
|
|
@@ -191,7 +191,7 @@ a.create({
|
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
193
|
//#endregion
|
|
194
|
-
//#region node_modules/.pnpm/@tiptap+extension-floating-menu@3.30.
|
|
194
|
+
//#region node_modules/.pnpm/@tiptap+extension-floating-menu@3.30.2_@floating-ui+dom@1.8.0_@tiptap+core@3.30.2_@tiptap+pm@3.30.2__@tiptap+pm@3.30.2/node_modules/@tiptap/extension-floating-menu/dist/index.js
|
|
195
195
|
var O = class {
|
|
196
196
|
constructor({ editor: e, element: t, view: n, pluginKey: r = "floatingMenu", updateDelay: i = 250, resizeDelay: a = 60, options: o, appendTo: s, shouldShow: c }) {
|
|
197
197
|
this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: e, state: t }) => {
|
|
@@ -240,11 +240,11 @@ var O = class {
|
|
|
240
240
|
}, this.element.tabIndex = 0, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
|
|
241
241
|
}
|
|
242
242
|
getTextContent(e) {
|
|
243
|
-
return
|
|
243
|
+
return r(e, { textSerializers: t(this.editor.schema) });
|
|
244
244
|
}
|
|
245
245
|
get middlewares() {
|
|
246
246
|
let e = [];
|
|
247
|
-
return this.floatingUIOptions.flip && e.push(
|
|
247
|
+
return this.floatingUIOptions.flip && e.push(a(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(c(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(o(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(f(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(p(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(l(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(u(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(d(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
|
|
248
248
|
}
|
|
249
249
|
getShouldShow(e) {
|
|
250
250
|
let { state: t } = this.view, { selection: n } = t, { ranges: r } = n, i = Math.min(...r.map((e) => e.$from.pos)), a = Math.max(...r.map((e) => e.$to.pos));
|
|
@@ -268,8 +268,8 @@ var O = class {
|
|
|
268
268
|
}
|
|
269
269
|
updatePosition() {
|
|
270
270
|
if (!this.view?.dom?.parentNode) return;
|
|
271
|
-
let { selection:
|
|
272
|
-
|
|
271
|
+
let { selection: t } = this.editor.state, n = e(this.view, t.from, t.to);
|
|
272
|
+
s({
|
|
273
273
|
getBoundingClientRect: () => n,
|
|
274
274
|
getClientRects: () => [n]
|
|
275
275
|
}, this.element, {
|
|
@@ -298,14 +298,14 @@ var O = class {
|
|
|
298
298
|
destroy() {
|
|
299
299
|
this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
|
|
300
300
|
}
|
|
301
|
-
}, k = (e) => new
|
|
302
|
-
key: typeof e.pluginKey == "string" ? new
|
|
301
|
+
}, k = (e) => new g({
|
|
302
|
+
key: typeof e.pluginKey == "string" ? new _(e.pluginKey) : e.pluginKey,
|
|
303
303
|
view: (t) => new O({
|
|
304
304
|
view: t,
|
|
305
305
|
...e
|
|
306
306
|
})
|
|
307
307
|
});
|
|
308
|
-
|
|
308
|
+
i.create({
|
|
309
309
|
name: "floatingMenu",
|
|
310
310
|
addOptions() {
|
|
311
311
|
return {
|
|
@@ -335,11 +335,11 @@ a.create({
|
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
337
|
//#endregion
|
|
338
|
-
//#region node_modules/.pnpm/@tiptap+react@3.30.
|
|
338
|
+
//#region node_modules/.pnpm/@tiptap+react@3.30.2_@floating-ui+dom@1.8.0_@tiptap+core@3.30.2_@tiptap+pm@3.30.2__@tip_864597464ea99af6963241e56e6f20f3/node_modules/@tiptap/react/dist/menus/index.js
|
|
339
339
|
function A(e, t) {
|
|
340
|
-
return e ?? new
|
|
340
|
+
return e ?? new _(t);
|
|
341
341
|
}
|
|
342
|
-
var j = typeof window < "u" ?
|
|
342
|
+
var j = typeof window < "u" ? x : b, M = /* @__PURE__ */ new Set([
|
|
343
343
|
"left",
|
|
344
344
|
"opacity",
|
|
345
345
|
"position",
|
|
@@ -507,7 +507,7 @@ function Q(e, t, n) {
|
|
|
507
507
|
}), r;
|
|
508
508
|
}
|
|
509
509
|
function $(e, t) {
|
|
510
|
-
let n =
|
|
510
|
+
let n = S({}), r = S([]);
|
|
511
511
|
j(() => {
|
|
512
512
|
let i = n.current;
|
|
513
513
|
return X(e, i.className, t.className), Z(e, i.style, t.style), Y(e, i, t), r.current = Q(e, r.current, t), n.current = t, () => {
|
|
@@ -517,117 +517,117 @@ function $(e, t) {
|
|
|
517
517
|
};
|
|
518
518
|
}, [e, t]);
|
|
519
519
|
}
|
|
520
|
-
var te =
|
|
521
|
-
let
|
|
522
|
-
$(
|
|
523
|
-
let { editor:
|
|
524
|
-
updateDelay:
|
|
525
|
-
resizeDelay:
|
|
526
|
-
appendTo:
|
|
527
|
-
pluginKey:
|
|
528
|
-
shouldShow:
|
|
529
|
-
getReferencedVirtualElement:
|
|
530
|
-
options:
|
|
531
|
-
},
|
|
532
|
-
|
|
533
|
-
let [
|
|
534
|
-
return
|
|
520
|
+
var te = y.forwardRef(({ pluginKey: e, editor: t, updateDelay: n, resizeDelay: r, appendTo: i, shouldShow: a = null, getReferencedVirtualElement: o, options: s, children: c, ...l }, u) => {
|
|
521
|
+
let d = S(document.createElement("div")), f = S(A(e, "bubbleMenu")).current;
|
|
522
|
+
$(d.current, l), typeof u == "function" ? u(d.current) : u && (u.current = d.current);
|
|
523
|
+
let { editor: p } = m(), h = t || p, g = {
|
|
524
|
+
updateDelay: n,
|
|
525
|
+
resizeDelay: r,
|
|
526
|
+
appendTo: i,
|
|
527
|
+
pluginKey: f,
|
|
528
|
+
shouldShow: a,
|
|
529
|
+
getReferencedVirtualElement: o,
|
|
530
|
+
options: s
|
|
531
|
+
}, _ = S(g);
|
|
532
|
+
_.current = g;
|
|
533
|
+
let [v, y] = C(!1), x = S(!0);
|
|
534
|
+
return b(() => {
|
|
535
535
|
if (h?.isDestroyed) return;
|
|
536
536
|
if (!h) {
|
|
537
537
|
console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
538
538
|
return;
|
|
539
539
|
}
|
|
540
|
-
let e =
|
|
540
|
+
let e = d.current;
|
|
541
541
|
e.style.visibility = "hidden", e.style.position = "absolute";
|
|
542
542
|
let t = D({
|
|
543
|
-
...
|
|
543
|
+
..._.current,
|
|
544
544
|
editor: h,
|
|
545
545
|
element: e
|
|
546
546
|
});
|
|
547
547
|
h.registerPlugin(t);
|
|
548
|
-
let n =
|
|
549
|
-
return
|
|
550
|
-
|
|
548
|
+
let n = _.current.pluginKey;
|
|
549
|
+
return x.current = !0, y(!0), () => {
|
|
550
|
+
y(!1), h.unregisterPlugin(n), window.requestAnimationFrame(() => {
|
|
551
551
|
e.parentNode && e.parentNode.removeChild(e);
|
|
552
552
|
});
|
|
553
553
|
};
|
|
554
|
-
}, [h]),
|
|
555
|
-
if (!(!
|
|
556
|
-
if (
|
|
557
|
-
|
|
554
|
+
}, [h]), b(() => {
|
|
555
|
+
if (!(!v || !h || h.isDestroyed)) {
|
|
556
|
+
if (x.current) {
|
|
557
|
+
x.current = !1;
|
|
558
558
|
return;
|
|
559
559
|
}
|
|
560
|
-
h.view.dispatch(h.state.tr.setMeta(
|
|
560
|
+
h.view.dispatch(h.state.tr.setMeta(f, {
|
|
561
561
|
type: "updateOptions",
|
|
562
|
-
options:
|
|
562
|
+
options: _.current
|
|
563
563
|
}));
|
|
564
564
|
}
|
|
565
565
|
}, [
|
|
566
|
-
|
|
566
|
+
v,
|
|
567
567
|
h,
|
|
568
|
+
n,
|
|
568
569
|
r,
|
|
569
|
-
i,
|
|
570
|
-
o,
|
|
571
|
-
c,
|
|
572
570
|
a,
|
|
573
571
|
s,
|
|
574
|
-
|
|
575
|
-
|
|
572
|
+
i,
|
|
573
|
+
o,
|
|
574
|
+
f
|
|
575
|
+
]), w(c, d.current);
|
|
576
576
|
});
|
|
577
|
-
|
|
578
|
-
let
|
|
579
|
-
$(
|
|
580
|
-
let { editor:
|
|
581
|
-
updateDelay:
|
|
582
|
-
resizeDelay:
|
|
583
|
-
appendTo:
|
|
584
|
-
pluginKey:
|
|
585
|
-
shouldShow:
|
|
586
|
-
options:
|
|
587
|
-
},
|
|
588
|
-
|
|
589
|
-
let [
|
|
590
|
-
return
|
|
591
|
-
if (
|
|
592
|
-
if (!
|
|
577
|
+
y.forwardRef(({ pluginKey: e, editor: t, updateDelay: n, resizeDelay: r, appendTo: i, shouldShow: a = null, options: o, children: s, ...c }, l) => {
|
|
578
|
+
let u = S(document.createElement("div")), d = S(A(e, "floatingMenu")).current;
|
|
579
|
+
$(u.current, c), typeof l == "function" ? l(u.current) : l && (l.current = u.current);
|
|
580
|
+
let { editor: f } = m(), p = t || f, h = {
|
|
581
|
+
updateDelay: n,
|
|
582
|
+
resizeDelay: r,
|
|
583
|
+
appendTo: i,
|
|
584
|
+
pluginKey: d,
|
|
585
|
+
shouldShow: a,
|
|
586
|
+
options: o
|
|
587
|
+
}, g = S(h);
|
|
588
|
+
g.current = h;
|
|
589
|
+
let [_, v] = C(!1), y = S(!0);
|
|
590
|
+
return b(() => {
|
|
591
|
+
if (p?.isDestroyed) return;
|
|
592
|
+
if (!p) {
|
|
593
593
|
console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");
|
|
594
594
|
return;
|
|
595
595
|
}
|
|
596
|
-
let e =
|
|
596
|
+
let e = u.current;
|
|
597
597
|
e.style.visibility = "hidden", e.style.position = "absolute";
|
|
598
598
|
let t = k({
|
|
599
|
-
...
|
|
600
|
-
editor:
|
|
599
|
+
...g.current,
|
|
600
|
+
editor: p,
|
|
601
601
|
element: e
|
|
602
602
|
});
|
|
603
|
-
|
|
604
|
-
let n =
|
|
605
|
-
return
|
|
606
|
-
|
|
603
|
+
p.registerPlugin(t);
|
|
604
|
+
let n = g.current.pluginKey;
|
|
605
|
+
return y.current = !0, v(!0), () => {
|
|
606
|
+
v(!1), p.unregisterPlugin(n), window.requestAnimationFrame(() => {
|
|
607
607
|
e.parentNode && e.parentNode.removeChild(e);
|
|
608
608
|
});
|
|
609
609
|
};
|
|
610
|
-
}, [
|
|
611
|
-
if (!(!
|
|
612
|
-
if (
|
|
613
|
-
|
|
610
|
+
}, [p]), b(() => {
|
|
611
|
+
if (!(!_ || !p || p.isDestroyed)) {
|
|
612
|
+
if (y.current) {
|
|
613
|
+
y.current = !1;
|
|
614
614
|
return;
|
|
615
615
|
}
|
|
616
|
-
|
|
616
|
+
p.view.dispatch(p.state.tr.setMeta(d, {
|
|
617
617
|
type: "updateOptions",
|
|
618
|
-
options:
|
|
618
|
+
options: g.current
|
|
619
619
|
}));
|
|
620
620
|
}
|
|
621
621
|
}, [
|
|
622
|
-
|
|
623
|
-
|
|
622
|
+
_,
|
|
623
|
+
p,
|
|
624
|
+
n,
|
|
624
625
|
r,
|
|
625
|
-
i,
|
|
626
|
-
o,
|
|
627
|
-
s,
|
|
628
626
|
a,
|
|
629
|
-
|
|
630
|
-
|
|
627
|
+
o,
|
|
628
|
+
i,
|
|
629
|
+
d
|
|
630
|
+
]), w(s, u.current);
|
|
631
631
|
});
|
|
632
632
|
//#endregion
|
|
633
633
|
export { te as t };
|