Skip to content

Conversation

OnkelTem
Copy link

@OnkelTem OnkelTem commented Jun 10, 2022

To resolve this: #39

First, if I'm not mistaking the entire block:

 (selectedText && sufFirst === " ") ||
        (!selectedText && sufFirst === " ")
          ? editor.replaceSelection(`${prefix}${selectedText}${suffix}`)
          : selectedText && sufFirst !== " "
          ? editor.replaceSelection(`${prefix}${selectedText}${suffix} `)
          : editor.replaceSelection(`${prefix}${selectedText}${suffix} `);

is equivalent to:

editor.replaceSelection(`${prefix}${selectedText}${suffix}${sufFirst !== " " ? " " : ""}`)

Thus, the idea was to add a whitespece if the selection doesn't have another one aftewards.
And if I select a word in word. I get [word ]. selected.
I don't think it's correct behavior and so I dared to change it.

@chetachiezikeuzor
Copy link
Owner

Firstly, thank you so much for contributing. I apologize for neglecting this plugin, as I've been dealing with family issues for the past few months. Looking at this now, I'm not sure why I added the extra space. I do think this looks great, and much cleaner as well! I'll test later today and hopefully release a version before tomorrow. Thanks again!

@OnkelTem
Copy link
Author

Sure, n/p!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants