ianstormtaylor / slate-plugins

A set of my personal Slate editor plugins, in a monorepo.
https://slate-plugins.netlify.com
Other
248 stars 68 forks source link

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

Open knubie opened 5 years ago

knubie commented 5 years ago

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?

What's the expected behavior?

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

nz-chris commented 5 years ago

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

MuniJay commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.