A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix delete note from inside editor.
ammarahm-eddf45e28cffd4
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.jsindex 8cf2acb25..fd7a4e7ef 100644--- a/apps/mobile/src/components/Dialog/index.js+++ b/apps/mobile/src/components/Dialog/index.js@@ -8,6 +8,7 @@ import {eCloseFullscreenEditor,eOnLoadNote,eOnNewTopicAdded,+ eClearEditor,} from '../../services/events';import NavigationService from '../../services/NavigationService';import {exitEditorAnimation} from '../../utils/animations';@@ -43,10 +44,13 @@ export class Dialog extends Component {history.selectedItemsList.forEach(async i => {if (i.type === 'note') {+ console.log(i.id);await db.notes.delete(i.id);ToastEvent.show('Notes moved to trash', 'error');updateEvent({type: i.type});updateEvent({type: ACTIONS.PINNED});++ eSendEvent(eClearEditor);} else if (i.type === 'topic') {await db.notebooks.notebook(i.notebookId).topics.delete(i.title);@@ -65,14 +69,6 @@ export class Dialog extends Component {updateEvent({type: ACTIONS.CLEAR_SELECTION});updateEvent({type: ACTIONS.SELECTION_MODE, enabled: false});- if (editing.currentlyEditing) {- eSendEvent(eOnLoadNote, {type: 'new'});- if (DDS.isTab) {- eSendEvent(eCloseFullscreenEditor);- } else {- exitEditorAnimation();- }- }this.hide();break;}diff --git a/apps/mobile/src/services/events.js b/apps/mobile/src/services/events.jsindex bb2e7956b..2523e1793 100644--- a/apps/mobile/src/services/events.js+++ b/apps/mobile/src/services/events.js@@ -65,3 +65,5 @@ export const eCloseVaultDialog = '531';export const refreshNotesPage = '532';export const eClearSearch = '533';++export const eClearEditor = '534';diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex 8d6b699f9..da9ba26b9 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -33,6 +33,7 @@ import {eOnLoadNote,eOpenFullscreenEditor,refreshNotesPage,+ eClearEditor,} from '../../services/events';import {exitEditorAnimation} from '../../utils/animations';import {sideMenuRef} from '../../utils/refs';@@ -115,6 +116,7 @@ const Editor = ({noMenu}) => {const clearEditor = async () => {await saveNote(true);+setDateEdited(0);title = null;content = null;@@ -134,6 +136,35 @@ const Editor = ({noMenu}) => {});};+ const onCallClear = () => {+ canSave = false;+ exitEditorAnimation();+ setDateEdited(0);+ title = null;+ content = null;+ note = null;+ id = null;+ tapCount = 0;+ saveCounter = 0;+ post({+ type: 'clearEditor',+ });+ post({+ type: 'clearTitle',+ });+ post({+ type: 'blur',+ });+ };++ useEffect(() => {+ eSubscribeEvent(eClearEditor, onCallClear);++ return () => {+ eUnSubscribeEvent(eClearEditor, onCallClear);+ };+ }, []);+const onChange = data => {if (data !== '') {let rawData = JSON.parse(data);@@ -170,16 +201,16 @@ const Editor = ({noMenu}) => {};const saveNote = async (lockNote = true) => {+ if (!canSave) return;+ console.log('reaching here and making shit ton.');if (!title && !content) return;- if (title === '' && content.text === '') return;if (title &&title.trim().length === 0 &&content &&- content?.text?.trim().length === 0+ content.text.length === 0)return;- if (!canSave) return;if (!content) {content = {