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

Auto Replace and Collapse on Escape not working in example page. #45

Open
knubie opened this issue Mar 23, 2019 · 4 comments
Open

Auto Replace and Collapse on Escape not working in example page. #45

knubie opened this issue Mar 23, 2019 · 4 comments

Comments

@knubie
Copy link

knubie commented Mar 23, 2019

Do you want to request a feature or report a bug?

Bug. (on the examples website https://slate-plugins.netlify.com/#/slate-auto-replace)

What's the current behavior?

  • Auto Replace
    • E.g. typing "(c)" removes the entire "(c)" sequence when the last ")" is inserted, and replaces it with an empty string "".
  • Collapse on escape
    • When selecting some text, then hitting escape. The text is deselected, and nothing else happens.

What's the expected behavior?

  • Auto Replace
    • The "(c)" string should be replaced with "©" when the last ")" is inserted.
  • Collapse on escape
    • I actually have no idea.

Update: May 11, 2019
It seems that "Collapse on escape" is working as expected.

@nz-chris
Copy link

I'm pretty sure what you describe as the current behaviour for collapse on escape is the expected behaviour.

@MuniJay
Copy link

MuniJay commented Mar 29, 2019

Really? Then isn't Deselect On Escape perhaps a more descriptive name? Collapse made me think somehow the selected text would actually collapse, and could then be expanded again. Much like you can collapse/expand blocks of code. (Not trying to be picky just for the sake of being picky...)

@francisashley
Copy link

Can confirm the slate-auto-replace demo is broken. Looks like a mismatch with the latest slate API.

Should be easy to fix by replacing:

  AutoReplace({
    trigger: 'space',
    before: /^(#)$/,
    change: (change, e, matches) => change.setBlocks({ type: 'h1' })
  })

with:

  AutoReplace({
    trigger: 'space',
    before: /^(#)$/,
    change: (change, e, matches) => change.setBlocks('h1' )
  })

@nz-chris
Copy link

nz-chris commented May 4, 2019

Really? Then isn't Deselect On Escape perhaps a more descriptive name? Collapse made me think somehow the selected text would actually collapse, and could then be expanded again. Much like you can collapse/expand blocks of code. (Not trying to be picky just for the sake of being picky...)

It would be a more explicit name, yes! How you interpreted 'collapse' is definitely understandable.

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

No branches or pull requests

4 participants