1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-06 09:19:22 +02:00

Android: Fixes #3797: Disable beta editor even if it was already enabled

This commit is contained in:
Laurent Cozic
2020-09-22 16:01:00 +01:00
parent 4ec9faadd5
commit 8e11eababa

View File

@@ -208,6 +208,10 @@ class NoteScreenComponent extends BaseScreenComponent {
}
};
this.useBetaEditor = () => {
return Setting.value('editor.beta') && Platform.OS !== 'android';
};
this.takePhoto_onPress = this.takePhoto_onPress.bind(this);
this.cameraView_onPhoto = this.cameraView_onPhoto.bind(this);
this.cameraView_onCancel = this.cameraView_onCancel.bind(this);
@@ -644,7 +648,7 @@ class NoteScreenComponent extends BaseScreenComponent {
const newNote = Object.assign({}, this.state.note);
if (this.state.mode == 'edit' && !Setting.value('editor.beta') && !!this.selection) {
if (this.state.mode == 'edit' && !this.useBetaEditor() && !!this.selection) {
const prefix = newNote.body.substring(0, this.selection.start);
const suffix = newNote.body.substring(this.selection.end);
newNote.body = `${prefix}\n${resourceTag}\n${suffix}`;
@@ -966,7 +970,7 @@ class NoteScreenComponent extends BaseScreenComponent {
}
let bodyComponent = null;
if (this.state.mode == 'view' && !Setting.value('editor.beta')) {
if (this.state.mode == 'view' && !this.useBetaEditor()) {
const onCheckboxChange = newBody => {
this.saveOneProperty('body', newBody);
};
@@ -1021,7 +1025,7 @@ class NoteScreenComponent extends BaseScreenComponent {
this.saveOneProperty('body', newBody);
};
bodyComponent = Setting.value('editor.beta')
bodyComponent = this.useBetaEditor()
// Note: blurOnSubmit is necessary to get multiline to work.
// See https://github.com/facebook/react-native/issues/12717#issuecomment-327001997
? <MarkdownEditor
@@ -1170,7 +1174,7 @@ class NoteScreenComponent extends BaseScreenComponent {
/>
{titleComp}
{bodyComponent}
{!Setting.value('editor.beta') && actionButtonComp}
{!this.useBetaEditor() && actionButtonComp}
<SelectDateTimeDialog shown={this.state.alarmDialogShown} date={dueDate} onAccept={this.onAlarmDialogAccept} onReject={this.onAlarmDialogReject} />