Skip to content

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

feat: allow only single color to be assigned to note

thecodrr777eb0a6f18a
diff --git a/apps/web/src/components/menu/colors.js b/apps/web/src/components/menu/colors.js
index 45d947f05..a289badf2 100644
--- a/apps/web/src/components/menu/colors.js
+++ b/apps/web/src/components/menu/colors.js
@@ -29,8 +29,8 @@ function Colors(props) {
data-test-id={`menuitem-colors-${label}-check`}
sx={{
position: "absolute",
- left: "5px",
- top: "4px",
+ left: 1,
+ top: 1,
cursor: "pointer",
}}
color="static"
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index d6ac0b02e..594cbc06c 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -171,7 +171,8 @@ class EditorStore extends BaseStore {
};
setColor = (color) => {
- this._setTagOrColor("color", color);
+ //this._setTagOrColor("color", color);
+ return noteStore.setColor(this.get().session.id, color);
};
setTag = (tag) => {
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index 8e6cd00fd..a007e6d28 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -95,17 +95,15 @@ class NoteStore extends BaseStore {
};
setColor = async (id, color) => {
- const note = db.notes.note(id);
+ let note = db.notes.note(id);
if (!note) return;
- let index = note.data.colors.indexOf(color);
- if (index > -1) {
- await note.uncolor(color);
- } else {
- await note.color(color);
+ for (var c of note.data.colors) {
+ await note.uncolor(c);
}
+ await db.notes.note(id).color(color);
+ appStore.refreshColors();
if (!this._syncEditor(note.id, "colors", db.notes.note(id).data.colors)) {
this.refresh();
- appStore.refreshColors();
}
};