From 66899c818ea27bbd64601b6e6487e0d1c12b4526 Mon Sep 17 00:00:00 2001 From: vitalif Date: Fri, 11 Jan 2013 22:25:22 +0000 Subject: [PATCH] Add border option to nicTable, use SimpleAutocomplete in GT --- nicEdit.js | 12 ++++++++---- nicImageUploadGT.js | 19 +++++++++++++------ nicLinkGT.js | 5 ++++- nicRu.js | 5 ++++- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/nicEdit.js b/nicEdit.js index b0f86ef..4d814f7 100644 --- a/nicEdit.js +++ b/nicEdit.js @@ -1485,25 +1485,28 @@ var nicTableOptions = { /* END CONFIG */ var nicTableButton = nicEditorAdvancedButton.extend({ - addPane : function() { + addPane: function() { this.t = this.ne.selectedInstance.selElm().parentTag('TABLE'); - var r = 3, c = 3, h = ''; + var r = 3, c = 3, h = '', b = 'yes'; if (this.t && (r = this.t.rows.length)) { c = this.t.rows[0].cells.length; if (this.t.rows[0].cells[c-1].nodeName == 'TH') h += 'top'; if (this.t.rows[r-1].cells[0].nodeName == 'TH') h += 'left'; + if (this.t.className.indexOf('bordered') < 0) b = 'no'; } this.addForm({ '': {type: 'title', txt: __('Add/Edit Table')}, 'cols': {type: 'text', txt: __('Columns'), value: c, style: {width: '50px'}}, 'rows': {type: 'text', txt: __('Rows'), value: r, style: {width: '50px'}}, - 'header': {type: 'select', txt: __('Headers'), value: h, options: {'':__('None'), left:__('Left'), top:__('Top'), topleft:__('Top and Left')}} + 'header': {type: 'select', txt: __('Headers'), value: h, options: {'':__('None'), left:__('Left'), top:__('Top'), topleft:__('Top and Left')}}, + 'bordered': {type: 'select', txt: __('Borders'), value: b, options: {'no':__('No'), 'yes':__('Yes')}} },this.t); }, - submit : function(e) { + submit: function(e) { var r = parseInt(this.inputs['rows'].value); var c = parseInt(this.inputs['cols'].value); + var cl = this.inputs['bordered'].value == 'no' ? '' : 'bordered'; var i, j; if(!this.t) { var tmp = 'javascript:nicImTemp();', h = ''; @@ -1514,6 +1517,7 @@ var nicTableButton = nicEditorAdvancedButton.extend({ this.t = this.findElm('TABLE','title',tmp); } if(this.t) { + this.t.className = cl; this.t.removeAttribute('title'); for (i = this.t.rows.length-1; i >= r; i--) { this.t.deleteRow(r); diff --git a/nicImageUploadGT.js b/nicImageUploadGT.js index 44474d1..b2668a3 100644 --- a/nicImageUploadGT.js +++ b/nicImageUploadGT.js @@ -24,7 +24,10 @@ var nicImageUploadGTButton = nicEditorAdvancedButton.extend({ 'alt': {type: 'text', txt: __('Popup text'), style: {width: '150px'}} }, params); - this.hinter = new SimpleAutocomplete(this.inputs['src'], this.gtLoadData.closure(this), null, null, null, false, true); + this.hinter = new SimpleAutocomplete(this.inputs['src'], this.gtLoadData.closure(this), { + emptyText: false, + allowHTML: true + }); s = this.inputs['href'].parentNode; new bkElement('br').appendTo(s); @@ -156,11 +159,15 @@ var nicImageUploadGTButton = nicEditorAdvancedButton.extend({ target: this.inputs['newwindow'].checked ? '_blank' : '', title: alt }; - if (!lnk.href.length && gtId && gtId[1] && (w || h)) { - // If link URL is not '-', add lightbox (relative path) - lnk.href = 'file.php?action=thumb&id='+gtId[1]; - lnk.target = '_blank'; - lnk.rel = 'lightbox'; + if (!lnk.href.length) { + if (gtId && gtId[1] && (w || h)) { + // If link URL is not '-', add lightbox (relative path) + lnk.href = 'file.php?action=thumb&id='+gtId[1]; + lnk.target = '_blank'; + lnk.rel = 'lightbox'; + } else { + lnk.href = '-'; + } } var p = $BK(this.im.parentNode); if (p.nodeName != 'A' && lnk.href != '-') { diff --git a/nicLinkGT.js b/nicLinkGT.js index b92112c..ad20418 100644 --- a/nicLinkGT.js +++ b/nicLinkGT.js @@ -18,7 +18,10 @@ var nicLinkGTButton = nicEditorAdvancedButton.extend({ 'title': {type: 'text', txt: __('Hint')}, 'target': {type: 'select', txt: __('Open In'), options: {'' : __('Current Window'), '_blank': __('New Window')}, style: {width: '100px'}} }, this.parseParams(this.ln || {})); - this.hinter = new SimpleAutocomplete(this.inputs['href'], this.gtLoadData.closure(this), null, null, null, false, true); + this.hinter = new SimpleAutocomplete(this.inputs['href'], this.gtLoadData.closure(this), { + emptyText: false, + allowHTML: true + }); }, parseParams: function(elm) { diff --git a/nicRu.js b/nicRu.js index d3d5c79..aa4e54b 100644 --- a/nicRu.js +++ b/nicRu.js @@ -92,7 +92,10 @@ var nicRu = { 'Headers': 'Заголовок', 'None': 'Нет', 'Top': 'Сверху', - 'Top and Left': 'Сверху и слева' + 'Top and Left': 'Сверху и слева', + 'Borders': 'Рамки', + 'Yes': 'Да', + 'No': 'Нет' }; function __(s) {