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
fix: scroll jumps when sticking/unsticking toolbar
thecodrr1d5e194a5635
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.jsindex 35a75c42e..e595ea9e0 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);@@ -89,19 +89,25 @@ function Editor(props) {const title = document.querySelector(".editorTitle");const headerOffset = title.scrollHeight;const hideOffset = headerOffset + 60;- if (e.target.scrollTop > hideOffset && !isToolbarSticky) {+ const { editor } = editorRef.current;+ if (e.target.scrollTop > hideOffset && !editor.isToolbarSticky) {+ editor.pauseScrollIntoView = true;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) {+ editor.isToolbarSticky = true;+ } else if (+ e.target.scrollTop <= hideOffset &&+ editor.isToolbarSticky+ ) {+ editor.pauseScrollIntoView = true;const toolbar = document.querySelector(".tox-editor-header");toolbar.style.position = "relative";toolbar.style.top = "0px";- toolbar.style.bottom = "0px";- isToolbarSticky = false;+ toolbar.style.bottom = "auto";+ editor.isToolbarSticky = false;}}}>diff --git a/apps/web/src/components/editor/tinymce.js b/apps/web/src/components/editor/tinymce.jsindex 507b6ff94..6ab4ccf50 100644--- a/apps/web/src/components/editor/tinymce.js+++ b/apps/web/src/components/editor/tinymce.js@@ -175,6 +175,14 @@ function TinyMCE(props) {"data:" + blobInfo.blob().type + ";base64," + blobInfo.base64());},+ setup: (editor) => {+ editor.on("ScrollIntoView", (e) => {+ if (editor.pauseScrollIntoView) {+ e.preventDefault();+ editor.pauseScrollIntoView = false;+ }+ });+ },}}// onBeforeExecCommand={async (command) => {// if (