Ticket #595: ticket595.patch
| File ticket595.patch, 5.7 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 and show the main loading message and the sub loading message for details of loading actions 103 // global element 104 var loading_message = document.createElement("div"); 105 loading_message.id = "loading_" + textarea.name; 106 loading_message.style.position = 'absolute'; 107 loading_message.style.zIndex = 998; 108 try 109 { 110 // how can i find the real width in pixels without % or em and with no errors ? 111 // A few lines above seems to indicate offsetWidth is not always set 112 loading_message.style.width = textarea.offsetWidth + 'px'; 113 } 114 catch (e) 115 { 116 // offsetWidth seems not set, so let's use this._initial_ta_size.w, but sometimes it seems to be too huge width 117 loading_message.style.width = this._initial_ta_size.w; 118 } 119 loading_message.style.left = HTMLArea.findPosX(textarea) + 'px'; 120 loading_message.style.top = (HTMLArea.findPosY(textarea) + parseInt(this._initial_ta_size.h) / 2) + 'px'; 121 // main static message 122 var loading_main = document.createElement("div"); 123 loading_main.className = "loading_main"; 124 loading_main.id = "loading_main_" + textarea.name; 125 loading_main.appendChild(document.createTextNode(HTMLArea._lc("Loading in progress. Please wait !"))); 126 // sub dynamic message 127 var loading_sub = document.createElement("div"); 128 loading_sub.className = "loading_sub"; 129 loading_sub.id = "loading_sub_" + textarea.name; 130 loading_sub.appendChild(document.createTextNode(HTMLArea._lc("Constructing main object"))); 131 loading_message.appendChild(loading_main); 132 loading_message.appendChild(loading_sub); 133 document.body.appendChild(loading_message); 134 this.setLoadingMessage("Constructing object"); 135 102 136 this._editMode = "wysiwyg"; 103 137 this.plugins = {}; 104 138 this._timerToolbar = null; … … 534 568 HTMLArea.prototype.registerPanel = function(side, object) 535 569 { 536 570 if(!side) side = 'right'; 571 this.setLoadingMessage('Register panel ' + side); 537 572 var panel = this.addPanel(side); 538 573 if(object) 539 574 { … … 715 750 716 751 // Creates the toolbar and appends it to the _htmlarea 717 752 HTMLArea.prototype._createToolbar = function () { 753 this.setLoadingMessage('Create Toolbar'); 718 754 var editor = this; // to access this in nested functions 719 755 720 756 var toolbar = document.createElement("div"); … … 1143 1179 }; 1144 1180 1145 1181 HTMLArea.prototype._createStatusBar = function() { 1182 this.setLoadingMessage('Create StatusBar'); 1146 1183 var statusbar = document.createElement("div"); 1147 1184 statusbar.className = "statusBar"; 1148 1185 this._statusBar = statusbar; … … 1176 1213 // Creates the HTMLArea object and replaces the textarea with it. 1177 1214 HTMLArea.prototype.generate = function () 1178 1215 { 1216 this.setLoadingMessage('Generate Xinha object'); 1179 1217 var editor = this; // we'll need "this" in some nested functions 1180 1218 1181 1219 if(typeof Dialog == 'undefined') … … 1426 1464 1427 1465 HTMLArea.prototype.initSize = function() 1428 1466 { 1467 this.setLoadingMessage('Init editor size'); 1429 1468 var editor = this; 1430 1469 1431 1470 var width = null; … … 1841 1880 1842 1881 HTMLArea.prototype.initIframe = function() 1843 1882 { 1883 this.setLoadingMessage('Init IFrame'); 1844 1884 this.disableToolbar(); 1845 1885 var doc = null; 1846 1886 var editor = this; … … 2051 2091 if(typeof editor._onGenerate == "function") { 2052 2092 editor._onGenerate(); 2053 2093 } 2094 editor.removeLoadingMessage(); 2054 2095 } 2055 2096 ); 2056 2097 }; … … 5438 5479 { 5439 5480 for(var i = 0; i < plugin_names.length; i++) 5440 5481 { 5482 this.setLoadingMessage('Register plugin ' + plugin_names[i]); 5441 5483 this.registerPlugin(eval(plugin_names[i])); 5442 5484 } 5443 5485 } … … 5548 5590 } 5549 5591 }; 5550 5592 5593 // fix X position of an element 5594 HTMLArea.findPosX = function(obj) 5595 { 5596 var curleft = 0; 5597 if (obj.offsetParent) 5598 { 5599 while (obj.offsetParent) 5600 { 5601 curleft += obj.offsetLeft 5602 obj = obj.offsetParent; 5603 } 5604 } 5605 else if (obj.x) 5606 { 5607 curleft += obj.x; 5608 } 5609 return curleft; 5610 }; 5611 5612 // fix Y position of an element 5613 HTMLArea.findPosY = function(obj) 5614 { 5615 var curtop = 0; 5616 if (obj.offsetParent) 5617 { 5618 while (obj.offsetParent) 5619 { 5620 curtop += obj.offsetTop 5621 obj = obj.offsetParent; 5622 } 5623 } 5624 else if (obj.y) 5625 { 5626 curtop += obj.y; 5627 } 5628 return curtop; 5629 }; 5630 5631 HTMLArea.prototype.setLoadingMessage = function(string, context) 5632 { 5633 if (!document.getElementById("loading_sub_" + this._textArea.name)) { return ; } 5634 var elt = document.getElementById("loading_sub_" + this._textArea.name); 5635 elt.innerHTML = HTMLArea._lc(string, context); 5636 }; 5637 5638 HTMLArea.prototype.removeLoadingMessage = function() 5639 { 5640 if (!document.getElementById("loading_" + this._textArea.name)) { return ; } 5641 document.body.removeChild(document.getElementById("loading_" + this._textArea.name)); 5642 }; 5643 5551 5644 HTMLArea.toFree = [ ]; 5552 5645 HTMLArea.freeLater = function(obj,prop) 5553 5646 {
