Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lastIndexWithoutLeadingSpace (lastIndexOf replacement) #902

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicolasmondain
Copy link

@nicolasmondain nicolasmondain commented Nov 8, 2023

Usecase:

  • trigger: '{'

When Tribute is configured with requireLeadingSpace: true, it's possible to start typing a mention like this:

Lorem
Lorem ipsum
Lorem ipsum { // => triggered

And if we add another trigger:

Lorem ipsum {{ // => triggered
Lorem ipsum {{{ // => triggered

The replacement will be effective considering the space before the trigger (lastIndexWithLeadingSpace).
The replacement is effective and works with multiple consecutive triggers.

When Tribute is configured with requireLeadingSpace: false, it's possible to start typing a mention like this:

Lorem
Lorem ipsum
Lorem ipsum{ // => triggered

But if we add another trigger:

Lorem ipsum{{ // => triggered
Lorem ipsum{{{ // => triggered

The replacement will be effective considering the last trigger only (lastIndexOf).
With the new lastIndexWithoutLeadingSpace method, the replacement is effective in the exact same way and works with multiple consecutive triggers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant