@firecms/editor 3.0.0-beta.6 → 3.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/editor-command-item.d.ts +4 -5
- package/dist/components/editor-command.d.ts +8 -9
- package/dist/components/editor.d.ts +2 -2
- package/dist/extensions/_image-resizer.d.ts +0 -1
- package/dist/index.es.js +10 -19
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +25 -25
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { Editor, type Range } from "@tiptap/core";
|
|
3
2
|
interface EditorCommandItemProps {
|
|
4
3
|
onCommand: ({ editor, range }: {
|
|
@@ -9,10 +8,10 @@ interface EditorCommandItemProps {
|
|
|
9
8
|
export declare const EditorCommandItem: import("react").ForwardRefExoticComponent<EditorCommandItemProps & Omit<{
|
|
10
9
|
children?: import("react").ReactNode;
|
|
11
10
|
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "onSelect" | "value" | "disabled"> & {
|
|
12
|
-
disabled?: boolean
|
|
13
|
-
onSelect?: (
|
|
14
|
-
value?: string
|
|
15
|
-
forceMount?: boolean
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
onSelect?: (value: string) => void;
|
|
13
|
+
value?: string;
|
|
14
|
+
forceMount?: boolean;
|
|
16
15
|
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
16
|
export declare const EditorCommandEmpty: import("react").ForwardRefExoticComponent<{
|
|
18
17
|
children?: import("react").ReactNode;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { Range } from "@tiptap/core";
|
|
3
2
|
export declare const queryAtom: import("jotai").PrimitiveAtom<string> & {
|
|
4
3
|
init: string;
|
|
@@ -13,12 +12,12 @@ export declare const EditorCommandOut: ({ query, range, }: {
|
|
|
13
12
|
export declare const EditorCommand: import("react").ForwardRefExoticComponent<Omit<{
|
|
14
13
|
children?: import("react").ReactNode;
|
|
15
14
|
} & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
16
|
-
label?: string
|
|
17
|
-
shouldFilter?: boolean
|
|
18
|
-
filter?: (
|
|
19
|
-
defaultValue?: string
|
|
20
|
-
value?: string
|
|
21
|
-
onValueChange?: (
|
|
22
|
-
loop?: boolean
|
|
23
|
-
vimBindings?: boolean
|
|
15
|
+
label?: string;
|
|
16
|
+
shouldFilter?: boolean;
|
|
17
|
+
filter?: (value: string, search: string) => number;
|
|
18
|
+
defaultValue?: string;
|
|
19
|
+
value?: string;
|
|
20
|
+
onValueChange?: (value: string) => void;
|
|
21
|
+
loop?: boolean;
|
|
22
|
+
vimBindings?: boolean;
|
|
24
23
|
} & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
export declare const editorStore: {
|
|
3
3
|
get: <Value>(atom: import("jotai").Atom<Value>) => Value;
|
|
4
|
-
set: <
|
|
4
|
+
set: <Value, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value, Args, Result>, ...args: Args) => Result;
|
|
5
5
|
sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
|
|
6
6
|
} & Partial<{
|
|
7
7
|
dev_subscribe_store: (l: (action: {
|
|
@@ -34,7 +34,7 @@ export declare const editorStore: {
|
|
|
34
34
|
dev_get_mounted: (a: import("jotai").Atom<unknown>) => {
|
|
35
35
|
l: Set<() => void>;
|
|
36
36
|
t: Set<import("jotai").Atom<unknown>>;
|
|
37
|
-
u?: (
|
|
37
|
+
u?: () => void;
|
|
38
38
|
} | undefined;
|
|
39
39
|
dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
|
|
40
40
|
}>;
|
package/dist/index.es.js
CHANGED
|
@@ -20,7 +20,7 @@ import { TaskList as De } from "@tiptap/extension-task-list";
|
|
|
20
20
|
import { Extension as B, InputRule as Be } from "@tiptap/core";
|
|
21
21
|
import ze from "@tiptap/suggestion";
|
|
22
22
|
import Fe from "tippy.js";
|
|
23
|
-
import { Popover as Q, Button as w, ExpandMoreIcon as Ue, CheckIcon as V, TextFieldsIcon as X, LooksOneIcon as Y, LooksTwoIcon as J, Looks3Icon as G, CheckBoxIcon as j, FormatListBulletedIcon as ee, FormatListNumberedIcon as te, FormatQuoteIcon as oe, CodeIcon as z,
|
|
23
|
+
import { Popover as Q, Button as w, ExpandMoreIcon as Ue, CheckIcon as V, TextFieldsIcon as X, LooksOneIcon as Y, LooksTwoIcon as J, Looks3Icon as G, CheckBoxIcon as j, FormatListBulletedIcon as ee, FormatListNumberedIcon as te, FormatQuoteIcon as oe, CodeIcon as z, cls as g, DeleteIcon as Ke, FormatBoldIcon as $e, FormatItalicIcon as qe, FormatUnderlinedIcon as We, FormatStrikethroughIcon as Oe, defaultBorderMixin as x, useInjectStyles as Ze, Separator as K, ImageIcon as _e } from "@firecms/ui";
|
|
24
24
|
import { Plugin as Qe } from "prosemirror-state";
|
|
25
25
|
import { DecorationSet as Ve, Decoration as Xe, __serializeForClipboard as Ye } from "@tiptap/pm/view";
|
|
26
26
|
import { Plugin as Je, NodeSelection as $ } from "@tiptap/pm/state";
|
|
@@ -228,8 +228,7 @@ const ot = Me, rt = B.create({
|
|
|
228
228
|
onOpenChange: o
|
|
229
229
|
}) => {
|
|
230
230
|
const { editor: t } = y();
|
|
231
|
-
if (!t)
|
|
232
|
-
return null;
|
|
231
|
+
if (!t) return null;
|
|
233
232
|
const r = q.filter((a) => a.isActive(t)).pop() ?? {
|
|
234
233
|
name: "Multiple"
|
|
235
234
|
};
|
|
@@ -282,8 +281,7 @@ function lt(e) {
|
|
|
282
281
|
}
|
|
283
282
|
}
|
|
284
283
|
function dt(e) {
|
|
285
|
-
if (lt(e))
|
|
286
|
-
return e;
|
|
284
|
+
if (lt(e)) return e;
|
|
287
285
|
try {
|
|
288
286
|
return e.includes(".") && !e.includes(" ") ? new URL(`https://${e}`).toString() : null;
|
|
289
287
|
} catch {
|
|
@@ -428,7 +426,6 @@ function R(e, o, t, r = 300) {
|
|
|
428
426
|
}, n = L.useRef(void 0);
|
|
429
427
|
L.useEffect(
|
|
430
428
|
() => (a.current = !0, clearTimeout(n.current), n.current = setTimeout(c, r), () => {
|
|
431
|
-
t && c();
|
|
432
429
|
}),
|
|
433
430
|
[t, e]
|
|
434
431
|
);
|
|
@@ -528,8 +525,7 @@ const xt = (e) => {
|
|
|
528
525
|
const c = Array.from(r.dataTransfer.files).filter((n) => /image/i.test(n.type));
|
|
529
526
|
return c.length === 0 ? !1 : (c.forEach((n) => {
|
|
530
527
|
const i = t.posAtCoords({ left: r.clientX, top: r.clientY });
|
|
531
|
-
if (!i)
|
|
532
|
-
return;
|
|
528
|
+
if (!i) return;
|
|
533
529
|
const d = new FileReader();
|
|
534
530
|
d.onload = async (u) => {
|
|
535
531
|
await W(o, t, u, i.pos, e, n);
|
|
@@ -621,17 +617,14 @@ function O(e, o, t) {
|
|
|
621
617
|
}
|
|
622
618
|
function wt(e) {
|
|
623
619
|
function o(n, i) {
|
|
624
|
-
if (i.focus(), !n.dataTransfer)
|
|
625
|
-
return;
|
|
620
|
+
if (i.focus(), !n.dataTransfer) return;
|
|
626
621
|
const d = I({
|
|
627
622
|
x: n.clientX + 50 + e.dragHandleWidth,
|
|
628
623
|
y: n.clientY
|
|
629
624
|
});
|
|
630
|
-
if (!(d instanceof Element))
|
|
631
|
-
return;
|
|
625
|
+
if (!(d instanceof Element)) return;
|
|
632
626
|
const u = O(d, i, e);
|
|
633
|
-
if (u == null || u < 0)
|
|
634
|
-
return;
|
|
627
|
+
if (u == null || u < 0) return;
|
|
635
628
|
i.dispatch(i.state.tr.setSelection($.create(i.state.doc, u)));
|
|
636
629
|
const p = i.state.selection.content(), { dom: h, text: f } = Ye(i, p);
|
|
637
630
|
n.dataTransfer.clearData(), n.dataTransfer.setData("text/html", h.innerHTML), n.dataTransfer.setData("text/plain", f), n.dataTransfer.effectAllowed = "copyMove", n.dataTransfer.setDragImage(d, 0, 0), i.dragging = { slice: p, move: n.ctrlKey };
|
|
@@ -642,8 +635,7 @@ function wt(e) {
|
|
|
642
635
|
x: n.clientX + 50 + e.dragHandleWidth,
|
|
643
636
|
y: n.clientY
|
|
644
637
|
});
|
|
645
|
-
if (!(d instanceof Element))
|
|
646
|
-
return;
|
|
638
|
+
if (!(d instanceof Element)) return;
|
|
647
639
|
const u = O(d, i, e);
|
|
648
640
|
u && i.dispatch(i.state.tr.setSelection($.create(i.state.doc, u)));
|
|
649
641
|
}
|
|
@@ -840,8 +832,7 @@ const At = B.create({
|
|
|
840
832
|
const k = document.createElement("input");
|
|
841
833
|
k.type = "file", k.accept = "image/*", k.onchange = async () => {
|
|
842
834
|
if (k.files?.length) {
|
|
843
|
-
if (!k.files[0])
|
|
844
|
-
return;
|
|
835
|
+
if (!k.files[0]) return;
|
|
845
836
|
l.view.state.selection.from;
|
|
846
837
|
}
|
|
847
838
|
}, k.click();
|
|
@@ -905,7 +896,7 @@ const At = B.create({
|
|
|
905
896
|
}
|
|
906
897
|
},
|
|
907
898
|
onUpdate: ({ editor: l }) => {
|
|
908
|
-
console.
|
|
899
|
+
console.debug("Editor updated"), ue(l);
|
|
909
900
|
},
|
|
910
901
|
children: [
|
|
911
902
|
/* @__PURE__ */ b(
|