mirror of https://github.com/laurent22/joplin.git
Desktop: Do not select pasted text no matter the paste method (#2431)
parent
c4fb5b72cd
commit
b15b3d6ac5
|
@ -1406,7 +1406,7 @@ class NoteTextComponent extends React.Component {
|
|||
}
|
||||
|
||||
editorPasteText() {
|
||||
this.wrapSelectionWithStrings('', '', '', clipboard.readText());
|
||||
this.wrapSelectionWithStrings(clipboard.readText(), '', '', '');
|
||||
}
|
||||
|
||||
selectionRangePreviousLine() {
|
||||
|
@ -1425,7 +1425,7 @@ class NoteTextComponent extends React.Component {
|
|||
return this.selectionRange_ ? this.rangeToTextOffsets(this.selectionRange_, this.state.note.body) : null;
|
||||
}
|
||||
|
||||
wrapSelectionWithStrings(string1, string2 = '', defaultText = '', replacementText = '', byLine=false) {
|
||||
wrapSelectionWithStrings(string1, string2 = '', defaultText = '', replacementText = null, byLine = false) {
|
||||
if (!this.rawEditor() || !this.state.note) return;
|
||||
|
||||
const selection = this.textOffsetSelection();
|
||||
|
@ -1433,7 +1433,7 @@ class NoteTextComponent extends React.Component {
|
|||
let newBody = this.state.note.body;
|
||||
|
||||
if (selection && selection.start !== selection.end) {
|
||||
const selectedLines = replacementText ? replacementText : this.state.note.body.substr(selection.start, selection.end - selection.start);
|
||||
const selectedLines = replacementText !== null ? replacementText : this.state.note.body.substr(selection.start, selection.end - selection.start);
|
||||
let selectedStrings = byLine ? selectedLines.split(/\r?\n/) : [selectedLines];
|
||||
|
||||
newBody = this.state.note.body.substr(0, selection.start);
|
||||
|
@ -1456,7 +1456,7 @@ class NoteTextComponent extends React.Component {
|
|||
column: r.end.column + str1Split[str1Split.length - 1].length },
|
||||
};
|
||||
|
||||
if (replacementText) {
|
||||
if (replacementText !== null) {
|
||||
const diff = replacementText.length - (selection.end - selection.start);
|
||||
newRange.end.column += diff;
|
||||
}
|
||||
|
@ -1472,7 +1472,7 @@ class NoteTextComponent extends React.Component {
|
|||
editor.focus();
|
||||
});
|
||||
} else {
|
||||
let middleText = replacementText ? replacementText : defaultText;
|
||||
let middleText = replacementText !== null ? replacementText : defaultText;
|
||||
const textOffset = this.currentTextOffset();
|
||||
const s1 = this.state.note.body.substr(0, textOffset);
|
||||
const s2 = this.state.note.body.substr(textOffset);
|
||||
|
@ -1550,7 +1550,7 @@ class NoteTextComponent extends React.Component {
|
|||
if (!range || (range.start.row === range.end.row && !this.selectionRangeCurrentLine())) {
|
||||
newLine = '';
|
||||
}
|
||||
this.wrapSelectionWithStrings(newLine + string1, string2, defaultText, '', byLine);
|
||||
this.wrapSelectionWithStrings(newLine + string1, string2, defaultText, null, byLine);
|
||||
}
|
||||
|
||||
commandTextCheckbox() {
|
||||
|
|
Loading…
Reference in New Issue