I have code like the following:
addComment(from, to, text, id, mode) {
if (!comments[id]) {
if (!from.cmp(to)) to = from.move(1)
let range = pm.markRange(from, to, { className: "mode-"+mode})
console.log(range)
comments[id] = new Comment(id, text, range, mode)
commentsNode.appendChild(comments[id].newDom)
The range returns null positions for from
and to
. If I put logging in pm.markRange, the first range also has null positions (which is resumably the range above) but there is a later invocation of pm.markRange with the ranges filled in. How do I retrieve the correct range?