[kupu-checkins] r43479 - in kupu/trunk/kupu: common plone plone/kupu_plone_layer plone/kupu_references

duncan at codespeak.net duncan at codespeak.net
Fri May 18 15:02:43 CEST 2007


Author: duncan
Date: Fri May 18 15:02:42 2007
New Revision: 43479

Modified:
   kupu/trunk/kupu/common/kupubasetools.js
   kupu/trunk/kupu/common/kupusourceedit.js
   kupu/trunk/kupu/plone/body.kupu
   kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html
   kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
   kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt
Log:
Removed tabindex code from all toolbar buttons.
Added tabindex to iframe, added event handler for tab which tabs to next available tabindex (unless zoomed).

Modified: kupu/trunk/kupu/common/kupubasetools.js
==============================================================================
--- kupu/trunk/kupu/common/kupubasetools.js	(original)
+++ kupu/trunk/kupu/common/kupubasetools.js	Fri May 18 15:02:42 2007
@@ -76,12 +76,6 @@
     this._selectSelectItem = function(select, item) {
         this.editor.logMessage(_('Deprecation warning: KupuTool._selectSelectItem'));
     };
-    this._fixTabIndex = function(element) {
-        var tabIndex = this.editor.getDocument().getEditable().tabIndex-1;
-        if (tabIndex && !element.tabIndex) {
-            element.tabIndex = tabIndex;
-        }
-    };
 }
 
 function KupuToolBox() {
@@ -146,7 +140,6 @@
 KupuButton.prototype.initialize = function(editor) {
     this.editor = editor;
     if (!this.button) return;
-    this._fixTabIndex(this.button);
     addEventHandler(this.button, 'click', this.execCommand, this);
 };
 
@@ -272,7 +265,6 @@
         this.cleanStyles();
         this.enableOptions(false);
         if (this.tsselect) {
-            this._fixTabIndex(this.tsselect);
             this._selectevent = addEventHandler(this.tsselect, 'change', this.setTextStyleHandler, this);
         }
     };
@@ -2223,20 +2215,16 @@
         /* attach event handlers */
         this.editor = editor;
         if (this.addulbutton) {
-            this._fixTabIndex(this.addulbutton);
             addEventHandler(this.addulbutton, "click", this.addUnorderedList, this);
         }
         if (this.addolbutton) {
-            this._fixTabIndex(this.addolbutton);
             addEventHandler(this.addolbutton, "click", this.addOrderedList, this);
         }
         if (this.ulselect) {
-            this._fixTabIndex(this.ulselect);
             addEventHandler(this.ulselect, "change", this.setUnorderedListStyle, this);
             this.ulselect.style.display = "none";
         }
         if (this.olselect) {
-            this._fixTabIndex(this.olselect);
             addEventHandler(this.olselect, "change", this.setOrderedListStyle, this);
             this.olselect.style.display = "none";
         }
@@ -2420,7 +2408,6 @@
         /* initialize the tool */
         this.editor = editor;
         if (!this.dlbutton) return;
-        this._fixTabIndex(this.dlbutton);
         addEventHandler(this.dlbutton, 'click', this.createDefinitionList, this);
         addEventHandler(editor.getInnerDocument(), 'keyup', this._keyDownHandler, this);
         addEventHandler(editor.getInnerDocument(), 'keypress', this._keyPressHandler, this);
@@ -2727,7 +2714,6 @@
         this.pressed = false;
         if (!this.button) return;
         this.baseinitialize(editor);
-        this.button.tabIndex = this.editor.document.editable.tabIndex;
         addEventHandler(window, "resize", this.onresize, this);
         addEventHandler(window, "scroll", this.onscroll, this);
 

Modified: kupu/trunk/kupu/common/kupusourceedit.js
==============================================================================
--- kupu/trunk/kupu/common/kupusourceedit.js	(original)
+++ kupu/trunk/kupu/common/kupusourceedit.js	Fri May 18 15:02:42 2007
@@ -39,7 +39,6 @@
     /* attach the event handlers */
     this.editor = editor;
     if (!this.sourceButton) return;
-    this._fixTabIndex(this.sourceButton);
     addEventHandler(this.sourceButton, "click", this.switchSourceEdit, this);
     this.editor.logMessage(_('Source edit tool initialized'));
 };

Modified: kupu/trunk/kupu/plone/body.kupu
==============================================================================
--- kupu/trunk/kupu/plone/body.kupu	(original)
+++ kupu/trunk/kupu/plone/body.kupu	Fri May 18 15:02:42 2007
@@ -11,12 +11,13 @@
     <iframe class="kupu-editor-iframe"
         frameborder="0"
         src="emptypage"
+        tabindex=""
         onfocus="this.contentWindow.focus();"
         tal:define="base python:here.kupu_library_tool.getBaseUrl(here, True);
                     base kupu_base_override|base;"
         tal:attributes="src string:${base}/emptypage;
                         id string:kupu-editor-iframe-${fname};
-                        name string:kupu-editor-iframe-${fname};"
+                        name string:kupu-editor-iframe-${fname};tabindex tabindex|nothing;"
         >
     </iframe>
      <input type="hidden" name="text_format:default" value="text/html"

Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html	(original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupu_wysiwyg_support.html	Fri May 18 15:02:42 2007
@@ -436,7 +436,7 @@
     </table>
   <script type="text/javascript">var focuscount = 0;</script>
     <div>
-    <iframe class="kupu-editor-iframe" frameborder="0" src="emptypage" onfocus="this.contentWindow.focus();" tal:define="base python:here.kupu_library_tool.getBaseUrl(here, True);                     base kupu_base_override|base;" tal:attributes="src string:${base}/emptypage;                         id string:kupu-editor-iframe-${fname};                         name string:kupu-editor-iframe-${fname};">
+    <iframe class="kupu-editor-iframe" frameborder="0" src="emptypage" tabindex="" onfocus="this.contentWindow.focus();" tal:define="base python:here.kupu_library_tool.getBaseUrl(here, True);                     base kupu_base_override|base;" tal:attributes="src string:${base}/emptypage;                         id string:kupu-editor-iframe-${fname};                         name string:kupu-editor-iframe-${fname};tabindex tabindex|nothing;">
     </iframe>
      <input type="hidden" name="text_format:default" value="text/html" tal:define="fieldName fieldName|inputname|nothing;                 val python:fieldName and 'text/html' or 'html';                 fieldName python:test(fieldName, fieldName+'_', '') + 'text_format:default';" tal:attributes="name fieldName;value val;"/>
 <tal:test condition="fieldName|nothing">

Modified: kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js
==============================================================================
--- kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js	(original)
+++ kupu/trunk/kupu/plone/kupu_plone_layer/kupuploneinit.js	Fri May 18 15:02:42 2007
@@ -34,7 +34,6 @@
 
     // now we can create the controller
     var kupu = (window.kupu = new KupuEditor(doc, conf, l));
-
     kupu.setHTMLBody(initialtext);
 
     // now we can create a UI object which we can use from the UI
@@ -283,6 +282,35 @@
     };
     addEventHandler(textarea.form, 'submit', prepareForm, textarea);
 
+    function tabHandler(event) {
+        event = event||window.event;
+        if (event.keyCode!=9) { return; }
+        if (!/kupu-fulleditor-zoomed/.test(document.body.className)) {
+            var form = textarea.form;
+            var els = form.elements;
+            var target, targindex;
+            var mytabindex = iframe.tabIndex;
+            for (var i = 0; i < els.length; i++) {
+                var el = els[i];
+                if (el.tabIndex && el.tabIndex > mytabindex && !el.disabled && el.offsetWidth && el.offsetHeight) {
+                    if (!targindex || el.tabIndex < targindex) {
+                        target = el;
+                        targindex = el.tabIndex;
+                    }
+                }
+            }
+            if (target) {
+                window.focus();
+                target.focus();
+            }
+        }
+        if (event.preventDefault) { event.preventDefault(); event.stopPropagation();}
+        event.returnValue = false;
+        return false;
+    }
+    var inner = kupu.getInnerDocument();
+    kupu._addEventHandler(inner.documentElement, "keydown", tabHandler);
+
     kupu.initialize();
     return kupu;
 };
@@ -290,3 +318,8 @@
 // modify LinkDrawer so links don't have a target
 LinkDrawer.prototype.target = '';
 LinkLibraryDrawer.prototype.target = '';
+if (!window.console) {
+    window.console = new function() {
+        this.log = function() {};
+    };
+}

Modified: kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt
==============================================================================
--- kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt	(original)
+++ kupu/trunk/kupu/plone/kupu_references/referencebrowser.pt	Fri May 18 15:02:42 2007
@@ -151,8 +151,10 @@
                         class="searchButton"
                         value="Browse..." 
                         onClick=""
+                        tabindex=""
                         i18n:attributes="value label_browse;"
-                        tal:attributes="onClick string:referencebrowser_draweropen(event,$rFieldName,$rLabel,$multiVal,'$resource_type');;;" />
+                        tal:attributes="onClick string:referencebrowser_draweropen(event,$rFieldName,$rLabel,$multiVal,'$resource_type');;;
+                     tabindex tabindex/next|nothing" />
 
               <input type="button" 
                         class="destructive" 


More information about the kupu-checkins mailing list