Hello,
I want to use inline node as chip.
export const FlavorNode: NodeSpec = {
group: "inline",
content: "text*",
inline: true,
selectable: true,
draggable: true,
attrs: {
code: {},
name: {},
},
toDOM: (node) => {
return [
"span",
{
"data-flavor-code": node.attrs.code,
"data-flavor-name": node.attrs.name,
class: "prosemirror-mention-node",
},
0,
]
},
parseDOM: [
{
tag: "span[data-flavor-code][data-flavor-name]",
getAttrs: (dom) => {
if (typeof dom === "string" || dom.nodeType !== Node.ELEMENT_NODE)
return {};
const element = dom as Element;
var code = element.getAttribute("data-flavor-code");
var name = element.getAttribute("data-flavor-name");
return {
code: code,
name: name,
};
}
}
],
};
I want to set selection inside and outside, so I reference prosemirror-codemark and make a plugin.
(example: ProseMirror Code Mark ) (document work have not done… due to incomplete implement. sorry) (you can make node wrap ‘/’ like /text/)
I have a problem handling composition input. At right outside and Left inside of span(usally not able to set cursor), I implement as prosemirror-nodemark/plugin.ts at b52ca660f26e4243bf1b77dc5566cb351c62bda7 · DearRAMA/prosemirror-nodemark · GitHub
But in android chrome. It break.
In prosemirror-codemark, using addStoredMark
and removeStoredMark
default feature, intercept composition input and insert other position.
(I modify no-cursor style.)
Pink cursor is actual cursor and black one is virtual cursor.
Originally, ‘테스트’ should be inserted inside of span(actual cursor position) but inserted outside of span maintaining composing.
How can I use this feature or how do I implement?