Hiya,
I’m resurrecting a prosemirror project I had from a while back (now on Vue3). was getting very close to all the desired behaviour for my implementation (I’ve updated all my prose mirror libraries to the latest on npm) when it comes to the implementation of lists I’m pretty much using what’s there. What I’m finding though is huge penalties when I start holding an arrow key down (up or down arrow key specifically) over nth level lists. I get a compareDeep error. It doesn’t reach overflow, but the overhead is large enough to temporarily freeze my machine!
export default {
attrs: {
class: {
default: 'pm-align--left'
}
},
content: 'listItem+',
group: 'block',
parseDOM: [{
tag: 'ul',
getAttrs: node => ({
class: node && node.attributes && node.attributes.class
? node.attributes.class.nodeValue
: 'pm-align--left'
})
}],
toDOM: (node) => ['ul', { class: node.attrs.class }, 0]
}
numbered list
export default {
attrs: {
class: {
default: 'pm-align--left'
},
start: {
default: 1
},
style: { default: '' }
},
content: 'listItem+',
group: 'block',
parseDOM: [{
tag: 'ol',
getAttrs: node => {
return {
class: node && node.attributes && node.attributes.class
? node.attributes.class.nodeValue
: 'pm-align--left',
start: node.hasAttribute('start') ? node.attributes.start : 1
}
}
}],
toDOM: (node) => {
const start = typeof node.attrs.start !== 'object'
? (node.attrs.start || 1)
: (node.attrs.start.nodeValue
? node.attrs.start.nodeValue
: 1)
return ['ol',
{
class: node.attrs.class,
start: start,
style: `counter-increment: pm-ol-counter ${start - 1} !important;`
}, 0]
}
}
list item
export default {
content: 'paragraph block*',
group: 'block',
attrs: {
style: {
default: ''
},
class: {
default: ''
}
},
defining: true,
draggable: false,
parseDOM: [{ tag: 'li' }],
toDOM: (node) => ['li',
{
style: node.attrs.style,
class: node.attrs.class
}, 0]
}
here’s an example I just-about-managed to capture with peek:
I copy pasted 3 lots of the bullet list you see, go to the bottom of the page and hold down the up arrow…
I’ve tried stripping out basically all my plugins just to be sure it isn’t one of them. the plugins make the issue more pronounced but the problem persists with a more-or-less vanilla implementation from what I can surmise. Am I missing something obvious or is this a bug?