mirror of https://github.com/laurent22/joplin.git
Mobile: Fixed text update issue when attaching a file to an empty note
parent
e7409145b6
commit
78f3f1c01a
|
@ -694,12 +694,18 @@ class NoteScreenComponent extends BaseScreenComponent {
|
||||||
|
|
||||||
const newNote = { ...this.state.note };
|
const newNote = { ...this.state.note };
|
||||||
|
|
||||||
if (this.state.mode === 'edit' && !!this.selection) {
|
if (this.state.mode === 'edit') {
|
||||||
const newText = `\n${resourceTag}\n`;
|
let newText = '';
|
||||||
|
|
||||||
const prefix = newNote.body.substring(0, this.selection.start);
|
if (this.selection) {
|
||||||
const suffix = newNote.body.substring(this.selection.end);
|
newText = `\n${resourceTag}\n`;
|
||||||
newNote.body = `${prefix}${newText}${suffix}`;
|
const prefix = newNote.body.substring(0, this.selection.start);
|
||||||
|
const suffix = newNote.body.substring(this.selection.end);
|
||||||
|
newNote.body = `${prefix}${newText}${suffix}`;
|
||||||
|
} else {
|
||||||
|
newText = `\n${resourceTag}`;
|
||||||
|
newNote.body = `${newNote.body}\n${newText}`;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.useEditorBeta()) {
|
if (this.useEditorBeta()) {
|
||||||
// The beta editor needs to be explicitly informed of changes
|
// The beta editor needs to be explicitly informed of changes
|
||||||
|
|
Loading…
Reference in New Issue