Skip to content

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

fix: placeholders not following theme colors

thecodrr77733076fb64
diff --git a/apps/web/src/components/diff-viewer/index.js b/apps/web/src/components/diff-viewer/index.js
index 5613d36b2..26316dee4 100644
--- a/apps/web/src/components/diff-viewer/index.js
+++ b/apps/web/src/components/diff-viewer/index.js
@@ -110,7 +110,7 @@ function DiffViewer(props) {
const content = await db.content.insertPlaceholders(
await db.content.raw(note.contentId),
- "placeholder.svg"
+ "/placeholder.svg"
);
if (!content.conflicted)
return resolveConflict({
@@ -120,7 +120,7 @@ function DiffViewer(props) {
content.conflicted = await db.content.insertPlaceholders(
content.conflicted,
- "placeholder.svg"
+ "/placeholder.svg"
);
setConflictedNote(note);
diff --git a/apps/web/src/components/editor/editor.css b/apps/web/src/components/editor/editor.css
index 3f78da9e9..532186512 100644
--- a/apps/web/src/components/editor/editor.css
+++ b/apps/web/src/components/editor/editor.css
@@ -93,26 +93,26 @@
border-color: #b1b1b1 !important;
}
-img {
+.mce-content-body img {
border-radius: 5px;
max-width: 100% !important;
/* height: auto !important; */
background-color: var(--bgSecondary);
}
-img[style="float: right;"] {
+.mce-content-body img[style="float: right;"] {
margin-left: 10px;
}
-img[style="float: left;"] {
+.mce-content-body img[style="float: left;"] {
margin-right: 10px;
}
-iframe {
+.mce-content-body iframe {
max-width: 100% !important;
}
-table {
+.mce-content-body table {
display: block !important;
overflow-x: auto !important;
white-space: nowrap !important;
@@ -121,7 +121,7 @@ table {
height: auto !important;
}
-td {
+.mce-content-body td {
min-width: 20vw !important;
}
@@ -164,10 +164,10 @@ td {
}
.mce-content-body h1,
-h2,
-h3,
-h4,
-h5,
-h6 {
+.mce-content-body h2,
+.mce-content-body h3,
+.mce-content-body h4,
+.mce-content-body h5,
+.mce-content-body h6 {
font-weight: 600 !important;
}
diff --git a/apps/web/src/components/placeholders/favorites-placeholder.js b/apps/web/src/components/placeholders/favorites-placeholder.js
index 7e78c9a75..c2a20f4ef 100644
--- a/apps/web/src/components/placeholders/favorites-placeholder.js
+++ b/apps/web/src/components/placeholders/favorites-placeholder.js
@@ -1,11 +1,9 @@
-import React from "react";
-import Fav from "../../assets/fav.svg";
import Placeholder from "./index";
function FavoritesPlaceholder() {
return (
<Placeholder
- image={Fav}
+ id="favorites"
title="Your favorites"
text="Notes you favorite will appear here."
/>
diff --git a/apps/web/src/components/placeholders/index.js b/apps/web/src/components/placeholders/index.js
index 99fcf7f08..17b974dd9 100644
--- a/apps/web/src/components/placeholders/index.js
+++ b/apps/web/src/components/placeholders/index.js
@@ -1,14 +1,12 @@
-import React, { useEffect } from "react";
-import { Button, Flex, Image, Text } from "rebass";
+import React from "react";
+import { Button, Flex, Text } from "rebass";
import { useStore } from "../../stores/theme-store";
import { changeSvgTheme } from "../../utils/css";
+const PlaceholderLoader = React.lazy(() => import("./loader"));
function Placeholder(props) {
const accent = useStore((store) => store.accent);
- useEffect(() => {
- changeSvgTheme(accent);
- }, [accent]);
- const { image: PlaceholderImage, text, callToAction } = props;
+ const { id, text, callToAction } = props;
return (
<>
@@ -17,7 +15,16 @@ function Placeholder(props) {
alignSelf="stretch"
sx={{ position: "relative" }}
>
- <Image src={PlaceholderImage} width={"100%"} height={"100px"} />
+ <React.Suspense fallback={<div />}>
+ <PlaceholderLoader
+ onLoad={() => {
+ changeSvgTheme(accent);
+ }}
+ name={id}
+ width={"150px"}
+ height={"150px"}
+ />
+ </React.Suspense>
<Text
variant="body"
mt={2}
diff --git a/apps/web/src/components/placeholders/loader.js b/apps/web/src/components/placeholders/loader.js
new file mode 100644
index 000000000..a20e5707b
--- /dev/null
+++ b/apps/web/src/components/placeholders/loader.js
@@ -0,0 +1,29 @@
+import { useLayoutEffect } from "react";
+import { ReactComponent as Note } from "../../assets/note.svg";
+import { ReactComponent as Notebook } from "../../assets/notebook.svg";
+import { ReactComponent as Monographs } from "../../assets/monographs.svg";
+import { ReactComponent as Search } from "../../assets/search.svg";
+import { ReactComponent as Tag } from "../../assets/tag.svg";
+import { ReactComponent as Trash } from "../../assets/trash.svg";
+import { ReactComponent as Fav } from "../../assets/fav.svg";
+
+const Placeholders = {
+ note: Note,
+ notebook: Notebook,
+ topic: Notebook,
+ monograph: Monographs,
+ search: Search,
+ tag: Tag,
+ trash: Trash,
+ favorites: Fav,
+};
+
+export default function PlaceholderLoader({ name, onLoad, ...restProps }) {
+ const Component = Placeholders[name];
+ useLayoutEffect(() => {
+ onLoad && onLoad();
+ }, [onLoad]);
+
+ if (!Component) return null;
+ return <Component {...restProps} />;
+}
diff --git a/apps/web/src/components/placeholders/monographs-placeholder.js b/apps/web/src/components/placeholders/monographs-placeholder.js
index daa22f047..c2ff1255f 100644
--- a/apps/web/src/components/placeholders/monographs-placeholder.js
+++ b/apps/web/src/components/placeholders/monographs-placeholder.js
@@ -1,11 +1,9 @@
-import React from "react";
-import Monographs from "../../assets/monographs.svg";
import Placeholder from "./index";
function MonographsPlaceholder() {
return (
<Placeholder
- image={Monographs}
+ id="monographs"
title="Your monographs"
text="All your published notes will be shown here."
/>
diff --git a/apps/web/src/components/placeholders/notebooks-placeholder.js b/apps/web/src/components/placeholders/notebooks-placeholder.js
index 161d98053..10c362b38 100644
--- a/apps/web/src/components/placeholders/notebooks-placeholder.js
+++ b/apps/web/src/components/placeholders/notebooks-placeholder.js
@@ -1,18 +1,17 @@
import React from "react";
-import Notebook from "../../assets/notebook.svg";
import Placeholder from "./index";
-import * as Icon from "../icons";
+import { Plus } from "../icons";
import { hashNavigate } from "../../navigation";
function NotebooksPlaceholder() {
return (
<Placeholder
- image={Notebook}
+ id="notebook"
title="Your notebooks"
text="You have not made any notebooks yet."
callToAction={{
text: "Make your first notebook",
- icon: Icon.Plus,
+ icon: Plus,
onClick: () => hashNavigate("/notebooks/create"),
}}
/>
diff --git a/apps/web/src/components/placeholders/notesplacholder.js b/apps/web/src/components/placeholders/notesplacholder.js
index 181850581..b79903672 100644
--- a/apps/web/src/components/placeholders/notesplacholder.js
+++ b/apps/web/src/components/placeholders/notesplacholder.js
@@ -1,5 +1,3 @@
-import React from "react";
-import Note from "../../assets/note.svg";
import Placeholder from "./index";
import * as Icon from "../icons";
import { hashNavigate } from "../../navigation";
@@ -7,7 +5,7 @@ import { hashNavigate } from "../../navigation";
function NotesPlaceholder() {
return (
<Placeholder
- image={Note}
+ id="note"
title="Your notes"
text="You have not made any notes yet."
callToAction={{
diff --git a/apps/web/src/components/placeholders/search-placeholder.js b/apps/web/src/components/placeholders/search-placeholder.js
index 2033b4e5e..6d08ecb4d 100644
--- a/apps/web/src/components/placeholders/search-placeholder.js
+++ b/apps/web/src/components/placeholders/search-placeholder.js
@@ -1,8 +1,6 @@
-import React from "react";
-import Search from "../../assets/search.svg";
import Placeholder from "./index";
function SearchPlaceholder({ text }) {
- return <Placeholder image={Search} text={text || "Nothing to show."} />;
+ return <Placeholder id="search" text={text || "Nothing to show."} />;
}
export default SearchPlaceholder;
diff --git a/apps/web/src/components/placeholders/tags-placeholder.js b/apps/web/src/components/placeholders/tags-placeholder.js
index e4d8ab0a6..cf749fd2c 100644
--- a/apps/web/src/components/placeholders/tags-placeholder.js
+++ b/apps/web/src/components/placeholders/tags-placeholder.js
@@ -1,11 +1,9 @@
-import React from "react";
-import Tag from "../../assets/tag.svg";
import Placeholder from "./index";
function TagsPlaceholder() {
return (
<Placeholder
- image={Tag}
+ id="tag"
title="Your tags"
text="You have not tagged any notes yet."
/>
diff --git a/apps/web/src/components/placeholders/topics-placeholder.js b/apps/web/src/components/placeholders/topics-placeholder.js
index 449eb6134..8e5e11de3 100644
--- a/apps/web/src/components/placeholders/topics-placeholder.js
+++ b/apps/web/src/components/placeholders/topics-placeholder.js
@@ -1,17 +1,15 @@
-import React from "react";
-import Notebook from "../../assets/notebook.svg";
import Placeholder from "./index";
-import * as Icon from "../icons";
+import { Plus } from "../icons";
import { hashNavigate } from "../../navigation";
function TopicsPlaceholder() {
return (
<Placeholder
- image={Notebook}
+ id="topic"
text="You have not added any topics yet."
callToAction={{
text: "Add a topic",
- icon: Icon.Plus,
+ icon: Plus,
onClick: () => hashNavigate("/topics/create"),
}}
/>
diff --git a/apps/web/src/components/placeholders/trash-placeholder.js b/apps/web/src/components/placeholders/trash-placeholder.js
index 971229fd4..07729c4f1 100644
--- a/apps/web/src/components/placeholders/trash-placeholder.js
+++ b/apps/web/src/components/placeholders/trash-placeholder.js
@@ -1,11 +1,10 @@
import React from "react";
-import Trash from "../../assets/trash.svg";
import Placeholder from "./index";
function TrashPlaceholder() {
return (
<Placeholder
- image={Trash}
+ id="trash"
title="Your trash"
text="All items here are permanently deleted after 7 days."
/>