chore: remove unused code to remove wrapping
This commit is contained in:
parent
0c34335d1c
commit
378473b923
|
@ -194,28 +194,9 @@ Rectangle {
|
|||
|
||||
function wrapSelection(wrapWith) {
|
||||
if (messageInputField.selectionStart - messageInputField.selectionEnd === 0) return
|
||||
|
||||
let selection = messageInputField.selectedText
|
||||
let availableAnnotations = ["**", "*", "~~", "`"]
|
||||
let performWrap = true
|
||||
|
||||
// First we remove all existing annotations of the selections, so that users can easily
|
||||
// switch from, for example, italic to bold
|
||||
for (let i = 0; i < availableAnnotations.length; i++) {
|
||||
let annotation = availableAnnotations[i]
|
||||
|
||||
if (selection.startsWith(annotation) && selection.endsWith(annotation)) {
|
||||
messageInputField.remove(messageInputField.selectionEnd, messageInputField.selectionEnd - annotation.length);
|
||||
messageInputField.remove(messageInputField.selectionStart, messageInputField.selectionStart + annotation.length);
|
||||
performWrap = annotation !== wrapWith;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (performWrap) {
|
||||
insertInTextInput(messageInputField.selectionStart, wrapWith);
|
||||
insertInTextInput(messageInputField.selectionEnd, wrapWith);
|
||||
}
|
||||
|
||||
insertInTextInput(messageInputField.selectionStart, wrapWith);
|
||||
insertInTextInput(messageInputField.selectionEnd, wrapWith);
|
||||
|
||||
messageInputField.deselect()
|
||||
formatInputMessage()
|
||||
|
|
Loading…
Reference in New Issue