mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 06:37:56 +01:00
Fix undo on text editor.
This commit is contained in:
parent
36f435099d
commit
44a6c19912
@ -36,24 +36,24 @@ describe('Node manager', () => {
|
|||||||
|
|
||||||
it('undo changes', () => {
|
it('undo changes', () => {
|
||||||
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
|
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
|
||||||
|
cy.focusTopicByText('Mind Mapping rocks!!');
|
||||||
cy.triggerUndo();
|
cy.triggerUndo();
|
||||||
cy.focusTopicById(36);
|
|
||||||
|
|
||||||
cy.matchImageSnapshot('undoChange');
|
cy.matchImageSnapshot('undoChange');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('redo changes', () => {
|
it('redo changes', () => {
|
||||||
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
|
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
|
||||||
cy.triggerUndo();
|
cy.focusTopicByText('Mind Mapping rocks!!');
|
||||||
cy.focusTopicById(36);
|
|
||||||
|
|
||||||
|
cy.triggerUndo();
|
||||||
cy.triggerRedo();
|
cy.triggerRedo();
|
||||||
cy.focusTopicById(36);
|
cy.focusTopicByText('Mind Mapping rocks!!');
|
||||||
|
|
||||||
cy.matchImageSnapshot('redoChange');
|
cy.matchImageSnapshot('redoChange');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Save changes', () => {
|
it('save changes', () => {
|
||||||
cy.get('body').type('{ctrl}s');
|
cy.get('body').type('{ctrl}s');
|
||||||
cy.matchImageSnapshot('saveChagesShortcut');
|
cy.matchImageSnapshot('saveChagesShortcut');
|
||||||
});
|
});
|
||||||
|
@ -70,8 +70,6 @@ class EditorComponent extends Events {
|
|||||||
switch (event.code) {
|
switch (event.code) {
|
||||||
case 'Escape':
|
case 'Escape':
|
||||||
// Revert to previous text ...
|
// Revert to previous text ...
|
||||||
this._topic.setText(this._oldText);
|
|
||||||
this.resize();
|
|
||||||
this.close(false);
|
this.close(false);
|
||||||
break;
|
break;
|
||||||
case 'Enter': {
|
case 'Enter': {
|
||||||
@ -253,6 +251,8 @@ class EditorComponent extends Events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(update: boolean): void {
|
close(update: boolean): void {
|
||||||
|
this._topic.setText(this._oldText);
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
this.updateModel();
|
this.updateModel();
|
||||||
}
|
}
|
||||||
@ -261,6 +261,8 @@ class EditorComponent extends Events {
|
|||||||
|
|
||||||
// Restore topoc share visibility ...
|
// Restore topoc share visibility ...
|
||||||
this._topic.getOrBuildTextShape().setVisibility(true);
|
this._topic.getOrBuildTextShape().setVisibility(true);
|
||||||
|
|
||||||
|
this.resize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user