@flozy/editor 10.8.7 → 10.8.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.
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useSlate } from "slate-react";
|
2
|
-
import {
|
2
|
+
import { defaultTheme } from "../theme";
|
3
3
|
import { getPageSettings, updatePageSettings } from "../utils/pageSettings";
|
4
4
|
import { HEADING_THEME_FIELDS, PARAGRAPH_THEME_FIELDS } from "../helper/theme";
|
5
5
|
import { useEditorContext } from "./useMouseMove";
|
@@ -145,10 +145,8 @@ export const useEditorTheme = () => {
|
|
145
145
|
const {
|
146
146
|
theme
|
147
147
|
} = pageProps || {};
|
148
|
-
const fallbackTheme = baseTheme?.theme || {};
|
149
|
-
console.log("fallbackTheme", fallbackTheme, baseTheme);
|
150
148
|
return {
|
151
|
-
selectedTheme: theme?.theme ||
|
149
|
+
selectedTheme: theme?.theme || defaultTheme()?.theme,
|
152
150
|
updateTheme: (update, actionData) => updateTheme(editor, pageSt, update, actionData, triggerRender),
|
153
151
|
theme
|
154
152
|
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Box, MenuItem, Select } from "@mui/material";
|
2
|
-
import {
|
2
|
+
import { defaultTheme } from ".";
|
3
3
|
import { useEditorTheme } from "../hooks/useEditorTheme";
|
4
4
|
import { useEffect, useState } from "react";
|
5
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
@@ -31,8 +31,7 @@ function ThemeList({
|
|
31
31
|
const {
|
32
32
|
value
|
33
33
|
} = e.target;
|
34
|
-
const
|
35
|
-
const selectedTheme = themes.find(t => t.id === value) || fallbackTheme;
|
34
|
+
const selectedTheme = themes.find(t => t.id === value) || defaultTheme();
|
36
35
|
updateTheme(selectedTheme, "THEME_CHANGE");
|
37
36
|
};
|
38
37
|
return /*#__PURE__*/_jsx(Box, {
|
@@ -117,7 +117,7 @@ export const transformTheme = (selectedTheme = {}) => {
|
|
117
117
|
...others
|
118
118
|
};
|
119
119
|
};
|
120
|
-
export const
|
120
|
+
export const defaultTheme = () => ({
|
121
121
|
theme: {
|
122
122
|
cssVars: {},
|
123
123
|
elementProps: {
|
@@ -143,7 +143,7 @@ export const baseTheme = {
|
|
143
143
|
}
|
144
144
|
}
|
145
145
|
}
|
146
|
-
};
|
146
|
+
});
|
147
147
|
export function getTheme(selectedTheme) {
|
148
|
-
return transformTheme(selectedTheme?.theme ||
|
148
|
+
return transformTheme(selectedTheme?.theme || defaultTheme().theme);
|
149
149
|
}
|