Ticket #595: ticket595.patch

File ticket595.patch, 5.7 kB (added by mokhet, 6 years ago)
  • htmlarea.css

     
    232232.htmlarea .panels.right .panel { border-right:none; border-left:none; } 
    233233.htmlarea .panels.left  h1     { border-left:none;  } 
    234234.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

     
    9999      h: textarea.style.height ? textarea.style.height : (textarea.offsetHeight ? (textarea.offsetHeight + 'px') : (textarea.rows+'em')) 
    100100    }; 
    101101 
     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 
    102136    this._editMode = "wysiwyg"; 
    103137    this.plugins = {}; 
    104138    this._timerToolbar = null; 
     
    534568HTMLArea.prototype.registerPanel = function(side, object) 
    535569{ 
    536570  if(!side) side = 'right'; 
     571  this.setLoadingMessage('Register panel ' + side); 
    537572  var panel = this.addPanel(side); 
    538573  if(object) 
    539574  { 
     
    715750 
    716751// Creates the toolbar and appends it to the _htmlarea 
    717752HTMLArea.prototype._createToolbar = function () { 
     753  this.setLoadingMessage('Create Toolbar'); 
    718754  var editor = this;    // to access this in nested functions 
    719755 
    720756  var toolbar = document.createElement("div"); 
     
    11431179}; 
    11441180 
    11451181HTMLArea.prototype._createStatusBar = function() { 
     1182  this.setLoadingMessage('Create StatusBar'); 
    11461183  var statusbar = document.createElement("div"); 
    11471184  statusbar.className = "statusBar"; 
    11481185  this._statusBar = statusbar; 
     
    11761213// Creates the HTMLArea object and replaces the textarea with it. 
    11771214HTMLArea.prototype.generate = function () 
    11781215{ 
     1216  this.setLoadingMessage('Generate Xinha object'); 
    11791217  var editor = this;    // we'll need "this" in some nested functions 
    11801218 
    11811219  if(typeof Dialog == 'undefined') 
     
    14261464 
    14271465  HTMLArea.prototype.initSize = function() 
    14281466  { 
     1467    this.setLoadingMessage('Init editor size'); 
    14291468    var editor = this; 
    14301469 
    14311470    var width  = null; 
     
    18411880 
    18421881  HTMLArea.prototype.initIframe = function() 
    18431882  { 
     1883    this.setLoadingMessage('Init IFrame'); 
    18441884    this.disableToolbar(); 
    18451885    var doc = null; 
    18461886    var editor = this; 
     
    20512091      if(typeof editor._onGenerate == "function") { 
    20522092        editor._onGenerate(); 
    20532093      } 
     2094      editor.removeLoadingMessage(); 
    20542095    } 
    20552096  ); 
    20562097}; 
     
    54385479  { 
    54395480    for(var i = 0; i < plugin_names.length; i++) 
    54405481    { 
     5482      this.setLoadingMessage('Register plugin ' + plugin_names[i]); 
    54415483      this.registerPlugin(eval(plugin_names[i])); 
    54425484    } 
    54435485  } 
     
    55485590  } 
    55495591}; 
    55505592 
     5593// fix X position of an element 
     5594HTMLArea.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 
     5613HTMLArea.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 
     5631HTMLArea.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 
     5638HTMLArea.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 
    55515644HTMLArea.toFree = [ ]; 
    55525645HTMLArea.freeLater = function(obj,prop) 
    55535646{