I have:
const marks = {
link: {
attrs: {
href: {},
title: { default: null },
contenteditable: {default: false },
target: { default: "_blank" }
},
inclusive: false,
parseDOM: [{
tag: "a[href]",
getAttrs(dom) {
return { href: dom.getAttribute("href"), title: dom.getAttribute("title") }
}
}],
toDOM(node) {
return ["a", node.attrs] }
},
I then do:
attrs.title={ href: 'google.com', title: 'hello' }
let schema=view.state.schema
let node=schema.text(text, [schema.marks.link.create(attrs)])
view.dispatch(view.state.tr.replaceSelectionWith(node, false))
so that the created link is the last thing in the editor
I can place the cursor before or after the link fine
But - if I put the cursor before and press the fw arrow nothing happened (expected it to move to after the link, in this case the end of the document).
If the link is not the last thing (ie some text after it) then fw/bw works fine.
thx!
There seems to be more than one issues with this
A simpler example is the horizontal rule which also has contenteditable=false
here are some problems I noticed:
go to http://prosemirror.net/examples/basic/
select all and delete
insert horizontal rule
now press home and/or end
problem - the cursor blinks but it’s not clear if it’s before or after the rule
pressing home or end keeps the cursor in the same position
now press x
problem - the rule is deleted even though it was not selected
again select and delete all
type x
insert horizontal rule
type ctrl+home (cursor at doc beginning before the x)
press arrow fw three times
problem - the cursor moves to after the x (expected it after the ruler, this is what I reported above with my link)
type ctrl+home (cursor at doc beginning before the x)
type ctrl+end
problem - cursor blinks after the rule but them moves to after the x
also another example of this issue is the codemirror example
if you go to the end of the sample and then backspace all the characters before the codemirror editor until you enter the codemirror nodeview, you now cannot add text after it, that is there is no way to reach that location by pressing fw, page down, ctrl+end etc