diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml index 7a63f59de..e22711084 100644 --- a/chrome/content/zotero/bindings/styled-textbox.xml +++ b/chrome/content/zotero/bindings/styled-textbox.xml @@ -355,6 +355,9 @@ .getService(Components.interfaces.nsIChromeRegistry); uri = cr.convertChromeURL(uri); + // Pass directionality (LTR/RTL) in URL + uri.spec += "?dir=" + Zotero.dir; + Zotero.debug("Loading " + uri.spec); // Register handler for deferred setting of content diff --git a/chrome/content/zotero/tinymce/note.html b/chrome/content/zotero/tinymce/note.html index 7a97f1c89..1931359d7 100644 --- a/chrome/content/zotero/tinymce/note.html +++ b/chrome/content/zotero/tinymce/note.html @@ -25,6 +25,15 @@ }, setup : function (ed) { + // Set text direction + var dir = window.location.href.match(/dir=(ltr|rtl)/)[1]; + ed.settings.directionality = dir; + // Include button for opposite direction, to function as a toggle + ed.settings.theme_advanced_buttons1 = ed.settings.theme_advanced_buttons1.replace( + "%DIR%", + "," + dir.split("").reverse().join("") + ); + ed.onInit.add(function (ed) { zoteroInit(ed); }); @@ -40,10 +49,10 @@ fix_list_elements : true, fix_table_elements : true, - plugins : "paste,contextmenu", + plugins : "paste,contextmenu,directionality", // Theme options - theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,sub,sup,|,forecolor,backcolor,|,blockquote,|,link,unlink", + theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,sub,sup,|,forecolor,backcolor,|,blockquote,|,link,unlink,|,%DIR%", theme_advanced_buttons2 : "formatselect,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,outdent,indent,|,removeformat,code", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", diff --git a/chrome/content/zotero/tinymce/plugins/directionality/editor_plugin.js b/chrome/content/zotero/tinymce/plugins/directionality/editor_plugin.js new file mode 100644 index 000000000..90847e78e --- /dev/null +++ b/chrome/content/zotero/tinymce/plugins/directionality/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(b,c){var d=this;d.editor=b;function a(e){var h=b.dom,g,f=b.selection.getSelectedBlocks();if(f.length){g=h.getAttrib(f[0],"dir");tinymce.each(f,function(i){if(!h.getParent(i.parentNode,"*[dir='"+e+"']",h.getRoot())){if(g!=e){h.setAttrib(i,"dir",e)}else{h.setAttrib(i,"dir",null)}}});b.nodeChanged()}}b.addCommand("mceDirectionLTR",function(){a("ltr")});b.addCommand("mceDirectionRTL",function(){a("rtl")});b.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});b.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});b.onNodeChange.add(d._nodeChange,d)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})(); \ No newline at end of file diff --git a/chrome/skin/default/zotero/overlay.css b/chrome/skin/default/zotero/overlay.css index a65339016..e3aebd5dc 100644 --- a/chrome/skin/default/zotero/overlay.css +++ b/chrome/skin/default/zotero/overlay.css @@ -226,8 +226,8 @@ #zotero-item-pane { - width: 335px; - min-width: 335px; + width: 338px; + min-width: 338px; } #zotero-pane .toolbar