[gnome-notes/106-copy-and-paste-a-text-doesn-t-save-a-note] bijiben.js: Add paste listener
- From: Isaque Galdino de Araujo <igaldino src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-notes/106-copy-and-paste-a-text-doesn-t-save-a-note] bijiben.js: Add paste listener
- Date: Sun, 10 Nov 2019 22:02:22 +0000 (UTC)
commit 05fe956fcd16ba9b4647705c5b65cc9bde49d251
Author: Isaque Galdino <igaldino gmail com>
Date: Sun Nov 10 18:59:16 2019 -0300
bijiben.js: Add paste listener
When paste was performed, a content change event was not executed. This
change fixes that by adding a listener to paste event on webkitview
object and then triggering the content update process.
data/bijiben.js | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
---
diff --git a/data/bijiben.js b/data/bijiben.js
index 8c0a74b..b71bceb 100644
--- a/data/bijiben.js
+++ b/data/bijiben.js
@@ -74,3 +74,19 @@ document.addEventListener('selectionchange', function () {
}, 0);
}
}, false);
+
+var pasteTimerID = -1;
+document.addEventListener("paste", function () {
+ if (pasteTimerID == -1) {
+ pasteTimerID = setTimeout(function () {
+ pasteTimerID = -1;
+ doc = document.documentElement;
+ window.webkit.messageHandlers.bijiben.postMessage({
+ messageName: 'ContentsUpdate',
+ outerHTML: doc.outerHTML,
+ innerText: doc.innerText
+ });
+ }, 0);
+ }
+}, false);
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]