Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor(mobile): add theme to global styles

Abdullah Atta394002eb4c9d
diff --git a/packages/editor-mobile/src/App.tsx b/packages/editor-mobile/src/App.tsx
index d584cf24d..be01f6621 100644
--- a/packages/editor-mobile/src/App.tsx
+++ b/packages/editor-mobile/src/App.tsx
@@ -17,15 +17,22 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import { ScopedThemeProvider } from "@notesnook/theme";
+import {
+ ScopedThemeProvider,
+ themeToCSS,
+ useThemeEngineStore
+} from "@notesnook/theme";
import "./App.css";
import Tiptap from "./components/editor";
import { EmotionEditorTheme } from "./theme-factory";
+import { Global, css } from "@emotion/react";
+import { useMemo } from "react";
function App(): JSX.Element {
return (
<ScopedThemeProvider value="base">
<EmotionEditorTheme>
+ <GlobalStyles />
<Tiptap />
</EmotionEditorTheme>
</ScopedThemeProvider>
@@ -33,3 +40,17 @@ function App(): JSX.Element {
}
export default App;
+
+function GlobalStyles() {
+ const theme = useThemeEngineStore((store) => store.theme);
+ const cssTheme = useMemo(() => themeToCSS(theme), [theme]);
+ return (
+ <>
+ <Global
+ styles={css`
+ ${cssTheme}
+ `}
+ />
+ </>
+ );
+}
diff --git a/packages/editor-mobile/src/components/editor.tsx b/packages/editor-mobile/src/components/editor.tsx
index c15f8fdf5..bf2750287 100644
--- a/packages/editor-mobile/src/components/editor.tsx
+++ b/packages/editor-mobile/src/components/editor.tsx
@@ -234,6 +234,7 @@ const Tiptap = ({ settings }: { settings: Settings }) => {
{!layout ? null : (
<EmotionEditorToolbarTheme>
<Toolbar
+ className="theme-scope-editorToolbar"
sx={{
display: settings.noToolbar ? "none" : "flex"
}}
@@ -259,6 +260,7 @@ const ContentDiv = memo(
return (
<div
ref={ref}
+ className="theme-scope-editor"
style={{
padding: 12,
paddingTop: props.padding,