Skip to content

Editor: Explicitly create undo levels for onChange block resets - #14105

Closed
aduth wants to merge 2 commits into
masterfrom
try/improve-on-change
Closed

aduth wants to merge 2 commits into
masterfrom
try/improve-on-change

Conversation

@aduth

@aduth aduth commented Feb 25, 2019

Copy link
Copy Markdown
Member

Related: #13088

This pull request seeks to explore consider improvements to blocks history management. Particularly, it seeks to address a point raised at #13088 (comment) where trying to create an undo level explicitly within the same dispatch may fail when the next state is equal to current. The implementation of withHistory is such that it expects an undo level creation to be a separate action, in this case immediately preceding the action which incurs the change (onChange calling resetEditorBlocks).

cc @iseulde in case you have some feedback here, since I think you originally implemented the explicit "create undo level" mechanism.

Separate explorations in a3aa1e5 , while not directly related, were the original changes considered here. It may make sense to fork these off separately. They were motivated by a desire to understand what was meant in a comment about "avoiding batching changes" with a subscriber within BlockEditorProvider.

@aduth aduth added [Status] In Progress Tracking issues with work in progress [Feature] History History, undo, redo, revisions, autosave. labels Feb 25, 2019
@aduth
aduth requested a review from youknowriad February 25, 2019 21:17
if ( ! hasSyncedValue ) {
this.syncedValue = blocks;
console.log( 'input' );
onInput( blocks );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to understand how this is supposed to work but I don't understand yet. In my testing in the previous PR, if you call onInput or onChange in componentDidUpdate, it will only be called once with the last value if you call them synchronously in RichText. which breaks "backticks undo" for instance (curious to know the result of this particular e2e test in this PR)

@youknowriad

Copy link
Copy Markdown
Contributor

The history management changed a lot since this PR was started. I'm not sure if this PR is still relevant?

@aduth

aduth commented Mar 19, 2020

Copy link
Copy Markdown
Member Author

I think it's still relevant, at least in how the withHistory behavior in assuming actions to be dispatched in very particular orders. SInce it was never something I was able to finish, and evidently not a pressing concern, I'm fine to close for now.

@aduth aduth closed this Mar 19, 2020
@aduth
aduth deleted the try/improve-on-change branch March 19, 2020 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] History History, undo, redo, revisions, autosave. [Status] In Progress Tracking issues with work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants