import { Step , StepResult } from "prosemirror-transform" ; import { Node as ProseNode , Schema as ProseSchema } from "prosemirror-model" ; export class SetDocAttrStep < T = unknown > extends Step { prevValue ? : T ; /**
     * A Step representing a change to the attrs of a ProseMirror document.
     * As of (7/25/20), This is not possible without
     */ constructor ( public key , public value , public stepType = 'SetDocAttr' ) { super ( ) ; } apply ( doc ) { this . prevValue = doc . attrs [ this . key ] ; todo doc . attrs [ this . key ] = this . value ; return StepResult . ok ( doc ) ; } invert ( ) { return new SetDocAttrStep ( this . key , this . prevValue , 'revertSetDocAttr' ) ; } map ( ) { todo return null ; } toJSON ( ) { return { stepType : this . stepType , key : this . key , value : this . value , } ; } static fromJSON < T = unknown > ( schema , json ) { return new SetDocAttrStep < T > ( json . key , json . value , json . stepType ) ; } }