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 title input not focus on load
ammarahm-ed8fb3184490f9
diff --git a/apps/mobile/android/app/src/main/assets/texteditor.html b/apps/mobile/android/app/src/main/assets/texteditor.htmlindex c7bf34961..df4de9b38 100644--- a/apps/mobile/android/app/src/main/assets/texteditor.html+++ b/apps/mobile/android/app/src/main/assets/texteditor.html@@ -1207,7 +1207,7 @@}var changeInterval = null;- document.getElementById('titleInput').onchange = onChangetitle()+ document.getElementById('titleInput').onsubmit = onChangetitle()document.getElementById('titleInput').onkeydown = function (evt) {@@ -1536,25 +1536,34 @@// Receber mensagens do RNdocument.addEventListener('message', data => {+if (JSON.parse(data.data).type === "text") {editor.setText(JSON.parse(data.data).value, 'api')setTimeout(() => {- editor.focus();- editor.setSelection(editor.getText().length - 1, 0);+ if (JSON.parse(data.data).value.length > 0) {+ editor.focus();+ editor.setSelection(editor.getText().length - 1, 0);+ } else {+ document.getElementById('titleInput').focus();+ }+}, 0)}- else if (data.data === "clear") {+ else if (data.data == "clear") {editor.setText('', 'api')- } else if (data.data === "focusEditor") {+ } else if (data.data == "focusEditor") {editor.focus();- } else if (data.data === 'focusTitle') {+ } else if (data.data == 'focusTitle') {+document.getElementById('titleInput').focus();++} else if (JSON.parse(data.data).type === "nomenu") {let isenabled = JSON.parse(data.data).value;let width = window.innerWidth;diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex 873bc4c92..77db3a146 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -82,6 +82,7 @@ const Editor = ({navigation, noMenu}) => {dispatch({type: ACTIONS.NOTES});if (item && item.type === 'new') {await clearEditor();+ post('focusTitle');} else {note = item;dispatch({@@ -94,6 +95,7 @@ const Editor = ({navigation, noMenu}) => {dispatch({type: ACTIONS.NOTES});if (item && item.type === 'new') {await clearEditor();+ post('focusTitle');} else {note = item;dispatch({@@ -122,7 +124,6 @@ const Editor = ({navigation, noMenu}) => {value: '',}),);- post('focusTitle');};const onChange = data => {@@ -275,7 +276,6 @@ const Editor = ({navigation, noMenu}) => {}, [noMenu]);const onWebViewLoad = () => {- //EditorWebView.requestFocus();if (noMenu) {post(JSON.stringify({@@ -295,6 +295,8 @@ const Editor = ({navigation, noMenu}) => {if (note && note.id) {updateEditor();} else {+ console.log('i am called');+ EditorWebView.current?.requestFocus();post('focusTitle');}let c = {...colors};@@ -378,11 +380,14 @@ const Editor = ({navigation, noMenu}) => {if (note && note.id) {ToastEvent.show('Note Saved!', 'success');}- Keyboard.dismiss();+await clearEditor();+if (noMenu) return true;DDS.isTab ? SideMenuEvent.open() : null;SideMenuEvent.enable();+ EditorWebView.current?.reload();+ // Keyboard.dismiss();return true;} else {@@ -456,11 +461,11 @@ const Editor = ({navigation, noMenu}) => {simpleDialogEvent(TEMPLATE_EXIT_FULLSCREEN());} else {exitEditorAnimation();- Keyboard.dismiss();if (note && note.id) {ToastEvent.show('Note Saved!', 'success');}await clearEditor();+ EditorWebView.current?.reload();DDS.isTab ? SideMenuEvent.open() : null;SideMenuEvent.enable();}