Skip to content
Snippets Groups Projects
Commit 12d5e95b authored by chris's avatar chris
Browse files

lists in progress

parent 592b84f4
No related branches found
No related tags found
1 merge request!146Images lists
import { SchemaHelpers } from 'wax-prosemirror-utilities';
const orderedlist = {
group: "block",
content: "list_item+",
group: 'block',
content: 'list_item+',
attrs: {
order: { default: 1 }
order: { default: 1 },
track: { default: [] },
},
parseDOM: [
{
tag: "ol",
tag: 'ol',
getAttrs(hook, next) {
Object.assign(hook, {
order: hook.dom.hasAttribute("start")
? +hook.dom.getAttribute("start")
: 1
order: hook.dom.hasAttribute('start')
? +hook.dom.getAttribute('start')
: 1,
track: SchemaHelpers.parseTracks(hook.dom.dataset.track),
});
next();
}
}
},
},
],
toDOM(hook, next) {
const attrs = {};
if (hook.node.attrs.order !== 1) {
attrs.start = hook.node.attrs.order;
}
hook.value = ["ol", attrs, 0];
if (hook.node.attrs.track.length) {
attrs['data-track'] = JSON.stringify(hook.node.attrs.track);
}
hook.value = ['ol', attrs, 0];
next();
}
},
};
export default orderedlist;
......@@ -25,12 +25,14 @@ class AcceptTrackChange extends Tools {
node.attrs.track &&
node.attrs.track.find(track => track.type === 'deletion')
) {
console.log('here?');
removeNode(tr, node, pos, map);
}
if (
node.marks &&
node.marks.find(mark => mark.type.name === 'deletion')
) {
console.log('or here?', node);
const deletionStep = new ReplaceStep(
map.map(Math.max(pos, from)),
map.map(Math.min(pos + node.nodeSize, to)),
......
......@@ -25,7 +25,7 @@ const trackedTransaction = (tr, state, user) => {
}
}
// images
if (tr.meta.inputType === 'backwardsDelete' && !tr.steps.lenght) return tr;
// if (tr.meta.inputType === 'backwardsDelete' && !tr.steps.lenght) return tr;
if (
!tr.steps.length ||
......@@ -102,6 +102,7 @@ const trackedTransaction = (tr, state, user) => {
newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));
} else {
if (state.selection.from === state.selection.to) {
console.log('to fix for lists');
const caretPos = map.map(tr.selection.from, -1);
newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment