summaryrefslogtreecommitdiff
path: root/source/helpers/smart-block-wrap.ts
diff options
context:
space:
mode:
Diffstat (limited to 'source/helpers/smart-block-wrap.ts')
-rw-r--r--source/helpers/smart-block-wrap.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/helpers/smart-block-wrap.ts b/source/helpers/smart-block-wrap.ts
index 10a368cd..8d51fb48 100644
--- a/source/helpers/smart-block-wrap.ts
+++ b/source/helpers/smart-block-wrap.ts
@@ -1,7 +1,10 @@
// Wraps string in at least two newlines on each side,
// as long as the field doesn't already have them.
// Code adapted from GitHub.
-export default function smartBlockWrap(content: string, field: HTMLTextAreaElement): string {
+export default function smartBlockWrap(
+ content: string,
+ field: HTMLTextAreaElement
+): string {
const before = field.value.slice(0, field.selectionStart);
const after = field.value.slice(field.selectionEnd);
const [whitespaceAtStart] = /\n*$/.exec(before)!;