@firecms/editor 3.0.0-canary.8 → 3.0.0-canary.80

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/LICENSE CHANGED
@@ -1,21 +1,113 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 FireCMS
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: Firecms S.L.
6
+ Licensed Work: Firecms CMS packages:
7
+ cli
8
+ collection_editor
9
+ collection_editor_firebase
10
+ data_enhancement
11
+ data_import_export
12
+ editor
13
+ firecms_cloud
14
+ schema_inference
15
+ user_management
16
+
17
+ The Licensed Work is (c) 2024 Firecms S.L
18
+ Additional Use Grant: You may make use of the Licensed Work, provided that
19
+ you may not use the Licensed Work for a CMS Data Enhancement
20
+ Service.
21
+
22
+ A “CMS package” is a commercial offering that
23
+ allows third parties (other than your employees and
24
+ contractors) to access the functionality of the
25
+ Licensed Work by using software to extend the base features of
26
+ content management system controlled by such third parties.
27
+
28
+ Change Date: Four years from the date the Licensed Work is published.
29
+
30
+ Change License: MIT
31
+
32
+ For information about alternative licensing arrangements for the Software,
33
+ please visit: https://firecms.co
34
+
35
+ Notice
36
+
37
+ The Business Source License (this document, or the “License”) is not an Open
38
+ Source license. However, the Licensed Work will eventually be made available
39
+ under an Open Source License, as stated in this License.
40
+
41
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
42
+ “Business Source License” is a trademark of MariaDB Corporation Ab.
43
+
44
+ -----------------------------------------------------------------------------
45
+
46
+ Business Source License 1.1
47
+
48
+ Terms
49
+
50
+ The Licensor hereby grants you the right to copy, modify, create derivative
51
+ works, redistribute, and make non-production use of the Licensed Work. The
52
+ Licensor may make an Additional Use Grant, above, permitting limited
53
+ production use.
54
+
55
+ Effective on the Change Date, or the fourth anniversary of the first publicly
56
+ available distribution of a specific version of the Licensed Work under this
57
+ License, whichever comes first, the Licensor hereby grants you rights under
58
+ the terms of the Change License, and the rights granted in the paragraph
59
+ above terminate.
60
+
61
+ If your use of the Licensed Work does not comply with the requirements
62
+ currently in effect as described in this License, you must purchase a
63
+ commercial license from the Licensor, its affiliated entities, or authorized
64
+ resellers, or you must refrain from using the Licensed Work.
65
+
66
+ All copies of the original and modified Licensed Work, and derivative works
67
+ of the Licensed Work, are subject to this License. This License applies
68
+ separately for each version of the Licensed Work and the Change Date may vary
69
+ for each version of the Licensed Work released by Licensor.
70
+
71
+ You must conspicuously display this License on each original or modified copy
72
+ of the Licensed Work. If you receive the Licensed Work in original or
73
+ modified form from a third party, the terms and conditions set forth in this
74
+ License apply to your use of that work.
75
+
76
+ Any use of the Licensed Work in violation of this License will automatically
77
+ terminate your rights under this License for the current and all other
78
+ versions of the Licensed Work.
79
+
80
+ This License does not grant you any right in any trademark or logo of
81
+ Licensor or its affiliates (provided that you may use a trademark or logo of
82
+ Licensor as expressly required by this License).
83
+
84
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
85
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
86
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
88
+ TITLE.
89
+
90
+ MariaDB hereby grants you permission to use this License’s text to license
91
+ your works, and to refer to it using the trademark “Business Source License”,
92
+ as long as you comply with the Covenants of Licensor below.
93
+
94
+ Covenants of Licensor
95
+
96
+ In consideration of the right to use this License’s text and the “Business
97
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
98
+ other recipients of the licensed work to be provided by Licensor:
99
+
100
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
101
+ or a license that is compatible with GPL Version 2.0 or a later version,
102
+ where “compatible” means that software provided under the Change License can
103
+ be included in a program with software provided under GPL Version 2.0 or a
104
+ later version. Licensor may specify additional Change Licenses without
105
+ limitation.
106
+
107
+ 2. To either: (a) specify an additional grant of rights to use that does not
108
+ impose any additional restriction on the right granted in this License, as
109
+ the Additional Use Grant; or (b) insert the text “None”.
110
+
111
+ 3. To specify a Change Date.
112
+
113
+ 4. Not to modify this License in any other way.
@@ -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 | undefined;
13
- onSelect?: ((value: string) => void) | undefined;
14
- value?: string | undefined;
15
- forceMount?: boolean | undefined;
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 | undefined;
17
- shouldFilter?: boolean | undefined;
18
- filter?: ((value: string, search: string) => number) | undefined;
19
- defaultValue?: string | undefined;
20
- value?: string | undefined;
21
- onValueChange?: ((value: string) => void) | undefined;
22
- loop?: boolean | undefined;
23
- vimBindings?: boolean | undefined;
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,8 +1,9 @@
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: <Value_1, Args extends unknown[], Result>(atom: import("jotai").WritableAtom<Value_1, Args, Result>, ...args: Args) => Result;
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
+ } & Partial<{
6
7
  dev_subscribe_store: (l: (action: {
7
8
  type: "write";
8
9
  flushed: Set<import("jotai").Atom<unknown>>;
@@ -33,19 +34,10 @@ export declare const editorStore: {
33
34
  dev_get_mounted: (a: import("jotai").Atom<unknown>) => {
34
35
  l: Set<() => void>;
35
36
  t: Set<import("jotai").Atom<unknown>>;
36
- u?: (() => void) | undefined;
37
+ u?: () => void;
37
38
  } | undefined;
38
39
  dev_restore_atoms: (values: Iterable<readonly [import("jotai").Atom<unknown>, unknown]>) => void;
39
- } | {
40
- get: <Value_2>(atom: import("jotai").Atom<Value_2>) => Value_2;
41
- set: <Value_1_1, Args_1 extends unknown[], Result_1>(atom: import("jotai").WritableAtom<Value_1_1, Args_1, Result_1>, ...args: Args_1) => Result_1;
42
- sub: (atom: import("jotai").Atom<unknown>, listener: () => void) => () => void;
43
- dev_subscribe_store?: undefined;
44
- dev_get_mounted_atoms?: undefined;
45
- dev_get_atom_state?: undefined;
46
- dev_get_mounted?: undefined;
47
- dev_restore_atoms?: undefined;
48
- };
40
+ }>;
49
41
  export declare const EditorRoot: ({ children }: {
50
42
  children: ReactNode;
51
43
  }) => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ImageResizer: () => JSX.Element | null;
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, cn 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";
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.log("editor updated"), ue(l);
899
+ console.debug("Editor updated"), ue(l);
909
900
  },
910
901
  children: [
911
902
  /* @__PURE__ */ b(