While debugging I found that posAtCoords goes into posFromCaret fn, where dom.nodeType == 1 since this is a span element, and isBlock will be false, and desc has no contentDom.
As I understand the execution should not go into the if this is a text or a text inside inline decoration, but since !desc.contentDom will be true, the condition results in true
(If I write it as if (desc.dom.nodeType == 1 && desc.node.isBlock && (desc.parent && !sawBlock || !desc.contentDOM)) { then I get correct results, though it's etirely possible that I'm misunderstanding the code, and this will result in something bad.)
See https://github.com/nono1013/pm-deco-issue/blob/main/src/main.ts for example.
While debugging I found that posAtCoords goes into posFromCaret fn, where dom.nodeType == 1 since this is a span element, and isBlock will be false, and desc has no contentDom. As I understand the execution should not go into the if this is a text or a text inside inline decoration, but since !desc.contentDom will be true, the condition results in true (If I write it as
if (desc.dom.nodeType == 1 && desc.node.isBlock && (desc.parent && !sawBlock || !desc.contentDOM)) {
then I get correct results, though it's etirely possible that I'm misunderstanding the code, and this will result in something bad.)