@flozy/editor 1.9.7 → 1.9.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.
|
@@ -48,7 +48,7 @@ const SimpleTextStyle = ({
|
|
|
48
48
|
const SimpleText = props => {
|
|
49
49
|
const {
|
|
50
50
|
theme
|
|
51
|
-
} = useEditorContext();
|
|
51
|
+
} = useEditorContext() || {};
|
|
52
52
|
const editor = useSlateStatic();
|
|
53
53
|
const {
|
|
54
54
|
element,
|
|
@@ -68,7 +68,7 @@ const SimpleText = props => {
|
|
|
68
68
|
pageColor
|
|
69
69
|
} = pageSt?.pageProps || {};
|
|
70
70
|
const classes = SimpleTextStyle({
|
|
71
|
-
pageColor: pageColor || theme?.palette?.editor?.background
|
|
71
|
+
pageColor: pageColor || theme?.palette?.editor?.background || '#FFFFFF'
|
|
72
72
|
});
|
|
73
73
|
const selected = useSelected();
|
|
74
74
|
const path = ReactEditor.findPath(editor, element);
|
|
@@ -36,14 +36,14 @@ export function invertColor(hex) {
|
|
|
36
36
|
if (hex?.indexOf("#") === -1) {
|
|
37
37
|
hex = rgbToHex(hex);
|
|
38
38
|
}
|
|
39
|
-
if (hex
|
|
39
|
+
if (hex?.indexOf("#") === 0) {
|
|
40
40
|
hex = hex.slice(1);
|
|
41
41
|
}
|
|
42
42
|
// convert 3-digit hex to 6-digits.
|
|
43
|
-
if (hex
|
|
43
|
+
if (hex?.length === 3) {
|
|
44
44
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
45
45
|
}
|
|
46
|
-
if (hex
|
|
46
|
+
if (hex?.length !== 6) {
|
|
47
47
|
// throw new Error("Invalid HEX color.");
|
|
48
48
|
}
|
|
49
49
|
// invert color components
|