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

📄 bs_wysiwyg.class.js

📁 在线电子表格SpreadSheet 在线电子表格SpreadSheet
💻 JS
📖 第 1 页 / 共 2 页
字号:
this.wysiwygElm.innerText = str;} else {this.wysiwygElm.innerHTML = str;}}return true;}this.getValue = function() {return this._value;}this.setImageBrowser = function(url) {this._imageBrowserUrl = url;}this.openImageBrowser = function() {if (typeof(this._imageBrowserUrl) == 'undefined') return false;var url    = this._imageBrowserUrl + '?callbackFunction=' + this._objectName + '.imageBrowserCallback';var params = "dependent=yes,width=500,height=300,location=no,menubar=no,scrollbars=no,status=no,toolbar=no";imgBrowserPopup = window.open(url, "Bs_ImageBrowser", params);return true;}this.imageBrowserCallback = function(url) {var img = this.toolbarDoc.document.getElementById('imgSource');if (img) img.value = url;}this.setCodeSnippets = function(arr) {this._codeSnippets = arr;}this._initCodeSnippets = function() {if (this._codeSnippets) {this.toolbarDoc.document.getElementById('btnSnippets').style.display = '';var formFieldSelect = new Bs_FormFieldSelect;var snippetGroupSelect = this.toolbarDoc.document.getElementById('snippetGroupSelect');formFieldSelect.init(snippetGroupSelect);for (var group in this._codeSnippets) {var opt = new Option(group, group, false, false);snippetGroupSelect.options[snippetGroupSelect.length] = opt;}var snippetNameSelect = this.toolbarDoc.document.getElementById('snippetNameSelect');formFieldSelect.init(snippetNameSelect);for (var group in this._codeSnippets) { break; }if (group) {this._snippetUpdateNames(group);}}}this._snippetUpdateNames = function(groupName) {var snippetNameSelect = this.toolbarDoc.document.getElementById('snippetNameSelect');snippetNameSelect.prune();for (var myName in this._codeSnippets[groupName]) {var opt = new Option(myName, myName, false, false);snippetNameSelect.options[snippetNameSelect.length] = opt;}}this.snippetSwitchGroup = function(groupName) {this._snippetUpdateNames(groupName);var snippetHtmlEditor       = this.toolbarDoc.document.getElementById('snippetHtmlEditor');snippetHtmlEditor.innerText = '';}this.snippetShow = function(snippetName) {var groupName              = this.toolbarDoc.document.getElementById('snippetGroupSelect').getValue();var snippetHtmlEditor      = this.toolbarDoc.document.getElementById('snippetHtmlEditor');var snippetPropModified    = this.toolbarDoc.document.getElementById('snippetPropModified');var snippetPropUser        = this.toolbarDoc.document.getElementById('snippetPropUser');var snippetPropDescription = this.toolbarDoc.document.getElementById('snippetPropDescription');var t = this._codeSnippets[groupName][snippetName];var value       = (t['value'])       ? t['value']       : '';var lastMod     = (t['lastMod'])     ? t['lastMod']     : '';var user        = (t['user'])        ? t['user']        : '';var description = (t['description']) ? t['description'] : '';snippetHtmlEditor.innerText      = value;snippetPropModified.innerHTML    = lastMod;snippetPropUser.innerHTML        = user;snippetPropDescription.innerHTML = description;}this.specialCharsSelectorShow = function() {if (!this.specialCharsSelectorUrl) return false;bsWysiwygSpecialCharsOpener = this;var params = "dependent=yes,width=420,height=200,location=no,menubar=no,scrollbars=no,status=no,toolbar=no";bsWysiwygSpecialCharsWindow = window.open(this.specialCharsSelectorUrl, "Bs_SpecialCharsSelector", params);return true;}this.specialCharsOnloadCallback = function() {}this.specialCharsDoneCallback = function(code) {if (this.inHtmlMode) {this.insertHtml('&' + code + ';');} else {this.insertHtml('&' + code + ';');}}this.insertHtml = function(str) {this._editorCursorPos.pasteHTML(str);}this.saveCursorPos = function() {try {this._editorCursorPos = document.selection.createRange().duplicate();} catch (e) {this._editorCursorPos = null;}}this.fireOnBlur = function() {if (this.wysiwygElm) {if (this.inHtmlMode) {this._value = this.wysiwygElm.innerText;} else {this._value = this.wysiwygElm.innerHTML;}if (typeof(this.formFieldName) != 'undefined') {var fld = document.getElementById(this.formFieldName);if (typeof(fld) != 'unknown') fld.value = this._value;}}this.fireEvent('editEnd');}this.fireOnFocus = function() {if (this.style == 'toolbar') {this.toggleToolbar(false);}this.fireEvent('editStart');}this._fireEditareaOnPaste = function() {if (typeof(this.editareaOnPaste) == 'function') {var status = this.editareaOnPaste();if (typeof(status) == 'string') {window.clipboardData.setData("Text", status);event.returnValue = true;} else {event.returnValue = false;}return;} else {switch (this.editareaOnPaste) {case 1:alert('Sorry, no pasting allowed.');case 0:event.returnValue = false;return;break;case 5:event.returnValue = true;return;break;default:var clipValOrig  = window.clipboardData.getData("Text");var clipValStrip = bs_stripTags(clipValOrig);if ((clipValOrig == clipValStrip) || (this.editareaOnPaste == 2)) {event.returnValue = true;return;} else {switch (this.editareaOnPaste) {case 3:alert("Formatting tags have been removed from the clipboard.");window.clipboardData.setData("Text", clipValStrip);event.returnValue = true;break;case 4:var status = confirm("The pasted content includes formatting tags. Click OK to paste your content with them. Click cancel to have them removed.");if (!status) window.clipboardData.setData("Text", clipValStrip);event.returnValue = true;break;}}}}}this.addToRegisterCustom1 = function(action, imgName, title, helpText) {var i = this.registerCustom1Content.length;if ((action == 'undefined') || (typeof(action) != 'string')) {this.registerCustom1Content[i] = '__SEPARATOR__';} else {var i = this.registerCustom1Content.length;this.registerCustom1Content[i] = new Array();this.registerCustom1Content[i]['action']   = action;this.registerCustom1Content[i]['imgName']  = imgName;this.registerCustom1Content[i]['title']    = title;this.registerCustom1Content[i]['helpText'] = helpText;}}this._objectName = objectName;bsWysiwygInstances[this._objectName] = this;}

⌨️ 快捷键说明

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