A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
feat: sticky toolbar
thecodrrd7fb8fd11004
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.jsindex 7e52315c1..237fc608d 100644--- a/apps/web/src/components/editor/index.js+++ b/apps/web/src/components/editor/index.js@@ -16,7 +16,7 @@ import Banner from "../banner";import EditorLoading from "./loading";const ReactMCE = React.lazy(() => import("./tinymce"));-+var isToolbarSticky = false;function Editor(props) {const editorRef = useRef();const sessionState = useStore((store) => store.session.state);@@ -85,6 +85,25 @@ function Editor(props) {flexDirection="column"overflow="hidden"overflowY="auto"+ onScroll={(e) => {+ const title = document.querySelector(".editorTitle");+ const headerOffset = title.scrollHeight;+ const hideOffset = headerOffset + 60;+ if (e.target.scrollTop > hideOffset && !isToolbarSticky) {+ const toolbar = document.querySelector(".tox-editor-header");+ toolbar.style.position = "fixed";+ toolbar.style.top = "40px";+ toolbar.style.bottom = "auto";+ toolbar.style.width = `${title.clientWidth}px`;+ isToolbarSticky = true;+ } else if (e.target.scrollTop <= hideOffset && isToolbarSticky) {+ const toolbar = document.querySelector(".tox-editor-header");+ toolbar.style.position = "relative";+ toolbar.style.top = "0px";+ toolbar.style.bottom = "0px";+ isToolbarSticky = false;+ }+ }}><Animated.Flexvariant="columnFill"@@ -99,6 +118,7 @@ function Editor(props) {}}transition={{ duration: 0.3, ease: "easeOut" }}maxWidth={isFocusMode ? "auto" : "900px"}+ width="100%"mt={[0, 0, 25]}><Header />diff --git a/apps/web/src/components/editor/tinymce.js b/apps/web/src/components/editor/tinymce.jsindex 4923f5c9c..507b6ff94 100644--- a/apps/web/src/components/editor/tinymce.js+++ b/apps/web/src/components/editor/tinymce.js@@ -40,6 +40,7 @@ const markdownPatterns = [{ start: "######", format: "h6" },{ start: "* ", cmd: "InsertUnorderedList" },{ start: "- ", cmd: "InsertUnorderedList" },+ { start: "> ", format: "blockquote" },{start: "1. ",cmd: "InsertOrderedList",@@ -137,6 +138,7 @@ function TinyMCE(props) {menubar: false,statusbar: false,link_quicklink: true,+ width: "100%",plugins:"paste importcss searchreplace autolink directionality code quickimage shortlink media table hr advlist lists imagetools textpattern noneditable quickbars autoresize",toolbar_mode: "sliding",@@ -157,7 +159,7 @@ function TinyMCE(props) {`,toolbar: simple? false- : `bold italic underline strikethrough code | fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | hr | image media link table | ltr rtl | searchreplace`,+ : `bold italic underline strikethrough blockquote code | fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | hr | image media link table | ltr rtl | searchreplace`,mobile: {toolbar_mode: "scrolling",},