This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Suggested merge commit message (convention)
Feature: When engine debugging is on, deltas that are results of transformation will keep their history of changes in
#history
property. Closes ckeditor/ckeditor5#4061.Additional information
This PR needs a change in
ckeditor5-undo
. Related PR ckeditor/ckeditor5-undo#61Delta#history
is created and filled automatically whenengine/model/delta/transform~deltaTransform#transform
is used, if engine debugging is on (engine/dev-utils/enableenginedebug~enableEngineDebug
was called).Delta#history
is an array. Each item is an object containing properties:{String} before
- JSON string containing delta state before transformation,{String} transformedBy
- JSON string containing delta whichbefore
was transformed by,{Boolean} wasImportant
- whetherbefore
was more important thantransformedBy
when it was transformed,{Number} resultsTotal
- how many deltas were returned as the transformation result,{Number} resultIndex
- what was the index of that delta in the transformation result.This info will let us recreate all steps which led to current delta state, even if it was transformed multiple times. First item's
before
property is the original delta. Then it has to be transformed bytransformBy
deltas of following items (usingwasImportant
). After each transformation,resultIndex
delta has to be chosen from among returned deltas.Non-first
before
values andresultsTotal
values can be used for additional checking or when there is no need to perform transformation back from the original delta. Those could be omitted/removed if we don't want them.Note:
before
andtransformedBy
JSON strings do not contain their ownhistory
properties. That would lead to enormous data duplication.