Skip to content
Snippets Groups Projects
Commit 64d08aa3 authored by chris's avatar chris
Browse files

remove certain properties for now

parent f5bddfba
No related branches found
No related tags found
1 merge request!109Track changes ids
......@@ -51,7 +51,7 @@ const Editoria = () => (
// value={`<p class="paragraph"><span class="comment" data-id="834ba3c5-1fcf-4a42-8e2f-1f975f229716" data-conversation="[]" data-group="main">and a </span><span class="insertion" data-id="" data-user="1234" data-username="demo" data-date="26541557" data-group=""><span class="comment" data-id="834ba3c5-1fcf-4a42-8e2f-1f975f229716" data-conversation="[]" data-group="main">sdasdssd</span></span><span class="comment" data-id="834ba3c5-1fcf-4a42-8e2f-1f975f229716" data-conversation="[]" data-group="main">paragraph</span></p><p class="paragraph">more</p>`}
layout={EditoriaLayout}
TrackChange
// onChange={source => console.log(source)}
onChange={source => console.log(source)}
user={user}
/>
</Fragment>
......
......@@ -2,11 +2,11 @@ import { Selection, TextSelection } from "prosemirror-state";
import { Slice } from "prosemirror-model";
import { ReplaceStep, Mapping } from "prosemirror-transform";
const markDeletion = (tr, from, to, user, date) => {
const markDeletion = (tr, from, to, user, date, group) => {
const deletionMark = tr.doc.type.schema.marks.deletion.create({
user: user.userId,
username: user.username,
date
username: user.username
// date
});
let firstTableCellChild = false;
const deletionMap = new Mapping();
......@@ -83,8 +83,8 @@ const markDeletion = (tr, from, to, user, date) => {
track.push({
type: "deletion",
user: user.userId,
username: user.username,
date
username: user.username
// date
});
tr.setNodeMarkup(
deletionMap.map(pos),
......
const markInsertion = (tr, from, to, user, date) => {
const markInsertion = (tr, from, to, user, date, group) => {
tr.removeMark(from, to, tr.doc.type.schema.marks.deletion);
tr.removeMark(from, to, tr.doc.type.schema.marks.insertion);
const insertionMark = tr.doc.type.schema.marks.insertion.create({
user: user.userId,
username: user.username,
date
username: user.username
// date
});
tr.addMark(from, to, insertionMark);
// Add insertion mark also to block nodes (figures, text blocks) but not table cells/rows and lists.
tr.doc.nodesBetween(from, to, (node, pos) => {
......@@ -27,13 +29,14 @@ const markInsertion = (tr, from, to, user, date) => {
type: "insertion",
user: user.userId,
username: user.username,
date
date,
group
});
tr.setNodeMarkup(
pos,
null,
Object.assign({}, node.attrs, { track }),
Object.assign({}, node.attrs, { track, group }),
node.marks
);
}
......
......@@ -5,7 +5,7 @@ import { DocumentHelpers } from "wax-prosemirror-utilities";
import markDeletion from "./markDeletion";
import markInsertion from "./markInsertion";
const replaceStep = (state, tr, step, newTr, map, doc, user, date) => {
const replaceStep = (state, tr, step, newTr, map, doc, user, date, group) => {
const cellDeleteTr =
["deleteContentBackward", "deleteContentForward"].includes(
tr.getMeta("inputType")
......@@ -38,7 +38,7 @@ const replaceStep = (state, tr, step, newTr, map, doc, user, date) => {
}
const mappedNewStepTo = newStep.getMap().map(newStep.to);
markInsertion(trTemp, newStep.from, mappedNewStepTo, user, date);
markInsertion(trTemp, newStep.from, mappedNewStepTo, user, date, group);
// We condense it down to a single replace step.
const condensedStep = new ReplaceStep(
newStep.from,
......@@ -54,7 +54,7 @@ const replaceStep = (state, tr, step, newTr, map, doc, user, date) => {
}
}
if (step.from !== step.to) {
map.appendMap(markDeletion(newTr, step.from, step.to, user, date));
map.appendMap(markDeletion(newTr, step.from, step.to, user, date, group));
}
};
......
......@@ -34,7 +34,7 @@ const trackedTransaction = (tr, state, user, group) => {
const newTr = state.tr;
const map = new Mapping();
const date = Math.floor(Date.now() / 60000);
const date = Math.floor(Date.now() / 300000);
tr.steps.forEach(originalStep => {
const step = originalStep.map(map),
......
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