@firecms/core 3.5.0 → 3.5.2-canary.16bf7bb
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/HomePage/HomePageDnD.d.ts +4 -2
- package/dist/{de-CBOjCvsy.js → de-CUF9f7S-.js} +2 -1
- package/dist/{de-CBOjCvsy.js.map → de-CUF9f7S-.js.map} +1 -1
- package/dist/{editor-BSo_aS1I.js → editor-WZytSO_1.js} +172 -137
- package/dist/editor-WZytSO_1.js.map +1 -0
- package/dist/{fr-DRfttcG0.js → fr-DmkMX6hp.js} +2 -1
- package/dist/{fr-DRfttcG0.js.map → fr-DmkMX6hp.js.map} +1 -1
- package/dist/{hi-DwieOZNf.js → hi-BKuaMr7w.js} +2 -1
- package/dist/{hi-DwieOZNf.js.map → hi-BKuaMr7w.js.map} +1 -1
- package/dist/index.es.js +70 -62
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +238 -189
- package/dist/index.umd.js.map +1 -1
- package/dist/{it-l2KXtx9n.js → it-BwQflFGz.js} +2 -1
- package/dist/{it-l2KXtx9n.js.map → it-BwQflFGz.js.map} +1 -1
- package/dist/{pl-DPZrdKhi.js → pl-BPsAvZvc.js} +2 -1
- package/dist/{pl-DPZrdKhi.js.map → pl-BPsAvZvc.js.map} +1 -1
- package/dist/{pt-BoHpabw1.js → pt-D5q7OQp1.js} +2 -1
- package/dist/{pt-BoHpabw1.js.map → pt-D5q7OQp1.js.map} +1 -1
- package/dist/types/translations.d.ts +1 -0
- package/package.json +3 -3
- package/src/components/HomePage/DefaultHomePage.tsx +2 -0
- package/src/components/HomePage/HomePageDnD.tsx +12 -4
- package/src/editor/selectors/link-selector.tsx +37 -12
- package/src/locales/de.ts +1 -0
- package/src/locales/en.ts +1 -0
- package/src/locales/es.ts +1 -0
- package/src/locales/fr.ts +1 -0
- package/src/locales/hi.ts +1 -0
- package/src/locales/it.ts +1 -0
- package/src/locales/pl.ts +1 -0
- package/src/locales/pt.ts +1 -0
- package/src/types/translations.ts +1 -0
- package/dist/editor-BSo_aS1I.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import React__default, { createContext, useContext, forwardRef, useRef, useState, useEffect, useLayoutEffect } from "react";
|
|
4
|
-
import { defaultBorderMixin, cls, TextFieldsIcon, CheckBoxIcon, LooksOneIcon, LooksTwoIcon, Looks3Icon, FormatListBulletedIcon, FormatListNumberedIcon, FormatQuoteIcon, CodeIcon, ImageIcon, TableChartIcon, AutoFixHighIcon, TextField, Tooltip, IconButton, CheckIcon, Popover, Button, KeyboardArrowDownIcon, focusedDisabled, DeleteIcon, FormatBoldIcon, FormatItalicIcon, FormatUnderlinedIcon, FormatStrikethroughIcon, useInjectStyles, Separator, TextareaAutosize } from "@firecms/ui";
|
|
4
|
+
import { defaultBorderMixin, cls, TextFieldsIcon, CheckBoxIcon, LooksOneIcon, LooksTwoIcon, Looks3Icon, FormatListBulletedIcon, FormatListNumberedIcon, FormatQuoteIcon, CodeIcon, ImageIcon, TableChartIcon, AutoFixHighIcon, TextField, Tooltip, IconButton, CheckIcon, Popover, Button, KeyboardArrowDownIcon, focusedDisabled, DeleteIcon, Typography, FormatBoldIcon, FormatItalicIcon, FormatUnderlinedIcon, FormatStrikethroughIcon, useInjectStyles, Separator, TextareaAutosize } from "@firecms/ui";
|
|
5
5
|
import { useTranslation } from "./index.es.js";
|
|
6
6
|
import { autoUpdate, computePosition, offset, flip, shift } from "@floating-ui/dom";
|
|
7
7
|
import { NodeSelection, Plugin, PluginKey, TextSelection, EditorState } from "prosemirror-state";
|
|
@@ -2668,7 +2668,7 @@ function getUrlFromString(str) {
|
|
|
2668
2668
|
}
|
|
2669
2669
|
}
|
|
2670
2670
|
const LinkSelector = (t0) => {
|
|
2671
|
-
const $ = c(
|
|
2671
|
+
const $ = c(66);
|
|
2672
2672
|
const {
|
|
2673
2673
|
open,
|
|
2674
2674
|
onOpenChange
|
|
@@ -2681,20 +2681,23 @@ const LinkSelector = (t0) => {
|
|
|
2681
2681
|
const {
|
|
2682
2682
|
t
|
|
2683
2683
|
} = useTranslation();
|
|
2684
|
+
const [error, setError] = useState(null);
|
|
2685
|
+
const isInputInvalid = !!error;
|
|
2684
2686
|
let t1;
|
|
2685
|
-
|
|
2686
|
-
if ($[0] !== open) {
|
|
2687
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2687
2688
|
t1 = () => {
|
|
2688
|
-
|
|
2689
|
-
inputRef.current.focus();
|
|
2690
|
-
}
|
|
2689
|
+
setError(null);
|
|
2691
2690
|
};
|
|
2691
|
+
$[0] = t1;
|
|
2692
|
+
} else {
|
|
2693
|
+
t1 = $[0];
|
|
2694
|
+
}
|
|
2695
|
+
let t2;
|
|
2696
|
+
if ($[1] !== open) {
|
|
2692
2697
|
t2 = [open];
|
|
2693
|
-
$[
|
|
2694
|
-
$[1] = t1;
|
|
2698
|
+
$[1] = open;
|
|
2695
2699
|
$[2] = t2;
|
|
2696
2700
|
} else {
|
|
2697
|
-
t1 = $[1];
|
|
2698
2701
|
t2 = $[2];
|
|
2699
2702
|
}
|
|
2700
2703
|
useEffect(t1, t2);
|
|
@@ -2702,195 +2705,227 @@ const LinkSelector = (t0) => {
|
|
|
2702
2705
|
return null;
|
|
2703
2706
|
}
|
|
2704
2707
|
let t3;
|
|
2705
|
-
if ($[3] !==
|
|
2708
|
+
if ($[3] !== isInputInvalid) {
|
|
2706
2709
|
t3 = (e) => {
|
|
2707
|
-
|
|
2710
|
+
if (isInputInvalid) {
|
|
2711
|
+
setError(null);
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
$[3] = isInputInvalid;
|
|
2715
|
+
$[4] = t3;
|
|
2716
|
+
} else {
|
|
2717
|
+
t3 = $[4];
|
|
2718
|
+
}
|
|
2719
|
+
const handleChange = t3;
|
|
2720
|
+
let t4;
|
|
2721
|
+
if ($[5] !== onOpenChange || $[6] !== t || $[7] !== view) {
|
|
2722
|
+
t4 = (e_0) => {
|
|
2723
|
+
e_0.preventDefault();
|
|
2724
|
+
e_0.stopPropagation();
|
|
2725
|
+
setError(null);
|
|
2708
2726
|
const value = inputRef.current?.value;
|
|
2709
2727
|
if (!value) {
|
|
2710
2728
|
return;
|
|
2711
2729
|
}
|
|
2712
2730
|
const url = getUrlFromString(value);
|
|
2713
|
-
if (url) {
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
})(view.state, view.dispatch);
|
|
2717
|
-
view.focus();
|
|
2718
|
-
onOpenChange(false);
|
|
2731
|
+
if (!url) {
|
|
2732
|
+
setError(t("editor_invalid_url"));
|
|
2733
|
+
return;
|
|
2719
2734
|
}
|
|
2735
|
+
setMark(schema.marks.link, {
|
|
2736
|
+
href: url
|
|
2737
|
+
})(view.state, view.dispatch);
|
|
2738
|
+
view.focus();
|
|
2739
|
+
onOpenChange(false);
|
|
2720
2740
|
};
|
|
2721
|
-
$[
|
|
2722
|
-
$[
|
|
2723
|
-
$[
|
|
2741
|
+
$[5] = onOpenChange;
|
|
2742
|
+
$[6] = t;
|
|
2743
|
+
$[7] = view;
|
|
2744
|
+
$[8] = t4;
|
|
2724
2745
|
} else {
|
|
2725
|
-
|
|
2746
|
+
t4 = $[8];
|
|
2726
2747
|
}
|
|
2727
|
-
const handleSubmit =
|
|
2728
|
-
let
|
|
2729
|
-
if ($[
|
|
2730
|
-
|
|
2748
|
+
const handleSubmit = t4;
|
|
2749
|
+
let t5;
|
|
2750
|
+
if ($[9] !== onOpenChange || $[10] !== view) {
|
|
2751
|
+
t5 = () => {
|
|
2731
2752
|
unsetMark(schema.marks.link)(view.state, view.dispatch);
|
|
2732
2753
|
view.focus();
|
|
2733
2754
|
onOpenChange(false);
|
|
2734
2755
|
};
|
|
2735
|
-
$[
|
|
2736
|
-
$[
|
|
2737
|
-
$[
|
|
2756
|
+
$[9] = onOpenChange;
|
|
2757
|
+
$[10] = view;
|
|
2758
|
+
$[11] = t5;
|
|
2738
2759
|
} else {
|
|
2739
|
-
|
|
2760
|
+
t5 = $[11];
|
|
2740
2761
|
}
|
|
2741
|
-
const handleRemoveLink =
|
|
2762
|
+
const handleRemoveLink = t5;
|
|
2742
2763
|
let T0;
|
|
2743
2764
|
let T1;
|
|
2744
2765
|
let href;
|
|
2745
2766
|
let t10;
|
|
2746
2767
|
let t11;
|
|
2747
2768
|
let t12;
|
|
2748
|
-
let
|
|
2769
|
+
let t13;
|
|
2749
2770
|
let t6;
|
|
2750
2771
|
let t7;
|
|
2751
2772
|
let t8;
|
|
2752
2773
|
let t9;
|
|
2753
|
-
if ($[
|
|
2774
|
+
if ($[12] !== onOpenChange || $[13] !== open || $[14] !== state) {
|
|
2754
2775
|
const isActive = isMarkActive(state, schema.marks.link);
|
|
2755
|
-
let
|
|
2756
|
-
if ($[
|
|
2757
|
-
|
|
2758
|
-
$[
|
|
2759
|
-
$[
|
|
2776
|
+
let t142;
|
|
2777
|
+
if ($[26] !== state) {
|
|
2778
|
+
t142 = getMarkAttributes(state, schema.marks.link).href || "";
|
|
2779
|
+
$[26] = state;
|
|
2780
|
+
$[27] = t142;
|
|
2760
2781
|
} else {
|
|
2761
|
-
|
|
2782
|
+
t142 = $[27];
|
|
2762
2783
|
}
|
|
2763
|
-
href =
|
|
2784
|
+
href = t142;
|
|
2764
2785
|
T1 = Popover;
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2786
|
+
t11 = true;
|
|
2787
|
+
t12 = open;
|
|
2788
|
+
t13 = onOpenChange;
|
|
2768
2789
|
T0 = Button;
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2790
|
+
t7 = "text";
|
|
2791
|
+
t8 = "button";
|
|
2792
|
+
t9 = "gap-2 rounded-none";
|
|
2793
|
+
t10 = "text";
|
|
2794
|
+
t6 = cls("underline decoration-stone-400 underline-offset-4", {
|
|
2774
2795
|
"text-blue-500": isActive
|
|
2775
2796
|
});
|
|
2776
|
-
$[
|
|
2777
|
-
$[
|
|
2778
|
-
$[
|
|
2779
|
-
$[
|
|
2780
|
-
$[
|
|
2781
|
-
$[
|
|
2782
|
-
$[
|
|
2783
|
-
$[
|
|
2784
|
-
$[
|
|
2785
|
-
$[
|
|
2786
|
-
$[
|
|
2787
|
-
$[
|
|
2788
|
-
$[
|
|
2789
|
-
$[
|
|
2790
|
-
} else {
|
|
2791
|
-
T0 = $[12];
|
|
2792
|
-
T1 = $[13];
|
|
2793
|
-
href = $[14];
|
|
2794
|
-
t10 = $[15];
|
|
2795
|
-
t11 = $[16];
|
|
2796
|
-
t12 = $[17];
|
|
2797
|
-
t5 = $[18];
|
|
2798
|
-
t6 = $[19];
|
|
2799
|
-
t7 = $[20];
|
|
2800
|
-
t8 = $[21];
|
|
2801
|
-
t9 = $[22];
|
|
2802
|
-
}
|
|
2803
|
-
let t13;
|
|
2804
|
-
if ($[25] !== t) {
|
|
2805
|
-
t13 = t("editor_link");
|
|
2806
|
-
$[25] = t;
|
|
2807
|
-
$[26] = t13;
|
|
2797
|
+
$[12] = onOpenChange;
|
|
2798
|
+
$[13] = open;
|
|
2799
|
+
$[14] = state;
|
|
2800
|
+
$[15] = T0;
|
|
2801
|
+
$[16] = T1;
|
|
2802
|
+
$[17] = href;
|
|
2803
|
+
$[18] = t10;
|
|
2804
|
+
$[19] = t11;
|
|
2805
|
+
$[20] = t12;
|
|
2806
|
+
$[21] = t13;
|
|
2807
|
+
$[22] = t6;
|
|
2808
|
+
$[23] = t7;
|
|
2809
|
+
$[24] = t8;
|
|
2810
|
+
$[25] = t9;
|
|
2808
2811
|
} else {
|
|
2809
|
-
|
|
2812
|
+
T0 = $[15];
|
|
2813
|
+
T1 = $[16];
|
|
2814
|
+
href = $[17];
|
|
2815
|
+
t10 = $[18];
|
|
2816
|
+
t11 = $[19];
|
|
2817
|
+
t12 = $[20];
|
|
2818
|
+
t13 = $[21];
|
|
2819
|
+
t6 = $[22];
|
|
2820
|
+
t7 = $[23];
|
|
2821
|
+
t8 = $[24];
|
|
2822
|
+
t9 = $[25];
|
|
2810
2823
|
}
|
|
2811
2824
|
let t14;
|
|
2812
|
-
if ($[
|
|
2813
|
-
t14 =
|
|
2814
|
-
$[
|
|
2815
|
-
$[28] = t5;
|
|
2825
|
+
if ($[28] !== t) {
|
|
2826
|
+
t14 = t("editor_link");
|
|
2827
|
+
$[28] = t;
|
|
2816
2828
|
$[29] = t14;
|
|
2817
2829
|
} else {
|
|
2818
2830
|
t14 = $[29];
|
|
2819
2831
|
}
|
|
2820
2832
|
let t15;
|
|
2821
|
-
if ($[30] !==
|
|
2822
|
-
t15 = /* @__PURE__ */ jsx(
|
|
2823
|
-
$[30] =
|
|
2824
|
-
$[31] =
|
|
2825
|
-
$[32] =
|
|
2826
|
-
$[33] = t7;
|
|
2827
|
-
$[34] = t8;
|
|
2828
|
-
$[35] = t9;
|
|
2829
|
-
$[36] = t15;
|
|
2833
|
+
if ($[30] !== t14 || $[31] !== t6) {
|
|
2834
|
+
t15 = /* @__PURE__ */ jsx("p", { className: t6, children: t14 });
|
|
2835
|
+
$[30] = t14;
|
|
2836
|
+
$[31] = t6;
|
|
2837
|
+
$[32] = t15;
|
|
2830
2838
|
} else {
|
|
2831
|
-
t15 = $[
|
|
2839
|
+
t15 = $[32];
|
|
2832
2840
|
}
|
|
2833
2841
|
let t16;
|
|
2834
|
-
if ($[37] !==
|
|
2835
|
-
t16 =
|
|
2836
|
-
$[
|
|
2837
|
-
$[
|
|
2842
|
+
if ($[33] !== T0 || $[34] !== t10 || $[35] !== t15 || $[36] !== t7 || $[37] !== t8 || $[38] !== t9) {
|
|
2843
|
+
t16 = /* @__PURE__ */ jsx(T0, { variant: t7, type: t8, className: t9, color: t10, children: t15 });
|
|
2844
|
+
$[33] = T0;
|
|
2845
|
+
$[34] = t10;
|
|
2846
|
+
$[35] = t15;
|
|
2847
|
+
$[36] = t7;
|
|
2848
|
+
$[37] = t8;
|
|
2849
|
+
$[38] = t9;
|
|
2850
|
+
$[39] = t16;
|
|
2838
2851
|
} else {
|
|
2839
|
-
t16 = $[
|
|
2852
|
+
t16 = $[39];
|
|
2840
2853
|
}
|
|
2841
2854
|
let t17;
|
|
2842
|
-
if ($[
|
|
2843
|
-
t17 =
|
|
2844
|
-
$[
|
|
2855
|
+
if ($[40] !== t) {
|
|
2856
|
+
t17 = t("editor_paste_or_type_link");
|
|
2857
|
+
$[40] = t;
|
|
2858
|
+
$[41] = t17;
|
|
2845
2859
|
} else {
|
|
2846
|
-
t17 = $[
|
|
2860
|
+
t17 = $[41];
|
|
2847
2861
|
}
|
|
2848
2862
|
let t18;
|
|
2849
|
-
if ($[
|
|
2850
|
-
t18 =
|
|
2851
|
-
$[
|
|
2852
|
-
$[41] = open;
|
|
2853
|
-
$[42] = t16;
|
|
2854
|
-
$[43] = t18;
|
|
2863
|
+
if ($[42] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
2864
|
+
t18 = cls("text-surface-900 dark:text-white flex-grow bg-transparent p-1 text-sm outline-none", focusedDisabled);
|
|
2865
|
+
$[42] = t18;
|
|
2855
2866
|
} else {
|
|
2856
|
-
t18 = $[
|
|
2867
|
+
t18 = $[42];
|
|
2857
2868
|
}
|
|
2858
2869
|
let t19;
|
|
2859
|
-
if ($[44] !==
|
|
2860
|
-
t19 =
|
|
2861
|
-
$[
|
|
2862
|
-
$[
|
|
2863
|
-
$[
|
|
2870
|
+
if ($[43] !== href || $[44] !== isInputInvalid || $[45] !== open || $[46] !== t17) {
|
|
2871
|
+
t19 = /* @__PURE__ */ jsx("input", { ref: inputRef, autoFocus: open, placeholder: t17, defaultValue: href, className: t18, "aria-invalid": isInputInvalid });
|
|
2872
|
+
$[43] = href;
|
|
2873
|
+
$[44] = isInputInvalid;
|
|
2874
|
+
$[45] = open;
|
|
2875
|
+
$[46] = t17;
|
|
2876
|
+
$[47] = t19;
|
|
2864
2877
|
} else {
|
|
2865
|
-
t19 = $[
|
|
2878
|
+
t19 = $[47];
|
|
2866
2879
|
}
|
|
2867
2880
|
let t20;
|
|
2868
|
-
if ($[
|
|
2869
|
-
t20 = /* @__PURE__ */
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
] });
|
|
2873
|
-
$[47] = handleSubmit;
|
|
2874
|
-
$[48] = t18;
|
|
2875
|
-
$[49] = t19;
|
|
2881
|
+
if ($[48] !== handleRemoveLink || $[49] !== href) {
|
|
2882
|
+
t20 = href ? /* @__PURE__ */ jsx(Button, { size: "small", variant: "text", type: "button", color: "text", className: "flex items-center", onClick: handleRemoveLink, children: /* @__PURE__ */ jsx(DeleteIcon, { size: "small" }) }) : /* @__PURE__ */ jsx(Button, { size: "small", type: "submit", variant: "text", children: /* @__PURE__ */ jsx(CheckIcon, { size: "small" }) });
|
|
2883
|
+
$[48] = handleRemoveLink;
|
|
2884
|
+
$[49] = href;
|
|
2876
2885
|
$[50] = t20;
|
|
2877
2886
|
} else {
|
|
2878
2887
|
t20 = $[50];
|
|
2879
2888
|
}
|
|
2880
2889
|
let t21;
|
|
2881
|
-
if ($[51] !==
|
|
2882
|
-
t21 = /* @__PURE__ */
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
$[
|
|
2887
|
-
$[
|
|
2888
|
-
$[
|
|
2889
|
-
$[
|
|
2890
|
+
if ($[51] !== handleChange || $[52] !== handleSubmit || $[53] !== t19 || $[54] !== t20) {
|
|
2891
|
+
t21 = /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "flex p-1 gap-1", onChange: handleChange, children: [
|
|
2892
|
+
t19,
|
|
2893
|
+
t20
|
|
2894
|
+
] });
|
|
2895
|
+
$[51] = handleChange;
|
|
2896
|
+
$[52] = handleSubmit;
|
|
2897
|
+
$[53] = t19;
|
|
2898
|
+
$[54] = t20;
|
|
2899
|
+
$[55] = t21;
|
|
2900
|
+
} else {
|
|
2901
|
+
t21 = $[55];
|
|
2902
|
+
}
|
|
2903
|
+
let t22;
|
|
2904
|
+
if ($[56] !== error) {
|
|
2905
|
+
t22 = error && /* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "error", role: "alert", "aria-live": "polite", children: error }) });
|
|
2906
|
+
$[56] = error;
|
|
2907
|
+
$[57] = t22;
|
|
2908
|
+
} else {
|
|
2909
|
+
t22 = $[57];
|
|
2910
|
+
}
|
|
2911
|
+
let t23;
|
|
2912
|
+
if ($[58] !== T1 || $[59] !== t11 || $[60] !== t12 || $[61] !== t13 || $[62] !== t16 || $[63] !== t21 || $[64] !== t22) {
|
|
2913
|
+
t23 = /* @__PURE__ */ jsxs(T1, { modal: t11, open: t12, onOpenChange: t13, trigger: t16, children: [
|
|
2914
|
+
t21,
|
|
2915
|
+
t22
|
|
2916
|
+
] });
|
|
2917
|
+
$[58] = T1;
|
|
2918
|
+
$[59] = t11;
|
|
2919
|
+
$[60] = t12;
|
|
2920
|
+
$[61] = t13;
|
|
2921
|
+
$[62] = t16;
|
|
2922
|
+
$[63] = t21;
|
|
2923
|
+
$[64] = t22;
|
|
2924
|
+
$[65] = t23;
|
|
2890
2925
|
} else {
|
|
2891
|
-
|
|
2926
|
+
t23 = $[65];
|
|
2892
2927
|
}
|
|
2893
|
-
return
|
|
2928
|
+
return t23;
|
|
2894
2929
|
};
|
|
2895
2930
|
const TextButtons = () => {
|
|
2896
2931
|
const $ = c(3);
|
|
@@ -4560,4 +4595,4 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
|
|
|
4560
4595
|
export {
|
|
4561
4596
|
FireCMSEditor
|
|
4562
4597
|
};
|
|
4563
|
-
//# sourceMappingURL=editor-
|
|
4598
|
+
//# sourceMappingURL=editor-WZytSO_1.js.map
|