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