Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add undo/redo for design page #3780

Merged
merged 28 commits into from
Aug 7, 2020
Merged

feat: Add undo/redo for design page #3780

merged 28 commits into from
Aug 7, 2020

Conversation

lei9444
Copy link
Contributor

@lei9444 lei9444 commented Aug 4, 2020

Description

  1. now undo/redo steps:

    • editor update dialog
    • add commit in shell's saveData api
    • check if the assets changes
    • add snapshot to undo stack
  2. change some async functions to sync:

    • now all lg template and lu intent apis in shell are synchronous.
    • commitChanges will batch all changes before commit. If there are some async functions, we need to find all of them and await. but it's easy to use if the apis are synchronous.

Task Item

closes #3779
closes #3400
closes #2212
closes #1451

Screenshots

undo

@coveralls
Copy link

coveralls commented Aug 4, 2020

Coverage Status

Coverage increased (+0.2%) to 56.515% when pulling 31977ca on lei9444:undo into 660119e on microsoft:main.

@lei9444 lei9444 changed the title Add undo/redo for design page feat: Add undo/redo for design page Aug 4, 2020
@boydc2014 boydc2014 requested review from zhixzhan and yeze322 August 5, 2020 01:10
@boydc2014 boydc2014 self-assigned this Aug 5, 2020
@lei9444 lei9444 marked this pull request as ready for review August 5, 2020 02:25
@lei9444
Copy link
Contributor Author

lei9444 commented Aug 5, 2020

undo the inline lg editor, the data changes but the content in editor doesn't update.

@@ -78,7 +77,7 @@ function createLgApi(
return {
addLgTemplate: updateLgTemplate,
getLgTemplates,
updateLgTemplate: debounce(updateLgTemplate, 250),
updateLgTemplate,
Copy link
Contributor

Choose a reason for hiding this comment

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

So I see that the debounce and throttle have been removed from the lgApi and luApi respectively. Don't we still want to debounce and throttle them despite the lg and lu parsers being fast now for performance reasons? This is gonna trigger an updateLgTemplate or luTemplate on every keystroke change in the lg file right? Either we can do it here or debounce, throttle inside the dispatcher factory functions returns. What do u think?

@yeze322 yeze322 self-requested a review August 6, 2020 01:15
@srinaath
Copy link
Contributor

srinaath commented Aug 6, 2020

@lei9444 saving the partial atoms in the stack is good with me as the storing the difference in object and combining them on each undo/redo seems a lot more complex. I'm good with these changes. Can you make sure the electron installer works fine with this branch before we merge it in main.

@zhixzhan
Copy link
Contributor

zhixzhan commented Aug 7, 2020

I verified lg/lu assets change, looks good.

@lei9444
Copy link
Contributor Author

lei9444 commented Aug 7, 2020

@lei9444 saving the partial atoms in the stack is good with me as the storing the difference in object and combining them on each undo/redo seems a lot more complex. I'm good with these changes. Can you make sure the electron installer works fine with this branch before we merge it in main.

Hi, @srinaath, I tested the undo/redo in electron app
electron

@lei9444
Copy link
Contributor Author

lei9444 commented Aug 7, 2020

undo the inline lg editor, the data changes but the content in editor doesn't update.

fix this issue: use key to force update the property editor when undo and redo

@cwhitten cwhitten merged commit 3b0c2c2 into microsoft:main Aug 7, 2020
alanlong9278 added a commit that referenced this pull request Aug 10, 2020
* main:
  fix: let values pass without needless sanitization (#3805)
  feat: Add undo/redo for design page (#3780)
@lei9444 lei9444 deleted the undo branch February 1, 2021 02:07
lei9444 added a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
* add undo

* replace some async methods to sync

* fix unit tests

* fix shared unit tests

* add undo unit tests

* update some naming

* add some comments

* adapt undo/redo to Electron app menu

* watch external cahnges

* fix form empty string can not update

* use atom content as undo history stack value

* add unit test for undoHistory

* Revert "watch external cahnges"

This reverts commit a2b7eb1.

* add commit version to force update the editor

* add number limite

* add fragment for navigation

* add breadcrumb

Co-authored-by: zeye <[email protected]>
Co-authored-by: zhixzhan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants