Skip to content

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

fix: topics cannot be deleted using notebook edit dialog (fixes streetwriters/notesnook#193)

thecodrr5337c2c6ec57
diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.js
index 9a2a7b056..e090853d4 100644
--- a/apps/web/src/common/dialogcontroller.js
+++ b/apps/web/src/common/dialogcontroller.js
@@ -55,14 +55,14 @@ export function showEditNotebookDialog(notebookId) {
// we remove the topics from notebook
// beforehand so we can add them manually, later
const topics = qclone(nb.topics);
- delete nb.topics;
+ nb.topics = [];
let notebookId = await db.notebooks.add(nb);
// add or delete topics as required
const notebookTopics = db.notebooks.notebook(notebookId).topics;
- // await notebookTopics.delete(...deletedTopics);
await notebookTopics.add(...topics);
+ await notebookTopics.delete(...deletedTopics);
notebookStore.refresh();
noteStore.refresh();
diff --git a/apps/web/src/components/dialogs/add-notebook-dialog.js b/apps/web/src/components/dialogs/add-notebook-dialog.js
index 9fd4086d9..6fc4f7a89 100644
--- a/apps/web/src/components/dialogs/add-notebook-dialog.js
+++ b/apps/web/src/components/dialogs/add-notebook-dialog.js
@@ -96,7 +96,7 @@ class AddNotebookDialog extends React.Component {
}
icon={Icon.Notebook}
positiveButton={{
- text: props.edit ? "Edit notebook" : "Create notebook",
+ text: props.edit ? "Save" : "Create",
onClick: () => {
props.onDone(
{
diff --git a/apps/web/src/components/dialogs/dialog.js b/apps/web/src/components/dialogs/dialog.js
index ca1c29bd1..dd86f142d 100644
--- a/apps/web/src/components/dialogs/dialog.js
+++ b/apps/web/src/components/dialogs/dialog.js
@@ -101,8 +101,10 @@ function Dialog(props) {
</Text>
)}
</Flex>
- <Flex variant="columnFill" sx={{ overflowY: "hidden" }} my={1} mx={4}>
- <FlexScrollContainer>{props.children}</FlexScrollContainer>
+ <Flex variant="columnFill" sx={{ overflowY: "hidden" }} my={1}>
+ <FlexScrollContainer style={{ paddingRight: 20, paddingLeft: 20 }}>
+ {props.children}
+ </FlexScrollContainer>
</Flex>
{(props.positiveButton || props.negativeButton) && (
<Flex
diff --git a/apps/web/src/components/scroll-container/index.js b/apps/web/src/components/scroll-container/index.js
index b54a7a757..0ee36156e 100644
--- a/apps/web/src/components/scroll-container/index.js
+++ b/apps/web/src/components/scroll-container/index.js
@@ -28,7 +28,7 @@ const ScrollContainer = ({ children, style, forwardedRef, ...props }) => {
};
export default ScrollContainer;
-export function FlexScrollContainer({ children, className, ...props }) {
+export function FlexScrollContainer({ children, className, style, ...props }) {
return (
<Scrollbars
{...props}
@@ -40,6 +40,7 @@ export function FlexScrollContainer({ children, className, ...props }) {
display: "flex",
flexDirection: "column",
flex: "1 1 auto",
+ ...style,
}}
renderView={({ style, ...props }) => (
<Box