From bb2800ec4067ab3fc09ac61bfff65555fd65a0b1 Mon Sep 17 00:00:00 2001 From: profi248 Date: Wed, 30 Dec 2020 21:52:43 +0000 Subject: [PATCH] Improve editor buttons UX (#361) Co-authored-by: konrad Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/361 Reviewed-by: konrad Co-authored-by: profi248 Co-committed-by: profi248 --- cypress/integration/task/task.spec.js | 2 +- src/components/input/editor.vue | 36 ++++++++++++++------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/cypress/integration/task/task.spec.js b/cypress/integration/task/task.spec.js index 8f8dbbe64..efa398553 100644 --- a/cypress/integration/task/task.spec.js +++ b/cypress/integration/task/task.spec.js @@ -165,7 +165,7 @@ describe('Task', () => { cy.get('.task-view .details.content.description .editor .vue-easymde .EasyMDEContainer .CodeMirror-scroll') .type('{selectall}New Description') cy.get('.task-view .details.content.description .editor a') - .contains('Preview') + .contains('Done') .click() cy.get('.task-view .details.content.description h3 span.is-small.has-text-success') diff --git a/src/components/input/editor.vue b/src/components/input/editor.vue index 2e44b8681..c651bd008 100644 --- a/src/components/input/editor.vue +++ b/src/components/input/editor.vue @@ -2,11 +2,9 @@
@@ -23,17 +21,15 @@
@@ -394,10 +390,16 @@ export default { this.bubble() this.renderPreview() }, - showPreview() { - this.isPreviewActive = true - this.isEditActive = false - this.renderPreview() + toggleEdit() { + if (this.isEditActive) { + this.isPreviewActive = true; + this.isEditActive = false; + this.renderPreview(); + this.bubble(0); // save instantly + } else { + this.isPreviewActive = false; + this.isEditActive = true; + } }, }, }