Skip to content

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

fix: note doesn't open after switching from diffviewer

thecodrr407c2d2fac83
diff --git a/apps/web/public/skins/notesnook/content.min.css b/apps/web/public/skins/notesnook/content.inline.min.css
similarity index 100%
rename from apps/web/public/skins/notesnook/content.min.css
rename to apps/web/public/skins/notesnook/content.inline.min.css
diff --git a/apps/web/public/skins/notesnook/content.min.css.map b/apps/web/public/skins/notesnook/content.inline.min.css.map
similarity index 100%
rename from apps/web/public/skins/notesnook/content.min.css.map
rename to apps/web/public/skins/notesnook/content.inline.min.css.map
diff --git a/apps/web/src/components/diff-viewer/index.js b/apps/web/src/components/diff-viewer/index.js
index 684af70de..4c16e3a98 100644
--- a/apps/web/src/components/diff-viewer/index.js
+++ b/apps/web/src/components/diff-viewer/index.js
@@ -7,6 +7,7 @@ import { db } from "../../common/db";
import { useStore as useAppStore } from "../../stores/app-store";
import { useStore as useThemeStore } from "../../stores/theme-store";
import { useStore as useUserStore } from "../../stores/user-store";
+import { useStore as useEditorStore } from "../../stores/editor-store";
import { hashNavigate } from "../../navigation";
import HTMLDiffer from "./differ";
import { showToast } from "../../utils/toast";
@@ -42,6 +43,7 @@ function DiffViewer(props) {
const setIsEditorOpen = useAppStore((store) => store.setIsEditorOpen);
const theme = useThemeStore((store) => store.theme);
const sync = useUserStore((store) => store.sync);
+ const clearSession = useEditorStore((store) => store.clearSession);
const [conflictedNote, setConflictedNote] = useState();
const [remoteContent, setRemoteContent] = useState();
const [localContent, setLocalContent] = useState();
@@ -130,8 +132,9 @@ function DiffViewer(props) {
useEffect(() => {
let cssPath = "";
- if (theme === "dark") cssPath = "/skins/notesnook-dark/content.min.css";
- else cssPath = "/skins/notesnook/content.min.css";
+ if (theme === "dark")
+ cssPath = "/skins/notesnook-dark/content.inline.min.css";
+ else cssPath = "/skins/notesnook/content.inline.min.css";
injectCssSrc("tmce", cssPath);
return () => {
removeCss("tmce");
@@ -139,8 +142,9 @@ function DiffViewer(props) {
}, [theme]);
useEffect(() => {
+ clearSession();
setIsEditorOpen(true);
- }, [setIsEditorOpen]);
+ }, [setIsEditorOpen, clearSession]);
const [selectedContent, setSelectedContent] = useState(-1);
diff --git a/apps/web/src/components/editor/tinymce.js b/apps/web/src/components/editor/tinymce.js
index 59764c8c4..8134d8efb 100644
--- a/apps/web/src/components/editor/tinymce.js
+++ b/apps/web/src/components/editor/tinymce.js
@@ -99,9 +99,10 @@ const premiumCommands = [
function useSkin() {
const theme = useThemeStore((store) => store.theme);
+ const host = window.location.origin;
return theme === "dark"
- ? ["/skins/notesnook", "/skins/notesnook-dark"]
- : ["/skins/notesnook-dark", "/skins/notesnook"];
+ ? [host + "/skins/notesnook", host + "/skins/notesnook-dark"]
+ : [host + "/skins/notesnook-dark", host + "/skins/notesnook"];
}
function TinyMCE(props) {
@@ -120,20 +121,18 @@ function TinyMCE(props) {
const [oldSkin, newSkin] = useSkin();
const tinymceRef = editorRef;
useEffect(() => {
- // if (tinymceRef.current.editor.initialized) {
tinymceRef.current.editor.dom.styleSheetLoader.unload(
- `${oldSkin}/content.min.css`
+ `${oldSkin}/content.inline.min.css`
);
tinymceRef.current.editor.ui.styleSheetLoader.unload(
`${oldSkin}/skin.min.css`
);
tinymceRef.current.editor.dom.styleSheetLoader.load(
- `${newSkin}/content.min.css`
+ `${newSkin}/content.inline.min.css`
);
tinymceRef.current.editor.ui.styleSheetLoader.load(
`${newSkin}/skin.min.css`
);
- // }
}, [tinymceRef, newSkin, oldSkin]);
return (
@@ -206,12 +205,12 @@ function TinyMCE(props) {
});
},
toolbar_persist: true,
+ toolbar_sticky: false,
browser_spellcheck: true,
+ inline: true,
+ fixed_toolbar_container: "#editorToolbar",
autoresize_bottom_margin: 100,
- fixed_toolbar_container_target:
- document.getElementById("editorToolbar"),
}}
- inline
onBeforeExecCommand={async (command) => {
if (
premiumCommands.some(
diff --git a/apps/web/src/index.css b/apps/web/src/index.css
index e24379fed..5f79495e3 100644
--- a/apps/web/src/index.css
+++ b/apps/web/src/index.css
@@ -26,9 +26,10 @@ body,
transition: background-color 300ms linear, border-color 300ms linear;
}
-/* * {
- font-family: sans-serif;
-} */
+* {
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
+ Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
+}
@keyframes fadeUp {
0% {
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 7207ccd51..7644b2245 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -5,7 +5,6 @@ import { store as tagStore } from "./tag-store";
import { db } from "../common/db";
import BaseStore from ".";
import { EV, EVENTS } from "notes-core/common";
-import getId from "notes-core/utils/id";
import { hashNavigate } from "../navigation";
const SESSION_STATES = {