Changeset 277
- Timestamp:
- 07/19/05 06:23:58 (8 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
examples/full_example-body.html (modified) (1 diff)
-
examples/stylist.css (modified) (1 diff)
-
examples/testbed.html (modified) (4 diffs)
-
htmlarea.js (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/full_example-body.html
r238 r277 1 <!DOCTYPE BHTML PUBLIC "-//BC//DTD BHTML 3.2 Final//EN"> 1 2 <html> 2 3 <head> -
trunk/examples/stylist.css
r14 r277 29 29 } 30 30 31 img.polaroid { border:1px solid black; background-color:white; padding:10px; padding-bottom:30px; } -
trunk/examples/testbed.html
r260 r277 55 55 xinha_plugins = xinha_plugins ? xinha_plugins : 56 56 [ 57 'FullScreen'57 58 58 ]; 59 59 // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :) … … 84 84 85 85 xinha_config = xinha_config ? xinha_config : new HTMLArea.Config(); 86 /* 87 // We can load an external stylesheet like this - NOTE : YOU MUST GIVE AN ABSOLUTE URL 88 // otherwise it won't work! 89 xinha_config.stylistLoadStylesheet(document.location.href.replace(/[^\/]*\.html/, 'stylist.css')); 86 90 91 // Or we can load styles directly 92 xinha_config.stylistLoadStyles('p.red_text { color:red }'); 93 94 // If you want to provide "friendly" names you can do so like 95 // (you can do this for stylistLoadStylesheet as well) 96 xinha_config.stylistLoadStyles('p.pink_text { color:pink }', {'p.pink_text' : 'Pretty Pink'}); 97 */ 87 98 /** STEP 3 *************************************************************** 88 99 * We first create editors for the textareas. … … 125 136 126 137 window.onload = xinha_init; 127 window.onunload = HTMLArea.flushEvents;138 // window.onunload = HTMLArea.collectGarbageForIE; 128 139 </script> 129 140 </head> … … 158 169 document.write(document.compatMode); 159 170 </script> 171 <a href="#" onclick="xinha_editors.myTextArea.hidePanels();">Hide</a> 172 <a href="#" onclick="xinha_editors.myTextArea.showPanels();">Show</a> 160 173 </body> 161 174 </html> -
trunk/htmlarea.js
r275 r277 92 92 } 93 93 this._textArea = textarea; 94 94 95 95 // Before we modify anything, get the initial textarea size 96 96 this._initial_ta_size = … … 147 147 panels[i].div = panels[i].container; // legacy 148 148 panels[i].container.className = 'panels ' + i; 149 } 149 HTMLArea.freeLater(panels[i], 'container'); 150 HTMLArea.freeLater(panels[i], 'div'); 151 } 152 HTMLArea.freeLater(this, '_textArea'); 150 153 } 151 154 }; … … 483 486 btn[0] = HTMLArea._lc(btn[0]); //initialize tooltip 484 487 } 488 485 489 }; 486 490 … … 717 721 toolbar.unselectable = "1"; 718 722 723 HTMLArea.freeLater(this, '_toolBar'); 724 HTMLArea.freeLater(this, '_toolbar'); 725 719 726 var tb_row = null; 720 727 var tb_objects = new Object(); … … 722 729 723 730 this._createToolbar1(editor, toolbar, tb_objects); 724 this._htmlArea.appendChild(toolbar); 731 this._htmlArea.appendChild(toolbar); 732 725 733 return toolbar; 726 734 } … … 867 875 context : context 868 876 }; 877 878 HTMLArea.freeLater(obj); 879 869 880 tb_objects[txt] = obj; 881 870 882 for (var i in options) { 871 883 var op = document.createElement("option"); … … 913 925 state : setButtonStatus // for changing state 914 926 }; 927 928 HTMLArea.freeLater(obj); 929 915 930 tb_objects[txt] = obj; 916 931 break; … … 937 952 context : btn[4] || null // enabled in a certain context? 938 953 }; 954 955 HTMLArea.freeLater(obj); 956 939 957 tb_objects[txt] = obj; 940 958 // handlers to emulate nice flat toolbar buttons … … 972 990 el.appendChild(i_contain); 973 991 974 obj.imgel = img; 992 obj.imgel = img; 975 993 obj.swapImage = function(newimg) 976 994 { … … 989 1007 } 990 1008 } 991 1009 992 1010 } else if (!el) { 993 1011 el = createSelect(txt); … … 1064 1082 { 1065 1083 doc._htmlareaImgCache = { }; 1084 HTMLArea.freeLater(doc._htmlareaImgCache); 1066 1085 } 1067 1086 … … 1124 1143 statusbar.className = "statusBar"; 1125 1144 this._statusBar = statusbar; 1126 1145 HTMLArea.freeLater(this, '_statusBar'); 1146 1127 1147 // statusbar.appendChild(document.createTextNode(HTMLArea._lc("Path") + ": ")); 1128 1148 // creates a holder for the path view … … 1131 1151 div.innerHTML = HTMLArea._lc("Path") + ": "; 1132 1152 this._statusBarTree = div; 1153 HTMLArea.freeLater(this, '_statusBarTree'); 1133 1154 this._statusBar.appendChild(div); 1134 1155 … … 1137 1158 div.style.display = "none"; 1138 1159 this._statusBarTextMode = div; 1160 HTMLArea.freeLater(this, '_statusBarTextMode'); 1139 1161 this._statusBar.appendChild(div); 1140 1162 … … 1257 1279 } 1258 1280 1281 HTMLArea.freeLater(this._framework); 1282 1259 1283 var fw = this._framework; 1260 1284 fw.table.border="0"; … … 1298 1322 var htmlarea = this._framework.table; 1299 1323 this._htmlArea = htmlarea; 1324 HTMLArea.freeLater(this, '_htmlArea'); 1300 1325 htmlarea.className = "htmlarea"; 1301 1326 … … 1310 1335 this._iframe = iframe; 1311 1336 this._iframe.className = 'xinha_iframe'; 1312 1337 HTMLArea.freeLater(this, '_iframe'); 1338 1313 1339 // creates & appends the status bar 1314 1340 var statusbar = this._createStatusBar(); … … 1819 1845 if (editor._iframe.contentDocument) 1820 1846 { 1821 this._doc = editor._iframe.contentDocument; 1847 this._doc = editor._iframe.contentDocument; 1822 1848 } 1823 1849 else … … 1825 1851 this._doc = editor._iframe.contentWindow.document; 1826 1852 } 1827 doc = this._doc; 1853 doc = this._doc; 1828 1854 if (!doc) { // try later 1829 1855 if (HTMLArea.is_gecko) { … … 1839 1865 setTimeout(function() { editor.initIframe()}, 50); 1840 1866 } 1841 1867 1868 HTMLArea.freeLater(this, '_doc'); 1869 1842 1870 doc.open(); 1843 1871 if (!editor.config.fullPage) { … … 4340 4368 } 4341 4369 } 4342 4343 if(document.all) 4344 { 4345 for(var i = 0; i < document.all.length; i++) 4346 { 4347 for(var j in document.all[i]) 4348 { 4349 if(/^on/.test(j) && typeof document.all[i][j] == 'function') 4370 4371 /* 4372 // This code is very agressive, and incredibly slow in IE, so I've disabled it. 4373 4374 if(document.all) 4375 { 4376 for(var i = 0; i < document.all.length; i++) 4377 { 4378 for(var j in document.all[i]) 4350 4379 { 4351 document.all[i][j] = null; 4352 x++; 4353 } 4354 } 4355 } 4356 } 4357 alert('Flushed ' + x + ' events.'); 4380 if(/^on/.test(j) && typeof document.all[i][j] == 'function') 4381 { 4382 document.all[i][j] = null; 4383 x++; 4384 } 4385 } 4386 } 4387 } 4388 */ 4389 4390 // alert('Flushed ' + x + ' events.'); 4358 4391 } 4359 4392 … … 4439 4472 { 4440 4473 // Create a structure to hold our lists of event handlers 4441 if(typeof el._xinha_dom0Events == 'undefined') el._xinha_dom0Events = { }; 4474 if(typeof el._xinha_dom0Events == 'undefined') 4475 { 4476 el._xinha_dom0Events = { }; 4477 HTMLArea.freeLater(el, '_xinha_dom0Events'); 4478 } 4442 4479 4443 4480 // Create a list of handlers for this event type … … 4482 4519 { 4483 4520 this._notifyListeners[ev] = [ ]; 4521 HTMLArea.freeLater(this, '_notifyListeners'); 4484 4522 } 4485 4523 … … 5418 5456 } 5419 5457 5458 HTMLArea.toFree = [ ]; 5459 HTMLArea.freeLater = function(obj,prop) 5460 { 5461 HTMLArea.toFree.push({o:obj,p:prop}); 5462 } 5463 5464 HTMLArea.free = function(obj, prop) 5465 { 5466 if(obj && !prop) 5467 { 5468 for(var p in obj) 5469 { 5470 HTMLArea.free(obj, p); 5471 } 5472 } 5473 else if (obj) 5474 { 5475 obj[prop] = null; 5476 } 5477 } 5478 5479 /** IE's Garbage Collector is broken very badly. We will do our best to 5480 * do it's job for it, but we can't be perfect. 5481 */ 5482 5483 HTMLArea.collectGarbageForIE = function() 5484 { 5485 HTMLArea.flushEvents(); 5486 for(var x = 0; x < HTMLArea.toFree.length; x++) 5487 { 5488 if(!HTMLArea.toFree[x].o) alert("What is " + x + ' ' + HTMLArea.toFree[x].o); 5489 HTMLArea.free(HTMLArea.toFree[x].o, HTMLArea.toFree[x].p); 5490 } 5491 } 5420 5492 5421 5493 HTMLArea.init(); 5494 HTMLArea.addDom0Event(window,'unload',HTMLArea.collectGarbageForIE);
