diff --git a/packages/editor/cypress/e2e/topicManager.cy.ts b/packages/editor/cypress/e2e/topicManager.cy.ts index 26ff3509..cb51d7fb 100644 --- a/packages/editor/cypress/e2e/topicManager.cy.ts +++ b/packages/editor/cypress/e2e/topicManager.cy.ts @@ -36,24 +36,24 @@ describe('Node manager', () => { it('undo changes', () => { cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}'); + cy.focusTopicByText('Mind Mapping rocks!!'); cy.triggerUndo(); - cy.focusTopicById(36); cy.matchImageSnapshot('undoChange'); }); it('redo changes', () => { cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}'); - cy.triggerUndo(); - cy.focusTopicById(36); + cy.focusTopicByText('Mind Mapping rocks!!'); + cy.triggerUndo(); cy.triggerRedo(); - cy.focusTopicById(36); + cy.focusTopicByText('Mind Mapping rocks!!'); cy.matchImageSnapshot('redoChange'); }); - it('Save changes', () => { + it('save changes', () => { cy.get('body').type('{ctrl}s'); cy.matchImageSnapshot('saveChagesShortcut'); }); diff --git a/packages/mindplot/src/components/MultilineTextEditor.ts b/packages/mindplot/src/components/MultilineTextEditor.ts index 7ce4b0bb..5c677fc5 100644 --- a/packages/mindplot/src/components/MultilineTextEditor.ts +++ b/packages/mindplot/src/components/MultilineTextEditor.ts @@ -70,8 +70,6 @@ class EditorComponent extends Events { switch (event.code) { case 'Escape': // Revert to previous text ... - this._topic.setText(this._oldText); - this.resize(); this.close(false); break; case 'Enter': { @@ -253,6 +251,8 @@ class EditorComponent extends Events { } close(update: boolean): void { + this._topic.setText(this._oldText); + if (update) { this.updateModel(); } @@ -261,6 +261,8 @@ class EditorComponent extends Events { // Restore topoc share visibility ... this._topic.getOrBuildTextShape().setVisibility(true); + + this.resize(); } }