@flozy/editor 1.9.7 → 1.9.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -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);
@@ -10,7 +10,7 @@ const ColorPickerButton = props => {
10
10
  value,
11
11
  onSave,
12
12
  defaultColors = [],
13
- classes
13
+ classes = {}
14
14
  } = props;
15
15
  const [anchorEl, setAnchorEl] = useState(null);
16
16
  const [color, setColor] = useState(value);
@@ -36,14 +36,14 @@ export function invertColor(hex) {
36
36
  if (hex?.indexOf("#") === -1) {
37
37
  hex = rgbToHex(hex);
38
38
  }
39
- if (hex.indexOf("#") === 0) {
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.length === 3) {
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.length !== 6) {
46
+ if (hex?.length !== 6) {
47
47
  // throw new Error("Invalid HEX color.");
48
48
  }
49
49
  // invert color components
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.9.7",
3
+ "version": "1.9.8",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"