Currently, editorjs-undo is undergoing a refactoring process to address the various bugs that have appeared over time and to improve its performance regarding memory consumption and block updates when performing undo and redo actions.
As a first step, we plan to use the jsondiffpatch library, allowing us to capture only the affected blocks in each user interaction through the diff function. Additionally, we will obtain the type of operation with jsonpatchFormatter and maintain the integrity of the editor's basic data with the patch and unpatch functions. We also saw the need to update how we managed data within the this.stack array, switching to one stack for undo actions and another for redo actions. Once this is completed, we will have finished the first part of the refactoring and will continue with the creation of the core functions that update the editor's blocks.
Objective
[ ] Implement the jsondiffpatch library.
[ ] Change the this.stack list with two stacks for handling the undo and redo actions.
[ ] Implement the usage of diff to save the differences (delta) in the new stacks.
[ ] Implement the jsonpatchFormatter to get the operations of the previous difference stored in the undo stack.
[ ] Implement the usage of unpatch and patch, to restore and apply the changes stored in the undo and redo stacks respectively, and build the new state of basicData, which is storing a copy of the editor state.
Context
Currently, editorjs-undo is undergoing a refactoring process to address the various bugs that have appeared over time and to improve its performance regarding memory consumption and block updates when performing undo and redo actions.
As a first step, we plan to use the
jsondiffpatch
library, allowing us to capture only the affected blocks in each user interaction through thediff
function. Additionally, we will obtain the type of operation withjsonpatchFormatter
and maintain the integrity of the editor's basic data with thepatch
andunpatch
functions. We also saw the need to update how we managed data within thethis.stack
array, switching to one stack forundo
actions and another forredo
actions. Once this is completed, we will have finished the first part of the refactoring and will continue with the creation of the core functions that update the editor's blocks.Objective
jsondiffpatch
library.this.stack
list with two stacks for handling theundo
andredo
actions.diff
to save the differences (delta) in the new stacks.jsonpatchFormatter
to get the operations of the previous difference stored in theundo
stack.unpatch
andpatch
, to restore and apply the changes stored in theundo
andredo
stacks respectively, and build the new state ofbasicData
, which is storing a copy of the editor state.