Ticket #595: ticket595_3.patch

File ticket595_3.patch, 6.3 kB (added by mokhet, 6 years ago)

set the config variable false by default

  • 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 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 
    102141    this._editMode = "wysiwyg"; 
    103142    this.plugins = {}; 
    104143    this._timerToolbar = null; 
     
    296335  // even neater, if you resize the window the toolbars will reflow.  Niiiice. 
    297336 
    298337  this.flowToolbars = true; 
     338   
     339  // set to true if you want the loading panel to show at startup 
     340  this.showLoading = false; 
    299341 
    300342  /** CUSTOMIZING THE TOOLBAR 
    301343   * ------------------------- 
     
    534576HTMLArea.prototype.registerPanel = function(side, object) 
    535577{ 
    536578  if(!side) side = 'right'; 
     579  this.setLoadingMessage('Register panel ' + side); 
    537580  var panel = this.addPanel(side); 
    538581  if(object) 
    539582  { 
     
    715758 
    716759// Creates the toolbar and appends it to the _htmlarea 
    717760HTMLArea.prototype._createToolbar = function () { 
     761  this.setLoadingMessage('Create Toolbar'); 
    718762  var editor = this;    // to access this in nested functions 
    719763 
    720764  var toolbar = document.createElement("div"); 
     
    11431187}; 
    11441188 
    11451189HTMLArea.prototype._createStatusBar = function() { 
     1190  this.setLoadingMessage('Create StatusBar'); 
    11461191  var statusbar = document.createElement("div"); 
    11471192  statusbar.className = "statusBar"; 
    11481193  this._statusBar = statusbar; 
     
    11761221// Creates the HTMLArea object and replaces the textarea with it. 
    11771222HTMLArea.prototype.generate = function () 
    11781223{ 
     1224  this.setLoadingMessage('Generate Xinha object'); 
    11791225  var editor = this;    // we'll need "this" in some nested functions 
    11801226 
    11811227  if(typeof Dialog == 'undefined') 
     
    14261472 
    14271473  HTMLArea.prototype.initSize = function() 
    14281474  { 
     1475    this.setLoadingMessage('Init editor size'); 
    14291476    var editor = this; 
    14301477 
    14311478    var width  = null; 
     
    18411888 
    18421889  HTMLArea.prototype.initIframe = function() 
    18431890  { 
     1891    this.setLoadingMessage('Init IFrame'); 
    18441892    this.disableToolbar(); 
    18451893    var doc = null; 
    18461894    var editor = this; 
     
    20512099      if(typeof editor._onGenerate == "function") { 
    20522100        editor._onGenerate(); 
    20532101      } 
     2102      editor.removeLoadingMessage(); 
    20542103    } 
    20552104  ); 
    20562105}; 
     
    54385487  { 
    54395488    for(var i = 0; i < plugin_names.length; i++) 
    54405489    { 
     5490      this.setLoadingMessage('Register plugin ' + plugin_names[i]); 
    54415491      this.registerPlugin(eval(plugin_names[i])); 
    54425492    } 
    54435493  } 
     
    55485598  } 
    55495599}; 
    55505600 
     5601// fix X position of an element 
     5602HTMLArea.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 
     5621HTMLArea.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 
     5639HTMLArea.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 
     5646HTMLArea.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 
    55515652HTMLArea.toFree = [ ]; 
    55525653HTMLArea.freeLater = function(obj,prop) 
    55535654{