-
- Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
area: extensions/editor-componentspinnedtype: bugcode to address defects in shipped codecode to address defects in shipped code
Description
Describe the bug
It looks like bugs #4539 and #3578 have returned.
To Reproduce
- Register editorComponent with text field (below).
- Create document, add component, add text to text field.
- Move pointer to anywhere but the end of the text field input.
- Try to type.
- After one character, the cursor jumps to the end.
const typeToPre = { bonus: '+>', info: '!>', warning: '?>', error: '#>', }; const preToType = R.zipObj(R.values(typeToPre), R.keys(typeToPre)); CMS.registerEditorComponent({ id: 'hint', label: 'Hint', fields: [ F.select({label: 'Type', name: 'type', options: R.keys(typeToPre)}), F.text({label: 'Text', name: 'text'}), ], pattern: /^([!#+?]>) (.+)$/, fromBlock([_, pre, text]) { return {type: preToType[pre], text}; }, toBlock({type, text = ''}) { return `${typeToPre[type]} ${text}`; }, toPreview({type, text = ''}) { return ( <p className={`hint ${type}`} dangerouslySetInnerHTML={{__html: text}} /> ); }, });
Expected behavior
I expect the cursor to hold its position.
Applicable Versions:
- Netlify CMS version: 2.10.97
- Git provider: Github
- OS: OSX 11
- Browser version Chrome 88
- Node.JS version: 14.15.4
johnxie, lailleo, JackDevAU, robertduplock, delucis and 8 more
Metadata
Metadata
Assignees
Labels
area: extensions/editor-componentspinnedtype: bugcode to address defects in shipped codecode to address defects in shipped code