Skip to content

Commit

Permalink
Merge pull request #36 from silverwind/suffix
Browse files Browse the repository at this point in the history
Add `suffix` option to `<text-expander>`
  • Loading branch information
keithamus authored Apr 17, 2023
2 parents 5b5f7ad + c5bbf7e commit 6c915ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/text-expander-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 6c915ae

Please sign in to comment.