mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
* fixes #2573 This fixes the bug with spaces * Update NoteText.jsx
This commit is contained in:
parent
1d284a3528
commit
4840671f0e
@ -1435,9 +1435,17 @@ class NoteTextComponent extends React.Component {
|
||||
let selectedStrings = byLine ? selectedLines.split(/\r?\n/) : [selectedLines];
|
||||
|
||||
newBody = this.state.note.body.substr(0, selection.start);
|
||||
|
||||
for (let i = 0; i < selectedStrings.length; i++) {
|
||||
newBody += string1 + selectedStrings[i] + string2;
|
||||
if (byLine == false) {
|
||||
let start = selectedStrings[i].search(/[^\s]/);
|
||||
let end = selectedStrings[i].search(/[^\s](?=[\s]*$)/);
|
||||
newBody += selectedStrings[i].substr(0, start) + string1 + selectedStrings[i].substr(start, end - start + 1) + string2 + selectedStrings[i].substr(end + 1);
|
||||
if (this.state.note.body.substr(selection.end) === '') newBody = newBody.trim();
|
||||
} else { newBody += string1 + selectedStrings[i] + string2; }
|
||||
|
||||
}
|
||||
|
||||
newBody += this.state.note.body.substr(selection.end);
|
||||
|
||||
const r = this.selectionRange_;
|
||||
|
Loading…
Reference in New Issue
Block a user