⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bs_wysiwyg.class.js

📁 在线电子表格SpreadSheet 在线电子表格SpreadSheet
💻 JS
📖 第 1 页 / 共 2 页
字号:
/********************************************************************************************* BlueShoes Framework; This file is part of the php application framework.* NOTE: This code is stripped (obfuscated). To get the clean documented code goto *       www.blueshoes.org and register for the free open source *DEVELOPER* version or *       buy the commercial version.*       *       In case you've already got the developer version, then this is one of the few *       packages/classes that is only available to *PAYING* customers.*       To get it go to www.blueshoes.org and buy a commercial version.* * @copyright www.blueshoes.org* @author    Samuel Blume <sam at blueshoes dot org>* @author    Andrej Arn <andrej at blueshoes dot org>*/if (typeof(bsWysiwygInstances) == 'undefined') {var bsWysiwygInstances = new Object;}if (typeof(bsWysiwygDivToInstanceArray) == 'undefined') {var bsWysiwygDivToInstanceArray = new Object;}function bsWysiwygEditorOnBlurWrapper(tagId) {bsWysiwygDivToInstanceArray[tagId].fireOnBlur();}function bsWysiwygEditorOnFocusWrapper(tagId) {bsWysiwygDivToInstanceArray[tagId].fireOnFocus();}function bsWysiwygEditorEventWrapper(ev, tagId) {switch (ev) {case 'editareaMouseOver':case 'editareaMouseOut':bsWysiwygDivToInstanceArray[tagId].fireEvent(ev);break;case 'editareaPaste':bsWysiwygDivToInstanceArray[tagId]._fireEditareaOnPaste();break;}}function bsWysiwygEditorObdWrapper(tagId) {bsWysiwygDivToInstanceArray[tagId].saveCursorPos();}function bsWysiwygToolbarOnloadCallback() {for (var objectName in bsWysiwygInstances) {var page = document[objectName + '_toolbarIframe'];if (page) {if ((page.meLoaded) && (!page.sawThatMeLoaded)) {var evalStr = objectName + '.toolbarOnloadCallback();';eval(evalStr);break;}}}}var bsWysiwygSpecialCharsOpener;var bsWysiwygSpecialCharsWindow;function bsSpecialCharsOnloadCallback() {bsWysiwygSpecialCharsOpener.specialCharsOnloadCallback();}function bsSpecialCharsDoneCallback(code) {bsWysiwygSpecialCharsOpener.specialCharsDoneCallback(code);}function Bs_Wysiwyg(objectName) {this._objectName;this.dataType = 'whtml';this.editareaOnPaste = 5;this.style = 'inline';this.inHtmlMode = false;this._value = '';this.formFieldName;this.useRegisterCustom1 = false;this.useRegisterText    = 'auto';this.useRegisterEasy    = 'auto';this.useRegisterPlus    = 'auto';this.useRegisterEditlive   = false;this.useRegisterHtml       = 'auto';this.useRegisterScreentype = 'auto';this.registerCustom1Content = new Array();this.registerCustom1Caption = 'Custom 1';this.toolbarDoc;this.toolbarElm;this.wysiwygElm;this.outrendered = false;this._imageBrowserUrl;this.specialCharsSelectorUrl = '/_bsJavascript/components/wysiwyg/specialCharsSelector.html';this._codeSnippets;this._editorCursorPos;this.useTabWysiwyg;this.tabWysiwygGroup = new Array;this.tabWysiwygGroup['clipboard']     = 2;this.tabWysiwygGroup['undo']          = 2;this.tabWysiwygGroup['align']         = 2;this.tabWysiwygGroup['bold']          = 2;this.tabWysiwygGroup['list']          = 2;this.tabWysiwygGroup['dent']          = 2;this.tabWysiwygGroup['link']          = 2;this.tabWysiwygGroup['image']         = 2;this.tabWysiwygGroup['specialFormat'] = 2;this.tabWysiwygGroup['color']         = 2;this.tabWysiwygGroup['font']          = 2;this.tabWysiwygGroup['percent']       = 2;this.tabWysiwygGroup['codeSnippets']  = 2;this.tabWysiwygGroup['specialChars']  = 2;this.dataContainer;this.toolbarShowButtonUndo = false;this.toolbarShowButtonSave = false;this.toolbarShowButtonClose = true;this._toolbarStartActivated = false;this._attachedEvents;this.attachEvent = function(trigger, yourEvent) {if (typeof(this._attachedEvents) == 'undefined') {this._attachedEvents = new Array();}if (typeof(this._attachedEvents[trigger]) == 'undefined') {this._attachedEvents[trigger] = new Array(yourEvent);} else {this._attachedEvents[trigger][this._attachedEvents[trigger].length] = yourEvent;}}this.hasEventAttached = function(trigger) {return (this._attachedEvents && this._attachedEvents[trigger]);}this.fireEvent = function(trigger) {if (this._attachedEvents && this._attachedEvents[trigger]) {var e = this._attachedEvents[trigger];if ((typeof(e) == 'string') || (typeof(e) == 'function')) {e = new Array(e);}for (var i=0; i<e.length; i++) {if (typeof(e[i]) == 'function') {e[i](this);} else if (typeof(e[i]) == 'string') {eval(e[i]);}}}}this.toggleToolbar = function(hide) {var toolbarDiv = document.getElementById(this._objectName + '_toolbarDiv');if (typeof(toolbarDiv) == 'undefined') return false;toolbarDiv.style.display = (hide) ? 'none' : 'block';}this.toolbarButtonUndo = function() {this.toggleToolbar(true);}this.toolbarButtonSave = function() {this.toggleToolbar(true);}this.toolbarButtonClose = function() {this.toggleToolbar(true);document.body.focus();this.fireOnBlur();this.fireEvent('toolbarButtonClose');}this.drawAsToolbar = function(editableAreaId, startActivated) {this.wysiwygElm = document.getElementById(editableAreaId);if (!this.wysiwygElm) return false;if (startActivated) this._toolbarStartActivated = true;this._value = this.wysiwygElm.innerHTML;bsWysiwygDivToInstanceArray[editableAreaId] = this;this.wysiwygElm.attachEvent('onbeforedeactivate', function() { bsWysiwygEditorObdWrapper(editableAreaId); } );this.wysiwygElm.attachEvent('onblur',             function() { bsWysiwygEditorOnBlurWrapper(editableAreaId); } );this.wysiwygElm.attachEvent('onfocus',            function() { bsWysiwygEditorOnFocusWrapper(editableAreaId); } );this.wysiwygElm.attachEvent('onmouseover',        function() { bsWysiwygEditorEventWrapper('editareaMouseOver', editableAreaId); } );this.wysiwygElm.attachEvent('onmouseout',         function() { bsWysiwygEditorEventWrapper('editareaMouseOut',  editableAreaId); } );this.wysiwygElm.attachEvent('onpaste',            function() { bsWysiwygEditorEventWrapper('editareaPaste',     editableAreaId); } );var out = new Array;out[out.length] = '<div id="' + this._objectName + '_toolbarDiv" style="behavior:url(\'/_bsJavascript/lib/winlessmovable.htc\'); display:none; cursor:hand; position:absolute; left;50; top:50; width:446; height=expression(parseInt(document.getElementById(\'' + this._objectName + '_toolbarIframe\').offsetHeight) + 25 + \'px\'); border:1px solid gray;">';out[out.length] = '<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="blue">';out[out.length] = '  <tr>';out[out.length] = '    <td><font face="arial" size="2" color="white"><b>BlueShoes Wysiwyg Toolbar</b></font></td>';if (this.toolbarShowButtonUndo)  out[out.length] = '    <td align="right" width="16"><img src="/_bsJavascript/components/wysiwyg/buttons/windows_undo.gif"  width="16" height="14" border="0" onClick="' + this._objectName + '.toolbarButtonUndo();"></td>';if (this.toolbarShowButtonSave)  out[out.length] = '    <td align="right" width="16"><img src="/_bsJavascript/components/wysiwyg/buttons/windows_save.gif"  width="16" height="14" border="0" onClick="' + this._objectName + '.toolbarButtonSave();"></td>';if (this.toolbarShowButtonClose) out[out.length] = '    <td align="right" width="16"><img src="/_bsJavascript/components/wysiwyg/buttons/windows_close.gif" width="16" height="14" border="0" onClick="' + this._objectName + '.toolbarButtonClose();"></td>';out[out.length] = '  </tr>';out[out.length] = '</table>';out[out.length] = this._getDrawnFormField();out[out.length] = '<iframe src="/_bsJavascript/components/wysiwyg/toolbar.html"';out[out.length] = ' name="' + this._objectName + '_toolbarIframe' + '"';out[out.length] = ' id="' + this._objectName + '_toolbarIframe' + '"';out[out.length] = ' style="border:lightgrey 0px inset; position:relative; top:0; left:0; width:100%; height:0; z-index:1;"';out[out.length] = '></iframe>';out[out.length] = '</div>';var body = document.getElementsByTagName('body').item(0);body.insertAdjacentHTML('beforeEnd', out.join(''));this.outrendered = true;return true;}this.drawInto = function(tagId) {var out = new Array;if (this.style == 'toolbar') {out[out.length] = '<div style="position:absolute; left;50; top:50; width:442; height:200; border:1px solid gray;">';} else {out[out.length] = '<div style="width:100%; height:100%; border:1px solid gray;">';}out[out.length] = this._getDrawnFormField();out[out.length] = '<iframe src="/_bsJavascript/components/wysiwyg/toolbar.html"';out[out.length] = ' name="' + this._objectName + '_toolbarIframe' + '"';out[out.length] = ' id="' + this._objectName + '_toolbarIframe' + '"';out[out.length] = ' style="border:lightgrey 0px inset; position:relative; top:0; left:0; width:100%; height:0; z-index:1;"';out[out.length] = '></iframe>';out[out.length] = '<div id="' + this._objectName + '_wysiwyg' + '"';out[out.length] = ' style="background-color:white; border:1px gray solid; overflow:auto; width:100%;';var fullHeight = parseInt(document.getElementById(tagId).clientHeight);out[out.length] = ' height:expression(' + fullHeight + ' - parseInt(document.getElementById(\'' + this._objectName + '_toolbarIframe' + '\').clientHeight) + \'px\');"';out[out.length] = ' onBeforeDeactivate="' + this._objectName + '.saveCursorPos();"';out[out.length] = ' onBlur="'  + this._objectName + '.fireOnBlur();"';out[out.length] = ' onpaste="' + this._objectName + '._fireEditareaOnPaste();"';out[out.length] = '>' + this._value + '</div>';out[out.length] = '</div>';var tag = document.getElementById(tagId);tag.innerHTML = out.join('');this.outrendered = true;return true;}this._getDrawnFormField = function() {if (typeof(this.formFieldName) == 'undefined') return '';return '<input type="hidden" name="' + this.formFieldName + '" id="' + this.formFieldName + '" value="' + bs_filterForHtml(this._value) + '">';}this.toolbarOnloadCallback = function() {this.toolbarDoc = document[this._objectName + '_toolbarIframe'];this.toolbarElm = document.getElementById(this._objectName + '_toolbarIframe');if (this.style != 'toolbar') {this.wysiwygElm = document.getElementById(this._objectName + '_wysiwyg');} else {this.toolbarDoc.useInternalHtmlElement = true;this.toolbarDoc.registerSize['html']['height'] += 308;this.toolbarDoc.registerSizeNow['html']['height'] = this.toolbarDoc.registerSize['html']['height'];}this.toolbarDoc.sawThatMeLoaded = true;this.toolbarDoc.wysiwygObj = this;this.toolbarDoc.init(this.dataType, this._toolbarStartActivated);this._initCodeSnippets();if (this._toolbarStartActivated) this.wysiwygElm.focus();}this.setValue = function(str) {this._value = str;if (this.outrendered) {if (this.inHtmlMode) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -