@react-email/editor 0.0.0-experimental.46 → 0.0.0-experimental.48
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/{columns-DFnIRlLe.cjs → columns-D1gzbJr5.cjs} +5 -5
- package/dist/{columns-DC8gJU2D.mjs → columns-TFI4L-IC.mjs} +3 -3
- package/dist/columns-TFI4L-IC.mjs.map +1 -0
- package/dist/core/index.cjs +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/{core-BxIUuTKo.mjs → core-Dp3tVCOZ.mjs} +3 -3
- package/dist/core-Dp3tVCOZ.mjs.map +1 -0
- package/dist/{core-i3eza_VQ.cjs → core-NV1Aun-R.cjs} +10 -10
- package/dist/{event-bus-GmFPYJu2.cjs → event-bus-WI0H5tIM.cjs} +1 -1
- package/dist/{extension-CoGXXzHr.cjs → extension-CfIsm0_p.cjs} +21 -17
- package/dist/{extension-DgSX6dcu.mjs → extension-n2yYIR7e.mjs} +16 -12
- package/dist/extension-n2yYIR7e.mjs.map +1 -0
- package/dist/extensions/index.cjs +3 -3
- package/dist/extensions/index.d.cts.map +1 -1
- package/dist/extensions/index.d.mts.map +1 -1
- package/dist/extensions/index.mjs +2 -2
- package/dist/{extensions-DE0L4Pim.cjs → extensions-1UEW2WwW.cjs} +20 -20
- package/dist/{extensions-CGtkbFUL.mjs → extensions-4zUXngSP.mjs} +6 -6
- package/dist/extensions-4zUXngSP.mjs.map +1 -0
- package/dist/{global-content-Dcc6RTLp.cjs → global-content-CxV8qpMp.cjs} +1 -1
- package/dist/index-BMsf5s28.d.mts.map +1 -1
- package/dist/index-DNriNUPU.d.cts.map +1 -1
- package/dist/index.cjs +12 -11
- package/dist/index.d.cts +4 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +11 -10
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/index.cjs +1 -1
- package/dist/plugins/index.d.cts.map +1 -1
- package/dist/plugins/index.d.mts.map +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/{root-SovCbqdr.mjs → root-BWiLr5WO.mjs} +271 -224
- package/dist/root-BWiLr5WO.mjs.map +1 -0
- package/dist/{root-BYXulnav.cjs → root-Bm_YBU0n.cjs} +284 -231
- package/dist/{set-text-alignment-BTFzq8uT.mjs → set-text-alignment-BDkB4Vfh.mjs} +1 -1
- package/dist/{set-text-alignment-BTFzq8uT.mjs.map → set-text-alignment-BDkB4Vfh.mjs.map} +1 -1
- package/dist/{styles-DZ9S92ix.mjs → styles-BBXVfEv-.mjs} +23 -5
- package/dist/styles-BBXVfEv-.mjs.map +1 -0
- package/dist/{styles-CYEzPPfZ.cjs → styles-D5jB7Yx-.cjs} +22 -4
- package/dist/ui/index.cjs +7 -56
- package/dist/ui/index.d.cts +110 -141
- package/dist/ui/index.d.cts.map +1 -1
- package/dist/ui/index.d.mts +110 -141
- package/dist/ui/index.d.mts.map +1 -1
- package/dist/ui/index.mjs +5 -53
- package/dist/ui/index.mjs.map +1 -1
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/columns-DC8gJU2D.mjs.map +0 -1
- package/dist/core-BxIUuTKo.mjs.map +0 -1
- package/dist/extension-DgSX6dcu.mjs.map +0 -1
- package/dist/extensions-CGtkbFUL.mjs.map +0 -1
- package/dist/root-SovCbqdr.mjs.map +0 -1
- package/dist/styles-DZ9S92ix.mjs.map +0 -1
- /package/dist/{set-text-alignment-DWSnscb6.cjs → set-text-alignment-BlyZq1GA.cjs} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_columns = require('./columns-
|
|
2
|
-
const require_event_bus = require('./event-bus-
|
|
3
|
-
const require_set_text_alignment = require('./set-text-alignment-
|
|
1
|
+
const require_columns = require('./columns-D1gzbJr5.cjs');
|
|
2
|
+
const require_event_bus = require('./event-bus-WI0H5tIM.cjs');
|
|
3
|
+
const require_set_text_alignment = require('./set-text-alignment-BlyZq1GA.cjs');
|
|
4
4
|
let _tiptap_react = require("@tiptap/react");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_columns.__toESM(react);
|
|
@@ -740,10 +740,114 @@ function UnlinkIcon({ size, width, height, ...props }) {
|
|
|
740
740
|
const BubbleMenuContext = react.createContext(null);
|
|
741
741
|
function useBubbleMenuContext() {
|
|
742
742
|
const context = react.useContext(BubbleMenuContext);
|
|
743
|
-
if (!context) throw new Error("BubbleMenu compound components must be used within <BubbleMenu
|
|
743
|
+
if (!context) throw new Error("BubbleMenu compound components must be used within <BubbleMenu>");
|
|
744
744
|
return context;
|
|
745
745
|
}
|
|
746
746
|
|
|
747
|
+
//#endregion
|
|
748
|
+
//#region src/ui/bubble-menu/item.tsx
|
|
749
|
+
function BubbleMenuItem({ name, isActive, onCommand, className, children, ...rest }) {
|
|
750
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
751
|
+
type: "button",
|
|
752
|
+
"aria-label": name,
|
|
753
|
+
"aria-pressed": isActive,
|
|
754
|
+
className,
|
|
755
|
+
"data-re-bubble-menu-item": "",
|
|
756
|
+
"data-item": name,
|
|
757
|
+
...isActive ? { "data-active": "" } : {},
|
|
758
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
759
|
+
onClick: onCommand,
|
|
760
|
+
...rest,
|
|
761
|
+
children
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
//#endregion
|
|
766
|
+
//#region src/ui/bubble-menu/align-center.tsx
|
|
767
|
+
function BubbleMenuAlignCenter({ className, children }) {
|
|
768
|
+
const { editor } = useBubbleMenuContext();
|
|
769
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
770
|
+
name: "align-center",
|
|
771
|
+
isActive: (0, _tiptap_react.useEditorState)({
|
|
772
|
+
editor,
|
|
773
|
+
selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "center" }) ?? false
|
|
774
|
+
}),
|
|
775
|
+
onCommand: () => require_set_text_alignment.setTextAlignment(editor, "center"),
|
|
776
|
+
className,
|
|
777
|
+
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignCenterIcon, {})
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/ui/bubble-menu/align-left.tsx
|
|
783
|
+
function BubbleMenuAlignLeft({ className, children }) {
|
|
784
|
+
const { editor } = useBubbleMenuContext();
|
|
785
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
786
|
+
name: "align-left",
|
|
787
|
+
isActive: (0, _tiptap_react.useEditorState)({
|
|
788
|
+
editor,
|
|
789
|
+
selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "left" }) ?? false
|
|
790
|
+
}),
|
|
791
|
+
onCommand: () => require_set_text_alignment.setTextAlignment(editor, "left"),
|
|
792
|
+
className,
|
|
793
|
+
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignLeftIcon, {})
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region src/ui/bubble-menu/align-right.tsx
|
|
799
|
+
function BubbleMenuAlignRight({ className, children }) {
|
|
800
|
+
const { editor } = useBubbleMenuContext();
|
|
801
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
802
|
+
name: "align-right",
|
|
803
|
+
isActive: (0, _tiptap_react.useEditorState)({
|
|
804
|
+
editor,
|
|
805
|
+
selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "right" }) ?? false
|
|
806
|
+
}),
|
|
807
|
+
onCommand: () => require_set_text_alignment.setTextAlignment(editor, "right"),
|
|
808
|
+
className,
|
|
809
|
+
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignRightIcon, {})
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region src/ui/bubble-menu/create-mark-bubble-item.tsx
|
|
815
|
+
function createMarkBubbleItem(config) {
|
|
816
|
+
function MarkBubbleItem({ className, children }) {
|
|
817
|
+
const { editor } = useBubbleMenuContext();
|
|
818
|
+
const isActive = (0, _tiptap_react.useEditorState)({
|
|
819
|
+
editor,
|
|
820
|
+
selector: ({ editor: editor$1 }) => {
|
|
821
|
+
if (config.activeParams) return editor$1?.isActive(config.activeName, config.activeParams) ?? false;
|
|
822
|
+
return editor$1?.isActive(config.activeName) ?? false;
|
|
823
|
+
}
|
|
824
|
+
});
|
|
825
|
+
const handleCommand = () => {
|
|
826
|
+
const chain = editor.chain().focus();
|
|
827
|
+
const method = chain[config.command];
|
|
828
|
+
if (method) method.call(chain).run();
|
|
829
|
+
};
|
|
830
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
831
|
+
name: config.name,
|
|
832
|
+
isActive,
|
|
833
|
+
onCommand: handleCommand,
|
|
834
|
+
className,
|
|
835
|
+
children: children ?? config.icon
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
MarkBubbleItem.displayName = `BubbleMenu${config.name.charAt(0).toUpperCase() + config.name.slice(1)}`;
|
|
839
|
+
return MarkBubbleItem;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
//#endregion
|
|
843
|
+
//#region src/ui/bubble-menu/bold.tsx
|
|
844
|
+
const BubbleMenuBold = createMarkBubbleItem({
|
|
845
|
+
name: "bold",
|
|
846
|
+
activeName: "bold",
|
|
847
|
+
command: "toggleBold",
|
|
848
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoldIcon, {})
|
|
849
|
+
});
|
|
850
|
+
|
|
747
851
|
//#endregion
|
|
748
852
|
//#region src/ui/bubble-menu/button-edit-link.tsx
|
|
749
853
|
function BubbleMenuButtonEditLink({ className, children, onClick, onMouseDown, ...rest }) {
|
|
@@ -954,198 +1058,6 @@ function BubbleMenuButtonUnlink({ className, children, onClick, onMouseDown, onL
|
|
|
954
1058
|
});
|
|
955
1059
|
}
|
|
956
1060
|
|
|
957
|
-
//#endregion
|
|
958
|
-
//#region src/ui/bubble-menu/triggers.ts
|
|
959
|
-
const bubbleMenuTriggers = {
|
|
960
|
-
textSelection(hideWhenActiveNodes = [], hideWhenActiveMarks = []) {
|
|
961
|
-
return ({ editor, state }) => {
|
|
962
|
-
for (const node of hideWhenActiveNodes) {
|
|
963
|
-
if (editor.isActive(node)) return false;
|
|
964
|
-
const { $from } = state.selection;
|
|
965
|
-
for (let d = $from.depth; d > 0; d--) if ($from.node(d).type.name === node) return false;
|
|
966
|
-
}
|
|
967
|
-
for (const mark of hideWhenActiveMarks) if (editor.isActive(mark)) return false;
|
|
968
|
-
return editor.view.state.selection.content().size > 0;
|
|
969
|
-
};
|
|
970
|
-
},
|
|
971
|
-
node(name) {
|
|
972
|
-
return ({ editor }) => editor.isActive(name);
|
|
973
|
-
},
|
|
974
|
-
nodeWithoutSelection(name) {
|
|
975
|
-
return ({ editor }) => editor.isActive(name) && editor.view.state.selection.content().size === 0;
|
|
976
|
-
}
|
|
977
|
-
};
|
|
978
|
-
|
|
979
|
-
//#endregion
|
|
980
|
-
//#region src/ui/bubble-menu/root.tsx
|
|
981
|
-
const defaultPluginKey = new _tiptap_pm_state.PluginKey("bubbleMenu");
|
|
982
|
-
function BubbleMenuRoot({ trigger, pluginKey: pluginKey$1 = defaultPluginKey, hideWhenActiveNodes = [], hideWhenActiveMarks = [], placement = "bottom", offset: offset$1 = 8, onHide, className, children, ...rest }) {
|
|
983
|
-
const { editor } = (0, _tiptap_react.useCurrentEditor)();
|
|
984
|
-
const [isEditing, setIsEditing] = react.useState(false);
|
|
985
|
-
const resolvedTrigger = trigger ?? bubbleMenuTriggers.textSelection(hideWhenActiveNodes, hideWhenActiveMarks);
|
|
986
|
-
if (!editor) return null;
|
|
987
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react_menus.BubbleMenu, {
|
|
988
|
-
editor,
|
|
989
|
-
pluginKey: pluginKey$1,
|
|
990
|
-
"data-re-bubble-menu": "",
|
|
991
|
-
shouldShow: resolvedTrigger,
|
|
992
|
-
options: {
|
|
993
|
-
placement,
|
|
994
|
-
offset: offset$1,
|
|
995
|
-
onHide: () => {
|
|
996
|
-
setIsEditing(false);
|
|
997
|
-
onHide?.();
|
|
998
|
-
}
|
|
999
|
-
},
|
|
1000
|
-
className,
|
|
1001
|
-
...rest,
|
|
1002
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuContext.Provider, {
|
|
1003
|
-
value: {
|
|
1004
|
-
editor,
|
|
1005
|
-
isEditing,
|
|
1006
|
-
setIsEditing
|
|
1007
|
-
},
|
|
1008
|
-
children
|
|
1009
|
-
})
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
//#endregion
|
|
1014
|
-
//#region src/ui/bubble-menu/button-default.tsx
|
|
1015
|
-
const buttonPluginKey = new _tiptap_pm_state.PluginKey("buttonBubbleMenu");
|
|
1016
|
-
function BubbleMenuButtonDefaultInner({ validateUrl, onLinkApply, onLinkRemove }) {
|
|
1017
|
-
const { editor } = useBubbleMenuContext();
|
|
1018
|
-
const buttonHref = (0, _tiptap_react.useEditorState)({
|
|
1019
|
-
editor,
|
|
1020
|
-
selector: ({ editor: e }) => e?.getAttributes("button").href ?? ""
|
|
1021
|
-
});
|
|
1022
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuButtonToolbar, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonEditLink, {}), (buttonHref ?? "") !== "" && buttonHref !== "#" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonUnlink, { onLinkRemove })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonForm, {
|
|
1023
|
-
validateUrl,
|
|
1024
|
-
onLinkApply,
|
|
1025
|
-
onLinkRemove
|
|
1026
|
-
})] });
|
|
1027
|
-
}
|
|
1028
|
-
function BubbleMenuButtonDefault({ placement = "top", offset: offset$1, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
|
|
1029
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuRoot, {
|
|
1030
|
-
trigger: bubbleMenuTriggers.node("button"),
|
|
1031
|
-
pluginKey: buttonPluginKey,
|
|
1032
|
-
placement,
|
|
1033
|
-
offset: offset$1,
|
|
1034
|
-
onHide,
|
|
1035
|
-
className,
|
|
1036
|
-
...rest,
|
|
1037
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonDefaultInner, {
|
|
1038
|
-
validateUrl,
|
|
1039
|
-
onLinkApply,
|
|
1040
|
-
onLinkRemove
|
|
1041
|
-
})
|
|
1042
|
-
});
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
//#endregion
|
|
1046
|
-
//#region src/ui/bubble-menu/item.tsx
|
|
1047
|
-
function BubbleMenuItem({ name, isActive, onCommand, className, children, ...rest }) {
|
|
1048
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1049
|
-
type: "button",
|
|
1050
|
-
"aria-label": name,
|
|
1051
|
-
"aria-pressed": isActive,
|
|
1052
|
-
className,
|
|
1053
|
-
"data-re-bubble-menu-item": "",
|
|
1054
|
-
"data-item": name,
|
|
1055
|
-
...isActive ? { "data-active": "" } : {},
|
|
1056
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1057
|
-
onClick: onCommand,
|
|
1058
|
-
...rest,
|
|
1059
|
-
children
|
|
1060
|
-
});
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
//#endregion
|
|
1064
|
-
//#region src/ui/bubble-menu/align-center.tsx
|
|
1065
|
-
function BubbleMenuAlignCenter({ className, children }) {
|
|
1066
|
-
const { editor } = useBubbleMenuContext();
|
|
1067
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
1068
|
-
name: "align-center",
|
|
1069
|
-
isActive: (0, _tiptap_react.useEditorState)({
|
|
1070
|
-
editor,
|
|
1071
|
-
selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "center" }) ?? false
|
|
1072
|
-
}),
|
|
1073
|
-
onCommand: () => require_set_text_alignment.setTextAlignment(editor, "center"),
|
|
1074
|
-
className,
|
|
1075
|
-
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignCenterIcon, {})
|
|
1076
|
-
});
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
//#endregion
|
|
1080
|
-
//#region src/ui/bubble-menu/align-left.tsx
|
|
1081
|
-
function BubbleMenuAlignLeft({ className, children }) {
|
|
1082
|
-
const { editor } = useBubbleMenuContext();
|
|
1083
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
1084
|
-
name: "align-left",
|
|
1085
|
-
isActive: (0, _tiptap_react.useEditorState)({
|
|
1086
|
-
editor,
|
|
1087
|
-
selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "left" }) ?? false
|
|
1088
|
-
}),
|
|
1089
|
-
onCommand: () => require_set_text_alignment.setTextAlignment(editor, "left"),
|
|
1090
|
-
className,
|
|
1091
|
-
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignLeftIcon, {})
|
|
1092
|
-
});
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
//#endregion
|
|
1096
|
-
//#region src/ui/bubble-menu/align-right.tsx
|
|
1097
|
-
function BubbleMenuAlignRight({ className, children }) {
|
|
1098
|
-
const { editor } = useBubbleMenuContext();
|
|
1099
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
1100
|
-
name: "align-right",
|
|
1101
|
-
isActive: (0, _tiptap_react.useEditorState)({
|
|
1102
|
-
editor,
|
|
1103
|
-
selector: ({ editor: editor$1 }) => editor$1?.isActive({ alignment: "right" }) ?? false
|
|
1104
|
-
}),
|
|
1105
|
-
onCommand: () => require_set_text_alignment.setTextAlignment(editor, "right"),
|
|
1106
|
-
className,
|
|
1107
|
-
children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlignRightIcon, {})
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
//#endregion
|
|
1112
|
-
//#region src/ui/bubble-menu/create-mark-bubble-item.tsx
|
|
1113
|
-
function createMarkBubbleItem(config) {
|
|
1114
|
-
function MarkBubbleItem({ className, children }) {
|
|
1115
|
-
const { editor } = useBubbleMenuContext();
|
|
1116
|
-
const isActive = (0, _tiptap_react.useEditorState)({
|
|
1117
|
-
editor,
|
|
1118
|
-
selector: ({ editor: editor$1 }) => {
|
|
1119
|
-
if (config.activeParams) return editor$1?.isActive(config.activeName, config.activeParams) ?? false;
|
|
1120
|
-
return editor$1?.isActive(config.activeName) ?? false;
|
|
1121
|
-
}
|
|
1122
|
-
});
|
|
1123
|
-
const handleCommand = () => {
|
|
1124
|
-
const chain = editor.chain().focus();
|
|
1125
|
-
const method = chain[config.command];
|
|
1126
|
-
if (method) method.call(chain).run();
|
|
1127
|
-
};
|
|
1128
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItem, {
|
|
1129
|
-
name: config.name,
|
|
1130
|
-
isActive,
|
|
1131
|
-
onCommand: handleCommand,
|
|
1132
|
-
className,
|
|
1133
|
-
children: children ?? config.icon
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
MarkBubbleItem.displayName = `BubbleMenu${config.name.charAt(0).toUpperCase() + config.name.slice(1)}`;
|
|
1137
|
-
return MarkBubbleItem;
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
//#endregion
|
|
1141
|
-
//#region src/ui/bubble-menu/bold.tsx
|
|
1142
|
-
const BubbleMenuBold = createMarkBubbleItem({
|
|
1143
|
-
name: "bold",
|
|
1144
|
-
activeName: "bold",
|
|
1145
|
-
command: "toggleBold",
|
|
1146
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoldIcon, {})
|
|
1147
|
-
});
|
|
1148
|
-
|
|
1149
1061
|
//#endregion
|
|
1150
1062
|
//#region src/ui/bubble-menu/code.tsx
|
|
1151
1063
|
const BubbleMenuCode = createMarkBubbleItem({
|
|
@@ -1495,6 +1407,28 @@ const BubbleMenuStrike = createMarkBubbleItem({
|
|
|
1495
1407
|
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StrikethroughIcon, {})
|
|
1496
1408
|
});
|
|
1497
1409
|
|
|
1410
|
+
//#endregion
|
|
1411
|
+
//#region src/ui/bubble-menu/triggers.ts
|
|
1412
|
+
const bubbleMenuTriggers = {
|
|
1413
|
+
textSelection(hideWhenActiveNodes = [], hideWhenActiveMarks = []) {
|
|
1414
|
+
return ({ editor, state }) => {
|
|
1415
|
+
for (const node of hideWhenActiveNodes) {
|
|
1416
|
+
if (editor.isActive(node)) return false;
|
|
1417
|
+
const { $from } = state.selection;
|
|
1418
|
+
for (let d = $from.depth; d > 0; d--) if ($from.node(d).type.name === node) return false;
|
|
1419
|
+
}
|
|
1420
|
+
for (const mark of hideWhenActiveMarks) if (editor.isActive(mark)) return false;
|
|
1421
|
+
return editor.view.state.selection.content().size > 0;
|
|
1422
|
+
};
|
|
1423
|
+
},
|
|
1424
|
+
node(name) {
|
|
1425
|
+
return ({ editor }) => editor.isActive(name);
|
|
1426
|
+
},
|
|
1427
|
+
nodeWithoutSelection(name) {
|
|
1428
|
+
return ({ editor }) => editor.isActive(name) && editor.view.state.selection.content().size === 0;
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
|
|
1498
1432
|
//#endregion
|
|
1499
1433
|
//#region src/ui/bubble-menu/underline.tsx
|
|
1500
1434
|
const BubbleMenuUnderline = createMarkBubbleItem({
|
|
@@ -1514,12 +1448,42 @@ const BubbleMenuUppercase = createMarkBubbleItem({
|
|
|
1514
1448
|
});
|
|
1515
1449
|
|
|
1516
1450
|
//#endregion
|
|
1517
|
-
//#region src/ui/bubble-menu/
|
|
1451
|
+
//#region src/ui/bubble-menu/root.tsx
|
|
1452
|
+
const defaultPluginKey = new _tiptap_pm_state.PluginKey("bubbleMenu");
|
|
1453
|
+
function Root({ trigger, pluginKey: pluginKey$1 = defaultPluginKey, hideWhenActiveNodes = [], hideWhenActiveMarks = [], placement = "bottom", offset: offset$1 = 8, onHide, className, children, ...rest }) {
|
|
1454
|
+
const { editor } = (0, _tiptap_react.useCurrentEditor)();
|
|
1455
|
+
const [isEditing, setIsEditing] = react.useState(false);
|
|
1456
|
+
const resolvedTrigger = trigger ?? bubbleMenuTriggers.textSelection(hideWhenActiveNodes, hideWhenActiveMarks);
|
|
1457
|
+
if (!editor) return null;
|
|
1458
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiptap_react_menus.BubbleMenu, {
|
|
1459
|
+
editor,
|
|
1460
|
+
pluginKey: pluginKey$1,
|
|
1461
|
+
"data-re-bubble-menu": "",
|
|
1462
|
+
shouldShow: resolvedTrigger,
|
|
1463
|
+
options: {
|
|
1464
|
+
placement,
|
|
1465
|
+
offset: offset$1,
|
|
1466
|
+
onHide: () => {
|
|
1467
|
+
setIsEditing(false);
|
|
1468
|
+
onHide?.();
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
className,
|
|
1472
|
+
...rest,
|
|
1473
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuContext.Provider, {
|
|
1474
|
+
value: {
|
|
1475
|
+
editor,
|
|
1476
|
+
isEditing,
|
|
1477
|
+
setIsEditing
|
|
1478
|
+
},
|
|
1479
|
+
children
|
|
1480
|
+
})
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1518
1483
|
const textPluginKey = new _tiptap_pm_state.PluginKey("textBubbleMenu");
|
|
1519
|
-
function
|
|
1484
|
+
function Default({ hideWhenActiveNodes, hideWhenActiveMarks, placement, offset: offset$1, onHide, className, ...rest }) {
|
|
1520
1485
|
const [isNodeSelectorOpen, setIsNodeSelectorOpen] = react.useState(false);
|
|
1521
1486
|
const [isLinkSelectorOpen, setIsLinkSelectorOpen] = react.useState(false);
|
|
1522
|
-
const has = (item) => !excludeItems.includes(item);
|
|
1523
1487
|
const handleNodeSelectorOpenChange = react.useCallback((open) => {
|
|
1524
1488
|
setIsNodeSelectorOpen(open);
|
|
1525
1489
|
if (open) setIsLinkSelectorOpen(false);
|
|
@@ -1528,47 +1492,83 @@ function BubbleMenuDefault({ excludeItems = [], hideWhenActiveNodes, hideWhenAct
|
|
|
1528
1492
|
setIsLinkSelectorOpen(open);
|
|
1529
1493
|
if (open) setIsNodeSelectorOpen(false);
|
|
1530
1494
|
}, []);
|
|
1531
|
-
|
|
1532
|
-
setIsNodeSelectorOpen(false);
|
|
1533
|
-
setIsLinkSelectorOpen(false);
|
|
1534
|
-
onHide?.();
|
|
1535
|
-
}, [onHide]);
|
|
1536
|
-
const hasFormattingItems = has("bold") || has("italic") || has("underline") || has("strike") || has("code") || has("uppercase");
|
|
1537
|
-
const hasAlignmentItems = has("align-left") || has("align-center") || has("align-right");
|
|
1538
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuRoot, {
|
|
1495
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Root, {
|
|
1539
1496
|
pluginKey: textPluginKey,
|
|
1540
1497
|
hideWhenActiveNodes,
|
|
1541
1498
|
hideWhenActiveMarks,
|
|
1542
1499
|
placement,
|
|
1543
1500
|
offset: offset$1,
|
|
1544
|
-
onHide:
|
|
1501
|
+
onHide: react.useCallback(() => {
|
|
1502
|
+
setIsNodeSelectorOpen(false);
|
|
1503
|
+
setIsLinkSelectorOpen(false);
|
|
1504
|
+
onHide?.();
|
|
1505
|
+
}, [onHide]),
|
|
1545
1506
|
className,
|
|
1546
1507
|
...rest,
|
|
1547
1508
|
children: [
|
|
1548
|
-
|
|
1509
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuNodeSelector, {
|
|
1549
1510
|
open: isNodeSelectorOpen,
|
|
1550
1511
|
onOpenChange: handleNodeSelectorOpenChange
|
|
1551
1512
|
}),
|
|
1552
|
-
|
|
1513
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuLinkSelector, {
|
|
1553
1514
|
open: isLinkSelectorOpen,
|
|
1554
1515
|
onOpenChange: handleLinkSelectorOpenChange
|
|
1555
1516
|
}),
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1517
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuItemGroup, { children: [
|
|
1518
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuBold, {}),
|
|
1519
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuItalic, {}),
|
|
1520
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuUnderline, {}),
|
|
1521
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuStrike, {}),
|
|
1522
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuCode, {}),
|
|
1523
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuUppercase, {})
|
|
1563
1524
|
] }),
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1525
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuItemGroup, { children: [
|
|
1526
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignLeft, {}),
|
|
1527
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignCenter, {}),
|
|
1528
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuAlignRight, {})
|
|
1568
1529
|
] })
|
|
1569
1530
|
]
|
|
1570
1531
|
});
|
|
1571
1532
|
}
|
|
1533
|
+
function RootWithDefault({ children, ...rest }) {
|
|
1534
|
+
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Root, {
|
|
1535
|
+
...rest,
|
|
1536
|
+
children
|
|
1537
|
+
});
|
|
1538
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Default, { ...rest });
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
//#endregion
|
|
1542
|
+
//#region src/ui/bubble-menu/button-default.tsx
|
|
1543
|
+
const buttonPluginKey = new _tiptap_pm_state.PluginKey("buttonBubbleMenu");
|
|
1544
|
+
function BubbleMenuButtonDefaultInner({ validateUrl, onLinkApply, onLinkRemove }) {
|
|
1545
|
+
const { editor } = useBubbleMenuContext();
|
|
1546
|
+
const buttonHref = (0, _tiptap_react.useEditorState)({
|
|
1547
|
+
editor,
|
|
1548
|
+
selector: ({ editor: e }) => e?.getAttributes("button").href ?? ""
|
|
1549
|
+
});
|
|
1550
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(BubbleMenuButtonToolbar, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonEditLink, {}), (buttonHref ?? "") !== "" && buttonHref !== "#" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonUnlink, { onLinkRemove })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonForm, {
|
|
1551
|
+
validateUrl,
|
|
1552
|
+
onLinkApply,
|
|
1553
|
+
onLinkRemove
|
|
1554
|
+
})] });
|
|
1555
|
+
}
|
|
1556
|
+
function BubbleMenuButtonDefault({ placement = "top", offset: offset$1, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
|
|
1557
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootWithDefault, {
|
|
1558
|
+
trigger: bubbleMenuTriggers.node("button"),
|
|
1559
|
+
pluginKey: buttonPluginKey,
|
|
1560
|
+
placement,
|
|
1561
|
+
offset: offset$1,
|
|
1562
|
+
onHide,
|
|
1563
|
+
className,
|
|
1564
|
+
...rest,
|
|
1565
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BubbleMenuButtonDefaultInner, {
|
|
1566
|
+
validateUrl,
|
|
1567
|
+
onLinkApply,
|
|
1568
|
+
onLinkRemove
|
|
1569
|
+
})
|
|
1570
|
+
});
|
|
1571
|
+
}
|
|
1572
1572
|
|
|
1573
1573
|
//#endregion
|
|
1574
1574
|
//#region src/ui/bubble-menu/image-edit-link.tsx
|
|
@@ -1610,7 +1610,7 @@ function BubbleMenuImageToolbar({ children, ...rest }) {
|
|
|
1610
1610
|
const imagePluginKey = new _tiptap_pm_state.PluginKey("imageBubbleMenu");
|
|
1611
1611
|
function BubbleMenuImageDefault({ excludeItems = [], placement = "top", offset: offset$1, onHide, className, ...rest }) {
|
|
1612
1612
|
const hasEditLink = !excludeItems.includes("edit-link");
|
|
1613
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1613
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootWithDefault, {
|
|
1614
1614
|
trigger: bubbleMenuTriggers.node("image"),
|
|
1615
1615
|
pluginKey: imagePluginKey,
|
|
1616
1616
|
placement,
|
|
@@ -1817,7 +1817,7 @@ const linkPluginKey = new _tiptap_pm_state.PluginKey("linkBubbleMenu");
|
|
|
1817
1817
|
function BubbleMenuLinkDefault({ excludeItems = [], placement = "top", offset: offset$1, onHide, className, validateUrl, onLinkApply, onLinkRemove, ...rest }) {
|
|
1818
1818
|
const has = (item) => !excludeItems.includes(item);
|
|
1819
1819
|
const hasToolbarItems = has("edit-link") || has("open-link") || has("unlink");
|
|
1820
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(
|
|
1820
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RootWithDefault, {
|
|
1821
1821
|
trigger: bubbleMenuTriggers.nodeWithoutSelection("link"),
|
|
1822
1822
|
pluginKey: linkPluginKey,
|
|
1823
1823
|
placement,
|
|
@@ -1837,6 +1837,53 @@ function BubbleMenuLinkDefault({ excludeItems = [], placement = "top", offset: o
|
|
|
1837
1837
|
});
|
|
1838
1838
|
}
|
|
1839
1839
|
|
|
1840
|
+
//#endregion
|
|
1841
|
+
//#region src/ui/bubble-menu/separator.tsx
|
|
1842
|
+
function BubbleMenuSeparator({ className }) {
|
|
1843
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", {
|
|
1844
|
+
className,
|
|
1845
|
+
"data-re-bubble-menu-separator": ""
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
//#endregion
|
|
1850
|
+
//#region src/ui/bubble-menu/index.ts
|
|
1851
|
+
const BubbleMenu = Object.assign(RootWithDefault, {
|
|
1852
|
+
Root: RootWithDefault,
|
|
1853
|
+
ItemGroup: BubbleMenuItemGroup,
|
|
1854
|
+
Separator: BubbleMenuSeparator,
|
|
1855
|
+
Item: BubbleMenuItem,
|
|
1856
|
+
Bold: BubbleMenuBold,
|
|
1857
|
+
Italic: BubbleMenuItalic,
|
|
1858
|
+
Underline: BubbleMenuUnderline,
|
|
1859
|
+
Strike: BubbleMenuStrike,
|
|
1860
|
+
Code: BubbleMenuCode,
|
|
1861
|
+
Uppercase: BubbleMenuUppercase,
|
|
1862
|
+
AlignLeft: BubbleMenuAlignLeft,
|
|
1863
|
+
AlignCenter: BubbleMenuAlignCenter,
|
|
1864
|
+
AlignRight: BubbleMenuAlignRight,
|
|
1865
|
+
NodeSelector: Object.assign(BubbleMenuNodeSelector, {
|
|
1866
|
+
Root: NodeSelectorRoot,
|
|
1867
|
+
Trigger: NodeSelectorTrigger,
|
|
1868
|
+
Content: NodeSelectorContent
|
|
1869
|
+
}),
|
|
1870
|
+
LinkSelector: BubbleMenuLinkSelector,
|
|
1871
|
+
ButtonToolbar: BubbleMenuButtonToolbar,
|
|
1872
|
+
ButtonEditLink: BubbleMenuButtonEditLink,
|
|
1873
|
+
ButtonUnlink: BubbleMenuButtonUnlink,
|
|
1874
|
+
ButtonForm: BubbleMenuButtonForm,
|
|
1875
|
+
ButtonDefault: BubbleMenuButtonDefault,
|
|
1876
|
+
LinkToolbar: BubbleMenuLinkToolbar,
|
|
1877
|
+
LinkEditLink: BubbleMenuLinkEditLink,
|
|
1878
|
+
LinkUnlink: BubbleMenuLinkUnlink,
|
|
1879
|
+
LinkOpenLink: BubbleMenuLinkOpenLink,
|
|
1880
|
+
LinkForm: BubbleMenuLinkForm,
|
|
1881
|
+
LinkDefault: BubbleMenuLinkDefault,
|
|
1882
|
+
ImageToolbar: BubbleMenuImageToolbar,
|
|
1883
|
+
ImageEditLink: BubbleMenuImageEditLink,
|
|
1884
|
+
ImageDefault: BubbleMenuImageDefault
|
|
1885
|
+
});
|
|
1886
|
+
|
|
1840
1887
|
//#endregion
|
|
1841
1888
|
//#region src/ui/slash-command/utils.ts
|
|
1842
1889
|
function isInsideNode(editor, type) {
|
|
@@ -2350,6 +2397,12 @@ Object.defineProperty(exports, 'BoldIcon', {
|
|
|
2350
2397
|
return BoldIcon;
|
|
2351
2398
|
}
|
|
2352
2399
|
});
|
|
2400
|
+
Object.defineProperty(exports, 'BubbleMenu', {
|
|
2401
|
+
enumerable: true,
|
|
2402
|
+
get: function () {
|
|
2403
|
+
return BubbleMenu;
|
|
2404
|
+
}
|
|
2405
|
+
});
|
|
2353
2406
|
Object.defineProperty(exports, 'BubbleMenuAlignCenter', {
|
|
2354
2407
|
enumerable: true,
|
|
2355
2408
|
get: function () {
|
|
@@ -2410,12 +2463,6 @@ Object.defineProperty(exports, 'BubbleMenuCode', {
|
|
|
2410
2463
|
return BubbleMenuCode;
|
|
2411
2464
|
}
|
|
2412
2465
|
});
|
|
2413
|
-
Object.defineProperty(exports, 'BubbleMenuDefault', {
|
|
2414
|
-
enumerable: true,
|
|
2415
|
-
get: function () {
|
|
2416
|
-
return BubbleMenuDefault;
|
|
2417
|
-
}
|
|
2418
|
-
});
|
|
2419
2466
|
Object.defineProperty(exports, 'BubbleMenuImageDefault', {
|
|
2420
2467
|
enumerable: true,
|
|
2421
2468
|
get: function () {
|
|
@@ -2500,10 +2547,10 @@ Object.defineProperty(exports, 'BubbleMenuNodeSelector', {
|
|
|
2500
2547
|
return BubbleMenuNodeSelector;
|
|
2501
2548
|
}
|
|
2502
2549
|
});
|
|
2503
|
-
Object.defineProperty(exports, '
|
|
2550
|
+
Object.defineProperty(exports, 'BubbleMenuSeparator', {
|
|
2504
2551
|
enumerable: true,
|
|
2505
2552
|
get: function () {
|
|
2506
|
-
return
|
|
2553
|
+
return BubbleMenuSeparator;
|
|
2507
2554
|
}
|
|
2508
2555
|
});
|
|
2509
2556
|
Object.defineProperty(exports, 'BubbleMenuStrike', {
|
|
@@ -2698,6 +2745,12 @@ Object.defineProperty(exports, 'QUOTE', {
|
|
|
2698
2745
|
return QUOTE;
|
|
2699
2746
|
}
|
|
2700
2747
|
});
|
|
2748
|
+
Object.defineProperty(exports, 'RootWithDefault', {
|
|
2749
|
+
enumerable: true,
|
|
2750
|
+
get: function () {
|
|
2751
|
+
return RootWithDefault;
|
|
2752
|
+
}
|
|
2753
|
+
});
|
|
2701
2754
|
Object.defineProperty(exports, 'Rows2Icon', {
|
|
2702
2755
|
enumerable: true,
|
|
2703
2756
|
get: function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set-text-alignment-
|
|
1
|
+
{"version":3,"file":"set-text-alignment-BDkB4Vfh.mjs","names":[],"sources":["../src/utils/set-text-alignment.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core';\n\nexport function setTextAlignment(editor: Editor, alignment: string) {\n const { from, to } = editor.state.selection;\n const tr = editor.state.tr;\n editor.state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isTextblock) {\n const prop = 'align' in node.attrs ? 'align' : 'alignment';\n tr.setNodeMarkup(pos, null, { ...node.attrs, [prop]: alignment });\n }\n });\n editor.view.dispatch(tr);\n}\n"],"mappings":";AAEA,SAAgB,iBAAiB,QAAgB,WAAmB;CAClE,MAAM,EAAE,MAAM,OAAO,OAAO,MAAM;CAClC,MAAM,KAAK,OAAO,MAAM;AACxB,QAAO,MAAM,IAAI,aAAa,MAAM,KAAK,MAAM,QAAQ;AACrD,MAAI,KAAK,aAAa;GACpB,MAAM,OAAO,WAAW,KAAK,QAAQ,UAAU;AAC/C,MAAG,cAAc,KAAK,MAAM;IAAE,GAAG,KAAK;KAAQ,OAAO;IAAW,CAAC;;GAEnE;AACF,QAAO,KAAK,SAAS,GAAG"}
|
|
@@ -18,13 +18,31 @@ const jsToInlineCss = (styleObject) => {
|
|
|
18
18
|
}
|
|
19
19
|
return parts.join(";") + (parts.length ? ";" : "");
|
|
20
20
|
};
|
|
21
|
+
const splitDeclarations = (input) => {
|
|
22
|
+
const results = [];
|
|
23
|
+
let current = "";
|
|
24
|
+
let depth = 0;
|
|
25
|
+
for (const char of input) {
|
|
26
|
+
if (char === "(") depth++;
|
|
27
|
+
if (char === ")") depth--;
|
|
28
|
+
if (char === ";" && depth === 0) {
|
|
29
|
+
results.push(current);
|
|
30
|
+
current = "";
|
|
31
|
+
} else current += char;
|
|
32
|
+
}
|
|
33
|
+
if (current) results.push(current);
|
|
34
|
+
return results;
|
|
35
|
+
};
|
|
21
36
|
const inlineCssToJs = (inlineStyle, options = {}) => {
|
|
22
37
|
const styleObject = {};
|
|
23
38
|
if (!inlineStyle || inlineStyle === "" || typeof inlineStyle === "object") return styleObject;
|
|
24
|
-
inlineStyle
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
39
|
+
splitDeclarations(inlineStyle).forEach((style) => {
|
|
40
|
+
const trimmed = style.trim();
|
|
41
|
+
if (trimmed) {
|
|
42
|
+
const separatorIndex = trimmed.indexOf(":");
|
|
43
|
+
if (separatorIndex === -1) return;
|
|
44
|
+
const key = trimmed.slice(0, separatorIndex);
|
|
45
|
+
const valueTrimmed = trimmed.slice(separatorIndex + 1).trim();
|
|
28
46
|
if (!valueTrimmed) return;
|
|
29
47
|
const formattedKey = key.trim().replace(/-\w/g, (match) => match[1].toUpperCase());
|
|
30
48
|
styleObject[formattedKey] = options?.removeUnit ? valueTrimmed.replace(/px|%/g, "") : valueTrimmed;
|
|
@@ -202,4 +220,4 @@ function resolveConflictingStyles(resetStyles, inlineStyles) {
|
|
|
202
220
|
|
|
203
221
|
//#endregion
|
|
204
222
|
export { resolveConflictingStyles as a, jsToInlineCss as i, expandShorthandProperties as n, inlineCssToJs as r, ensureBorderStyleFallback as t };
|
|
205
|
-
//# sourceMappingURL=styles-
|
|
223
|
+
//# sourceMappingURL=styles-BBXVfEv-.mjs.map
|