You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-13 00:10:37 +02:00
Mobile: Removed old editor code
This commit is contained in:
@ -210,12 +210,6 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.useBetaEditor = () => {
|
|
||||||
// Disable for now
|
|
||||||
return false;
|
|
||||||
// return Setting.value('editor.beta') && Platform.OS !== 'android';
|
|
||||||
};
|
|
||||||
|
|
||||||
this.takePhoto_onPress = this.takePhoto_onPress.bind(this);
|
this.takePhoto_onPress = this.takePhoto_onPress.bind(this);
|
||||||
this.cameraView_onPhoto = this.cameraView_onPhoto.bind(this);
|
this.cameraView_onPhoto = this.cameraView_onPhoto.bind(this);
|
||||||
this.cameraView_onCancel = this.cameraView_onCancel.bind(this);
|
this.cameraView_onCancel = this.cameraView_onCancel.bind(this);
|
||||||
@ -678,7 +672,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
|
|
||||||
const newNote = Object.assign({}, this.state.note);
|
const newNote = Object.assign({}, this.state.note);
|
||||||
|
|
||||||
if (this.state.mode == 'edit' && !this.useBetaEditor() && !!this.selection) {
|
if (this.state.mode == 'edit' && !!this.selection) {
|
||||||
const prefix = newNote.body.substring(0, this.selection.start);
|
const prefix = newNote.body.substring(0, this.selection.start);
|
||||||
const suffix = newNote.body.substring(this.selection.end);
|
const suffix = newNote.body.substring(this.selection.end);
|
||||||
newNote.body = `${prefix}\n${resourceTag}\n${suffix}`;
|
newNote.body = `${prefix}\n${resourceTag}\n${suffix}`;
|
||||||
@ -1034,7 +1028,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
const keywords = this.props.searchQuery && !!this.props.ftsEnabled ? this.props.highlightedWords : emptyArray;
|
const keywords = this.props.searchQuery && !!this.props.ftsEnabled ? this.props.highlightedWords : emptyArray;
|
||||||
|
|
||||||
let bodyComponent = null;
|
let bodyComponent = null;
|
||||||
if (this.state.mode == 'view' && !this.useBetaEditor()) {
|
if (this.state.mode == 'view') {
|
||||||
// Note: as of 2018-12-29 it's important not to display the viewer if the note body is empty,
|
// Note: as of 2018-12-29 it's important not to display the viewer if the note body is empty,
|
||||||
// to avoid the HACK_webviewLoadingState related bug.
|
// to avoid the HACK_webviewLoadingState related bug.
|
||||||
bodyComponent =
|
bodyComponent =
|
||||||
@ -1057,76 +1051,21 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// bodyComponent = this.useBetaEditor()
|
// Note: In theory ScrollView can be used to provide smoother scrolling of the TextInput.
|
||||||
// // Note: blurOnSubmit is necessary to get multiline to work.
|
// However it causes memory or rendering issues on older Android devices, probably because
|
||||||
// // See https://github.com/facebook/react-native/issues/12717#issuecomment-327001997
|
// the whole text input has to be in memory for the scrollview to work. So we keep it as
|
||||||
// //
|
// a plain TextInput for now.
|
||||||
// // 2020-10-16: As of React Native 0.63, the Markdown Editor no longer crashes in Android, however the
|
// See https://github.com/laurent22/joplin/issues/3041
|
||||||
// // cursor is still too unreliable to be usable, so we disable it in Android.
|
|
||||||
// ? <MarkdownEditor
|
|
||||||
// ref={this.markdownEditorRef} // For focusing the Markdown editor
|
|
||||||
// editorFont={editorFont(this.props.editorFont)}
|
|
||||||
// style={this.styles().bodyTextInput}
|
|
||||||
// previewStyles={this.styles().noteBodyViewer}
|
|
||||||
// value={note.body}
|
|
||||||
// borderColor={this.styles().markdownButtons.borderColor}
|
|
||||||
// markdownButtonsColor={this.styles().markdownButtons.color}
|
|
||||||
// saveText={(text:string) => this.body_changeText(text)}
|
|
||||||
// blurOnSubmit={false}
|
|
||||||
// selectionColor={theme.textSelectionColor}
|
|
||||||
// keyboardAppearance={theme.keyboardAppearance}
|
|
||||||
// placeholder={_('Add body')}
|
|
||||||
// placeholderTextColor={theme.colorFaded}
|
|
||||||
// noteBodyViewer={{
|
|
||||||
// onJoplinLinkClick: this.onJoplinLinkClick_,
|
|
||||||
// style: this.styles().noteBodyViewerPreview,
|
|
||||||
// paddingBottom: 0,
|
|
||||||
// webViewStyle: theme,
|
|
||||||
// noteBody: note.body,
|
|
||||||
// noteMarkupLanguage: note.markup_language,
|
|
||||||
// noteResources: this.state.noteResources,
|
|
||||||
// highlightedKeywords: keywords,
|
|
||||||
// themeId: this.props.themeId,
|
|
||||||
// noteHash: this.props.noteHash,
|
|
||||||
// onCheckboxChange: this.onBodyViewerCheckboxChange,
|
|
||||||
// onMarkForDownload: this.onMarkForDownload,
|
|
||||||
// onLoadEnd: this.onBodyViewerLoadEnd,
|
|
||||||
// }}
|
|
||||||
|
|
||||||
// />
|
|
||||||
// :
|
|
||||||
// // Note: In theory ScrollView can be used to provide smoother scrolling of the TextInput.
|
|
||||||
// // However it causes memory or rendering issues on older Android devices, probably because
|
|
||||||
// // the whole text input has to be in memory for the scrollview to work. So we keep it as
|
|
||||||
// // a plain TextInput for now.
|
|
||||||
// // See https://github.com/laurent22/joplin/issues/3041
|
|
||||||
|
|
||||||
// // IMPORTANT: The TextInput selection is unreliable and cannot be used in a controlled component
|
|
||||||
// // context. In other words, the selection should be considered read-only. For example, if the seleciton
|
|
||||||
// // is saved to the state in onSelectionChange and the current text in onChangeText, then set
|
|
||||||
// // back in `selection` and `value` props, it will mostly work. But when typing fast, sooner or
|
|
||||||
// // later the real selection will be different from what is stored in the state, thus making
|
|
||||||
// // the cursor jump around. Eg, when typing "abcdef", it will do this:
|
|
||||||
// // abcd|
|
|
||||||
// // abcde|
|
|
||||||
// // abcde|f
|
|
||||||
// (
|
|
||||||
// <TextInput
|
|
||||||
// autoCapitalize="sentences"
|
|
||||||
// style={this.styles().bodyTextInput}
|
|
||||||
// ref="noteBodyTextField"
|
|
||||||
// multiline={true}
|
|
||||||
// value={note.body}
|
|
||||||
// onChangeText={(text:string) => this.body_changeText(text)}
|
|
||||||
// onSelectionChange={this.body_selectionChange}
|
|
||||||
// blurOnSubmit={false}
|
|
||||||
// selectionColor={theme.textSelectionColor}
|
|
||||||
// keyboardAppearance={theme.keyboardAppearance}
|
|
||||||
// placeholder={_('Add body')}
|
|
||||||
// placeholderTextColor={theme.colorFaded}
|
|
||||||
// />
|
|
||||||
// );
|
|
||||||
|
|
||||||
|
// IMPORTANT: The TextInput selection is unreliable and cannot be used in a controlled component
|
||||||
|
// context. In other words, the selection should be considered read-only. For example, if the seleciton
|
||||||
|
// is saved to the state in onSelectionChange and the current text in onChangeText, then set
|
||||||
|
// back in `selection` and `value` props, it will mostly work. But when typing fast, sooner or
|
||||||
|
// later the real selection will be different from what is stored in the state, thus making
|
||||||
|
// the cursor jump around. Eg, when typing "abcdef", it will do this:
|
||||||
|
// abcd|
|
||||||
|
// abcde|
|
||||||
|
// abcde|f
|
||||||
bodyComponent = (
|
bodyComponent = (
|
||||||
<TextInput
|
<TextInput
|
||||||
autoCapitalize="sentences"
|
autoCapitalize="sentences"
|
||||||
@ -1218,7 +1157,7 @@ class NoteScreenComponent extends BaseScreenComponent {
|
|||||||
/>
|
/>
|
||||||
{titleComp}
|
{titleComp}
|
||||||
{bodyComponent}
|
{bodyComponent}
|
||||||
{!this.useBetaEditor() && actionButtonComp}
|
{actionButtonComp}
|
||||||
|
|
||||||
<SelectDateTimeDialog themeId={this.props.themeId} shown={this.state.alarmDialogShown} date={dueDate} onAccept={this.onAlarmDialogAccept} onReject={this.onAlarmDialogReject} />
|
<SelectDateTimeDialog themeId={this.props.themeId} shown={this.state.alarmDialogShown} date={dueDate} onAccept={this.onAlarmDialogAccept} onReject={this.onAlarmDialogReject} />
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user