From 7e551d2c90d3fedc6f9127f96b64b2abb5d02f73 Mon Sep 17 00:00:00 2001
From: Chih-Hsuan Yen <645432-yan12125@users.noreply.gitlab.com>
Date: Thu, 9 May 2024 21:54:17 +0800
Subject: [PATCH 1/3] Handle special keys only when IME is not compositing
This fixes interference between special keys (ESC, Enter, ...) for
Chinese input methods and the UI.
Closes https://github.com/nextcloud/tasks/issues/2572
Signed-off-by: Chih-Hsuan Yen <645432-yan12125@users.noreply.gitlab.com>
---
src/components/AppSidebar/NotesItem.vue | 17 ++++++++++++++++-
src/components/HeaderBar.vue | 22 ++++++++++++++++++++--
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/components/AppSidebar/NotesItem.vue b/src/components/AppSidebar/NotesItem.vue
index ef866cdd2..ad6ec8d35 100644
--- a/src/components/AppSidebar/NotesItem.vue
+++ b/src/components/AppSidebar/NotesItem.vue
@@ -35,7 +35,9 @@ License along with this library. If not, see .
@@ -86,6 +88,7 @@ export default {
.use(Mitl)
return {
md,
+ compositing: false,
}
},
watch: {
@@ -129,6 +132,18 @@ export default {
setNotes($event) {
this.setEditing(true, $event)
},
+ // Inspired by https://gist.github.com/gotraveltoworld/ecbd2ddc6a0d9bcee8baf396d683e1ba
+ compositionstart($event) {
+ this.compositing = true;
+ },
+ compositionend($event) {
+ this.compositing = false;
+ },
+ escKeyDown($event) {
+ if (!this.compositing) {
+ this.setEditing(false);
+ }
+ },
},
}
diff --git a/src/components/HeaderBar.vue b/src/components/HeaderBar.vue
index 8bc5c7ae9..50702d02a 100644
--- a/src/components/HeaderBar.vue
+++ b/src/components/HeaderBar.vue
@@ -33,8 +33,10 @@ License along with this library. If not, see .
:show-trailing-button="newTaskName !== ''"
:trailing-button-label="placeholder"
@trailing-button-click="addTask"
- @keyup.esc="clearNewTask($event)"
- @keyup.enter="addTask"
+ @compositionstart="compositionstart($event)"
+ @compositionend="compositionend($event)"
+ @keydown.esc="clearNewTask($event)"
+ @keydown.enter="addTask"
@paste.stop="addMultipleTasks">
@@ -83,6 +85,7 @@ export default {
showCreateMultipleTasksModal: false,
multipleTasks: { numberOfTasks: 0, tasks: {} },
additionalTaskProperties: {},
+ compositing: false,
}
},
computed: {
@@ -112,12 +115,27 @@ export default {
'createTask',
]),
+ compositionstart($event) {
+ this.compositing = true;
+ },
+ compositionend($event) {
+ this.compositing = false;
+ },
+
clearNewTask(event) {
+ if (this.compositing) {
+ return;
+ }
+
event.target.blur()
this.newTaskName = ''
},
async addTask() {
+ if (this.compositing) {
+ return;
+ }
+
const data = {
summary: this.newTaskName,
// If the task is created in the calendar view,
From c28e8e6d571ed56f6394462c6cbae3a93b3b0943 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?=
Date: Mon, 29 Jun 2026 22:26:21 +0200
Subject: [PATCH 2/3] fix(NotesItem): lint
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Raimund Schlüßler
---
src/components/AppSidebar/NotesItem.vue | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/components/AppSidebar/NotesItem.vue b/src/components/AppSidebar/NotesItem.vue
index ad6ec8d35..97aebf77a 100644
--- a/src/components/AppSidebar/NotesItem.vue
+++ b/src/components/AppSidebar/NotesItem.vue
@@ -35,9 +35,9 @@ License along with this library. If not, see .
@@ -133,15 +133,15 @@ export default {
this.setEditing(true, $event)
},
// Inspired by https://gist.github.com/gotraveltoworld/ecbd2ddc6a0d9bcee8baf396d683e1ba
- compositionstart($event) {
- this.compositing = true;
+ compositionstart() {
+ this.compositing = true
},
- compositionend($event) {
- this.compositing = false;
+ compositionend() {
+ this.compositing = false
},
- escKeyDown($event) {
+ escKeyDown() {
if (!this.compositing) {
- this.setEditing(false);
+ this.setEditing(false)
}
},
},
From a67b9b5fe18b7755850653d8758bfff66565fa5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?=
Date: Mon, 29 Jun 2026 22:28:42 +0200
Subject: [PATCH 3/3] fix(HeaderBar): lint
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Refactor compositionstart and compositionend methods to remove event parameters.
Signed-off-by: Raimund Schlüßler
---
src/components/HeaderBar.vue | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/components/HeaderBar.vue b/src/components/HeaderBar.vue
index 50702d02a..8086740e3 100644
--- a/src/components/HeaderBar.vue
+++ b/src/components/HeaderBar.vue
@@ -33,8 +33,8 @@ License along with this library. If not, see .
:show-trailing-button="newTaskName !== ''"
:trailing-button-label="placeholder"
@trailing-button-click="addTask"
- @compositionstart="compositionstart($event)"
- @compositionend="compositionend($event)"
+ @compositionstart="compositionstart()"
+ @compositionend="compositionend()"
@keydown.esc="clearNewTask($event)"
@keydown.enter="addTask"
@paste.stop="addMultipleTasks">
@@ -115,16 +115,16 @@ export default {
'createTask',
]),
- compositionstart($event) {
- this.compositing = true;
+ compositionstart() {
+ this.compositing = true
},
- compositionend($event) {
- this.compositing = false;
+ compositionend() {
+ this.compositing = false
},
clearNewTask(event) {
if (this.compositing) {
- return;
+ return
}
event.target.blur()
@@ -133,7 +133,7 @@ export default {
async addTask() {
if (this.compositing) {
- return;
+ return
}
const data = {