Skip to content

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

fix: crash when removing all the contents of a new note (#98)

Muhammad Ali74427f3c3949
diff --git a/apps/web/src/components/dialogs/add-notebook-dialog.js b/apps/web/src/components/dialogs/add-notebook-dialog.js
index 79b517eb1..d06aac113 100644
--- a/apps/web/src/components/dialogs/add-notebook-dialog.js
+++ b/apps/web/src/components/dialogs/add-notebook-dialog.js
@@ -57,7 +57,7 @@ export default class AddNotebookDialog extends React.Component {
if (!this.props.notebook) return;
const { title, description, id, topics } = this.props.notebook;
this.setState({
- topics: topics.map(topic => topic.title);
+ topics: topics.map(topic => topic.title)
});
this.title = title;
this.description = description;
diff --git a/apps/web/src/components/editor/index.js b/apps/web/src/components/editor/index.js
index a49f5035d..d1673fadb 100644
--- a/apps/web/src/components/editor/index.js
+++ b/apps/web/src/components/editor/index.js
@@ -100,7 +100,7 @@ function Editor() {
<TextSeperator />
</>
)}
- {id.length > 0 && <>{isSaving ? "Saving" : "Saved"}</>}
+ {id && id.length > 0 && <>{isSaving ? "Saving" : "Saved"}</>}
</Text>
<Box id="toolbar" display={["none", "flex", "flex"]} />
<ReactQuill
diff --git a/apps/web/src/components/notebook/index.js b/apps/web/src/components/notebook/index.js
index 57d4df63f..41e77fba3 100644
--- a/apps/web/src/components/notebook/index.js
+++ b/apps/web/src/components/notebook/index.js
@@ -45,7 +45,7 @@ export default class Notebook extends React.Component {
title={notebook.title}
body={notebook.description}
subBody={
- <Flex sx={{ marginBottom:1,marginTop:1 }}>
+ <Flex sx={{ marginBottom: 1, marginTop: 1 }}>
{notebook.topics.slice(1, 4).map(topic => (
<Flex
onClick={e => {
@@ -59,9 +59,8 @@ export default class Notebook extends React.Component {
marginRight: 1,
borderRadius: "default",
color: "static",
- paddingTop:0.4,
- paddingBottom:0.4
-
+ paddingTop: 0.4,
+ paddingBottom: 0.4
}}
>
<Text variant="body" fontSize={11}>
diff --git a/apps/web/src/utils/string.js b/apps/web/src/utils/string.js
index f9a077735..d22327fec 100644
--- a/apps/web/src/utils/string.js
+++ b/apps/web/src/utils/string.js
@@ -9,7 +9,5 @@ export function toTitleCase(str) {
export function countWords(str) {
str = str.trim();
if (!str.length) return 0;
-
return str.split(/\W+\S/).length;
}
-