Skip to content

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

fix editor focus

ammarahm-ed7b4e7d117f4a
diff --git a/apps/mobile/src/components/CustomTabs/index.js b/apps/mobile/src/components/CustomTabs/index.js
index a7eb305ef..6d28d3a6d 100644
--- a/apps/mobile/src/components/CustomTabs/index.js
+++ b/apps/mobile/src/components/CustomTabs/index.js
@@ -87,6 +87,7 @@ export default class CustomTabs extends Component {
editing.keyboardState = false;
this.inputElement.current?.focus();
this.inputElement.current?.blur();
+ console.log('hiding keyboard from custom tabs');
}
}
@@ -124,7 +125,7 @@ export default class CustomTabs extends Component {
this.moved = true;
this.scrollOffset = event.nativeEvent.contentOffset.x;
- if (this.scrollOffset < this.props.offsets.b - 100 || this.nextPage !== 1) {
+ if (this.scrollOffset < this.props.offsets.b - 100 && this.nextPage !== 1) {
editing.movedAway = true;
} else {
editing.movedAway = false;
@@ -173,6 +174,7 @@ export default class CustomTabs extends Component {
editing.movedAway = false;
} else {
this.nextPage = 0;
+ console.log('moved away here',editing.movedAway);
editing.movedAway = true;
this.hideKeyboardIfVisible();
}
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index 0bfa941ba..0b2d08cab 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -184,7 +184,10 @@ let webviewTimer = null;
export const loadNote = async item => {
editing.currentlyEditing = true;
+ editing.movedAway = false;
+ if (editing.isFocused) {
tiny.call(EditorWebView, tiny.blur);
+ }
if (item && item.type === 'new') {
if (getNote()) {
await clearEditor();
diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.js
index 85d3832fc..655a1f01b 100644
--- a/apps/mobile/src/views/Editor/tiny/tiny.js
+++ b/apps/mobile/src/views/Editor/tiny/tiny.js
@@ -83,6 +83,7 @@ const updateSavingState = value => `
`;
export const clearEditor = `
+
tinymce.activeEditor.setContent("");
`;
const clearTitle = `
@@ -151,6 +152,7 @@ isLoading = false;
const html = value => post('html', value);
const focusEditor = `
+window.focus();
tinymce.activeEditor.focus();
`;