Fix typing after being weird on Android

Issue: character from mention gets deleted. Most weird on Swiftkey:
mention gets duplicated instead of deleting.

See https://github.com/ProseMirror/prosemirror/issues/565
https://bugs.chromium.org/p/chromium/issues/detail?id=612446

The keyboard still closes unexpectedly when you delete :(
This commit is contained in:
Sinclair Chen 2022-08-05 09:59:47 -07:00
parent 7a3ee1e58b
commit d2be20f190

View File

@ -11,7 +11,7 @@ const name = 'mention-component'
const MentionComponent = (props: any) => { const MentionComponent = (props: any) => {
return ( return (
<NodeViewWrapper className={clsx(name, 'not-prose inline text-indigo-700')}> <NodeViewWrapper className={clsx(name, 'not-prose text-indigo-700')}>
<Linkify text={'@' + props.node.attrs.label} /> <Linkify text={'@' + props.node.attrs.label} />
</NodeViewWrapper> </NodeViewWrapper>
) )
@ -25,5 +25,6 @@ const MentionComponent = (props: any) => {
export const DisplayMention = Mention.extend({ export const DisplayMention = Mention.extend({
parseHTML: () => [{ tag: name }], parseHTML: () => [{ tag: name }],
renderHTML: ({ HTMLAttributes }) => [name, mergeAttributes(HTMLAttributes)], renderHTML: ({ HTMLAttributes }) => [name, mergeAttributes(HTMLAttributes)],
addNodeView: () => ReactNodeViewRenderer(MentionComponent), addNodeView: () =>
ReactNodeViewRenderer(MentionComponent, { className: 'inline-block' }),
}) })