[Yulup-commits] rev 21006 - public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/editor

andi at wyona.com andi at wyona.com
Tue Dec 19 21:07:24 CET 2006


Author: andi
Date: 2006-12-19 21:07:22 +0100 (Tue, 19 Dec 2006)
New Revision: 21006

Modified:
   public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/editor/wysiwygxsltmodeview.js
Log:
Suppress DOM_VK_RETURN and DOM_VK_ENTER events until we now what to do upon such events.


Modified: public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/editor/wysiwygxsltmodeview.js
===================================================================
--- public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/editor/wysiwygxsltmodeview.js	2006-12-19 19:36:14 UTC (rev 21005)
+++ public/yulup/src/trunk/yulup/prototypes/prototype1/src/chrome/content/editor/wysiwygxsltmodeview.js	2006-12-19 20:07:22 UTC (rev 21006)
@@ -167,8 +167,9 @@
             this.view.updateBaseURL();
 
             wysiwygXSLTEditor.contentWindow.addEventListener("keypress", new CommandKeyListener(), true);
+            wysiwygXSLTEditor.contentWindow.addEventListener("keypress", new WYSIWYGXSLTKeyPressListener(this), true);
 
-            wysiwygXSLTEditor.contentWindow.addEventListener("keyup", new WYSIWYGXSLTKeyListener(this), true);
+            wysiwygXSLTEditor.contentWindow.addEventListener("keyup", new WYSIWYGXSLTKeyUpListener(this), true);
 
             if ((keyBinding = YulupPreferences.getCharPref("editor.", "keybinding")) != null) {
                 switch (keyBinding) {
@@ -884,23 +885,52 @@
 };
 
 
-function WYSIWYGXSLTKeyListener(aView) {
+function WYSIWYGXSLTKeyPressListener(aView) {
     /* DEBUG */ YulupDebug.ASSERT(aView != null);
 
-    this.view = aView;
+    this.__view = aView;
 }
 
-WYSIWYGXSLTKeyListener.prototype = {
-    view: null,
+WYSIWYGXSLTKeyPressListener.prototype = {
+    __view: null,
 
     handleEvent: function (aKeyEvent) {
-        /* DEBUG */ dump("Yulup:wysiwygxsltmodeview.js:WYSIWYGXSLTKeyListener.handleEvent() invoked\n");
+        /* DEBUG */ dump("Yulup:wysiwygxsltmodeview.js:WYSIWYGXSLTKeyPressListener.handleEvent() invoked\n");
 
-        // hook up paragraph inserter
-        this.view.updateSource();
+        switch (aKeyEvent.keyCode) {
+            case Components.interfaces.nsIDOMKeyEvent.DOM_VK_RETURN:
+            case Components.interfaces.nsIDOMKeyEvent.DOM_VK_ENTER:
+                /* DEBUG */ dump("Yulup:wysiwygxsltmodeview.js:WYSIWYGXSLTKeyPressListener.handleEvent: DOM_VK_RETURN or DOM_VK_ENTER pressed, suppress this event.\n");
+
+                // TODO: check keybindings for these keys and call paragraph inserter if needed
+
+                // we consumed this event
+                aKeyEvent.preventDefault();
+                return;
+                break;
+            default:
+        }
     }
 };
 
+
+function WYSIWYGXSLTKeyUpListener(aView) {
+    /* DEBUG */ YulupDebug.ASSERT(aView != null);
+
+    this.__view = aView;
+}
+
+WYSIWYGXSLTKeyUpListener.prototype = {
+    __view: null,
+
+    handleEvent: function (aKeyEvent) {
+        /* DEBUG */ dump("Yulup:wysiwygxsltmodeview.js:WYSIWYGXSLTKeyUpListener.handleEvent() invoked\n");
+
+        this.__view.updateSource();
+    }
+};
+
+
 function LocationPathSelectionListener(aSelectionChangeHandler) {
     /* DEBUG */ YulupDebug.ASSERT(aSelectionChangeHandler != null);
 
@@ -917,6 +947,7 @@
     }
 };
 
+
 function WYSIWYGXSLTSelectionChangeHandler(aView) {
     /* DEBUG */ YulupDebug.ASSERT(aView != null);
 




More information about the Phoenix-commits mailing list