Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Get \ instead of empty value when deleting all the content #532

Open
sklinov opened this issue Aug 24, 2021 · 5 comments
Open

Get \ instead of empty value when deleting all the content #532

sklinov opened this issue Aug 24, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@sklinov
Copy link
Contributor

sklinov commented Aug 24, 2021

A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/rich-markdown-editor-slash-oim2w?file=/src/App.tsx
  2. Try to delete all the content or enter \
  3. Check out console or value area to see that on empty value \ is set as a value

Expected behavior
Empty string is expected

Version
11.12.0-0

Screenshots

image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Chrome
  • Version 92.0
@sklinov sklinov added the bug Something isn't working label Aug 24, 2021
@plitzenberger
Copy link

same here. Getting \ for every empty block

@gzuidhof
Copy link
Contributor

I am seeing the same behavior, I haven't been able to figure out the cause.

@tommoor
Copy link
Member

tommoor commented Sep 30, 2021 via email

@sklinov
Copy link
Contributor Author

sklinov commented Oct 8, 2021

Yeah, stripping with regexp is that's what I've done eventually, so now my onChange looks like

onChange: (v: () => string) => {
        const val = v();
        const stripRegEx = new RegExp(/^\\\W*$/gm)
        const savedValue = stripRegEx.test(val) ? val.replace(/^\\/, "") : val
        setValue(savedValue);
        save(savedValue);
      },

@namlk-hamsa-dev
Copy link

Yeah, stripping with regexp is that's what I've done eventually, so now my onChange looks like

onChange: (v: () => string) => {
        const val = v();
        const stripRegEx = new RegExp(/^\\\W*$/gm)
        const savedValue = stripRegEx.test(val) ? val.replace(/^\\/, "") : val
        setValue(savedValue);
        save(savedValue);
      },

image
I do the same as you but get this error. Can anyone help me get rid of that nasty backlash from the end of my string. Thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants