Changeset 341
- Timestamp:
- 09/24/05 20:27:39 (8 years ago)
- Files:
-
- 1 modified
-
trunk/htmlarea.js (modified) (73 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htmlarea.js
r335 r341 40 40 'Revision' : '$LastChangedRevision$'.replace(/^[^:]*: (.*) \$$/, '$1'), 41 41 'RevisionBy': '$LastChangedBy$'.replace(/^[^:]*: (.*) \$$/, '$1') 42 } 42 }; 43 43 44 44 if (typeof _editor_url == "string") { … … 98 98 w: textarea.style.width ? textarea.style.width : (textarea.offsetWidth + 'px'), 99 99 h: textarea.style.height ? textarea.style.height : (textarea.offsetHeight + 'px') 100 } 100 }; 101 101 102 102 this._editMode = "wysiwyg"; … … 204 204 top: '100px', // Height 205 205 bottom: '100px' 206 } 206 }; 207 207 208 208 // enable creation of a status bar? … … 538 538 object.drawPanelIn(panel); 539 539 } 540 } 540 }; 541 541 542 542 /** The following helper function registers a dropdown box with the editor … … 697 697 } 698 698 } 699 } 699 }; 700 700 701 701 /** Helper function: replace all TEXTAREA-s in the document with HTMLArea-s. */ … … 733 733 734 734 return toolbar; 735 } 735 }; 736 736 737 737 738 738 HTMLArea.prototype._setConfig = function(config) { 739 739 this.config = config; 740 } 740 }; 741 741 742 742 HTMLArea.prototype._addToolbar = function() { 743 743 this._createToolbar1(this, this._toolbar, this._toolbarObjects); 744 } 744 }; 745 745 746 746 // separate from previous createToolBar to allow dynamic change of toolbar … … 1138 1138 i_contain.appendChild(img); 1139 1139 return i_contain; 1140 } 1140 }; 1141 1141 1142 1142 HTMLArea.prototype._createStatusBar = function() { … … 1278 1278 'sb_cell' :document.createElement('td') // status bar 1279 1279 1280 } 1280 }; 1281 1281 1282 1282 HTMLArea.freeLater(this._framework); … … 1469 1469 1470 1470 this.notifyOn('panel_change',function(){editor.sizeEditor();}); 1471 } 1471 }; 1472 1472 1473 1473 /** … … 1651 1651 1652 1652 this.notifyOf('resize', {width:this._htmlArea.offsetWidth, height:this._htmlArea.offsetHeight}); 1653 } 1653 }; 1654 1654 1655 1655 HTMLArea.prototype.addPanel = function(side) … … 1668 1668 1669 1669 return div; 1670 } 1670 }; 1671 1671 1672 1672 HTMLArea.prototype.removePanel = function(panel) … … 1683 1683 this._panels[panel.side].panels = clean; 1684 1684 this.notifyOf('panel_change', {'action':'remove','panel':panel}); 1685 } 1685 }; 1686 1686 1687 1687 HTMLArea.prototype.hidePanel = function(panel) … … 1692 1692 this.notifyOf('panel_change', {'action':'hide','panel':panel}); 1693 1693 } 1694 } 1694 }; 1695 1695 1696 1696 HTMLArea.prototype.showPanel = function(panel) … … 1701 1701 this.notifyOf('panel_change', {'action':'show','panel':panel}); 1702 1702 } 1703 } 1703 }; 1704 1704 1705 1705 HTMLArea.prototype.hidePanels = function(sides) … … 1720 1720 } 1721 1721 this.notifyOf('panel_change', {'action':'multi_hide','sides':sides}); 1722 } 1722 }; 1723 1723 1724 1724 HTMLArea.prototype.showPanels = function(sides) … … 1739 1739 } 1740 1740 this.notifyOf('panel_change', {'action':'multi_show','sides':sides}); 1741 } 1741 }; 1742 1742 1743 1743 HTMLArea.objectProperties = function(obj) … … 1749 1749 } 1750 1750 return props; 1751 } 1751 }; 1752 1752 1753 1753 /* … … 1767 1767 return false; 1768 1768 } 1769 } 1769 }; 1770 1770 1771 1771 HTMLArea._someEditorHasBeenActivated = false; … … 1809 1809 var editor = this; 1810 1810 this.enableToolbar(); 1811 } 1811 }; 1812 1812 1813 1813 HTMLArea.prototype.deactivateEditor = function() … … 1835 1835 1836 1836 HTMLArea._currentlyActiveEditor = false; 1837 } 1837 }; 1838 1838 1839 1839 HTMLArea.prototype.initIframe = function() … … 1941 1941 editor._onGenerate(); 1942 1942 } 1943 } 1943 }; 1944 1944 1945 1945 // Switches editor mode; parameter can be "textmode" or "wysiwyg". If no … … 2170 2170 } 2171 2171 return retVal; 2172 } 2172 }; 2173 2173 2174 2174 // refresh plugin by calling onGenerate or onGenerateOnce method. … … 2350 2350 this.setHTML(D); 2351 2351 this.updateToolbar(); 2352 } 2352 }; 2353 2353 2354 2354 HTMLArea.prototype._splitBlock = function() 2355 2355 { 2356 2356 this._doc.execCommand('formatblock', false, 'div'); 2357 } 2357 }; 2358 2358 2359 2359 HTMLArea.prototype.forceRedraw = function() { … … 2442 2442 btn.state("enabled", false); 2443 2443 } 2444 } 2444 }; 2445 2445 2446 2446 HTMLArea.prototype.enableToolbar = function() 2447 2447 { 2448 2448 this.updateToolbar(); 2449 } 2449 }; 2450 2450 2451 2451 if(!Array.prototype.contains) … … 2460 2460 2461 2461 return false; 2462 } 2462 }; 2463 2463 } 2464 2464 … … 2474 2474 2475 2475 return null; 2476 } 2476 }; 2477 2477 } 2478 2478 … … 2725 2725 2726 2726 2727 } 2727 }; 2728 2728 2729 2729 /** Returns a node after which we can insert other nodes, in the current … … 2865 2865 2866 2866 return null; 2867 } 2867 }; 2868 2868 2869 2869 /** … … 2943 2943 return null; 2944 2944 } 2945 } 2945 }; 2946 2946 2947 2947 … … 2960 2960 2961 2961 return true; 2962 } 2962 }; 2963 2963 2964 2964 HTMLArea.prototype._getAncestorBlock = function(sel) … … 3006 3006 3007 3007 return null; 3008 } 3008 }; 3009 3009 3010 3010 HTMLArea.prototype._createImplicitBlock = function(type) … … 3027 3027 3028 3028 // Expand DN 3029 } 3029 }; 3030 3030 3031 3031 HTMLArea.prototype._formatBlock = function(block_format) … … 3127 3127 } 3128 3128 3129 } 3129 }; 3130 3130 3131 3131 // Selects the contents inside the given node … … 4064 4064 this._iframe.contentWindow.scrollTo(left, top); 4065 4065 } 4066 } 4066 }; 4067 4067 4068 4068 // retrieve the HTML … … 4130 4130 4131 4131 return html; 4132 } 4132 }; 4133 4133 4134 4134 HTMLArea.prototype.inwardHtml = function(html) … … 4154 4154 html = this.fixRelativeLinks(html); 4155 4155 return html; 4156 } 4156 }; 4157 4157 4158 4158 HTMLArea.prototype.outwardSpecialReplacements = function(html) … … 4168 4168 } 4169 4169 return html; 4170 } 4170 }; 4171 4171 4172 4172 HTMLArea.prototype.inwardSpecialReplacements = function(html) … … 4185 4185 } 4186 4186 return html; 4187 } 4187 }; 4188 4188 4189 4189 … … 4224 4224 4225 4225 return html; 4226 } 4226 }; 4227 4227 4228 4228 // retrieve the HTML (fastest version, but uses innerHTML) … … 4388 4388 4389 4389 // alert('Flushed ' + x + ' events.'); 4390 } 4390 }; 4391 4391 4392 4392 HTMLArea._addEvent = function(el, evname, func) { … … 4449 4449 HTMLArea._prepareForDom0Events(el, ev); 4450 4450 el._xinha_dom0Events[ev].unshift(fn); 4451 } 4451 }; 4452 4452 4453 4453 … … 4462 4462 HTMLArea._prepareForDom0Events(el, ev); 4463 4463 el._xinha_dom0Events[ev].push(fn); 4464 } 4464 }; 4465 4465 4466 4466 /** … … 4511 4511 HTMLArea._eventFlushers.push([el, ev]); 4512 4512 } 4513 } 4513 }; 4514 4514 4515 4515 HTMLArea.prototype.notifyOn = function(ev, fn) … … 4522 4522 4523 4523 this._notifyListeners[ev].push(fn); 4524 } 4524 }; 4525 4525 4526 4526 HTMLArea.prototype.notifyOf = function(ev, args) … … 4535 4535 } 4536 4536 } 4537 } 4537 }; 4538 4538 4539 4539 … … 4582 4582 { 4583 4583 return el && el.nodeType == 1 && (HTMLArea._paraContainerTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1); 4584 } 4584 }; 4585 4585 4586 4586 HTMLArea._closingTags = " head script style div span tr td tbody table em strong b i strike code cite dfn abbr acronym font a title textarea select form "; … … 4614 4614 return editor._iframe.contentWindow.document.body.innerHTML; 4615 4615 } 4616 } 4616 }; 4617 4617 4618 4618 HTMLArea.getHTMLWrapper = function(root, outputRoot, editor, indent) { … … 4937 4937 } 4938 4938 return true; 4939 } 4939 }; 4940 4940 4941 4941 … … 4963 4963 el.className = thiers.join(' ').trim(); 4964 4964 } 4965 } 4965 }; 4966 4966 4967 4967 HTMLArea.removeClasses = function(el, classes) … … 4987 4987 } 4988 4988 return new_classes.join(' '); 4989 } 4989 }; 4990 4990 4991 4991 /** Alias these for convenience */ … … 5030 5030 } 5031 5031 } 5032 } 5032 }; 5033 5033 5034 5034 req.onreadystatechange = callBack; … … 5042 5042 //alert(content); 5043 5043 req.send(content); 5044 } 5044 }; 5045 5045 5046 5046 HTMLArea._getback = function(url, handler) … … 5069 5069 } 5070 5070 } 5071 } 5071 }; 5072 5072 5073 5073 req.onreadystatechange = callBack; 5074 5074 req.open('GET', url, true); 5075 5075 req.send(null); 5076 } 5076 }; 5077 5077 5078 5078 HTMLArea._geturlcontent = function(url) … … 5100 5100 } 5101 5101 5102 } 5102 }; 5103 5103 5104 5104 /** … … 5140 5140 } 5141 5141 return all_found; 5142 } 5142 }; 5143 5143 5144 5144 HTMLArea.arrayFilter = function(a1, filterfn) … … 5152 5152 5153 5153 return new_a; 5154 } 5154 }; 5155 5155 5156 5156 HTMLArea.uniq_count = 0; … … 5158 5158 { 5159 5159 return prefix + HTMLArea.uniq_count++; 5160 } 5160 }; 5161 5161 5162 5162 /** New language handling functions **/ … … 5200 5200 5201 5201 return lang; 5202 } 5202 }; 5203 5203 5204 5204 /** Return a localised string. … … 5285 5285 5286 5286 return ret; 5287 } 5287 }; 5288 5288 5289 5289 HTMLArea.hasDisplayedChildren = function(el) … … 5301 5301 } 5302 5302 return false; 5303 } 5303 }; 5304 5304 5305 5305 … … 5328 5328 } 5329 5329 return array; 5330 } 5330 }; 5331 5331 5332 5332 if(!Array.prototype.append) … … 5339 5339 } 5340 5340 return this; 5341 } 5341 }; 5342 5342 } 5343 5343 … … 5357 5357 } 5358 5358 return editors; 5359 } 5359 }; 5360 5360 5361 5361 HTMLArea.startEditors = function(editors) … … 5365 5365 if(editors[i].generate) editors[i].generate(); 5366 5366 } 5367 } 5367 }; 5368 5368 5369 5369 HTMLArea.prototype.registerPlugins = function(plugin_names) { … … 5375 5375 } 5376 5376 } 5377 } 5377 }; 5378 5378 5379 5379 /** Utility function to base64_encode some arbitrary data, uses the builtin btoa() if it exists (Moz) */ … … 5408 5408 5409 5409 return output; 5410 } 5410 }; 5411 5411 5412 5412 /** Utility function to base64_decode some arbitrary data, uses the builtin atob() if it exists (Moz) */ … … 5444 5444 5445 5445 return output; 5446 } 5446 }; 5447 5447 5448 5448 HTMLArea.removeFromParent = function(el) … … 5452 5452 pN.removeChild(el); 5453 5453 return el; 5454 } 5454 }; 5455 5455 5456 5456 HTMLArea.hasParentNode = function(el) … … 5468 5468 5469 5469 return false; 5470 } 5470 }; 5471 5471 5472 5472 HTMLArea.getOuterHTML = function(element) … … 5480 5480 return (new XMLSerializer()).serializeToString(element); 5481 5481 } 5482 } 5482 }; 5483 5483 5484 5484 HTMLArea.toFree = [ ]; … … 5486 5486 { 5487 5487 HTMLArea.toFree.push({o:obj,p:prop}); 5488 } 5488 }; 5489 5489 5490 5490 HTMLArea.free = function(obj, prop) … … 5501 5501 obj[prop] = null; 5502 5502 } 5503 } 5503 }; 5504 5504 5505 5505 /** IE's Garbage Collector is broken very badly. We will do our best to … … 5515 5515 HTMLArea.free(HTMLArea.toFree[x].o, HTMLArea.toFree[x].p); 5516 5516 } 5517 } 5517 }; 5518 5518 5519 5519 HTMLArea.init();
