Changeset 1008
- Timestamp:
- 05/22/08 11:04:40 (4 years ago)
- Location:
- branches/new-dialogs-merge
- Files:
-
- 12 added
- 29 modified
-
images/xinha-small-icon.gif (added)
-
modules/CreateLink/dialog.html (added)
-
modules/CreateLink/link.js (modified) (2 diffs)
-
modules/CreateLink/pluginMethods.js (added)
-
modules/FullScreen/lang/ru.js (modified) (1 diff)
-
modules/Gecko/Gecko.js (modified) (3 diffs)
-
modules/InlineStyler (added)
-
modules/InlineStyler/InlineStyler.js (added)
-
modules/InsertImage/dialog.html (added)
-
modules/InsertImage/insert_image.js (modified) (2 diffs)
-
modules/InsertImage/pluginMethods.js (added)
-
modules/InsertTable/dialog.html (added)
-
modules/InsertTable/insert_table.js (modified) (3 diffs)
-
modules/InsertTable/pluginMethods.js (added)
-
plugins/CharacterMap/CharacterMap.css (modified) (1 diff)
-
plugins/CharacterMap/character-map.js (modified) (3 diffs)
-
plugins/CharacterMap/img/ed_charmap.gif (modified) (previous)
-
plugins/CharacterMap/lang/fr.js (modified) (1 diff)
-
plugins/CharacterMap/lang/ru.js (modified) (1 diff)
-
plugins/InsertAnchor/dialog.html (added)
-
plugins/InsertAnchor/img/insert-anchor.gif (modified) (previous)
-
plugins/InsertAnchor/insert-anchor.js (modified) (3 diffs)
-
plugins/InsertAnchor/lang/pt_br.js (modified) (3 diffs)
-
plugins/PasteText/lang/de.js (modified) (1 diff)
-
plugins/PasteText/lang/pt_br.js (modified) (3 diffs)
-
plugins/PasteText/paste-text.js (modified) (3 diffs)
-
plugins/PasteText/popups/paste_text.html (modified) (1 diff)
-
plugins/SmartReplace/dialog.html (modified) (1 diff)
-
plugins/SmartReplace/lang/pt_br.js (modified) (3 diffs)
-
plugins/SmartReplace/readme.txt (modified) (1 diff)
-
plugins/SmartReplace/smart-replace.js (modified) (11 diffs)
-
plugins/Stylist/stylist.js (modified) (6 diffs)
-
plugins/SuperClean/dialog.html (modified) (1 diff)
-
plugins/SuperClean/img/ed_superclean.gif (modified) (previous)
-
plugins/SuperClean/lang/de.js (modified) (1 diff)
-
plugins/SuperClean/lang/pt_br.js (modified) (4 diffs)
-
plugins/SuperClean/super-clean.js (modified) (9 diffs)
-
plugins/TableOperations/lang/ru.js (modified) (1 diff)
-
plugins/TableOperations/popups/dialogRowCell.html (added)
-
plugins/TableOperations/popups/dialogTable.html (added)
-
plugins/TableOperations/table-operations.js (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/new-dialogs-merge/modules/CreateLink/link.js
r1001 r1008 1 // Paste Plain Text plugin for Xinha 1 2 2 /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- 3 -- Xinha (is not htmlArea) - http://xinha.org 4 -- 5 -- Use of Xinha is granted by the terms of the htmlArea License (based on 6 -- BSD license) please read license.txt in this package for details. 7 -- 8 -- Copyright (c) 2005-2008 Xinha Developer Team and contributors 9 -- 10 -- Xinha was originally based on work by Mihai Bazon which is: 11 -- Copyright (c) 2003-2004 dynarch.com. 12 -- Copyright (c) 2002-2003 interactivetools.com, inc. 13 -- This copyright notice MUST stay intact for use. 14 -- 15 -- This is the standard implementation of the Xinha.prototype._createLink method, 16 -- which provides the functionality to insert a hyperlink in the editor. 17 -- 18 -- he file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded. 19 -- 20 -- 21 -- $HeadURL:http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js $ 22 -- $LastChangedDate:2008-04-12 19:10:04 +0200 (Sa, 12 Apr 2008) $ 23 -- $LastChangedRevision:990 $ 24 -- $LastChangedBy:ray $ 25 --------------------------------------------------------------------------*/ 3 // Distributed under the same terms as Xinha itself. 4 // This notice MUST stay intact for use (see license.txt). 5 6 function CreateLink(editor) { 7 this.editor = editor; 8 var cfg = editor.config; 9 var self = this; 10 11 editor.config.btnList.createlink[3] = function() { self.show(self._getSelectedAnchor()); } 12 } 13 26 14 CreateLink._pluginInfo = { 27 15 name : "CreateLink", 28 16 origin : "Xinha Core", 29 version : "$LastChangedRevision :990 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),17 version : "$LastChangedRevision$".replace(/^[^:]*: (.*) \$$/, '$1'), 30 18 developer : "The Xinha Core Developer Team", 31 developer_url : "$HeadURL :http://svn.xinha.webfactional.com/trunk/modules/CreateLink/link.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),19 developer_url : "$HeadURL$".replace(/^[^:]*: (.*) \$$/, '$1'), 32 20 sponsor : "", 33 21 sponsor_url : "", … … 35 23 }; 36 24 37 function CreateLink(editor) { 38 } 25 CreateLink.prototype._lc = function(string) { 26 return Xinha._lc(string, 'Xinha'); 27 }; 39 28 40 Xinha.prototype._createLink = function(link) 29 30 CreateLink.prototype.onGenerateOnce = function() 41 31 { 42 var editor = this; 43 var outparam = null; 44 if ( typeof link == "undefined" ) 45 { 46 link = this.getParentElement(); 47 if ( link ) 48 { 49 while (link && !/^a$/i.test(link.tagName)) 50 { 51 link = link.parentNode; 52 } 53 } 54 } 55 if ( !link ) 56 { 57 var sel = editor.getSelection(); 58 var range = editor.createRange(sel); 59 var compare = 0; 60 if ( Xinha.is_ie ) 61 { 62 if ( sel.type == "Control" ) 63 { 64 compare = range.length; 65 } 66 else 67 { 68 compare = range.compareEndPoints("StartToEnd", range); 69 } 70 } 71 else 72 { 73 compare = range.compareBoundaryPoints(range.START_TO_END, range); 74 } 75 if ( compare === 0 ) 76 { 77 alert(Xinha._lc("You need to select some text before creating a link")); 78 return; 79 } 80 outparam = 81 { 82 f_href : '', 83 f_title : '', 84 f_target : '', 85 f_usetarget : editor.config.makeLinkShowsTarget 86 }; 87 } 88 else 89 { 90 outparam = 91 { 92 f_href : Xinha.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"), 93 f_title : link.title, 94 f_target : link.target, 95 f_usetarget : editor.config.makeLinkShowsTarget 96 }; 97 } 98 Dialog( 99 editor.config.URIs.link, 100 function(param) 101 { 102 if ( !param ) 103 { 104 return false; 105 } 106 var a = link; 107 if ( !a ) 108 { 109 try 110 { 111 var tmp = Xinha.uniq('http://www.example.com/Link'); 112 editor._doc.execCommand('createlink', false, tmp); 32 this.prepareDialog(); 33 this.loadScripts(); 34 }; 113 35 114 // Fix them up 115 var anchors = editor._doc.getElementsByTagName('a'); 116 for(var i = 0; i < anchors.length; i++) 117 { 118 var anchor = anchors[i]; 119 if(anchor.href == tmp) 120 { 121 // Found one. 122 if (!a) a = anchor; 123 anchor.href = param.f_href; 124 if (param.f_target) anchor.target = param.f_target; 125 if (param.f_title) anchor.title = param.f_title; 126 } 127 } 128 } catch(ex) {} 129 } 130 else 131 { 132 var href = param.f_href.trim(); 133 editor.selectNodeContents(a); 134 if ( href === '' ) 135 { 136 editor._doc.execCommand("unlink", false, null); 137 editor.updateToolbar(); 138 return false; 139 } 140 else 141 { 142 a.href = href; 143 } 144 } 145 if ( ! ( a && a.tagName.toLowerCase() == 'a' ) ) 146 { 147 return false; 148 } 149 a.target = param.f_target.trim(); 150 a.title = param.f_title.trim(); 151 editor.selectNodeContents(a); 152 editor.updateToolbar(); 153 }, 154 outparam); 36 CreateLink.prototype.loadScripts = function() 37 { 38 var self = this; 39 if(!this.methodsReady) 40 { 41 Xinha._getback(_editor_url + 'modules/CreateLink/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 42 return; 43 } 155 44 }; 45 46 CreateLink.prototype.onUpdateToolbar = function() 47 { 48 if (!(this.dialogReady && this.methodsReady)) 49 { 50 this.editor._toolbarObjects.createlink.state("enabled", false); 51 } 52 }; 53 54 CreateLink.prototype.prepareDialog = function() 55 { 56 var self = this; 57 var editor = this.editor; 58 59 if(!this.html) // retrieve the raw dialog contents 60 { 61 Xinha._getback(_editor_url + 'modules/CreateLink/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 62 return; 63 } 64 65 // Now we have everything we need, so we can build the dialog. 66 67 var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:400}) 68 // Connect the OK and Cancel buttons 69 dialog.getElementById('ok').onclick = function() {self.apply();} 70 71 dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; 72 73 if (!editor.config.makeLinkShowsTarget) 74 { 75 dialog.getElementById("f_target_label").style.visibility = "hidden"; 76 dialog.getElementById("f_target").style.visibility = "hidden"; 77 dialog.getElementById("f_other_target").style.visibility = "hidden"; 78 } 79 80 dialog.getElementById('f_target').onchange= function() 81 { 82 var f = dialog.getElementById("f_other_target"); 83 if (this.value == "_other") { 84 f.style.visibility = "visible"; 85 f.select(); 86 f.focus(); 87 } else f.style.visibility = "hidden"; 88 }; 89 90 91 this.dialogReady = true; 92 }; -
branches/new-dialogs-merge/modules/FullScreen/lang/ru.js
r901 r1008 1 // I18N constants1 // I18N constants 2 2 // LANG: "ru", ENCODING: UTF-8 3 3 // Author: Andrei Blagorazumov, a@fnr.ru 4 4 { 5 "Maximize/Minimize Editor": " Развернуть/Свернуть редактор"5 "Maximize/Minimize Editor": "РазвеÑМÑÑÑ/СвеÑМÑÑÑ ÑеЎакÑПÑ" 6 6 }; -
branches/new-dialogs-merge/modules/Gecko/Gecko.js
r1001 r1008 26 26 -- that way. 27 27 -- 28 -- $HeadURL :http://svn.xinha.webfactional.com/trunk/modules/Gecko/Gecko.js$29 -- $LastChangedDate :2008-05-01 14:33:36 +0200 (Do, 01 Mai 2008)$30 -- $LastChangedRevision :998$31 -- $LastChangedBy :ray$28 -- $HeadURL$ 29 -- $LastChangedDate$ 30 -- $LastChangedRevision$ 31 -- $LastChangedBy$ 32 32 --------------------------------------------------------------------------*/ 33 33 … … 35 35 name : "Gecko", 36 36 origin : "Xinha Core", 37 version : "$LastChangedRevision :998 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),37 version : "$LastChangedRevision$".replace(/^[^:]*: (.*) \$$/, '$1'), 38 38 developer : "The Xinha Core Developer Team", 39 developer_url : "$HeadURL :http://svn.xinha.webfactional.com/trunk/modules/Gecko/Gecko.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),39 developer_url : "$HeadURL$".replace(/^[^:]*: (.*) \$$/, '$1'), 40 40 sponsor : "", 41 41 sponsor_url : "", … … 576 576 Xinha.prototype.restoreSelection = function(savedSelection) 577 577 { 578 var sel = this.getSelection(); 579 sel.removeAllRanges(); 580 sel.addRange(savedSelection); 578 try 579 { 580 var sel = this.getSelection(); 581 sel.removeAllRanges(); 582 sel.addRange(savedSelection); 583 } 584 catch (e) {} 581 585 } 582 586 /** -
branches/new-dialogs-merge/modules/InsertImage/insert_image.js
r1001 r1008 1 2 1 /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- 3 -- Xinha (is not htmlArea) - http://xinha. org2 -- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ 4 3 -- 5 4 -- Use of Xinha is granted by the terms of the htmlArea License (based on 6 5 -- BSD license) please read license.txt in this package for details. 7 6 -- 8 -- Copyright (c) 2005-2008 Xinha Developer Team and contributors 7 -- Xinha was originally based on work by Mihai Bazon which is: 8 -- Copyright (c) 2003-2004 dynarch.com. 9 -- Copyright (c) 2002-2003 interactivetools.com, inc. 10 -- This copyright notice MUST stay intact for use. 9 11 -- 10 -- This is the standard implementation of the Xinha.prototype._insertImage method, 11 -- which provides the functionality to insert an image in the editor. 12 -- This is the Xinha standard implementation of an image insertion plugin 12 13 -- 13 -- The file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded.14 -- he file is loaded as a special plugin by the Xinha Core when no alternative method (plugin) is loaded. 14 15 -- 15 16 -- 16 -- $HeadURL :http://svn.xinha.webfactional.com/trunk/modules/InsertImage/insert_image.js$17 -- $LastChangedDate :2008-04-12 23:02:13 +0200 (Sa, 12 Apr 2008)$18 -- $LastChangedRevision :992$19 -- $LastChangedBy :ray$17 -- $HeadURL$ 18 -- $LastChangedDate$ 19 -- $LastChangedRevision$ 20 -- $LastChangedBy$ 20 21 --------------------------------------------------------------------------*/ 22 21 23 InsertImage._pluginInfo = { 22 24 name : "InsertImage", 23 25 origin : "Xinha Core", 24 version : "$LastChangedRevision :992 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),26 version : "$LastChangedRevision$".replace(/^[^:]*: (.*) \$$/, '$1'), 25 27 developer : "The Xinha Core Developer Team", 26 developer_url : "$HeadURL :http://svn.xinha.webfactional.com/trunk/modules/InsertImage/insert_image.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),28 developer_url : "$HeadURL$".replace(/^[^:]*: (.*) \$$/, '$1'), 27 29 sponsor : "", 28 30 sponsor_url : "", … … 31 33 32 34 function InsertImage(editor) { 33 } 35 this.editor = editor; 36 var cfg = editor.config; 37 var self = this; 34 38 35 // Called when the user clicks on "InsertImage" button. If an image is already 36 // there, it will just modify it's properties. 37 Xinha.prototype._insertImage = function(image) 39 editor.config.btnList.insertimage[3] = function() { self.show(); } 40 } 41 42 InsertImage.prototype._lc = function(string) { 43 return Xinha._lc(string, 'Xinha'); 44 }; 45 46 InsertImage.prototype.onGenerateOnce = function() 38 47 { 39 var editor = this; // for nested functions 40 var outparam; 41 if ( typeof image == "undefined" ) 42 { 43 image = this.getParentElement(); 44 if ( image && image.tagName.toLowerCase() != 'img' ) 45 { 46 image = null; 47 } 48 } 49 50 var base; 51 if ( typeof editor.config.baseHref != 'undefined' && editor.config.baseHref !== null ) { 52 base = editor.config.baseHref; 53 } 54 else { 55 var bdir = window.location.toString().split("/"); 56 bdir.pop(); 57 base = bdir.join("/"); 58 } 59 60 if ( image ) 61 { 62 function getSpecifiedAttribute(element,attribute) 63 { 64 var a = element.attributes; 65 for (var i=0;i<a.length;i++) 66 { 67 if (a[i].nodeName == attribute && a[i].specified) 68 { 69 return a[i].value; 70 } 71 } 72 return ''; 73 } 74 /* if you want to understand why the above function is required, uncomment the two lines below and launch InsertImage in both Mozilla & IE with an image selected that hath neither value set and compare the results 75 alert(image.vspace +' '+ image.getAttribute('vspace') + ' ' + image.getAttribute('vspace',2) + ' ' + getSpecifiedAttribute(image,'vspace') ); 76 alert(image.hspace +' '+ image.getAttribute('hspace') + ' ' + image.getAttribute('hspace',2) + ' ' + getSpecifiedAttribute(image,'hspace') ); 77 */ 78 outparam = 79 { 80 f_base : base, 81 f_url : this.stripBaseURL(image.getAttribute('src',2)), // the second parameter makes IE return the value as it is set, as opposed to an "interpolated" (as MSDN calls it) value 82 f_alt : image.alt, 83 f_border : image.border, 84 f_align : image.align, 85 f_vert : getSpecifiedAttribute(image,'vspace'), 86 f_horiz : getSpecifiedAttribute(image,'hspace'), 87 f_width : image.width, 88 f_height : image.height 89 }; 90 } 91 else{ 92 outparam = 93 { 94 f_base : base, 95 f_url : "" 96 }; 97 } 98 99 Dialog( 100 editor.config.URIs.insert_image, 101 function(param) 102 { 103 // user must have pressed Cancel 104 if ( !param ) 105 { 106 return false; 107 } 108 var img = image; 109 if ( !img ) 110 { 111 if ( Xinha.is_ie ) 112 { 113 var sel = editor.getSelection(); 114 var range = editor.createRange(sel); 115 editor._doc.execCommand("insertimage", false, param.f_url); 116 img = range.parentElement(); 117 // wonder if this works... 118 if ( img.tagName.toLowerCase() != "img" ) 119 { 120 img = img.previousSibling; 121 } 122 } 123 else 124 { 125 img = document.createElement('img'); 126 img.src = param.f_url; 127 editor.insertNodeAtSelection(img); 128 if ( !img.tagName ) 129 { 130 // if the cursor is at the beginning of the document 131 img = range.startContainer.firstChild; 132 } 133 } 134 } 135 else 136 { 137 img.src = param.f_url; 138 } 48 this.prepareDialog(); 49 this.loadScripts(); 50 }; 139 51 140 for ( var field in param ) 141 { 142 var value = param[field]; 143 switch (field) 144 { 145 case "f_alt": 146 if (value) 147 img.alt = value; 148 else 149 img.removeAttribute("alt"); 150 break; 151 case "f_border": 152 if (value) 153 img.border = parseInt(value || "0"); 154 else 155 img.removeAttribute("border"); 156 break; 157 case "f_align": 158 if (value) 159 img.align = value; 160 else 161 img.removeAttribute("align"); 162 break; 163 case "f_vert": 164 if (value != "") 165 img.vspace = parseInt(value || "0"); 166 else 167 img.removeAttribute("vspace"); 168 break; 169 case "f_horiz": 170 if (value != "") 171 img.hspace = parseInt(value || "0"); 172 else 173 img.removeAttribute("hspace"); 174 break; 175 case "f_width": 176 if (value) 177 img.width = parseInt(value || "0"); 178 else 179 img.removeAttribute("width"); 180 break; 181 case "f_height": 182 if (value) 183 img.height = parseInt(value || "0"); 184 else 185 img.removeAttribute("height"); 186 break; 187 } 188 } 189 }, 190 outparam); 52 InsertImage.prototype.loadScripts = function() 53 { 54 var self = this; 55 if(!this.methodsReady) 56 { 57 Xinha._getback(_editor_url + 'modules/InsertImage/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 58 return; 59 } 191 60 }; 61 62 InsertImage.prototype.onUpdateToolbar = function() 63 { 64 if (!(this.dialogReady && this.methodsReady)) 65 { 66 this.editor._toolbarObjects.insertimage.state("enabled", false); 67 } 68 }; 69 70 InsertImage.prototype.prepareDialog = function() 71 { 72 var self = this; 73 var editor = this.editor; 74 75 if(!this.html) // retrieve the raw dialog contents 76 { 77 Xinha._getback(_editor_url + 'modules/InsertImage/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 78 return; 79 } 80 81 // Now we have everything we need, so we can build the dialog. 82 83 var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:410}) 84 // Connect the OK and Cancel buttons 85 dialog.getElementById('ok').onclick = function() {self.apply();} 86 87 dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; 88 89 dialog.getElementById('preview').onclick = function() { 90 var f_url = dialog.getElementById("f_url"); 91 var url = f_url.value; 92 var base = dialog.getElementById("f_base").value; 93 if (!url) { 94 alert(dialog._lc("You must enter the URL")); 95 f_url.focus(); 96 return false; 97 } 98 dialog.getElementById('ipreview').src = Xinha._resolveRelativeUrl(base, url); 99 return false; 100 } 101 this.dialog.onresize = function () 102 { 103 104 105 var newHeightForPreview = 106 parseInt(this.height,10) 107 - this.getElementById('h1').offsetHeight 108 - this.getElementById('buttons').offsetHeight 109 - this.getElementById('inputs').offsetHeight 110 - parseInt(this.rootElem.style.paddingBottom,10); // we have a padding at the bottom, gotta take this into acount 111 112 113 this.getElementById("ipreview").style.height = ((newHeightForPreview > 0) ? newHeightForPreview : 0) + "px"; // no-go beyond 0 114 115 this.getElementById("ipreview").style.width = this.width - 2 + 'px'; // and the width 116 117 } 118 this.dialogReady = true; 119 }; -
branches/new-dialogs-merge/modules/InsertTable/insert_table.js
r1001 r1008 1 2 1 /*--------------------------------------:noTabs=true:tabSize=2:indentSize=2:-- 3 -- Xinha (is not htmlArea) - http://xinha. org2 -- Xinha (is not htmlArea) - http://xinha.gogo.co.nz/ 4 3 -- 5 4 -- Use of Xinha is granted by the terms of the htmlArea License (based on 6 5 -- BSD license) please read license.txt in this package for details. 7 --8 -- Copyright (c) 2005-2008 Xinha Developer Team and contributors9 6 -- 10 7 -- Xinha was originally based on work by Mihai Bazon which is: … … 13 10 -- This copyright notice MUST stay intact for use. 14 11 -- 15 -- This is the standard implementation of the Xinha.prototype._insertTable method, 16 -- which provides the functionality to insert an image in the editor. 12 -- This is the Xinha standard implementation of an image insertion plugin 17 13 -- 18 -- he file is loaded as a special pluginby the Xinha Core when no alternative method (plugin) is loaded.14 -- The file is loaded by the Xinha Core when no alternative method (plugin) is loaded. 19 15 -- 20 16 -- 21 -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertTable/insert_ table.js $22 -- $LastChangedDate: 2007-0 1-23 09:22:22 +1300 (Tue, 23 Jan2007) $23 -- $LastChangedRevision: 688$24 -- $LastChangedBy: ray$17 -- $HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertTable/insert_image.js $ 18 -- $LastChangedDate: 2007-02-13 13:54:39 +0100 (Di, 13 Feb 2007) $ 19 -- $LastChangedRevision: 733 $ 20 -- $LastChangedBy: htanaka $ 25 21 --------------------------------------------------------------------------*/ 22 26 23 InsertTable._pluginInfo = { 27 24 name : "InsertTable", 28 25 origin : "Xinha Core", 29 version : "$LastChangedRevision: 688 $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),26 version : "$LastChangedRevision: 733 $".replace(/^[^:]*: (.*) \$$/, '$1'), 30 27 developer : "The Xinha Core Developer Team", 31 developer_url : "$HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertTable/insert_ table.js $".replace(/^[^:]*:\s*(.*)\s*\$$/, '$1'),28 developer_url : "$HeadURL: http://svn.xinha.python-hosting.com/trunk/modules/InsertTable/insert_image.js $".replace(/^[^:]*: (.*) \$$/, '$1'), 32 29 sponsor : "", 33 30 sponsor_url : "", … … 36 33 37 34 function InsertTable(editor) { 38 } 35 this.editor = editor; 36 var cfg = editor.config; 37 var self = this; 39 38 40 Xinha.prototype._insertTable = function() 39 editor.config.btnList.inserttable[3] = function() { self.show(); } 40 } 41 42 InsertTable.prototype._lc = function(string) { 43 return Xinha._lc(string, 'Xinha'); 44 }; 45 46 47 InsertTable.prototype.onGenerateOnce = function() 41 48 { 42 var sel = this.getSelection(); 43 var range = this.createRange(sel); 44 var editor = this; // for nested functions 45 Dialog( 46 editor.config.URIs.insert_table, 47 function(param) 48 { 49 // user must have pressed Cancel 50 if ( !param ) 51 { 52 return false; 53 } 54 var doc = editor._doc; 55 // create the table element 56 var table = doc.createElement("table"); 57 // assign the given arguments 49 this.prepareDialog(); 50 this.loadScripts(); 51 }; 58 52 59 for ( var field in param ) 60 { 61 var value = param[field]; 62 if ( !value ) 63 { 64 continue; 65 } 66 switch (field) 67 { 68 case "f_width": 69 table.style.width = value + param.f_unit; 70 break; 71 case "f_align": 72 table.align = value; 73 break; 74 case "f_border": 75 table.border = parseInt(value, 10); 76 break; 77 case "f_spacing": 78 table.cellSpacing = parseInt(value, 10); 79 break; 80 case "f_padding": 81 table.cellPadding = parseInt(value, 10); 82 break; 83 } 84 } 85 var cellwidth = 0; 86 if ( param.f_fixed ) 87 { 88 cellwidth = Math.floor(100 / parseInt(param.f_cols, 10)); 89 } 90 var tbody = doc.createElement("tbody"); 91 table.appendChild(tbody); 92 for ( var i = 0; i < param.f_rows; ++i ) 93 { 94 var tr = doc.createElement("tr"); 95 tbody.appendChild(tr); 96 for ( var j = 0; j < param.f_cols; ++j ) 97 { 98 var td = doc.createElement("td"); 99 // @todo : check if this line doesnt stop us to use pixel width in cells 100 if (cellwidth) 101 { 102 td.style.width = cellwidth + "%"; 103 } 104 tr.appendChild(td); 105 // Browsers like to see something inside the cell ( ). 106 td.appendChild(doc.createTextNode('\u00a0')); 107 } 108 } 109 if ( Xinha.is_ie ) 110 { 111 range.pasteHTML(table.outerHTML); 112 } 113 else 114 { 115 // insert the table 116 editor.insertNodeAtSelection(table); 117 } 118 return true; 119 }, 120 null 121 ); 53 InsertTable.prototype.loadScripts = function() 54 { 55 var self = this; 56 if(!this.methodsReady) 57 { 58 Xinha._getback(_editor_url + 'modules/InsertTable/pluginMethods.js', function(getback) { eval(getback); self.methodsReady = true; }); 59 return; 60 } 122 61 }; 62 63 InsertTable.prototype.onUpdateToolbar = function() 64 { 65 if (!(this.dialogReady && this.methodsReady)) 66 { 67 this.editor._toolbarObjects.inserttable.state("enabled", false); 68 } 69 }; 70 71 InsertTable.prototype.prepareDialog = function() 72 { 73 var self = this; 74 var editor = this.editor; 75 76 if(!this.html) // retrieve the raw dialog contents 77 { 78 Xinha._getback(_editor_url + 'modules/InsertTable/dialog.html', function(getback) { self.html = getback; self.prepareDialog(); }); 79 return; 80 } 81 82 // Now we have everything we need, so we can build the dialog. 83 84 var dialog = this.dialog = new Xinha.Dialog(editor, this.html, 'Xinha',{width:400}) 85 // Connect the OK and Cancel buttons 86 dialog.getElementById('ok').onclick = function() {self.apply();} 87 dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; 88 89 this.borderColorPicker = new Xinha.colorPicker.InputBinding(dialog.getElementById('border_color')); 90 91 this.dialog.onresize = function () 92 { 93 this.getElementById("layout_fieldset").style.width =(this.width / 2) + 50 + 'px'; 94 this.getElementById("spacing_fieldset").style.width =(this.width / 2) - 120 + 'px'; 95 } 96 97 this.dialogReady = true; 98 }; -
branches/new-dialogs-merge/plugins/CharacterMap/CharacterMap.css
r677 r1008 1 .CharacterMap { } 1 .CharacterMap { 2 background-color:white; 3 } 2 4 .CharacterMap a.entity { 3 5 font-size:12px; -
branches/new-dialogs-merge/plugins/CharacterMap/character-map.js
r856 r1008 14 14 image : editor.imgURL( 'ed_charmap.gif', 'CharacterMap' ), 15 15 textMode : false, 16 action : function( editor ) { self.buttonPress( editor); }16 action : function() { self.show(); } 17 17 } 18 18 ); 19 19 cfg.addToolbarElement('insertcharacter', 'createlink', -1); 20 20 21 if ( cfg.CharacterMap.mode == 'panel' )22 {23 editor._CharacterMap = editor.addPanel( 'right' );24 Xinha._addClass( editor._CharacterMap, 'CharacterMap' );25 26 editor.notifyOn( 'modechange',27 function( e, args )28 {29 if ( args.mode == 'text' ) editor.hidePanel( editor._CharacterMap );30 }31 );32 33 var entites =34 [35 'Ÿ', 'š', '@', '"', '¡', '¢', '£', '¤', '¥', '¦',36 '§', '¨', '©', 'ª', '«', '¬', '¯', '°', '±', '²',37 '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼',38 '½', '¾', '¿', '×', 'Ø', '÷', 'ø', 'ƒ', 'ˆ',39 '˜', '–', '—', '‘', '’', '‚', '“', '”', '„',40 '†', '‡', '•', '…', '‰', '‹', '›', '€', '™',41 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È',42 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ',43 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '®', '×', 'Ù', 'Ú',44 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã',45 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì',46 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ',47 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ',48 'ÿ', 'Œ', 'œ', 'Š'49 ];50 51 for ( var i=0; i<entites.length; i++ )52 this.addEntity( entites[i], i );53 54 editor.hidePanel( editor._CharacterMap );55 }56 21 } 57 22 … … 76 41 CharacterMap._isActive = false; 77 42 78 CharacterMap.prototype.buttonPress = function( editor )79 {80 var cfg = editor.config;81 if ( cfg.CharacterMap.mode == 'panel' )82 {83 if ( this._isActive )84 {85 this._isActive = false;86 editor.hidePanel( editor._CharacterMap );87 }88 else89 {90 this._isActive = true;91 editor.showPanel( editor._CharacterMap );92 }93 }94 else95 {96 editor._popupDialog( "plugin://CharacterMap/select_character", function( entity )97 {98 if ( !entity ) return false;99 if ( Xinha.is_ie ) editor.focusEditor();100 editor.insertHTML( entity );101 }, null);102 }103 };104 43 105 44 CharacterMap.prototype.addEntity = function ( entite, pos ) … … 120 59 return false; 121 60 }; 122 editor._CharacterMap.appendChild( a );61 this.dialog.main.appendChild( a ); 123 62 a = null; 124 63 }; 64 65 CharacterMap.prototype.onGenerateOnce = function() 66 { 67 this._prepareDialog(); 68 }; 69 70 CharacterMap.prototype._prepareDialog = function() 71 { 72 var self = this; 73 var editor = this.editor; 74 75 var html = '<h1><l10n>Insert special character</l10n></h1>'; 76 77 // Now we have everything we need, so we can build the dialog. 78 this.dialog = new Xinha.Dialog(editor, html, 'CharacterMap',{width:300},{modal:false}); 79 Xinha._addClass( this.dialog.rootElem, 'CharacterMap' ); 80 81 if (editor.config.CharacterMap.mode == 'panel') this.dialog.attachToPanel('right'); 82 83 var entites = 84 [ 85 'Ÿ', 'š', '@', '"', '¡', '¢', '£', '¤', '¥', '¦', 86 '§', '¨', '©', 'ª', '«', '¬', '¯', '°', '±', '²', 87 '³', '´', 'µ', '¶', '·', '¸', '¹', 'º', '»', '¼', 88 '½', '¾', '¿', '×', 'Ø', '÷', 'ø', 'ƒ', 'ˆ', 89 '˜', '–', '—', '‘', '’', '‚', '“', '”', '„', 90 '†', '‡', '•', '…', '‰', '‹', '›', '€', '™', 91 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 92 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 93 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', '®', '×', 'Ù', 'Ú', 94 'Û', 'Ü', 'Ý', 'Þ', 'ß', 'à', 'á', 'â', 'ã', 95 'ä', 'å', 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 96 'í', 'î', 'ï', 'ð', 'ñ', 'ò', 'ó', 'ô', 'õ', 97 'ö', '÷', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'þ', 98 'ÿ', 'Œ', 'œ', 'Š' 99 ]; 100 101 for ( var i=0; i<entites.length; i++ ) 102 { 103 this.addEntity( entites[i], i ); 104 } 105 106 this.ready = true; 107 //this.hide(); 108 }; 109 110 CharacterMap.prototype.show = function() 111 { 112 if(!this.ready) // if the user is too fast clicking the, we have to make them wait 113 { 114 var self = this; 115 window.setTimeout(function() {self.show();},100); 116 return; 117 } 118 this.dialog.toggle(); 119 }; 120 CharacterMap.prototype.hide = function() 121 { 122 this.dialog.hide(); 123 }; 124 -
branches/new-dialogs-merge/plugins/CharacterMap/lang/fr.js
r822 r1008 2 2 // LANG: "fr", ENCODING: UTF-8 3 3 { 4 "Insert special character": "Insérer uncaractÚre spécial",4 "Insert special character": "Insérer caractÚre spécial", 5 5 "Cancel": "Annuler" 6 6 }; -
branches/new-dialogs-merge/plugins/CharacterMap/lang/ru.js
r901 r1008 1 // I18N constants1 // I18N constants 2 2 // LANG: "ru", ENCODING: UTF-8 3 3 // Author: Andrei Blagorazumov, a@fnr.ru 4 4 { 5 "Insert special character": " Вставить специальный символ",6 "Cancel": " Отменить"5 "Insert special character": "ÐÑÑавОÑÑ ÑпеÑОалÑМÑй ÑОЌвПл", 6 "Cancel": "ÐÑЌеМОÑÑ" 7 7 }; -
branches/new-dialogs-merge/plugins/InsertAnchor/insert-anchor.js
r999 r1008 3 3 var cfg = editor.config; 4 4 var self = this; 5 5 6 6 this.placeholderImg = '<img class="IA_placeholder" src="'+Xinha.getPluginDir("InsertAnchor")+'/img/placeholder.gif" />'; 7 7 … … 12 12 image : editor.imgURL("insert-anchor.gif", "InsertAnchor"), 13 13 textMode : false, 14 action : function( editor) {15 self. buttonPress(editor);14 action : function() { 15 self.show(); 16 16 } 17 17 }); … … 50 50 return html; 51 51 } 52 InsertAnchor.prototype.onGenerateOnce = function() 53 { 54 this._prepareDialog(); 55 }; 56 InsertAnchor.prototype._prepareDialog = function() 57 { 58 var self = this; 59 var editor = this.editor; 52 60 53 InsertAnchor.prototype.buttonPress = function(editor) { 54 var outparam = null; 55 var html = editor.getSelectedHTML(); 56 var sel = editor._getSelection(); 57 var range = editor._createRange(sel); 58 var self = this; 59 var a = editor._activeElement(sel); 60 if(!(a != null && a.tagName.toLowerCase() == 'a')) { 61 a = editor._getFirstAncestor(sel, 'a'); 61 if(!this.html) 62 { 63 Xinha._getback(_editor_url + 'plugins/InsertAnchor/dialog.html', function(getback) { self.html = getback; self._prepareDialog(); }); 64 return; 62 65 } 63 if (a != null && a.tagName.toLowerCase() == 'a') 64 outparam = { name : a.id }; 66 67 // Now we have everything we need, so we can build the dialog. 68 this.dialog = new Xinha.Dialog(editor, this.html, 'InsertAnchor',{width:400}); 69 70 this.dialog.getElementById('ok').onclick = function() {self.apply();} 71 72 this.dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; 73 74 this.ready = true; 75 }; 76 77 InsertAnchor.prototype.show = function() 78 { 79 if(!this.ready) // if the user is too fast clicking the, we have to make them wait 80 { 81 var self = this; 82 window.setTimeout(function() {self.show();},100); 83 return; 84 } 85 var editor = this.editor; 86 this.selectedHTML = editor.getSelectedHTML(); 87 var sel = editor.getSelection(); 88 var range = editor.createRange(sel); 89 this.a = editor.activeElement(sel); 90 91 if(!(this.a != null && this.a.tagName.toLowerCase() == 'a')) 92 { 93 this.a = editor._getFirstAncestor(sel, 'a'); 94 } 95 96 if (this.a != null && this.a.tagName.toLowerCase() == 'a') 97 { 98 inputs = { name : this.a.id }; 99 } 65 100 else 66 outparam = { name : '' }; 101 { 102 inputs = { name : '' }; 103 } 67 104 68 editor._popupDialog( "plugin://InsertAnchor/insert_anchor", function( param ) { 69 if ( param ) { 70 var anchor = param["name"]; 71 if (anchor == "" || anchor == null) { 72 if (a) { 73 var child = self.outwardHtml(a.innerHTML); 74 a.parentNode.removeChild(a); 75 editor.insertHTML(child); 76 } 77 return; 78 } 79 try { 80 var doc = editor._doc; 81 if (!a) { 82 // editor.surroundHTML('<a id="' + anchor + '" name="' + anchor + '" title="' + anchor + '" class="anchor">', '</a>'); 83 a = doc.createElement("a"); 84 a.id = anchor; 85 a.name = anchor; 86 a.title = anchor; 87 a.className = "anchor"; 88 a.innerHTML = self.placeholderImg; 89 if (html) a.innerHTML += html; 90 if (Xinha.is_ie) { 91 range.pasteHTML(a.outerHTML); 92 } else { 93 editor.insertNodeAtSelection(a); 94 } 95 } else { 96 a.id = anchor; 97 a.name = anchor; 98 a.title = anchor; 99 a.className = "anchor"; 100 } 101 } 102 catch (e) { } 103 } 104 }, outparam); 105 this.dialog.show(inputs); 106 107 this.dialog.getElementById("name").focus(); 105 108 }; 109 110 InsertAnchor.prototype.apply = function () 111 { 112 var editor = this.editor; 113 var param = this.dialog.hide(); 114 var anchor = param['name']; 115 var a = this.a; 116 var self = this; 117 if (anchor == "" || anchor == null) 118 { 119 if (a) 120 { 121 var child = self.outwardHtml(a.innerHTML); 122 a.parentNode.removeChild(a); 123 editor.insertHTML(child); 124 } 125 return; 126 } 127 try 128 { 129 var doc = editor._doc; 130 if (!a) 131 { 132 a = doc.createElement("a"); 133 a.id = anchor; 134 a.name = anchor; 135 a.title = anchor; 136 a.className = "anchor"; 137 a.innerHTML = self.placeholderImg; 138 var html = editor.getSelectedHTML(); 139 if (html) a.innerHTML += html; 140 if (Xinha.is_ie) 141 { 142 range.pasteHTML(a.outerHTML); 143 } 144 else 145 { 146 editor.insertNodeAtSelection(a); 147 } 148 } 149 else 150 { 151 a.id = anchor; 152 a.name = anchor; 153 a.title = anchor; 154 a.className = "anchor"; 155 } 156 } 157 catch (e) { } 158 159 } -
branches/new-dialogs-merge/plugins/InsertAnchor/lang/pt_br.js
r901 r1008 1 // I18N constants1 // I18N constants 2 2 // 3 3 // LANG: "pt_br", ENCODING: UTF-8 … … 9 9 // 10 10 // Last revision: 06 september 2007 11 // Please don ´t remove this information11 // Please donÂŽt remove this information 12 12 // If you modify any source, please insert a comment with your name and e-mail 13 13 // … … 15 15 // This notice MUST stay intact for use (see license.txt). 16 16 { 17 "Anchor name": "Nome da âncora",17 "Anchor name": "Nome da âncora", 18 18 "Cancel": "Cancelar", 19 19 "Delete": "Deletar", 20 "Insert Anchor": "Inserir Âncora",20 "Insert Anchor": "Inserir Ãncora", 21 21 "OK": "OK" 22 22 } -
branches/new-dialogs-merge/plugins/PasteText/lang/de.js
r677 r1008 2 2 // LANG: "de", ENCODING: UTF-8 3 3 { 4 "Paste as Plain Text": "unformatierten Text einfÌgen" 4 "Paste as Plain Text": "unformatierten Text einfÌgen", 5 "Insert text in new paragraph" : "Neue AbsÀtze eifÌgen" 5 6 }; -
branches/new-dialogs-merge/plugins/PasteText/lang/pt_br.js
r901 r1008 1 // I18N constants1 // I18N constants 2 2 // 3 3 // LANG: "pt_br", ENCODING: UTF-8 … … 9 9 // 10 10 // Last revision: 06 september 2007 11 // Please don ´t remove this information11 // Please donÂŽt remove this information 12 12 // If you modify any source, please insert a comment with your name and e-mail 13 13 // … … 18 18 "OK": "OK", 19 19 "Paste Text": "Colar Texto", 20 "Paste as Plain Text": "Colar um texto b ásico"20 "Paste as Plain Text": "Colar um texto básico" 21 21 } -
branches/new-dialogs-merge/plugins/PasteText/paste-text.js
r999 r1008 8 8 var cfg = editor.config; 9 9 var self = this; 10 10 11 11 cfg.registerButton({ 12 id : "pastetext", 13 tooltip : this._lc("Paste as Plain Text"), 14 image : editor.imgURL("ed_paste_text.gif", "PasteText"), 15 textMode : false, 16 action : function(editor) { 17 self.buttonPress(editor); 18 } 19 }); 12 id : "pastetext", 13 tooltip : this._lc("Paste as Plain Text"), 14 image : editor.imgURL("ed_paste_text.gif", "PasteText"), 15 textMode : false, 16 action : function() { self.show(); } 17 }); 20 18 21 19 cfg.addToolbarElement("pastetext", ["paste", "killword"], 1); … … 34 32 35 33 PasteText.prototype._lc = function(string) { 36 return Xinha._lc(string, 'PasteText');34 return Xinha._lc(string, 'PasteText'); 37 35 }; 38 36 … … 43 41 } 44 42 45 PasteText.prototype.buttonPress = function(editor) { 43 PasteText.prototype.onGenerateOnce = function() 44 { 45 this._prepareDialog(); 46 }; 46 47 48 PasteText.prototype._prepareDialog = function() 49 { 50 var self = this; 47 51 var editor = this.editor; 48 var outparam = editor.config.PasteText; 49 var action = function( ret ) { 50 var html = ret.text; 51 var insertParagraphs = ret.insertParagraphs; 52 html = html.replace(/</g, "<"); 53 html = html.replace(/>/g, ">"); 54 if ( ret.insertParagraphs) 55 { 56 html = html.replace(/\t/g," "); 57 html = html.replace(/\n/g,"</p><p>"); 58 html="<p>" + html + "</p>"; 59 if (Xinha.is_ie) 60 { 61 editor.insertHTML(html); 62 } 63 else 64 { 65 editor.execCommand("inserthtml",false,html); 66 } 52 53 if(!this.html) // retrieve the raw dialog contents 54 { 55 Xinha._getback(Xinha.getPluginDir("PasteText") + '/popups/paste_text.html', function(getback) { self.html = getback; self._prepareDialog(); }); 56 return; 57 } 58 59 // Now we have everything we need, so we can build the dialog. 60 this.dialog = new Xinha.Dialog(editor, this.html, 'PasteText',{width:350}) 61 62 // Connect the OK and Cancel buttons 63 this.dialog.getElementById('ok').onclick = function() {self.apply();} 64 65 this.dialog.getElementById('cancel').onclick = function() { self.dialog.hide()}; 66 67 // do some tweaking 68 if (editor.config.PasteText.showParagraphOption) 69 { 70 this.dialog.getElementById("paragraphOption").style.display = ""; 71 } 72 if (editor.config.PasteText.newParagraphDefault) 73 { 74 this.dialog.getElementById("insertParagraphs").checked = true; 75 } 76 77 // we can setup a custom function that cares for sizes etc. when the dialog is resized 78 this.dialog.onresize = function () 79 { 80 this.getElementById("inputArea").style.height = 81 parseInt(this.height,10) // the actual height of the dialog 82 - this.getElementById('h1').offsetHeight // the title bar 83 - this.getElementById('buttons').offsetHeight // the buttons 84 - parseInt(this.rootElem.style.paddingBottom,10) // we have a padding at the bottom, gotta take this into acount 85 + 'px'; // don't forget this ;) 86 87 this.getElementById("inputArea").style.width =(this.width - 2) + 'px'; // and the width 88 89 } 90 this.ready = true; 91 }; 92 93 PasteText.prototype.show = function() 94 { 95 if(!this.ready) // if the user is too fast clicking the, we have to make them wait 96 { 97 var self = this; 98 window.setTimeout(function() {self.show();},100); 99 return; 100 } 101 // here we can pass values to the dialog 102 // each property pair consists of the "name" of the input we want to populate, and the value to be set 103 var inputs = 104 { 105 inputArea : '' // we want the textarea always to be empty on showing 106 } 107 // now calling the show method of the Xinha.Dialog object to set the values and show the actual dialog 108 this.dialog.show(inputs); 109 110 // Init the sizes (only if we have set up the custom resize function) 111 this.dialog.onresize(); 112 113 this.dialog.getElementById("inputArea").focus(); 114 }; 115 116 // and finally ... take some action 117 PasteText.prototype.apply = function() 118 { 119 // the hide method of the dialog object returns the values of the inputs AND hides the dialog 120 // could also use this.dialog.getValues() here and hide it at the end 121 var returnValues = this.dialog.hide(); 122 123 var html = returnValues.inputArea; 124 var insertParagraphs = returnValues.insertParagraphs; 125 html = html.replace(/</g, "<"); 126 html = html.replace(/>/g, ">"); 127 if ( returnValues.insertParagraphs) 128 { 129 html = html.replace(/\t/g," "); 130 html = html.replace(/\n/g,"</p><p>"); 131 html="<p>" + html + "</p>"; 132 if (Xinha.is_ie) 133 { 134 this.editor.insertHTML(html); 67 135 } 68 136 else 69 137 { 70 html = html.replace(/\n/g,"<br />"); 71 editor.insertHTML(html); 138 this.editor.execCommand("inserthtml",false,html); 72 139 } 73 140 } 74 Dialog( Xinha.getPluginDir("PasteText")+ "/popups/paste_text.html", action, outparam); 141 else 142 { 143 html = html.replace(/\n/g,"<br />"); 144 this.editor.insertHTML(html); 145 } 75 146 }; -
branches/new-dialogs-merge/plugins/PasteText/popups/paste_text.html
r858 r1008 1 <!DOCTYPE html 2 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 5 <head> 6 <title>Paste Text</title> 7 <link rel="stylesheet" type="text/css" href="../../../popups/popup.css" /> 8 <script type="text/javascript" src="../../../popups/popup.js"></script> 9 <script type="text/javascript"> 10 11 function init() { 12 13 __dlg_translate("PasteText"); 14 __dlg_init(null,{width:600,height:480}); 15 16 var param = window.dialogArguments; 17 document.getElementById("paragraphOption").style.display = (param.showParagraphOption) ? '' : 'none'; 18 document.getElementById("insertParagraphs").checked = param.newParagraphDefault; 19 document.getElementById("inputArea").focus(); 20 } 21 22 function onCancel() { 23 __dlg_close( null ); 24 return false; 25 } 26 27 function onOK() { 28 var ret = {}; 29 ret.text = document.getElementById("inputArea").value; 30 ret.insertParagraphs = document.getElementById("insertParagraphs").checked; 31 __dlg_close( ret ); 32 } 33 window.onload = init; 34 </script> 35 </head> 36 37 <body class="dialog"> 38 <div class="title">Paste as Plain Text</div> 39 <form> 40 <div> 41 <textarea name="inputArea" id="inputArea" cols=22 rows=5 style="width: 100%; height: 315px; margin-top: 8px; margin-bottom: 4px; font-family: monospace; font-size: 11px;"></textarea> 42 <div id="buttons"> 43 <label for="insertParagraphs" style="float:left;display:none" id="paragraphOption"> 44 <input type="checkbox" id="insertParagraphs" /> Insert text in new paragraph 1 <h1 id="[h1]"><l10n>Paste as Plain Text</l10n></h1> 2 <textarea name="[inputArea]" id="[inputArea]" style="font-family:monospace;height:300px;border:none;"></textarea> 3 <div class="buttons" id="[buttons]"> 4 <label style="float:left;display:none" id="[paragraphOption]"> 5 <input type="checkbox" id="[insertParagraphs]" name="[insertParagraphs]" /> <l10n>Insert text in new paragraph</l10n> 45 6 </label> 46 <button type="button" name="ok" onclick="return onOK();">OK</button>47 <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>7 <input type="button" id="[ok]" value="_(OK)" /> 8 <input type="button" id="[cancel]" value="_(Cancel)" /> 48 9 </div> 49 </div>50 </form>51 </body>52 </html> -
branches/new-dialogs-merge/plugins/SmartReplace/dialog.html
r752 r1008 8 8 <tr> 9 9 <td style="width:15px"><input type="checkbox" id="[convert]" name="[convert]" /></td> 10 <td style="text-align:left"><l10n>Convert all quotes and dashes in the current document</l10n> </td>10 <td style="text-align:left"><l10n>Convert all quotes and dashes in the current document</l10n> <input style="display:none" type="button" id="[ok]" value="_(OK)" /></td> 11 11 </tr> 12 12 </table> 13 <div style="margin-top: 10px;">14 <input type="button" id="[ok]" value="_(OK)" />15 <input type="button" id="[cancel]" value="_(Cancel)" />16 </div>17 13 </div> 14 <div class="buttons"> 15 16 </div> -
branches/new-dialogs-merge/plugins/SmartReplace/lang/pt_br.js
r901 r1008 1 // I18N constants1 // I18N constants 2 2 // 3 3 // LANG: "pt_br", ENCODING: UTF-8 … … 9 9 // 10 10 // Last revision: 06 september 2007 11 // Please don ´t remove this information11 // Please donÂŽt remove this information 12 12 // If you modify any source, please insert a comment with your name and e-mail 13 13 // … … 17 17 { 18 18 "Cancel": "Cancelar", 19 "Convert all quotes and dashes in the current document": "Converter todas as cita ções e hífens no documento atual",20 "Enable automatic replacements": "Ativar substitui ções automáticas",19 "Convert all quotes and dashes in the current document": "Converter todas as citações e hÃfens no documento atual", 20 "Enable automatic replacements": "Ativar substituições automáticas", 21 21 "OK": "OK", 22 "SmartReplace": "Substitui ção Rápida",23 "SmartReplace Settings": "Configura ções da Substituição Rápida"22 "SmartReplace": "Substituição Rápida", 23 "SmartReplace Settings": "Configurações da Substituição Rápida" 24 24 } -
branches/new-dialogs-merge/plugins/SmartReplace/readme.txt
r990 r1008 2 2 3 3 This plugin lends the good old Word behaviour to Xinha, as ",', and - get converted to their respective typographic correct relatives while typing. 4 It also replaces ... with the ellipsis sign (which is three dots combined in one glyph that is considered typographically better).5 4 6 5 Configuration (to change the quote style from default English): -
branches/new-dialogs-merge/plugins/SmartReplace/smart-replace.js
r999 r1008 2 2 SmartReplace for Xinha 3 3 _______________________ 4 4 5 5 \*------------------------------------------*/ 6 6 … … 15 15 id : "smartreplace", 16 16 tooltip : this._lc("SmartReplace"), 17 image : Xinha.getPluginDir( 'SmartReplace')+"/img/smartquotes.gif",17 image : Xinha.getPluginDir("SmartReplace") + "/img/smartquotes.gif", 18 18 textMode : false, 19 /* action : function(editor) { 20 self.dialog(editor); 21 } 22 }); */ 19 23 action : function(e, objname, obj) { self.buttonPress(null, obj); } 20 24 }); … … 26 30 version : "1.0", 27 31 developer : "Raimund Meyer", 28 developer_url : "http:// x-webservice.net",32 developer_url : "http://rheinauf.de", 29 33 c_owner : "Raimund Meyer", 30 34 sponsor : "", 31 35 sponsor_url : "", 32 license : " LGPL"36 license : "htmlArea" 33 37 }; 34 38 35 39 SmartReplace.prototype._lc = function(string) { 36 return Xinha._lc(string, 'SmartReplace');40 return Xinha._lc(string, 'SmartReplace'); 37 41 }; 38 42 … … 65 69 var self = this; 66 70 Xinha._addEvent( 67 self.editor._doc,71 self.editor._doc, 68 72 "keypress", 69 function (event)70 {71 return self.keyEvent(Xinha.is_ie ? self.editor._iframe.contentWindow.event : event);72 });73 74 var quotes = this.editor.config.SmartReplace.quotes;73 function (event) 74 { 75 return self.keyEvent(Xinha.is_ie ? self.editor._iframe.contentWindow.event : event); 76 }); 77 78 var quotes = this.editor.config.SmartReplace.quotes; 75 79 76 if (quotes && typeof quotes == 'object')77 {78 this.openingQuotes = quotes[0];80 if (quotes && typeof quotes == 'object') 81 { 82 this.openingQuotes = quotes[0]; 79 83 this.closingQuotes = quotes[1]; 80 84 this.openingQuote = quotes[2]; 81 85 this.closingQuote = quotes[3]; 82 }83 else84 {85 this.openingQuotes = this._lc("OpeningDoubleQuotes");86 } 87 else 88 { 89 this.openingQuotes = this._lc("OpeningDoubleQuotes"); 86 90 this.closingQuote = this._lc("ClosingSingleQuote"); 87 91 this.closingQuotes = this._lc("ClosingDoubleQuotes"); 88 92 this.openingQuote = this._lc("OpeningSingleQuote"); 89 }90 93 } 94 91 95 if (this.openingQuotes == 'OpeningDoubleQuotes') //If nothing else is defined, English style as default 92 96 { … … 99 103 100 104 SmartReplace.prototype.keyEvent = function(ev) 101 { 105 { 102 106 if ( !this.active) return true; 103 107 var editor = this.editor; … … 152 156 r.moveStart('character', +1); 153 157 r.text = closing; 154 155 158 } 156 159 else … … 214 217 r.deleteContents(); 215 218 r.collapse(true); 216 if (stopEvent)217 {219 if (stopEvent) 220 { 218 221 Xinha._stopEvent(ev); 219 222 return false 220 }223 } 221 224 } 222 225 editor.getSelection().collapseToEnd(); … … 224 227 return true; 225 228 } 226 227 229 228 230 SmartReplace.prototype.replaceAll = function() … … 264 266 this.editor.setHTML(html); 265 267 } 266 SmartReplace.prototype.dialog = function() 268 269 SmartReplace.prototype.buttonPress = function(opts, obj) 267 270 { 268 271 var self = this; 269 var action = function (param) 270 { 271 self.toggleActivity(param.enable); 272 if (param.convert) 273 { 274 self.replaceAll(); 275 } 276 } 277 var init = this; 278 Dialog(Xinha.getPluginDir('SmartReplace')+'/popups/dialog.html', action, init); 279 } 280 281 282 SmartReplace.prototype.buttonPress = function(opts, obj) 283 { 284 var self = this; 285 286 if ( this._dialog.dialog.rootElem.style.display != 'none') 287 { 288 return this._dialog.hide(); 272 273 if ( this.dialog.rootElem.style.display != 'none') 274 { 275 return this.dialog.hide(); 289 276 } 290 277 var doOK = function() 291 278 { 292 var opts = self. _dialog.hide();279 var opts = self.dialog.hide(); 293 280 self.toggleActivity((opts.enable) ? true : false); 294 281 if (opts.convert) 295 282 { 296 283 self.replaceAll(); 297 self. _dialog.dialog.getElementById("convert").checked = false;284 self.dialog.getElementById("convert").checked = false; 298 285 } 299 286 } … … 303 290 convert: '' 304 291 }; 305 this. _dialog.show(inputs, doOK);292 this.show(inputs, doOK); 306 293 }; 307 294 308 295 SmartReplace.prototype.onGenerateOnce = function() 309 296 { 310 if( !this._dialog)311 {312 this._dialog = new SmartReplace.Dialog(this);313 }314 };315 316 SmartReplace.Dialog = function (mainPluginObject)317 {318 this.Dialog_nxtid = 0;319 this.mainPluginObject = mainPluginObject;320 this.id = { }; // This will be filled below with a replace, nifty321 322 this.ready = false;323 this.files = false;324 this.html = false;325 this.dialog = false;326 327 297 this._prepareDialog(); 328 329 }; 330 331 SmartReplace.Dialog.prototype._prepareDialog = function() 332 { 333 var pluginDialogObject = this; 334 var editor = this.mainPluginObject.editor; 335 336 if(this.html == false) 337 { 338 Xinha._getback(Xinha.getPluginDir('SmartReplace') + '/dialog.html', function(getback) { pluginDialogObject.html = getback; pluginDialogObject._prepareDialog(); }); 339 return; 298 }; 299 300 SmartReplace.prototype._prepareDialog = function() 301 { 302 var self = this; 303 var editor = this.editor; 304 305 if(!this.html) 306 { 307 Xinha._getback( Xinha.getPluginDir("SmartReplace") + '/dialog.html', function(getback) { self.html = getback; self._prepareDialog(); }); 308 return; 340 309 } 341 310 342 311 // Now we have everything we need, so we can build the dialog. 343 this.dialog = new Xinha.Dialog(editor, this.html, 'SmartReplace'); 344 312 this.dialog = new Xinha.Dialog(editor, this.html, 'SmartReplace',{},{modal:false}); 313 this.dialog.attachToPanel('top'); 314 315 this.dialog.getElementById('enable').onchange = function () 316 { 317 self.toggleActivity(this.checked); 318 } 319 this.dialog.getElementById('convert').onchange = function () 320 { 321 self.dialog.getElementById('ok').style.display = ( this.checked ) ? '' : 'none'; 322 } 323 this.dialog.getElementById('ok').onclick = function () 324 { 325 self.replaceAll(); 326 self.dialog.getElementById('convert').checked = false; 327 this.style.display = 'none'; 328 } 345 329 this.ready = true; 346 330 }; 347 331 348 SmartReplace.Dialog.prototype._lc = SmartReplace.prototype._lc; 349 350 SmartReplace.Dialog.prototype.show = function(inputs, ok, cancel) 332 SmartReplace.prototype.show = function(inputs) 351 333 { 352 334 if(!this.ready) 353 335 { 354 var pluginDialogObject= this;355 window.setTimeout(function() {pluginDialogObject.show(inputs,ok,cancel);},100);356 return;336 var self = this; 337 window.setTimeout(function() {self.show(inputs,ok,cancel);},100); 338 return; 357 339 } 358 340 359 341 // Connect the OK and Cancel buttons 360 var dialog = this.dialog; 361 var pluginDialogObject = this; 362 if(ok) 363 { 364 this.dialog.getElementById('ok').onclick = ok; 365 } 366 else 367 { 368 this.dialog.getElementById('ok').onclick = function() {pluginDialogObject.hide();}; 369 } 370 371 if(cancel) 372 { 373 this.dialog.getElementById('cancel').onclick = cancel; 374 } 375 else 376 { 377 this.dialog.getElementById('cancel').onclick = function() { pluginDialogObject.hide()}; 378 } 379 380 // Show the dialog 381 this.mainPluginObject.editor.disableToolbar(['fullscreen','smartreplace']); 342 var self = this; 382 343 383 344 this.dialog.show(inputs); … … 386 347 this.dialog.onresize(); 387 348 }; 388 389 SmartReplace.Dialog.prototype.hide = function()390 {391 this.mainPluginObject.editor.enableToolbar();392 return this.dialog.hide();393 }; -
branches/new-dialogs-merge/plugins/Stylist/stylist.js
r1000 r1008 66 66 Xinha.prototype._fillStylist = function() 67 67 { 68 if(!this._stylist) return false; 69 this.plugins.Stylist.instance.main.innerHTML = ''; 68 if(!this.plugins.Stylist.instance.dialog) return false; 69 var main = this.plugins.Stylist.instance.dialog.main; 70 main.innerHTML = ''; 70 71 71 72 var may_apply = true; … … 180 181 { 181 182 var anch = document.createElement('a'); 182 if ( Xinha.is_real_gecko ) anch.onfocus = function () { this.blur() } // prevent dotted line around link that causes horizontal scrollbar in Mozilla183 anch.onfocus = function () { this.blur() } // prevent dotted line around link that causes horizontal scrollbar 183 184 anch._stylist_className = className.trim(); 184 185 anch._stylist_applied = applied; … … 215 216 } 216 217 217 this.plugins.Stylist.instance.main.appendChild(anch);218 main.appendChild(anch); 218 219 } 219 220 } … … 452 453 Xinha.ripStylesFromCSSFile = function(URL) 453 454 { 455 Xinha.setLoadingMessage('Loading Styles'); 454 456 var css = Xinha._geturlcontent(URL); 455 457 return Xinha.ripStylesFromCSSString(css); … … 505 507 Stylist.prototype.onGenerateOnce = function() 506 508 { 509 var cfg = this.editor.config; 510 if(typeof cfg.css_style != 'undefined' && Xinha.objectProperties(cfg.css_style).length != 0) 511 { 512 this._prepareDialog(); 513 } 514 515 }; 516 Stylist.prototype._prepareDialog = function() 517 { 507 518 var editor = this.editor; 508 519 var stylist = this; 509 if(typeof editor.config.css_style != 'undefined' && Xinha.objectProperties(editor.config.css_style).length != 0) 510 { 511 editor._stylist = null; // This needs to be changes to be Stylist::_stylist sometime 512 editor._stylist = editor.addPanel('right'); 513 Xinha.addClass(editor._stylist, 'stylist'); 514 515 this.caption = document.createElement("h1"); 516 this.caption.innerHTML = Xinha._lc('Styles', 'Stylist'); 517 editor._stylist.appendChild(this.caption); 518 this.main = document.createElement("div"); 519 this.main.style.overflow = "auto"; 520 this.main.style.height = this.editor._framework.ed_cell.offsetHeight - this.caption.offsetHeight + 'px'; 521 522 editor._stylist.appendChild(this.main); 523 524 Xinha.freeLater(this,"caption"); 525 Xinha.freeLater(this,"main"); 526 527 editor.notifyOn('modechange', 528 function(e,args) 529 { 530 switch(args.mode) 531 { 532 case 'text': 533 { 534 editor.hidePanel(editor._stylist); 535 break; 536 } 537 case 'wysiwyg': 538 { 539 editor.showPanel(editor._stylist); 540 break; 541 } 542 } 543 } 544 ); 545 editor.notifyOn('panel_change', 546 function(e,args) 547 { 548 switch (args.action) 549 { 550 case 'show': 551 var newHeight = stylist.main.offsetHeight - args.panel.offsetHeight; 552 stylist.main.style.height = ((newHeight > 0) ? stylist.main.offsetHeight - args.panel.offsetHeight : 0) + 'px'; 553 editor._stylist.style.height = stylist.caption.offsetHeight + "px"; 554 editor.sizeEditor(); 555 break; 556 case 'hide': 557 stylist.resize(); 558 break; 559 } 560 } 561 ); 562 editor.notifyOn('before_resize', 563 function() 564 { 565 editor._stylist.style.height = stylist.caption.offsetHeight + "px"; 566 } 567 ); 568 editor.notifyOn('resize', 569 function() 570 { 571 stylist.resize(); 572 } 573 ); 574 } 575 576 }; 520 521 var html = '<h1><l10n>Styles</l10n></h1>'; 522 523 this.dialog = new Xinha.Dialog(editor, html, 'Stylist',{width:200},{modal:false,closable:false}); 524 Xinha._addClass( this.dialog.rootElem, 'Stylist' ); 525 this.dialog.attachToPanel('right'); 526 this.dialog.show(); 527 528 var dialog = this.dialog; 529 var main = this.dialog.main; 530 var caption = this.dialog.captionBar; 531 532 main.style.overflow = "auto"; 533 main.style.height = this.editor._framework.ed_cell.offsetHeight - caption.offsetHeight + 'px'; 534 535 editor.notifyOn('modechange', 536 function(e,args) 537 { 538 if (!dialog.attached) 539 { 540 return; 541 } 542 switch(args.mode) 543 { 544 case 'text': 545 { 546 dialog.hide(); 547 break; 548 } 549 case 'wysiwyg': 550 { 551 dialog.show(); 552 break; 553 } 554 } 555 } 556 ); 557 editor.notifyOn('panel_change', 558 function(e,args) 559 { 560 if (!dialog.attached) 561 { 562 return; 563 } 564 switch (args.action) 565 { 566 case 'show': 567 var newHeight = main.offsetHeight - args.panel.offsetHeight; 568 main.style.height = ((newHeight > 0) ? main.offsetHeight - args.panel.offsetHeight : 0) + 'px'; 569 dialog.rootElem.style.height = caption.offsetHeight + "px"; 570 editor.sizeEditor(); 571 break; 572 case 'hide': 573 stylist.resize(); 574 break; 575 } 576 } 577 ); 578 editor.notifyOn('before_resize', 579 function() 580 { 581 if (!dialog.attached) 582 { 583 return; 584 } 585 dialog.rootElem.style.height = caption.offsetHeight + "px"; 586 } 587 ); 588 editor.notifyOn('resize', 589 function() 590 { 591 if (!dialog.attached) 592 { 593 return; 594 } 595 stylist.resize(); 596 } 597 ); 598 } 577 599 Stylist.prototype.resize = function() 578 600 { 579 601 var editor = this.editor; 580 var panelContainer = editor._stylist.parentNode; 602 var rootElem = this.dialog.rootElem; 603 604 if (rootElem.style.display == 'none') return; 605 606 var panelContainer = rootElem.parentNode; 581 607 582 608 var newSize = panelContainer.offsetHeight; 583 609 for (var i=0; i < panelContainer.childNodes.length;++i) 584 610 { 585 if (panelContainer.childNodes[i] ==editor._stylist|| !panelContainer.childNodes[i].offsetHeight)611 if (panelContainer.childNodes[i] == rootElem || !panelContainer.childNodes[i].offsetHeight) 586 612 { 587 613 continue; … … 589 615 newSize -= panelContainer.childNodes[i].offsetHeight; 590 616 } 591 editor._stylist.style.height = newSize+ 'px';592 this. main.style.height = newSize - this.caption.offsetHeight+ 'px';617 rootElem.style.height = newSize-5 + 'px'; 618 this.dialog.main.style.height = newSize - this.dialog.captionBar.offsetHeight -5 + 'px'; 593 619 } 594 620 595 621 Stylist.prototype.onUpdateToolbar = function() 596 622 { 597 if(this. editor._stylist)623 if(this.dialog) 598 624 { 599 625 if(this._timeoutID) -
branches/new-dialogs-merge/plugins/SuperClean/dialog.html
r728 r1008 1 1 <h1 id="[h1]"><l10n>Clean up HTML</l10n></h1> 2 <div style="margin-left: 10px;" >2 <div style="margin-left: 10px;" id="[main]"> 3 3 <l10n>Please select from the following cleaning options...</l10n> 4 4 <!--filters--> 5 <div style="margin-top: 10px;">6 <input type="button" id="[ok]" value="_(OK)" />7 <input type="button" id="[cancel]" value="_(Cancel)" />8 </div>9 5 </div> 6 7 <div id="[waiting]" style="display:none;margin:3em 1em;text-align:center"><l10n>Please stand by while cleaning in process...</l10n></div> 8 <div id="[alert]" style="display:none;margin:3em 1em;text-align:center"></l10n></div> 9 10 <div class="buttons" id="[buttons]"> 11 <input type="button" id="[ok]" value="_(OK)" /> 12 <input type="button" id="[cancel]" value="_(Cancel)" /> 13 </div> -
branches/new-dialogs-merge/plugins/SuperClean/lang/de.js
r677 r1008 14 14 "Cancel": "Abbrechen", 15 15 "Tidy failed. Check your HTML for syntax errors.": "SÀubern fehlgeschlagen. ÃberprÃŒfen Sie Ihren Code auf Fehler.", 16 "You don't have anything to tidy!": "Es gibt nichts zu sÀubern...!" 16 "You don't have anything to tidy!": "Es gibt nichts zu sÀubern...!", 17 "Please stand by while cleaning in process..." : "Bitte warten Sie, wÀhrend die SÀuberung lÀuft..." 17 18 }; -
branches/new-dialogs-merge/plugins/SuperClean/lang/pt_br.js
r901 r1008 1 // I18N constants1 // I18N constants 2 2 // 3 3 // LANG: "pt_br", ENCODING: UTF-8 … … 9 9 // 10 10 // Last revision: 06 september 2007 11 // Please don ´t remove this information11 // Please donÂŽt remove this information 12 12 // If you modify any source, please insert a comment with your name and e-mail 13 13 // … … 17 17 { 18 18 "Cancel": "", 19 "Clean bad HTML from Microsoft Word": "Limpar c ódigos mal formatados do Microsoft Word",19 "Clean bad HTML from Microsoft Word": "Limpar códigos mal formatados do Microsoft Word", 20 20 "Clean up HTML": "Limpar HTML", 21 "General tidy up and correction of some problems.": "Limpesa geral e corre ção de alguns problemas.",21 "General tidy up and correction of some problems.": "Limpesa geral e correção de alguns problemas.", 22 22 "OK": "", 23 "Please select from the following cleaning options...": "Por favor, selecione uma das op ções de limpesa...",23 "Please select from the following cleaning options...": "Por favor, selecione uma das opções de limpesa...", 24 24 "Remove custom font sizes.": "Remover tamanho de fontes personalizados (font size).", 25 25 "Remove custom text colors.": "Remover cores de texto personalizados (font color).", … … 29 29 // not find with lc_parse_strings.php 30 30 "Tidy failed. Check your HTML for syntax errors.": "Limpesa falhou. Verifique seu HTML por erros de sintaxe.", 31 "You don't have anything to tidy!": "Voc ê não possui nada para limpar!"31 "You don't have anything to tidy!": "Você não possui nada para limpar!" 32 32 } 33 33 -
branches/new-dialogs-merge/plugins/SuperClean/super-clean.js
r999 r1008 37 37 var doOK = function() 38 38 { 39 var opts = superclean._dialog.hide(); 39 superclean._dialog.dialog.getElementById("main").style.display = "none"; 40 superclean._dialog.dialog.getElementById("waiting").style.display = ""; 41 superclean._dialog.dialog.getElementById("buttons").style.display = "none"; 42 43 var opts = superclean._dialog.dialog.getValues(); 40 44 var editor = superclean.editor; 41 45 … … 66 70 case 'setHTML': 67 71 editor.setHTML(response.value); 72 superclean._dialog.hide(); 68 73 break; 69 74 case 'alert': 70 alert(superclean._lc(response.value)); 75 superclean._dialog.dialog.getElementById("buttons").style.display = ""; 76 superclean._dialog.dialog.getElementById("ok").style.display = "none"; 77 superclean._dialog.dialog.getElementById("waiting").style.display = "none"; 78 superclean._dialog.dialog.getElementById("alert").style.display = ""; 79 superclean._dialog.dialog.getElementById("alert").innerHTML = superclean._lc(response.value); 80 break; 81 default: // make the dialog go away if sth goes wrong, who knows... 82 superclean._dialog.hide(); 71 83 break; 72 84 } 73 85 } 74 86 Xinha._postback(editor.config.SuperClean.tidy_handler, {'content' : editor.getInnerHTML()},callback); 87 } 88 else 89 { 90 superclean._dialog.hide(); 75 91 } 76 92 return true; … … 189 205 190 206 191 SuperClean.prototype.onGenerate = function()207 SuperClean.prototype.onGenerateOnce = function() 192 208 { 193 209 if(this.editor.config.SuperClean.show_dialog && !this._dialog) … … 206 222 } 207 223 224 this.loadFilters(); 225 }; 226 SuperClean.prototype.loadFilters = function() 227 { 208 228 var sc = this; 209 229 //load the filter-functions … … 222 242 function(func) { 223 243 eval('SuperClean.filterFunctions.'+filter+'='+func+';'); 224 sc. onGenerate();244 sc.loadFilters(); 225 245 }); 226 246 } … … 228 248 } 229 249 } 230 } ;250 } 231 251 // Inline Dialog for SuperClean 232 252 … … 256 276 if(this.html == false) 257 277 { 258 Xinha._getback( Xinha.getPluginDir("SuperClean") + '/dialog.html', function(txt) { lDialog.html = txt; lDialog._prepareDialog(); });278 Xinha._getback( Xinha.getPluginDir("SuperClean") + '/dialog.html', function(txt) { lDialog.html = txt; lDialog._prepareDialog(); }); 259 279 return; 260 280 } … … 282 302 283 303 // Now we have everything we need, so we can build the dialog. 284 var dialog = this.dialog = new Xinha.Dialog(SuperClean.editor, this.html, 'SuperClean' );304 var dialog = this.dialog = new Xinha.Dialog(SuperClean.editor, this.html, 'SuperClean',{width:400}); 285 305 286 306 this.ready = true; … … 331 351 { 332 352 this.SuperClean.editor.enableToolbar(); 353 this.dialog.getElementById("main").style.display = ""; 354 this.dialog.getElementById("buttons").style.display = ""; 355 this.dialog.getElementById("waiting").style.display = "none"; 356 this.dialog.getElementById("alert").style.display = "none"; 357 this.dialog.getElementById("ok").style.display = ""; 333 358 return this.dialog.hide(); 334 359 }; -
branches/new-dialogs-merge/plugins/TableOperations/lang/ru.js
r901 r1008 1 // I18N constants1 // I18N constants 2 2 // LANG: "ru", ENCODING: UTF-8 3 3 // Author: Andrei Blagorazumov, a@fnr.ru 4 4 { 5 "Align": "Выравнивание", 6 "All four sides": "Все 4 стороны", 7 "Background": "Фон", 8 "Baseline": "Базовая линия", 9 "Border": "Рамка", 10 "Borders": "Рамки", 11 "Bottom": "Низ", 12 "Style [CSS]": "Стиль [CSS]", 13 "Caption": "Заголовок", 14 "Cell Properties": "Свойства ячеек", 15 "Center": "Центр", 16 "Char": "Символ", 17 "Collapsed borders": "Накладывающиеся рамки", 18 "Color": "Цвет", 19 "Description": "Описание", 20 "FG Color": "Цвет переднего плана", 21 "Float": "Обтекание", 22 "Frames": "Фреймы", 23 "Height": "Высота", 24 "How many columns would you like to merge?": "Сколько столбцов вы хотите объединить?", 25 "How many rows would you like to merge?": "Сколько строк вы хотите объединить?", 26 "Image URL": "URL картинки", 27 "Justify": "По правому краю", 28 "Layout": "Раскладка", 29 "Left": "Лево", 30 "Margin": "Отступ", 31 "Middle": "Середина", 32 "No rules": "Нет линейки", 33 "No sides": "Нет сторон", 34 "None": "Ничего", 35 "Padding": "Поля", 36 "Please click into some cell": "Пожалуйста щелкните в некоторые ячейки", 37 "Right": "Право", 38 "Row Properties": "Свойства строк", 39 "Rules will appear between all rows and columns": "Линейки появятся между всеми строками и столбцами", 40 "Rules will appear between columns only": "Линейки появятся только между столбцами", 41 "Rules will appear between rows only": "Линейки появятся только между строками", 42 "Rules": "Линейки", 43 "Spacing and padding": "Поля и отступы", 44 "Spacing": "Отступы", 45 "Summary": "Сводка", 46 "Delete cell": "Удалить ячейку", 47 "Insert cell after": "Вставить ячейку после", 48 "Insert cell before": "Вставить ячейку до", 49 "Merge cells": "Объединить ячейки", 50 "Cell properties": "Свойства ячеек", 51 "Split cell": "Разделить ячейку", 52 "Delete column": "Удалить столбец", 53 "Insert column after": "Вставить столбец после", 54 "Insert column before": "Вставить столбец до", 55 "Split column": "Разделить столбец", 56 "Delete row": "Удалить строку", 57 "Insert row before": "Вставить строку до", 58 "Insert row after": "Вставить строку после", 59 "Row properties": "Свойства строки", 60 "Split row": "Разделить строку", 61 "Table properties": "Свойства таблиц", 62 "Table Properties": "Свойства таблиц", 63 "Text align": "Выравнивание теста", 64 "The bottom side only": "Только нижний край", 65 "The left-hand side only": "Только левый край", 66 "The right and left sides only": "Только левый и правый край", 67 "The right-hand side only": "Только правый край", 68 "The top and bottom sides only": "Только верхний и нижний край", 69 "The top side only": "Только верхний край", 70 "Top": "Верх", 71 "Unset color": "Отменить цвет", 72 "Vertical align": "Вертикальное выравнивание", 73 "Width": "Ширина", 74 "Xinha cowardly refuses to delete the last cell in row.": "Xinha отказалась удалять последнюю ячейку в строке.", 75 "Xinha cowardly refuses to delete the last column in table.": "Xinha отказалась удалять последний столбец в таблице.", 76 "Xinha cowardly refuses to delete the last row in table.": "Xinha отказалась удалять последнюю строку в таблице.", 77 "percent": "процентов", 78 "pixels": "пикселей" 5 "Align": "ÐÑÑавМОваМОе", 6 "All four sides": "ÐÑе 4 ÑÑПÑПМÑ", 7 "Background": "ЀПМ", 8 "Baseline": "ÐÐ°Ð·ÐŸÐ²Ð°Ñ Ð»ÐžÐœÐžÑ", 9 "Border": "РаЌка", 10 "Borders": "РаЌкО", 11 "Bottom": "ÐОз", 12 "Style [CSS]": "СÑÐžÐ»Ñ [CSS]", 13 "Caption": "ÐагПлПвПк", 14 "Cell Properties": "СвПйÑÑва ÑÑеек", 15 "Center": "ЊеМÑÑ", 16 "Char": "СОЌвПл", 17 "Collapsed borders": "ÐаклаЎÑваÑÑОеÑÑ ÑаЌкО", 18 "Color": "ЊвеÑ", 19 "Description": "ÐпОÑаМОе", 20 "FG Color": "ÐŠÐ²ÐµÑ Ð¿ÐµÑеЎМегП плаМа", 21 "Float": "ÐбÑекаМОе", 22 "Frames": "ЀÑейЌÑ", 23 "Height": "ÐÑÑПÑа", 24 "How many columns would you like to merge?": "СкПлÑкП ÑÑПлбÑПв Ð²Ñ Ñ 25 ПÑОÑе ПбÑеЎОМОÑÑ?", 26 "How many rows would you like to merge?": "СкПлÑкП ÑÑÑПк Ð²Ñ Ñ 27 ПÑОÑе ПбÑеЎОМОÑÑ?", 28 "Image URL": "URL каÑÑОМкО", 29 "Justify": "ÐП пÑÐ°Ð²ÐŸÐŒÑ ÐºÑаÑ", 30 "Layout": "РаÑклаЎка", 31 "Left": "ÐевП", 32 "Margin": "ÐÑÑÑÑп", 33 "Middle": "СеÑеЎОМа", 34 "No rules": "ÐÐµÑ Ð»ÐžÐœÐµÐ¹ÐºÐž", 35 "No sides": "ÐÐµÑ ÑÑПÑПМ", 36 "None": "ÐОÑегП", 37 "Padding": "ÐПлÑ", 38 "Please click into some cell": "ÐПжалÑйÑÑа ÑелкМОÑе в МекПÑПÑÑе ÑÑейкО", 39 "Right": "ÐÑавП", 40 "Row Properties": "СвПйÑÑва ÑÑÑПк", 41 "Rules will appear between all rows and columns": "ÐОМейкО пПÑвÑÑÑÑ ÐŒÐµÐ¶ÐŽÑ Ð²ÑеЌО ÑÑÑПкаЌО О ÑÑПлбÑаЌО", 42 "Rules will appear between columns only": "ÐОМейкО пПÑвÑÑÑÑ ÑПлÑкП ÐŒÐµÐ¶ÐŽÑ ÑÑПлбÑаЌО", 43 "Rules will appear between rows only": "ÐОМейкО пПÑвÑÑÑÑ ÑПлÑкП ÐŒÐµÐ¶ÐŽÑ ÑÑÑПкаЌО", 44 "Rules": "ÐОМейкО", 45 "Spacing and padding": "ÐÐŸÐ»Ñ Ðž ПÑÑÑÑпÑ", 46 "Spacing": "ÐÑÑÑÑпÑ", 47 "Summary": "СвПЎка", 48 "Delete cell": "УЎалОÑÑ ÑÑейкÑ", 49 "Insert cell after": "ÐÑÑавОÑÑ ÑÑÐµÐ¹ÐºÑ Ð¿ÐŸÑле", 50 "Insert cell before": "ÐÑÑавОÑÑ ÑÑÐµÐ¹ÐºÑ ÐŽÐŸ", 51 "Merge cells": "ÐбÑеЎОМОÑÑ ÑÑейкО", 52 "Cell properties": "СвПйÑÑва ÑÑеек", 53 "Split cell": "РазЎелОÑÑ ÑÑейкÑ", 54 "Delete column": "УЎалОÑÑ ÑÑПлбеÑ", 55 "Insert column after": "ÐÑÑавОÑÑ ÑÑÐŸÐ»Ð±ÐµÑ Ð¿ÐŸÑле", 56 "Insert column before": "ÐÑÑавОÑÑ ÑÑÐŸÐ»Ð±ÐµÑ ÐŽÐŸ", 57 "Split column": "РазЎелОÑÑ ÑÑПлбеÑ", 58 "Delete row": "УЎалОÑÑ ÑÑÑПкÑ", 59 "Insert row before": "ÐÑÑавОÑÑ ÑÑÑÐŸÐºÑ ÐŽÐŸ", 60 "Insert row after": "ÐÑÑавОÑÑ ÑÑÑÐŸÐºÑ Ð¿ÐŸÑле", 61 "Row properties": "СвПйÑÑва ÑÑÑПкО", 62 "Split row": "РазЎелОÑÑ ÑÑÑПкÑ", 63 "Table properties": "СвПйÑÑва ÑаблОÑ", 64 "Table Properties": "СвПйÑÑва ÑаблОÑ", 65 "Text align": "ÐÑÑавМОваМОе ÑеÑÑа", 66 "The bottom side only": "ТПлÑкП МОжМОй кÑай", 67 "The left-hand side only": "ТПлÑкП левÑй кÑай", 68 "The right and left sides only": "ТПлÑкП левÑй О пÑавÑй кÑай", 69 "The right-hand side only": "ТПлÑкП пÑавÑй кÑай", 70 "The top and bottom sides only": "ТПлÑкП веÑÑ 71 МОй О МОжМОй кÑай", 72 "The top side only": "ТПлÑкП веÑÑ 73 МОй кÑай", 74 "Top": "ÐеÑÑ 75 ", 76 "Unset color": "ÐÑЌеМОÑÑ ÑвеÑ", 77 "Vertical align": "ÐеÑÑОкалÑМПе вÑÑавМОваМОе", 78 "Width": "КОÑОМа", 79 "Xinha cowardly refuses to delete the last cell in row.": "Xinha ПÑказалаÑÑ ÑЎалÑÑÑ Ð¿ÐŸÑлеЎМÑÑ ÑÑÐµÐ¹ÐºÑ Ð² ÑÑÑПке.", 80 "Xinha cowardly refuses to delete the last column in table.": "Xinha ПÑказалаÑÑ ÑЎалÑÑÑ Ð¿ÐŸÑлеЎМОй ÑÑÐŸÐ»Ð±ÐµÑ Ð² ÑаблОÑе.", 81 "Xinha cowardly refuses to delete the last row in table.": "Xinha ПÑказалаÑÑ ÑЎалÑÑÑ Ð¿ÐŸÑлеЎМÑÑ ÑÑÑÐŸÐºÑ Ð² ÑаблОÑе.", 82 "percent": "пÑПÑеМÑПв", 83 "pixels": "пОкÑелей" 79 84 }; -
branches/new-dialogs-merge/plugins/TableOperations/table-operations.js
r999 r1008 11 11 // http://dynarch.com/mishoo 12 12 // 13 // $Id :table-operations.js 988 2008-04-12 13:46:09Z ray$13 // $Id$ 14 14 15 15 // Object that will encapsulate all the table operations provided by … … 18 18 { 19 19 'showButtons' : true // Set to false to hide all but inserttable and toggleborders buttons on the toolbar 20 // this is useful if you have the ContextMenu plugin and want to save toolbar space21 // (the context menu can perform all the button operations)20 // this is useful if you have the ContextMenu plugin and want to save toolbar space 21 // (the context menu can perform all the button operations) 22 22 } 23 23 … … 35 35 36 36 var toolbar = ["linebreak", "inserttable", "toggleborders"]; 37 37 38 38 39 39 for (var i = 0; i < bl.length; ++i) { … … 56 56 cfg.toolbar.push(toolbar); 57 57 58 if ( typeof PopupWin == 'undefined' )58 if ( typeof PopupWin == 'undefined' ) 59 59 { 60 Xinha._loadback(_editor_url + 'modules/Dialogs/popupwin.js');60 Xinha._loadback(_editor_url + 'modules/Dialogs/popupwin.js'); 61 61 } 62 if ( typeof Xinha.InlineStyler == 'undefined' ) 63 { 64 Xinha._loadback(_editor_url + 'modules/InlineStyler/InlineStyler.js'); 65 } 66 62 67 } 63 68 … … 74 79 75 80 TableOperations.prototype._lc = function(string) { 76 return Xinha._lc(string, 'TableOperations');81 return Xinha._lc(string, 'TableOperations'); 77 82 }; 78 83 … … 96 101 } 97 102 return ret; 98 };99 100 // this function requires the file PopupDiv/PopupWin to be loaded from browser101 TableOperations.prototype.dialogTableProperties = function() {102 // retrieve existing values103 var table = this.getClosest("table");104 // this.editor.selectNodeContents(table);105 // this.editor.updateToolbar();106 107 var dialog = new PopupWin(this.editor, Xinha._lc("Table Properties", "TableOperations"), function(dialog, params) {108 TableOperations.processStyle(params, table);109 for (var i in params) {110 if(typeof params[i] == 'function') continue;111 var val = params[i];112 switch (i) {113 case "f_caption":114 if (/\S/.test(val)) {115 // contains non white-space characters116 var caption = table.getElementsByTagName("caption")[0];117 if (!caption) {118 caption = dialog.editor._doc.createElement("caption");119 table.insertBefore(caption, table.firstChild);120 }121 caption.innerHTML = val;122 } else {123 // search for caption and delete it if found124 var caption = table.getElementsByTagName("caption")[0];125 if (caption) {126 caption.parentNode.removeChild(caption);127 }128 }129 break;130 case "f_summary":131 table.summary = val;132 break;133 case "f_width":134 table.style.width = ("" + val) + params.f_unit;135 break;136 case "f_align":137 table.align = val;138 break;139 case "f_spacing":140 table.cellSpacing = val;141 break;142 case "f_padding":143 table.cellPadding = val;144 break;145 case "f_borders":146 table.border = val;147 break;148 case "f_frames":149 table.frame = val;150 break;151 case "f_rules":152 table.rules = val;153 break;154 }155 }156 // various workarounds to refresh the table display (Gecko,157 // what's going on?! do not disappoint me!)158 dialog.editor.forceRedraw();159 dialog.editor.focusEditor();160 dialog.editor.updateToolbar();161 var save_collapse = table.style.borderCollapse;162 table.style.borderCollapse = "collapse";163 table.style.borderCollapse = "separate";164 table.style.borderCollapse = save_collapse;165 },166 167 // this function gets called when the dialog needs to be initialized168 function (dialog) {169 170 var f_caption = "";171 var capel = table.getElementsByTagName("caption")[0];172 if (capel) {173 f_caption = capel.innerHTML;174 }175 var f_summary = table.summary;176 var f_width = parseInt(table.style.width);177 isNaN(f_width) && (f_width = "");178 var f_unit = /%/.test(table.style.width) ? 'percent' : 'pixels';179 var f_align = table.align;180 var f_spacing = table.cellSpacing;181 var f_padding = table.cellPadding;182 var f_borders = table.border;183 var f_frames = table.frame;184 var f_rules = table.rules;185 186 function selected(val) {187 return val ? " selected" : "";188 }189 190 // dialog contents191 dialog.content.style.width = "400px";192 dialog.content.innerHTML = " \193 <div class='title'>" + Xinha._lc("Table Properties", "TableOperations") + "\194 </div> \195 <table style='width:100%'> \196 <tr> \197 <td> \198 <fieldset><legend>" + Xinha._lc("Description", "TableOperations") + "</legend> \199 <table style='width:100%'> \200 <tr> \201 <td class='label'>" + Xinha._lc("Caption", "TableOperations") + ":</td> \202 <td class='value'><input type='text' name='f_caption' value='" + f_caption + "'/></td> \203 </tr><tr> \204 <td class='label'>" + Xinha._lc("Summary", "TableOperations") + ":</td> \205 <td class='value'><input type='text' name='f_summary' value='" + f_summary + "'/></td> \206 </tr> \207 </table> \208 </fieldset> \209 </td> \210 </tr> \211 <tr><td id='--HA-layout'></td></tr> \212 <tr> \213 <td> \214 <fieldset><legend>" + Xinha._lc("Spacing and padding", "TableOperations") + "</legend> \215 <table style='width:100%'> \216 "+// <tr> \217 // <td class='label'>" + Xinha._lc("Width", "TableOperations") + ":</td> \218 // <td><input type='text' name='f_width' value='" + f_width + "' size='5' /> \219 // <select name='f_unit'> \220 // <option value='%'" + selected(f_unit == "percent") + ">" + Xinha._lc("percent", "TableOperations") + "</option> \221 // <option value='px'" + selected(f_unit == "pixels") + ">" + Xinha._lc("pixels", "TableOperations") + "</option> \222 // </select> " + Xinha._lc("Align", "TableOperations") + ": \223 // <select name='f_align'> \224 // <option value='left'" + selected(f_align == "left") + ">" + Xinha._lc("Left", "TableOperations") + "</option> \225 // <option value='center'" + selected(f_align == "center") + ">" + Xinha._lc("Center", "TableOperations") + "</option> \226 // <option value='right'" + selected(f_align == "right") + ">" + Xinha._lc("Right", "TableOperations") + "</option> \227 // </select> \228 // </td> \229 // </tr> \230 " <tr> \231 <td class='label'>" + Xinha._lc("Spacing", "TableOperations") + ":</td> \232 <td><input type='text' name='f_spacing' size='5' value='" + f_spacing + "' /> " + Xinha._lc("Padding", "TableOperations") + ":\233 <input type='text' name='f_padding' size='5' value='" + f_padding + "' /> " + Xinha._lc("pixels", "TableOperations") + "\234 </td> \235 </tr> \236 </table> \237 </fieldset> \238 </td> \239 </tr> \240 <tr> \241 <td> \242 <fieldset><legend>" + Xinha._lc("Frame and borders", "TableOperations") + "</legend> \243 <table width='100%'> \244 <tr> \245 <td class='label'>" + Xinha._lc("Borders", "TableOperations") + ":</td> \246 <td><input name='f_borders' type='text' size='5' value='" + f_borders + "' /> " + Xinha._lc("pixels", "TableOperations") + "</td> \247 </tr> \248 <tr> \249 <td class='label'>" + Xinha._lc("Frames", "TableOperations") + ":</td> \250 <td> \251 <select name='f_frames'> \252 <option value='void'" + selected(f_frames == "void") + ">" + Xinha._lc("No sides", "TableOperations") + "</option> \253 <option value='above'" + selected(f_frames == "above") + ">" + Xinha._lc("The top side only", "TableOperations") + "</option> \254 <option value='below'" + selected(f_frames == "below") + ">" + Xinha._lc("The bottom side only", "TableOperations") + "</option> \255 <option value='hsides'" + selected(f_frames == "hsides") + ">" + Xinha._lc("The top and bottom sides only", "TableOperations") + "</option> \256 <option value='vsides'" + selected(f_frames == "vsides") + ">" + Xinha._lc("The right and left sides only", "TableOperations") + "</option> \257 <option value='lhs'" + selected(f_frames == "lhs") + ">" + Xinha._lc("The left-hand side only", "TableOperations") + "</option> \258 <option value='rhs'" + selected(f_frames == "rhs") + ">" + Xinha._lc("The right-hand side only", "TableOperations") + "</option> \259 <option value='box'" + selected(f_frames == "box") + ">" + Xinha._lc("All four sides", "TableOperations") + "</option> \260 </select> \261 </td> \262 </tr> \263 <tr> \264 <td class='label'>" + Xinha._lc("Rules", "TableOperations") + ":</td> \265 <td> \266 <select name='f_rules'> \267 <option value='none'" + selected(f_rules == "none") + ">" + Xinha._lc("No rules", "TableOperations") + "</option> \268 <option value='rows'" + selected(f_rules == "rows") + ">" + Xinha._lc("Rules will appear between rows only", "TableOperations") + "</option> \269 <option value='cols'" + selected(f_rules == "cols") + ">" + Xinha._lc("Rules will appear between columns only", "TableOperations") + "</option> \270 <option value='all'" + selected(f_rules == "all") + ">" + Xinha._lc("Rules will appear between all rows and columns", "TableOperations") + "</option> \271 </select> \272 </td> \273 </tr> \274 </table> \275 </fieldset> \276 </td> \277 </tr> \278 <tr> \279 <td id='--HA-style'></td> \280 </tr> \281 </table> \282 ";283 var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, table);284 var p = dialog.doc.getElementById("--HA-style");285 p.appendChild(st_prop);286 var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, table);287 p = dialog.doc.getElementById("--HA-layout");288 p.appendChild(st_layout);289 dialog.modal = true;290 dialog.addButtons("OK", "Cancel");291 dialog.showAtElement(dialog.editor._iframe, "c");292 });293 };294 295 // this function requires the file PopupDiv/PopupWin to be loaded from browser296 TableOperations.prototype.dialogRowCellProperties = function(cell) {297 // retrieve existing values298 var element = this.getClosest(cell ? "td" : "tr");299 var table = this.getClosest("table");300 // this.editor.selectNodeContents(element);301 // this.editor.updateToolbar();302 303 var dialog = new PopupWin(this.editor, cell ? Xinha._lc("Cell Properties", "TableOperations") : Xinha._lc("Row Properties", "TableOperations"), function(dialog, params) {304 TableOperations.processStyle(params, element);305 for (var i in params) {306 if(typeof params[i] == 'function') continue;307 var val = params[i];308 switch (i) {309 case "f_align":310 element.align = val;311 break;312 case "f_char":313 element.ch = val;314 break;315 case "f_valign":316 element.vAlign = val;317 break;318 }319 }320 // various workarounds to refresh the table display (Gecko,321 // what's going on?! do not disappoint me!)322 dialog.editor.forceRedraw();323 dialog.editor.focusEditor();324 dialog.editor.updateToolbar();325 var save_collapse = table.style.borderCollapse;326 table.style.borderCollapse = "collapse";327 table.style.borderCollapse = "separate";328 table.style.borderCollapse = save_collapse;329 },330 331 // this function gets called when the dialog needs to be initialized332 function (dialog) {333 334 var f_align = element.align;335 var f_valign = element.vAlign;336 var f_char = element.ch;337 338 function selected(val) {339 return val ? " selected" : "";340 }341 342 // dialog contents343 dialog.content.style.width = "400px";344 dialog.content.innerHTML = " \345 <div class='title'>" + Xinha._lc(cell ? "Cell Properties" : "Row Properties", "TableOperations") + "</div> \346 <table style='width:100%'> \347 <tr> \348 <td id='--HA-layout'> \349 "+// <fieldset><legend>" + Xinha._lc("Layout", "TableOperations") + "</legend> \350 // <table style='width:100%'> \351 // <tr> \352 // <td class='label'>" + Xinha._lc("Align", "TableOperations") + ":</td> \353 // <td> \354 // <select name='f_align'> \355 // <option value='left'" + selected(f_align == "left") + ">" + Xinha._lc("Left", "TableOperations") + "</option> \356 // <option value='center'" + selected(f_align == "center") + ">" + Xinha._lc("Center", "TableOperations") + "</option> \357 // <option value='right'" + selected(f_align == "right") + ">" + Xinha._lc("Right", "TableOperations") + "</option> \358 // <option value='char'" + selected(f_align == "char") + ">" + Xinha._lc("Char", "TableOperations") + "</option> \359 // </select> \360 // " + Xinha._lc("Char", "TableOperations") + ": \361 // <input type='text' style='font-family: monospace; text-align: center' name='f_char' size='1' value='" + f_char + "' /> \362 // </td> \363 // </tr><tr> \364 // <td class='label'>" + Xinha._lc("Vertical align", "TableOperations") + ":</td> \365 // <td> \366 // <select name='f_valign'> \367 // <option value='top'" + selected(f_valign == "top") + ">" + Xinha._lc("Top", "TableOperations") + "</option> \368 // <option value='middle'" + selected(f_valign == "middle") + ">" + Xinha._lc("Middle", "TableOperations") + "</option> \369 // <option value='bottom'" + selected(f_valign == "bottom") + ">" + Xinha._lc("Bottom", "TableOperations") + "</option> \370 // <option value='baseline'" + selected(f_valign == "baseline") + ">" + Xinha._lc("Baseline", "TableOperations") + "</option> \371 // </select> \372 // </td> \373 // </tr> \374 // </table> \375 // </fieldset> \376 " </td> \377 </tr> \378 <tr> \379 <td id='--HA-style'></td> \380 </tr> \381 </table> \382 ";383 var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, element);384 var p = dialog.doc.getElementById("--HA-style");385 p.appendChild(st_prop);386 var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, element);387 p = dialog.doc.getElementById("--HA-layout");388 p.appendChild(st_layout);389 dialog.modal = true;390 dialog.addButtons("OK", "Cancel");391 dialog.showAtElement(dialog.editor._iframe, "c");392 });393 103 }; 394 104 … … 519 229 // ROWS 520 230 521 case "TO-row-insert-above":522 case "TO-row-insert-under":231 case "TO-row-insert-above": 232 case "TO-row-insert-under": 523 233 var tr = this.getClosest("tr"); 524 234 if (!tr) { … … 531 241 editor.focusEditor(); 532 242 break; 533 case "TO-row-delete":243 case "TO-row-delete": 534 244 var tr = this.getClosest("tr"); 535 245 if (!tr) { … … 549 259 editor.updateToolbar(); 550 260 break; 551 case "TO-row-split":261 case "TO-row-split": 552 262 var td = this.getClosest("td"); 553 263 if (!td) { … … 559 269 // COLUMNS 560 270 561 case "TO-col-insert-before":562 case "TO-col-insert-after":271 case "TO-col-insert-before": 272 case "TO-col-insert-after": 563 273 var td = this.getClosest("td"); 564 274 if (!td) { … … 567 277 var rows = td.parentNode.parentNode.rows; 568 278 var index = td.cellIndex; 569 var lastColumn = (td.parentNode.cells.length == index + 1);279 var lastColumn = (td.parentNode.cells.length == index + 1); 570 280 for (var i = rows.length; --i >= 0;) { 571 281 var tr = rows[i]; 572 282 var otd = editor._doc.createElement("td"); 573 283 otd.innerHTML = mozbr; 574 if (lastColumn && Xinha.is_ie)575 {576 tr.insertBefore(otd);577 }578 else579 {580 var ref = tr.cells[index + (/after/.test(button_id) ? 1 : 0)];581 tr.insertBefore(otd, ref);582 }284 if (lastColumn && Xinha.is_ie) 285 { 286 tr.insertBefore(otd); 287 } 288 else 289 { 290 var ref = tr.cells[index + (/after/.test(button_id) ? 1 : 0)]; 291 tr.insertBefore(otd, ref); 292 } 583 293 } 584 294 editor.focusEditor(); 585 295 break; 586 case "TO-col-split":296 case "TO-col-split": 587 297 var td = this.getClosest("td"); 588 298 if (!td) { … … 591 301 splitCol(td); 592 302 break; 593 case "TO-col-delete":303 case "TO-col-delete": 594 304 var td = this.getClosest("td"); 595 305 if (!td) { … … 615 325 // CELLS 616 326 617 case "TO-cell-split":327 case "TO-cell-split": 618 328 var td = this.getClosest("td"); 619 329 if (!td) { … … 622 332 splitCell(td); 623 333 break; 624 case "TO-cell-insert-before":625 case "TO-cell-insert-after":334 case "TO-cell-insert-before": 335 case "TO-cell-insert-after": 626 336 var td = this.getClosest("td"); 627 337 if (!td) { … … 635 345 editor.focusEditor(); 636 346 break; 637 case "TO-cell-delete":347 case "TO-cell-delete": 638 348 var td = this.getClosest("td"); 639 349 if (!td) { … … 650 360 editor.updateToolbar(); 651 361 break; 652 case "TO-cell-merge":362 case "TO-cell-merge": 653 363 //Mozilla, as opposed to IE, allows the selection of several cells, which is fine :) 654 364 var sel = editor._getSelection(); … … 707 417 // PROPERTIES 708 418 709 case "TO-table-prop":419 case "TO-table-prop": 710 420 this.dialogTableProperties(); 711 421 break; 712 422 713 case "TO-row-prop":423 case "TO-row-prop": 714 424 this.dialogRowCellProperties(false); 715 425 break; 716 426 717 case "TO-cell-prop":427 case "TO-cell-prop": 718 428 this.dialogRowCellProperties(true); 719 429 break; 720 430 721 default:431 default: 722 432 alert("Button [" + button_id + "] not yet implemented"); 723 433 } … … 727 437 TableOperations.btnList = [ 728 438 // table properties button 729 ["table-prop", "table", "Table properties"],439 ["table-prop", "table", "Table properties"], 730 440 null, // separator 731 441 … … 754 464 ]; 755 465 756 757 758 //// GENERIC CODE [style of any element; this should be moved into a separate 759 //// file as it'll be very useful] 760 //// BEGIN GENERIC CODE ----------------------------------------------------- 761 762 TableOperations.getLength = function(value) { 763 var len = parseInt(value); 764 if (isNaN(len)) { 765 len = ""; 766 } 767 return len; 466 TableOperations.prototype.dialogTableProperties = function() { 467 468 var table = this.getClosest("table"); 469 var self = this; 470 var editor = this.editor; 471 472 if(!this.dialogTablePropertiesHtml){ // retrieve the raw dialog contents 473 Xinha._getback( Xinha.getPluginDir("TableOperations") + '/popups/dialogTable.html', function(getback) { self.dialogTablePropertiesHtml = getback; self.dialogTableProperties(); }); 474 return; 475 } 476 if (!this.dialogTable) { 477 // Now we have everything we need, so we can build the dialog. 478 this.dialogTable = new Xinha.Dialog(editor, this.dialogTablePropertiesHtml, 'TableOperations',{width:440}) 479 this.dialogTable.getElementById('cancel').onclick = function() { self.dialogTable.hide()}; 480 } 481 var dialog = this.dialogTable; 482 483 var Styler = new Xinha.InlineStyler(table, this.editor); 484 485 function apply() { 486 var params = dialog.hide(); 487 Styler.applyStyle(params); 488 489 for (var i in params) { 490 if(typeof params[i] == 'function') continue; 491 var val = params[i]; 492 if (typeof val == 'object' && val.tagName) val = val.value; 493 switch (i) { 494 case "caption": 495 if (/\S/.test(val)) { 496 // contains non white-space characters 497 var caption = table.getElementsByTagName("caption")[0]; 498 if (!caption) { 499 caption = dialog.editor._doc.createElement("caption"); 500 table.insertBefore(caption, table.firstChild); 501 } 502 caption.innerHTML = val; 503 } else { 504 // search for caption and delete it if found 505 var caption = table.getElementsByTagName("caption")[0]; 506 if (caption) { 507 caption.parentNode.removeChild(caption); 508 } 509 } 510 break; 511 case "summary": 512 table.summary = val; 513 break; 514 case "width": 515 table.style.width = ("" + val) + params.f_unit; 516 break; 517 case "align": 518 table.align = val; 519 break; 520 case "spacing": 521 table.cellSpacing = val; 522 break; 523 case "padding": 524 table.cellPadding = val; 525 break; 526 case "borders": 527 table.border = val; 528 break; 529 case "frames": 530 table.frame = val; 531 break; 532 case "rules": 533 table.rules = val; 534 break; 535 } 536 } 537 538 // various workarounds to refresh the table display (Gecko, 539 // what's going on?! do not disappoint me!) 540 self.editor.forceRedraw(); 541 self.editor.focusEditor(); 542 self.editor.updateToolbar(); 543 var save_collapse = table.style.borderCollapse; 544 table.style.borderCollapse = "collapse"; 545 table.style.borderCollapse = "separate"; 546 table.style.borderCollapse = save_collapse; 547 } 548 549 var st_layout = Styler.createStyleLayoutFieldset(); 550 var p = dialog.getElementById("TO_layout"); 551 p.replaceChild(st_layout,p.firstChild); 552 553 var st_prop = Styler.createStyleFieldset(); 554 p = dialog.getElementById("TO_style"); 555 p.replaceChild(st_prop,p.firstChild); 556 557 this.dialogTable.getElementById('ok').onclick = apply; 558 559 // gather element's values 560 var values = {}; 561 var capel = table.getElementsByTagName("caption")[0]; 562 if (capel) { 563 values['caption'] = capel.innerHTML; 564 } 565 else values['caption'] = ""; 566 values['summary'] = table.summary; 567 568 values['spacing'] = table.cellSpacing; 569 values['padding'] = table.cellPadding; 570 var f_borders = table.border; 571 572 values['frames'] = table.frame; 573 values['rules'] = table.rules; 574 575 this.dialogTable.show(values); 768 576 }; 769 577 770 // Applies the style found in "params" to the given element. 771 TableOperations.processStyle = function(params, element) { 772 var style = element.style; 773 for (var i in params) { 774 if(typeof params[i] == 'function') continue; 775 var val = params[i]; 776 switch (i) { 777 case "f_st_backgroundColor": 778 style.backgroundColor = val; 779 break; 780 case "f_st_color": 781 style.color = val; 782 break; 783 case "f_st_backgroundImage": 784 if (/\S/.test(val)) { 785 style.backgroundImage = "url(" + val + ")"; 786 } else { 787 style.backgroundImage = "none"; 788 } 789 break; 790 case "f_st_borderWidth": 791 style.borderWidth = val; 792 break; 793 case "f_st_borderStyle": 794 style.borderStyle = val; 795 break; 796 case "f_st_borderColor": 797 style.borderColor = val; 798 break; 799 case "f_st_borderCollapse": 800 style.borderCollapse = val ? "collapse" : ""; 801 break; 802 case "f_st_width": 803 if (/\S/.test(val)) { 804 style.width = val + params["f_st_widthUnit"]; 805 } else { 806 style.width = ""; 807 } 808 break; 809 case "f_st_height": 810 if (/\S/.test(val)) { 811 style.height = val + params["f_st_heightUnit"]; 812 } else { 813 style.height = ""; 814 } 815 break; 816 case "f_st_textAlign": 817 if (val == "char") { 818 var ch = params["f_st_textAlignChar"]; 819 if (ch == '"') { 820 ch = '\\"'; 821 } 822 style.textAlign = '"' + ch + '"'; 823 } else if (val == "-") { 824 style.textAlign = ""; 825 } else { 826 style.textAlign = val; 827 } 828 break; 829 case "f_st_verticalAlign": 830 element.vAlign = ""; 831 if (val == "-") { 832 style.verticalAlign = ""; 833 834 } else { 835 style.verticalAlign = val; 836 } 837 break; 838 case "f_st_float": 839 if (Xinha.is_ie) { 840 style.styleFloat = val; 841 } 842 else { 843 style.cssFloat = val; 844 } 845 break; 846 // case "f_st_margin": 847 // style.margin = val + "px"; 848 // break; 849 // case "f_st_padding": 850 // style.padding = val + "px"; 851 // break; 852 } 853 } 578 TableOperations.prototype.dialogRowCellProperties = function(cell) { 579 // retrieve existing values 580 var element = this.getClosest(cell ? "td" : "tr"); 581 var table = this.getClosest("table"); 582 583 var self = this; 584 var editor = this.editor; 585 586 if(!self.dialogRowCellPropertiesHtml) // retrieve the raw dialog contents 587 { 588 Xinha._getback( Xinha.getPluginDir("TableOperations") + '/popups/dialogRowCell.html', function(getback) { self.dialogRowCellPropertiesHtml = getback; self.dialogRowCellProperties(cell); }); 589 return; 590 } 591 if (!this.dialogRowCell) { 592 // Now we have everything we need, so we can build the dialog. 593 this.dialogRowCell = new Xinha.Dialog(editor, self.dialogRowCellPropertiesHtml, 'TableOperations',{width:440}) 594 this.dialogRowCell.getElementById('cancel').onclick = function() { self.dialogRowCell.hide()}; 595 } 596 597 var dialog = this.dialogRowCell; 598 dialog.getElementById('title').innerHTML = cell ? Xinha._lc("Cell Properties", "TableOperations") : Xinha._lc("Row Properties", "TableOperations"); 599 var Styler = new Xinha.InlineStyler(element, self.editor); 600 601 function apply() { 602 var params = dialog.hide(); 603 Styler.applyStyle(); 604 605 // various workarounds to refresh the table display (Gecko, 606 // what's going on?! do not disappoint me!) 607 self.editor.forceRedraw(); 608 self.editor.focusEditor(); 609 self.editor.updateToolbar(); 610 var save_collapse = table.style.borderCollapse; 611 table.style.borderCollapse = "collapse"; 612 table.style.borderCollapse = "separate"; 613 table.style.borderCollapse = save_collapse; 614 } 615 616 var st_layout = Styler.createStyleLayoutFieldset(); 617 var p = dialog.getElementById("TO_layout"); 618 619 p.replaceChild(st_layout,p.firstChild); 620 621 var st_prop = Styler.createStyleFieldset(); 622 p = dialog.getElementById("TO_style"); 623 p.replaceChild(st_prop,p.firstChild); 624 625 this.dialogRowCell.getElementById('ok').onclick = apply; 626 this.dialogRowCell.show(); 854 627 }; 855 856 // Returns an HTML element for a widget that allows color selection. That is,857 // a button that contains the given color, if any, and when pressed will popup858 // the sooner-or-later-to-be-rewritten select_color.html dialog allowing user859 // to select some color. If a color is selected, an input field with the name860 // "f_st_"+name will be updated with the color value in #123456 format.861 TableOperations.createColorButton = function(doc, editor, color, name) {862 if (!color) {863 color = "";864 } else if (!/#/.test(color)) {865 color = Xinha._colorToRgb(color);866 }867 868 var df = doc.createElement("span");869 var field = doc.createElement("input");870 field.type = "hidden";871 df.appendChild(field);872 field.name = "f_st_" + name;873 field.value = color;874 var button = doc.createElement("span");875 button.className = "buttonColor";876 df.appendChild(button);877 var span = doc.createElement("span");878 span.className = "chooser";879 // span.innerHTML = " ";880 span.style.backgroundColor = color;881 button.appendChild(span);882 button.onmouseover = function() { if (!this.disabled) { this.className += " buttonColor-hilite"; }};883 button.onmouseout = function() { if (!this.disabled) { this.className = "buttonColor"; }};884 span.onclick = function() {885 if (this.parentNode.disabled) {886 return false;887 }888 editor._popupDialog("select_color.html", function(color) {889 if (color) {890 span.style.backgroundColor = "#" + color;891 field.value = "#" + color;892 }893 }, color);894 };895 var span2 = doc.createElement("span");896 span2.innerHTML = "×";897 span2.className = "nocolor";898 span2.title = Xinha._lc("Unset color", "TableOperations");899 button.appendChild(span2);900 span2.onmouseover = function() { if (!this.parentNode.disabled) { this.className += " nocolor-hilite"; }};901 span2.onmouseout = function() { if (!this.parentNode.disabled) { this.className = "nocolor"; }};902 span2.onclick = function() {903 span.style.backgroundColor = "";904 field.value = "";905 };906 return df;907 };908 909 TableOperations.createStyleLayoutFieldset = function(doc, editor, el) {910 var fieldset = doc.createElement("fieldset");911 var legend = doc.createElement("legend");912 fieldset.appendChild(legend);913 legend.innerHTML = Xinha._lc("Layout", "TableOperations");914 var table = doc.createElement("table");915 fieldset.appendChild(table);916 table.style.width = "100%";917 var tbody = doc.createElement("tbody");918 table.appendChild(tbody);919 920 var tagname = el.tagName.toLowerCase();921 var tr, td, input, select, option, options, i;922 923 if (tagname != "td" && tagname != "tr" && tagname != "th") {924 tr = doc.createElement("tr");925 tbody.appendChild(tr);926 td = doc.createElement("td");927 td.className = "label";928 tr.appendChild(td);929 td.innerHTML = Xinha._lc("Float", "TableOperations") + ":";930 td = doc.createElement("td");931 tr.appendChild(td);932 select = doc.createElement("select");933 td.appendChild(select);934 select.name = "f_st_float";935 options = ["None", "Left", "Right"];936 for (var i = 0; i < options.length; ++i) {937 var Val = options[i];938 var val = options[i].toLowerCase();939 option = doc.createElement("option");940 option.innerHTML = Xinha._lc(Val, "TableOperations");941 option.value = val;942 if (Xinha.is_ie) {943 option.selected = (("" + el.style.styleFloat).toLowerCase() == val);944 }945 else {946 option.selected = (("" + el.style.cssFloat).toLowerCase() == val);947 }948 select.appendChild(option);949 }950 }951 952 tr = doc.createElement("tr");953 tbody.appendChild(tr);954 td = doc.createElement("td");955 td.className = "label";956 tr.appendChild(td);957 td.innerHTML = Xinha._lc("Width", "TableOperations") + ":";958 td = doc.createElement("td");959 tr.appendChild(td);960 input = doc.createElement("input");961 input.type = "text";962 input.value = TableOperations.getLength(el.style.width);963 input.size = "5";964 input.name = "f_st_width";965 input.style.marginRight = "0.5em";966 td.appendChild(input);967 select = doc.createElement("select");968 select.name = "f_st_widthUnit";969 option = doc.createElement("option");970 option.innerHTML = Xinha._lc("percent", "TableOperations");971 option.value = "%";972 option.selected = /%/.test(el.style.width);973 select.appendChild(option);974 option = doc.createElement("option");975 option.innerHTML = Xinha._lc("pixels", "TableOperations");976 option.value = "px";977 option.selected = /px/.test(el.style.width);978 select.appendChild(option);979 td.appendChild(select);980 981 select.style.marginRight = "0.5em";982 td.appendChild(doc.createTextNode(Xinha._lc("Text align", "TableOperations") + ":"));983 select = doc.createElement("select");984 select.style.marginLeft = select.style.marginRight = "0.5em";985 td.appendChild(select);986 select.name = "f_st_textAlign";987 options = ["Left", "Center", "Right", "Justify", "-"];988 if (tagname == "td") {989 options.push("Char");990 }991 input = doc.createElement("input");992 input.name = "f_st_textAlignChar";993 input.size = "1";994 input.style.fontFamily = "monospace";995 td.appendChild(input);996 for (var i = 0; i < options.length; ++i) {997 var Val = options[i];998 var val = Val.toLowerCase();999 option = doc.createElement("option");1000 option.value = val;1001 option.innerHTML = Xinha._lc(Val, "TableOperations");1002 option.selected = ((el.style.textAlign.toLowerCase() == val) || (el.style.textAlign == "" && Val == "-"));1003 select.appendChild(option);1004 }1005 function setCharVisibility(value) {1006 input.style.visibility = value ? "visible" : "hidden";1007 if (value) {1008 input.focus();1009 input.select();1010 }1011 }1012 select.onchange = function() { setCharVisibility(this.value == "char"); };1013 setCharVisibility(select.value == "char");1014 1015 tr = doc.createElement("tr");1016 tbody.appendChild(tr);1017 td = doc.createElement("td");1018 td.className = "label";1019 tr.appendChild(td);1020 td.innerHTML = Xinha._lc("Height", "TableOperations") + ":";1021 td = doc.createElement("td");1022 tr.appendChild(td);1023 input = doc.createElement("input");1024 input.type = "text";1025 input.value = TableOperations.getLength(el.style.height);1026 input.size = "5";1027 input.name = "f_st_height";1028 input.style.marginRight = "0.5em";1029 td.appendChild(input);1030 select = doc.createElement("select");1031 select.name = "f_st_heightUnit";1032 option = doc.createElement("option");1033 option.innerHTML = Xinha._lc("percent", "TableOperations");1034 option.value = "%";1035 option.selected = /%/.test(el.style.height);1036 select.appendChild(option);1037 option = doc.createElement("option");1038 option.innerHTML = Xinha._lc("pixels", "TableOperations");1039 option.value = "px";1040 option.selected = /px/.test(el.style.height);1041 select.appendChild(option);1042 td.appendChild(select);1043 1044 select.style.marginRight = "0.5em";1045 td.appendChild(doc.createTextNode(Xinha._lc("Vertical align", "TableOperations") + ":"));1046 select = doc.createElement("select");1047 select.name = "f_st_verticalAlign";1048 select.style.marginLeft = "0.5em";1049 td.appendChild(select);1050 options = ["Top", "Middle", "Bottom", "Baseline", "-"];1051 for (var i = 0; i < options.length; ++i) {1052 var Val = options[i];1053 var val = Val.toLowerCase();1054 option = doc.createElement("option");1055 option.value = val;1056 option.innerHTML = Xinha._lc(Val, "TableOperations");1057 option.selected = ((el.style.verticalAlign.toLowerCase() == val) || (el.style.verticalAlign == "" && Val == "-"));1058 select.appendChild(option);1059 }1060 1061 return fieldset;1062 };1063 1064 // Returns an HTML element containing the style attributes for the given1065 // element. This can be easily embedded into any dialog; the functionality is1066 // also provided.1067 TableOperations.createStyleFieldset = function(doc, editor, el) {1068 var fieldset = doc.createElement("fieldset");1069 var legend = doc.createElement("legend");1070 fieldset.appendChild(legend);1071 legend.innerHTML = Xinha._lc("CSS Style", "TableOperations");1072 var table = doc.createElement("table");1073 fieldset.appendChild(table);1074 table.style.width = "100%";1075 var tbody = doc.createElement("tbody");1076 table.appendChild(tbody);1077 1078 var tr, td, input, select, option, options, i;1079 1080 tr = doc.createElement("tr");1081 tbody.appendChild(tr);1082 td = doc.createElement("td");1083 tr.appendChild(td);1084 td.className = "label";1085 td.innerHTML = Xinha._lc("Background", "TableOperations") + ":";1086 td = doc.createElement("td");1087 tr.appendChild(td);1088 var df = TableOperations.createColorButton(doc, editor, el.style.backgroundColor, "backgroundColor");1089 df.firstChild.nextSibling.style.marginRight = "0.5em";1090 td.appendChild(df);1091 td.appendChild(doc.createTextNode(Xinha._lc("Image URL", "TableOperations") + ": "));1092 input = doc.createElement("input");1093 input.type = "text";1094 input.name = "f_st_backgroundImage";1095 if (el.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/)) {1096 input.value = RegExp.$1;1097 }1098 // input.style.width = "100%";1099 td.appendChild(input);1100 1101 tr = doc.createElement("tr");1102 tbody.appendChild(tr);1103 td = doc.createElement("td");1104 tr.appendChild(td);1105 td.className = "label";1106 td.innerHTML = Xinha._lc("FG Color", "TableOperations") + ":";1107 td = doc.createElement("td");1108 tr.appendChild(td);1109 td.appendChild(TableOperations.createColorButton(doc, editor, el.style.color, "color"));1110 1111 // for better alignment we include an invisible field.1112 input = doc.createElement("input");1113 input.style.visibility = "hidden";1114 input.type = "text";1115 td.appendChild(input);1116 1117 tr = doc.createElement("tr");1118 tbody.appendChild(tr);1119 td = doc.createElement("td");1120 tr.appendChild(td);1121 td.className = "label";1122 td.innerHTML = Xinha._lc("Border", "TableOperations") + ":";1123 td = doc.createElement("td");1124 tr.appendChild(td);1125 1126 var colorButton = TableOperations.createColorButton(doc, editor, el.style.borderColor, "borderColor");1127 var btn = colorButton.firstChild.nextSibling;1128 td.appendChild(colorButton);1129 // borderFields.push(btn);1130 btn.style.marginRight = "0.5em";1131 1132 select = doc.createElement("select");1133 var borderFields = [];1134 td.appendChild(select);1135 select.name = "f_st_borderStyle";1136 options = ["none", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"];1137 var currentBorderStyle = el.style.borderStyle;1138 // Gecko reports "solid solid solid solid" for "border-style: solid".1139 // That is, "top right bottom left" -- we only consider the first1140 // value.1141 if (currentBorderStyle.match(/([^\s]*)\s/)) currentBorderStyle = RegExp.$1;1142 for (var i=0;i<options.length;i++) {1143 var val = options[i];1144 option = doc.createElement("option");1145 option.value = val;1146 option.innerHTML = val;1147 if (val == currentBorderStyle) option.selected = true;1148 select.appendChild(option);1149 }1150 select.style.marginRight = "0.5em";1151 function setBorderFieldsStatus(value) {1152 for (var i = 0; i < borderFields.length; ++i) {1153 var el = borderFields[i];1154 el.style.visibility = value ? "hidden" : "visible";1155 if (!value && (el.tagName.toLowerCase() == "input")) {1156 el.focus();1157 el.select();1158 }1159 }1160 }1161 select.onchange = function() { setBorderFieldsStatus(this.value == "none"); };1162 1163 input = doc.createElement("input");1164 borderFields.push(input);1165 input.type = "text";1166 input.name = "f_st_borderWidth";1167 input.value = TableOperations.getLength(el.style.borderWidth);1168 input.size = "5";1169 td.appendChild(input);1170 input.style.marginRight = "0.5em";1171 var span = doc.createElement("span");1172 span.innerHTML = Xinha._lc("pixels", "TableOperations");1173 td.appendChild(span);1174 borderFields.push(span);1175 1176 setBorderFieldsStatus(select.value == "none");1177 1178 if (el.tagName.toLowerCase() == "table") {1179 // the border-collapse style is only for tables1180 tr = doc.createElement("tr");1181 tbody.appendChild(tr);1182 td = doc.createElement("td");1183 td.className = "label";1184 tr.appendChild(td);1185 input = doc.createElement("input");1186 input.type = "checkbox";1187 input.name = "f_st_borderCollapse";1188 input.id = "f_st_borderCollapse";1189 var val = (/collapse/i.test(el.style.borderCollapse));1190 input.checked = val ? 1 : 0;1191 td.appendChild(input);1192 1193 td = doc.createElement("td");1194 tr.appendChild(td);1195 var label = doc.createElement("label");1196 label.htmlFor = "f_st_borderCollapse";1197 label.innerHTML = Xinha._lc("Collapsed borders", "TableOperations");1198 td.appendChild(label);1199 }1200 1201 // tr = doc.createElement("tr");1202 // tbody.appendChild(tr);1203 // td = doc.createElement("td");1204 // td.className = "label";1205 // tr.appendChild(td);1206 // td.innerHTML = Xinha._lc("Margin", "TableOperations") + ":";1207 // td = doc.createElement("td");1208 // tr.appendChild(td);1209 // input = doc.createElement("input");1210 // input.type = "text";1211 // input.size = "5";1212 // input.name = "f_st_margin";1213 // td.appendChild(input);1214 // input.style.marginRight = "0.5em";1215 // td.appendChild(doc.createTextNode(Xinha._lc("Padding", "TableOperations") + ":"));1216 1217 // input = doc.createElement("input");1218 // input.type = "text";1219 // input.size = "5";1220 // input.name = "f_st_padding";1221 // td.appendChild(input);1222 // input.style.marginLeft = "0.5em";1223 // input.style.marginRight = "0.5em";1224 // td.appendChild(doc.createTextNode(Xinha._lc("pixels", "TableOperations")));1225 1226 return fieldset;1227 };1228 1229 //// END GENERIC CODE -------------------------------------------------------
