Skip to content

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

feat: make editor toolbar sticky

thecodrrcf747bdec736
diff --git a/apps/web/src/components/editor/editor.css b/apps/web/src/components/editor/editor.css
index 05f371848..abd862beb 100644
--- a/apps/web/src/components/editor/editor.css
+++ b/apps/web/src/components/editor/editor.css
@@ -18,6 +18,14 @@
padding-top: 1px;
font-size: 0.975em;
}
+.ql-toolbar.ql-snow {
+ position: sticky;
+ position: -webkit-sticky;
+ top: 0;
+ z-index: 999;
+ background-color: var(--background);
+ margin-top: -1px !important;
+}
.ql-formats {
margin-bottom: 5px;
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index 96e53f1da..49f1856d7 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -1,6 +1,6 @@
import React, { useEffect, useMemo, useRef, Suspense } from "react";
//import ReactQuill from "./react-quill";
-import { Box, Flex } from "rebass";
+import { Flex } from "rebass";
import Properties from "../properties";
import {
useStore,
@@ -45,16 +45,6 @@ function Editor(props) {
const quillRef = useRef();
- useEffect(() => {
- if (contentType !== "delta") return;
- // move the toolbar outside (easiest way)
- const toolbar = document.querySelector(".ql-toolbar.ql-snow");
- const toolbarContainer = document.querySelector("#toolbar");
- if (toolbar && toolbarContainer) {
- toolbarContainer.appendChild(toolbar);
- }
- }, [contentType]);
-
useEffect(() => {
init();
}, [init]);
@@ -119,8 +109,6 @@ function Editor(props) {
mt={[0, 0, 50]}
>
<Header />
- <Box id="toolbar" />
- {/* <EditorMenu quill={quillRef.current?.quill} /> */}
{contentType === "delta" && (
<Suspense fallback={<EditorLoading />}>
<ReactQuill