Ticket #595: ticket595_3.patch
| File ticket595_3.patch, 6.3 kB (added by mokhet, 6 years ago) |
|---|
-
htmlarea.css
232 232 .htmlarea .panels.right .panel { border-right:none; border-left:none; } 233 233 .htmlarea .panels.left h1 { border-left:none; } 234 234 .htmlarea { border: 1px solid black; } 235 236 .loading { 237 background-color:#fff; 238 } 239 .loading_main { 240 background-color:#fff; 241 font-size:1.6em; 242 color:#66CCFF; 243 text-align:center; 244 } 245 .loading_sub { 246 background-color:#fff; 247 font-size:1.0em; 248 color:#000; 249 text-align:center; 250 } 251 No newline at end of file -
htmlarea.js
99 99 h: textarea.style.height ? textarea.style.height : (textarea.offsetHeight ? (textarea.offsetHeight + 'px') : (textarea.rows+'em')) 100 100 }; 101 101 102 // Create the loading message elements 103 if (this.config.showLoading) 104 { 105 // Create and show the main loading message and the sub loading message for details of loading actions 106 // global element 107 var loading_message = document.createElement("div"); 108 loading_message.id = "loading_" + textarea.name; 109 loading_message.style.position = 'absolute'; 110 loading_message.style.zIndex = 998; 111 try 112 { 113 // how can i find the real width in pixels without % or em *and* with no visual errors ? 114 // for instance, a textarea with a style="width:100%" and the body padding > 0 result in a horizontal scrollingbar while loading 115 // A few lines above seems to indicate offsetWidth is not always set 116 loading_message.style.width = textarea.offsetWidth + 'px'; 117 } 118 catch (e) 119 { 120 // offsetWidth seems not set, so let's use this._initial_ta_size.w, but sometimes it may be too huge width 121 loading_message.style.width = this._initial_ta_size.w; 122 } 123 loading_message.style.left = HTMLArea.findPosX(textarea) + 'px'; 124 loading_message.style.top = (HTMLArea.findPosY(textarea) + parseInt(this._initial_ta_size.h) / 2) + 'px'; 125 // main static message 126 var loading_main = document.createElement("div"); 127 loading_main.className = "loading_main"; 128 loading_main.id = "loading_main_" + textarea.name; 129 loading_main.appendChild(document.createTextNode(HTMLArea._lc("Loading in progress. Please wait !"))); 130 // sub dynamic message 131 var loading_sub = document.createElement("div"); 132 loading_sub.className = "loading_sub"; 133 loading_sub.id = "loading_sub_" + textarea.name; 134 loading_sub.appendChild(document.createTextNode(HTMLArea._lc("Constructing main object"))); 135 loading_message.appendChild(loading_main); 136 loading_message.appendChild(loading_sub); 137 document.body.appendChild(loading_message); 138 this.setLoadingMessage("Constructing object"); 139 } 140 102 141 this._editMode = "wysiwyg"; 103 142 this.plugins = {}; 104 143 this._timerToolbar = null; … … 296 335 // even neater, if you resize the window the toolbars will reflow. Niiiice. 297 336 298 337 this.flowToolbars = true; 338 339 // set to true if you want the loading panel to show at startup 340 this.showLoading = false; 299 341 300 342 /** CUSTOMIZING THE TOOLBAR 301 343 * ------------------------- … … 534 576 HTMLArea.prototype.registerPanel = function(side, object) 535 577 { 536 578 if(!side) side = 'right'; 579 this.setLoadingMessage('Register panel ' + side); 537 580 var panel = this.addPanel(side); 538 581 if(object) 539 582 { … … 715 758 716 759 // Creates the toolbar and appends it to the _htmlarea 717 760 HTMLArea.prototype._createToolbar = function () { 761 this.setLoadingMessage('Create Toolbar'); 718 762 var editor = this; // to access this in nested functions 719 763 720 764 var toolbar = document.createElement("div"); … … 1143 1187 }; 1144 1188 1145 1189 HTMLArea.prototype._createStatusBar = function() { 1190 this.setLoadingMessage('Create StatusBar'); 1146 1191 var statusbar = document.createElement("div"); 1147 1192 statusbar.className = "statusBar"; 1148 1193 this._statusBar = statusbar; … … 1176 1221 // Creates the HTMLArea object and replaces the textarea with it. 1177 1222 HTMLArea.prototype.generate = function () 1178 1223 { 1224 this.setLoadingMessage('Generate Xinha object'); 1179 1225 var editor = this; // we'll need "this" in some nested functions 1180 1226 1181 1227 if(typeof Dialog == 'undefined') … … 1426 1472 1427 1473 HTMLArea.prototype.initSize = function() 1428 1474 { 1475 this.setLoadingMessage('Init editor size'); 1429 1476 var editor = this; 1430 1477 1431 1478 var width = null; … … 1841 1888 1842 1889 HTMLArea.prototype.initIframe = function() 1843 1890 { 1891 this.setLoadingMessage('Init IFrame'); 1844 1892 this.disableToolbar(); 1845 1893 var doc = null; 1846 1894 var editor = this; … … 2051 2099 if(typeof editor._onGenerate == "function") { 2052 2100 editor._onGenerate(); 2053 2101 } 2102 editor.removeLoadingMessage(); 2054 2103 } 2055 2104 ); 2056 2105 }; … … 5438 5487 { 5439 5488 for(var i = 0; i < plugin_names.length; i++) 5440 5489 { 5490 this.setLoadingMessage('Register plugin ' + plugin_names[i]); 5441 5491 this.registerPlugin(eval(plugin_names[i])); 5442 5492 } 5443 5493 } … … 5548 5598 } 5549 5599 }; 5550 5600 5601 // fix X position of an element 5602 HTMLArea.findPosX = function(obj) 5603 { 5604 var curleft = 0; 5605 if (obj.offsetParent) 5606 { 5607 while (obj.offsetParent) 5608 { 5609 curleft += obj.offsetLeft 5610 obj = obj.offsetParent; 5611 } 5612 } 5613 else if (obj.x) 5614 { 5615 curleft += obj.x; 5616 } 5617 return curleft; 5618 }; 5619 5620 // fix Y position of an element 5621 HTMLArea.findPosY = function(obj) 5622 { 5623 var curtop = 0; 5624 if (obj.offsetParent) 5625 { 5626 while (obj.offsetParent) 5627 { 5628 curtop += obj.offsetTop 5629 obj = obj.offsetParent; 5630 } 5631 } 5632 else if (obj.y) 5633 { 5634 curtop += obj.y; 5635 } 5636 return curtop; 5637 }; 5638 5639 HTMLArea.prototype.setLoadingMessage = function(string, context) 5640 { 5641 if (!this.config.showLoading || !document.getElementById("loading_sub_" + this._textArea.name)) { return ; } 5642 var elt = document.getElementById("loading_sub_" + this._textArea.name); 5643 elt.innerHTML = HTMLArea._lc(string, context); 5644 }; 5645 5646 HTMLArea.prototype.removeLoadingMessage = function() 5647 { 5648 if (!this.config.showLoading || !document.getElementById("loading_" + this._textArea.name)) { return ; } 5649 document.body.removeChild(document.getElementById("loading_" + this._textArea.name)); 5650 }; 5651 5551 5652 HTMLArea.toFree = [ ]; 5552 5653 HTMLArea.freeLater = function(obj,prop) 5553 5654 {
