Skip to content

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

feat: improve toolbar and editor UI

thecodrr7275916a38db
diff --git a/apps/web/src/components/editor/editor.css b/apps/web/src/components/editor/editor.css
index 731afb4ca..3338d3b1f 100644
--- a/apps/web/src/components/editor/editor.css
+++ b/apps/web/src/components/editor/editor.css
@@ -67,9 +67,17 @@ tox-tbtn tox-tbtn--select {
.tox .tox-toolbar__overflow,
.tox .tox-toolbar__primary {
background: none !important;
- border-bottom: 1px solid var(--border) !important;
+ border-bottom: 0px solid var(--border) !important;
}
.mce-content-body:focus-visible {
outline: none;
}
+
+.mce-content-body:not([dir="rtl"])[data-mce-placeholder]:not(.mce-visualblocks)::before {
+ left: 0px !important;
+}
+
+.mce-content-body[data-mce-placeholder]:not(.mce-visualblocks)::before {
+ margin-top: 15px !important;
+}
diff --git a/apps/web/src/components/editor/header.js b/apps/web/src/components/editor/header.js
index 48ffc2f2c..06f91bb03 100644
--- a/apps/web/src/components/editor/header.js
+++ b/apps/web/src/components/editor/header.js
@@ -1,5 +1,4 @@
import React from "react";
-import { Flex } from "rebass";
import TitleBox from "./title-box";
import { useStore, SESSION_STATES } from "../../stores/editor-store";
@@ -10,18 +9,16 @@ function Header() {
const setSession = useStore((store) => store.setSession);
return (
- <Flex mx={2} mb={[2, 2, 0]}>
- <TitleBox
- shouldFocus={sessionState === SESSION_STATES.new && title.length <= 0}
- title={title}
- changeInterval={500}
- setTitle={(title) =>
- setSession((state) => {
- state.session.title = title;
- })
- }
- />
- </Flex>
+ <TitleBox
+ shouldFocus={sessionState === SESSION_STATES.new && title.length <= 0}
+ title={title}
+ changeInterval={500}
+ setTitle={(title) =>
+ setSession((state) => {
+ state.session.title = title;
+ })
+ }
+ />
);
}
export default Header;
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index 939513f0a..30c4f8765 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -1,10 +1,4 @@
-import React, {
- useEffect,
- useMemo,
- useRef,
- Suspense,
- useCallback,
-} from "react";
+import React, { useEffect, useRef, Suspense, useCallback } from "react";
import { Flex } from "rebass";
import Properties from "../properties";
import {
@@ -38,10 +32,6 @@ function Editor({ noteId, nonce }) {
const isFocusMode = useAppStore((store) => store.isFocusMode);
const isMobile = useMobile();
const isTablet = useTablet();
- const editorMargins = useMemo(() => {
- if (isMobile || isTablet) return "0%";
- else return "10px";
- }, [isTablet, isMobile]);
useEffect(() => {
init();
@@ -107,16 +97,29 @@ function Editor({ noteId, nonce }) {
overflow="hidden"
overflowY="auto"
>
+ <Flex
+ id="editorToolbar"
+ sx={{
+ bg: "background",
+ position: "sticky",
+ top: 0,
+ zIndex: 2,
+ borderBottom: "1px solid",
+ borderBottomColor: "border",
+ justifyContent: "center",
+ alignItems: "center",
+ }}
+ />
<Animated.Flex
variant="columnFill"
className="editor"
sx={{
- mx: [0, 0, editorMargins],
+ mx: 3,
alignSelf: ["stretch", "stretch", "center"],
}}
animate={{
- marginRight: isFocusMode && !isTablet ? "25%" : editorMargins,
- marginLeft: isFocusMode && !isTablet ? "25%" : editorMargins,
+ marginRight: isFocusMode && !isTablet ? "25%" : "15px",
+ marginLeft: isFocusMode && !isTablet ? "25%" : "15px",
}}
transition={{ duration: 0.3, ease: "easeOut" }}
maxWidth={isFocusMode ? "auto" : "900px"}
@@ -124,16 +127,7 @@ function Editor({ noteId, nonce }) {
mt={[0, 0, 25]}
>
<Header />
- <Flex
- id="editorToolbar"
- sx={{
- bg: "background",
- position: "sticky",
- top: 0,
- zIndex: 999,
- boxShadow: "0px 0px 15px 0px #0000002e",
- }}
- />
+
<Suspense fallback={<EditorLoading />}>
{contentType === "tiny" ? (
<>
diff --git a/apps/web/src/components/editor/titlebox.js b/apps/web/src/components/editor/titlebox.js
index fa51fab1f..edd8ef795 100644
--- a/apps/web/src/components/editor/titlebox.js
+++ b/apps/web/src/components/editor/titlebox.js
@@ -42,9 +42,8 @@ function TitleBox(props) {
}, [shouldFocus]);
return (
- <Flex width="100%" sx={{ position: "relative" }} py={2}>
+ <Flex width="100%" sx={{ position: "relative" }} flexShrink={0}>
<Text
- as="pre"
className="dummyEditorTitle"
variant="heading"
minHeight={[30, 30, 60]}
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index 1f81ed843..e24379fed 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -26,9 +26,9 @@ body,
transition: background-color 300ms linear, border-color 300ms linear;
}
-* {
+/* * {
font-family: sans-serif;
-}
+} */
@keyframes fadeUp {
0% {