gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

HOOKS: Naming is unexpected

Open tg-ephox opened this issue 9 years ago • 3 comments

Issue Overview

Existing hooks use naming like 'core\anchor-attribute' but the '\a' is a non-existent escape sequence so this is interpreted as 'coreanchor-attribute'.

I stumbled across this today investigating hooks for use in footnotes and created a hook named 'core\footontes' but '\f' is a valid escape sequence for ASCII character 12 (Line Feed) so my hook name was failing validation here

Incidently the coment here wasn't updated when the validation rules changed.

Possible Solution

Use '-' to delimit hook name.

Screenshots / Video

screen shot 2017-11-23 at 3 49 40 pm

Related Issues and/or PRs

Todos

  • [ ] Tests
  • [ ] Documentation

tg-ephox avatar Nov 23 '17 05:11 tg-ephox

@aduth pinging you so you were aware why \a got replaced with - for the hook namespace.

gziolo avatar Nov 23 '17 07:11 gziolo

I think a better permanent solution is to update the underlying hooks implementation to use / for namespacing.

aduth avatar Nov 24 '17 16:11 aduth

Agreed, we need to relax validation first.

gziolo avatar Nov 24 '17 17:11 gziolo