From c5bbf7e31929fbf46a13c39db2ef7f3b67898453 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 8 Apr 2023 19:08:58 +0200 Subject: [PATCH] Add `suffix` option to `` Fixes: https://github.com/github/text-expander-element/issues/35 --- README.md | 1 + src/text-expander-element.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 33850fa..1763729 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ With a script tag: - `keys` is a space separated list of menu activation keys - `multiword` defines whether the expansion should use several words or not - you can provide a space separated list of activation keys that should support multi-word matching +- `suffix` is a string that is appended to the value during expansion, default is a single space character ## Events diff --git a/src/text-expander-element.ts b/src/text-expander-element.ts index 1f43c14..73f2b1d 100644 --- a/src/text-expander-element.ts +++ b/src/text-expander-element.ts @@ -125,7 +125,8 @@ class TextExpander { if (canceled) return if (!detail.value) return - const value = `${detail.value} ` + const suffix = this.expander.getAttribute('suffix') ?? ' ' + const value = `${detail.value}${suffix}` this.input.value = beginning + value + remaining