(text)
| 460 | |
| 461 | //Separate function for the backticks. Change the key to what works on your keyboard |
| 462 | function insertBackticks(text) { |
| 463 | let activeElement = document.activeElement |
| 464 | if (activeElement.tagName === 'INPUT' || activeElement.tagName === 'TEXTAREA') { |
| 465 | let start = activeElement.selectionStart |
| 466 | let end = activeElement.selectionEnd |
| 467 | activeElement.value = activeElement.value.slice(0, start) + text + activeElement.value.slice(end) |
| 468 | activeElement.selectionStart = activeElement.selectionEnd = start + text.length |
| 469 | } else if (activeElement.isContentEditable) { |
| 470 | document.execCommand('insertText', false, text) |
| 471 | } |
| 472 | } |
| 473 | })() |
no outgoing calls
no test coverage detected