@@ -9,7 +9,7 @@ import { MarkSpec } from "prosemirror-model";
99export const SuggestionAddMark = Mark . create ( {
1010 name : "y-attributed-insert" ,
1111 inclusive : false ,
12- excludes : "y-attributed-delete y-attributed-format y-attributed-insert " ,
12+ excludes : "" ,
1313 addAttributes ( ) {
1414 return {
1515 id : { default : null , validate : "number" } , // note: validate is supported in prosemirror but not in tiptap, so this doesn't actually work (considered not critical)
@@ -61,7 +61,7 @@ export const SuggestionAddMark = Mark.create({
6161export const SuggestionDeleteMark = Mark . create ( {
6262 name : "y-attributed-delete" ,
6363 inclusive : false ,
64- excludes : "y-attributed-delete y-attributed-format y-attributed-insert " ,
64+ excludes : "" ,
6565 addAttributes ( ) {
6666 return {
6767 id : { default : null , validate : "number" } , // note: validate is supported in prosemirror but not in tiptap
@@ -116,16 +116,11 @@ export const SuggestionDeleteMark = Mark.create({
116116export const SuggestionModificationMark = Mark . create ( {
117117 name : "y-attributed-format" ,
118118 inclusive : false ,
119- excludes : "y-attributed-delete y-attributed-format y-attributed-insert " ,
119+ excludes : "" ,
120120 addAttributes ( ) {
121- // note: validate is supported in prosemirror but not in tiptap
122121 return {
123- id : { default : null , validate : "number" } ,
122+ id : { default : null , validate : "number" } , // note: validate is supported in prosemirror but not in tiptap
124123 "user-color" : { default : null , validate : "string" } ,
125- type : { validate : "string" } ,
126- attrName : { default : null , validate : "string|null" } ,
127- previousValue : { default : null } ,
128- newValue : { default : null } ,
129124 } ;
130125 } ,
131126 extendMarkSchema ( extension ) {
@@ -135,28 +130,18 @@ export const SuggestionModificationMark = Mark.create({
135130 return {
136131 blocknoteIgnore : true ,
137132 inclusive : false ,
138- // attrs: {
139- // id: { validate: "number" },
140- // type: { validate: "string" },
141- // attrName: { default: null, validate: "string|null" },
142- // previousValue: { default: null },
143- // newValue: { default: null },
144- // },
145133 toDOM ( mark , inline ) {
146134 return [
147135 inline ? "span" : "div" ,
148136 {
149137 "data-type" : "modification" ,
150138 "data-id" : String ( mark . attrs [ "id" ] ) ,
151139 "data-user-color" : String ( mark . attrs [ "user-color" ] ) ,
152- "data-mod-type" : mark . attrs [ "type" ] as string ,
153- "data-mod-prev-val" : JSON . stringify ( mark . attrs [ "previousValue" ] ) ,
154- // TODO: Try to serialize marks with toJSON?
155- "data-mod-new-val" : JSON . stringify ( mark . attrs [ "newValue" ] ) ,
156140 style :
157- "user-color" in mark . attrs
158- ? ` --user-color: ${ mark . attrs [ "user-color" ] } `
159- : "" , // changed to "contents" to make this work for table rows
141+ ( inline ? "" : "display: contents" ) +
142+ ( "user-color" in mark . attrs
143+ ? `; --user-color: ${ mark . attrs [ "user-color" ] } `
144+ : "" ) ,
160145 } ,
161146 0 ,
162147 ] ;
@@ -170,10 +155,7 @@ export const SuggestionModificationMark = Mark.create({
170155 }
171156 return {
172157 id : parseInt ( node . dataset [ "id" ] , 10 ) ,
173- userColor : node . dataset [ "userColor" ] ,
174- type : node . dataset [ "modType" ] ,
175- previousValue : node . dataset [ "modPrevVal" ] ,
176- newValue : node . dataset [ "modNewVal" ] ,
158+ "user-color" : node . dataset [ "userColor" ] ,
177159 } ;
178160 } ,
179161 } ,
@@ -185,8 +167,7 @@ export const SuggestionModificationMark = Mark.create({
185167 }
186168 return {
187169 id : parseInt ( node . dataset [ "id" ] , 10 ) ,
188- type : node . dataset [ "modType" ] ,
189- previousValue : node . dataset [ "modPrevVal" ] ,
170+ "user-color" : node . dataset [ "userColor" ] ,
190171 } ;
191172 } ,
192173 } ,
0 commit comments