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

📄 bs_wysiwygnew.class.js_

📁 在线电子表格SpreadSheet 在线电子表格SpreadSheet
💻 JS_
📖 第 1 页 / 共 5 页
字号:
      case 'Paste':
      case 'JustifyLeft':
      case 'JustifyCenter':
      case 'JustifyRight':
      case 'InsertOrderedList':
      case 'InsertUnorderedList':
      case 'Outdent':
      case 'Indent':
			case 'UnLink':
				try {
	        this.workingDoc.execCommand(btnObj.action, false, null);
				} catch (e) {
					//ugh.
				}
				break;
			case 'CreateLink':
				//we use our own window, that is way better.
        //this.workingDoc.execCommand(btnObj.action, true, null);
				var url = this.hrefSelector[0] + '?objectName=' + this._objectName;
				url += '&callbackLoad=callbackWindowHref&callbackSave=createLink';
				if (moz) {
					window.open(url, "HrefSelector", "width=" + this.hrefSelector[1] + ",height=" + this.hrefSelector[2] + ",left=0,top=0,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,hotkeys=no,dependent=yes");
				} else {
					var ret = window.showModalDialog(url, this.callbackWindowHref(), "dialogWidth:"  + this.hrefSelector[1] + "px; dialogHeight:" + this.hrefSelector[2] + "px;");
					if (ret) this.createLink(ret);
				}
				break;
			case 'InsertImage':
				//we use our own window, that is way better.
        //this.workingDoc.execCommand('InsertImage', true, null);
				var url = this.imageSelector[0] + '?objectName=' + this._objectName;
				url += '&callbackLoad=callbackWindowImage&callbackSave=createImage';
				if (moz) {
					window.open(url, "ImageSelector", "width=" + this.imageSelector[1] + ",height=" + this.imageSelector[2] + ",left=0,top=0,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,hotkeys=no,dependent=yes");
				} else {
					var ret = window.showModalDialog(url, this.callbackWindowImage(), "dialogWidth:"  + this.imageSelector[1] + "px; dialogHeight:" + this.imageSelector[2] + "px;");
					if (ret) this.createImage(ret);
				}
				break;
			case 'ForeColor':
				var url = this.fgColorSelector[0] + '?objectName=' + this._objectName;
				url += '&callbackLoad=callbackWindowColor&callbackSave=setFgColor';
				if (moz) {
					window.open(url, "FgColorSelector", "width=" + this.fgColorSelector[1] + ",height=" + this.fgColorSelector[2] + ",left=0,top=0,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,hotkeys=no,dependent=yes");
				} else {
					var ret = window.showModalDialog(url, this.callbackWindowColor(), "dialogWidth:"  + this.fgColorSelector[1] + "px; dialogHeight:" + this.fgColorSelector[2] + "px;");
					if (ret) this.setFgColor(ret);
				}
				break;
			case 'Color':
				var url = this.fgColorSelector[0] + '?objectName=' + this._objectName;
				url += '&callbackLoad=false&callbackSave=insertString';
				if (moz) {
					window.open(url, "ColorSelector", "width=" + this.fgColorSelector[1] + ",height=" + this.fgColorSelector[2] + ",left=0,top=0,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,hotkeys=no,dependent=yes");
				} else {
					var ret = window.showModalDialog(url, this.callbackWindowColor(), "dialogWidth:"  + this.fgColorSelector[1] + "px; dialogHeight:" + this.fgColorSelector[2] + "px;");
					if (ret) this.insertString(ret);
				}
				break;
			case 'Font':
				this.lastSelection = this.workingDoc.selection.createRange(); //have to remember it here, cause later this window has no focus.
				var url = this.fontSelector[0] + '?objectName=' + this._objectName;
				url += '&callbackLoad=callbackWindowFont&callbackSave=setFont';
				if (moz) {
					window.open(url, "fontSelector", "width=" + this.fontSelector[1] + ",height=" + this.fontSelector[2] + ",left=0,top=0,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,hotkeys=no,dependent=yes");
				} else {
					var ret = window.showModalDialog(url, this.callbackWindowFont(), "dialogWidth:"  + this.fontSelector[1] + "px; dialogHeight:" + this.fontSelector[2] + "px;");
					if (ret) this.setFont(ret);
				}
				break;
			case 'SpecialChars':
				var url = this.specialCharSelector[0] + '?objectName=' + this._objectName;
				url += '&callbackLoad=callbackWindowSpecialChars&callbackSave=insertSpecialChar';
				if (moz) {
					window.open(url, "specialCharSelector", "width=" + this.specialCharSelector[1] + ",height=" + this.specialCharSelector[2] + ",left=0,top=0,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,hotkeys=no,dependent=yes");
				} else {
					var ret = window.showModalDialog(url, true, "dialogWidth:"  + this.specialCharSelector[1] + "px; dialogHeight:" + this.specialCharSelector[2] + "px;");
					if (ret) this.insertSpecialChar(ret);
				}
				break;
			/*
			case 'InsertTable':
				break;*/
			case 'x':
				//this is only a testing case. 
				
				this.workingDoc.execCommand('FontName', true, 'arial');
		    //workingDoc.execCommand("FontName", false, fontFace); 
				/*
				tempRange = this.workingDoc.selection.createRange();
				tempRange.expand('word');
				tempRange.select();
				*/
				break;
				
				/*
				var r = document.body.createRange();
				var r = document.getElementById(this._objectName + '_iframe').contentWindow.document.body.createRange();
				//var r = this.workingDoc.body.createRange();
				r.selectNodeContents(this);
				alert(r.toString());
				*/
		}
	}
	
	
	/**
	* loads the buttons for the text bar.
	* @access public
	* @return void
	* @see    var this.buttonsText
	*/
	this.loadButtonsText = function() {
		var buttons = new Array();
		this.buttonsText = buttons;
		
		buttons['cut'] = new Array();
		buttons['cut'].action   = 'Cut';
		buttons['cut'].imgName  = 'bs_cut';
		
		buttons['copy'] = new Array();
		buttons['copy'].action   = 'Copy';
		buttons['copy'].imgName  = 'bs_copy';
		
		buttons['paste'] = new Array();
		buttons['paste'].action   = 'Paste';
		buttons['paste'].imgName  = 'bs_paste';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['undo'] = new Array();
		buttons['undo'].action   = 'Undo';
		buttons['undo'].imgName  = 'bs_undo';
		
		buttons['redo'] = new Array();
		buttons['redo'].action   = 'Redo';
		buttons['redo'].imgName  = 'bs_redo';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
	}
	
	/**
	* @access private
	* @return void
	*/
	this._drawButtonBarText = function() {
		toolbarText = new Bs_ButtonBar();
		toolbarText.useHelpBar = 'toolbarHelptext';
		if (typeof(this.buttonsText) == 'undefined') this.loadButtonsText();
		this._drawButtonBarHelper(this.buttonsText, 'toolbarText', 'text');
	}
	
	
	/**
	* loads the buttons for the wysiwyg bar.
	* @access public
	* @return void
	* @see    var this.buttonsWysiwyg
	*/
	this.loadButtonsWysiwyg = function() {
		var buttons = new Array();
		this.buttonsWysiwyg = buttons;
		
		buttons['cut'] = new Array();
		buttons['cut'].action   = 'Cut';
		buttons['cut'].imgName  = 'bs_cut';
		
		buttons['copy'] = new Array();
		buttons['copy'].action   = 'Copy';
		buttons['copy'].imgName  = 'bs_copy';
		
		buttons['paste'] = new Array();
		buttons['paste'].action   = 'Paste';
		buttons['paste'].imgName  = 'bs_paste';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['undo'] = new Array();
		buttons['undo'].action   = 'Undo';
		buttons['undo'].imgName  = 'bs_undo';
		
		buttons['redo'] = new Array();
		buttons['redo'].action   = 'Redo';
		buttons['redo'].imgName  = 'bs_redo';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['bold'] = new Array();
		buttons['bold'].action   = 'Bold';
		
		buttons['italic'] = new Array();
		buttons['italic'].action   = 'Italic';
		
		buttons['underline'] = new Array();
		buttons['underline'].action   = 'Underline';
		buttons['underline'].imgName  = 'bs_formatUnderline';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['font'] = new Array();
		buttons['font'].action   = 'Font';
		buttons['font'].imgName  = 'bs_font';
		
		buttons['forecolor'] = new Array();
		buttons['forecolor'].action   = 'ForeColor';
		buttons['forecolor'].imgName  = 'bs_fgColor';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['justifyleft'] = new Array();
		buttons['justifyleft'].action   = 'JustifyLeft';
		buttons['justifyleft'].imgName  = 'bs_alignLeft';
		
		buttons['justifycenter'] = new Array();
		buttons['justifycenter'].action   = 'JustifyCenter';
		buttons['justifycenter'].imgName  = 'bs_alignCenter';
		
		buttons['justifyright'] = new Array();
		buttons['justifyright'].action   = 'JustifyRight';
		buttons['justifyright'].imgName  = 'bs_alignRight';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['insertorderedlist'] = new Array();
		buttons['insertorderedlist'].action   = 'InsertOrderedList';
		buttons['insertorderedlist'].imgName  = 'bs_ol';
		
		buttons['insertunorderedlist'] = new Array();
		buttons['insertunorderedlist'].action   = 'InsertUnorderedList';
		buttons['insertunorderedlist'].imgName  = 'bs_ul';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['outdent'] = new Array();
		buttons['outdent'].action   = 'Outdent';
		buttons['outdent'].imgName  = 'bs_outdent';
		
		buttons['indent'] = new Array();
		buttons['indent'].action   = 'Indent';
		buttons['indent'].imgName  = 'bs_indent';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['createlink'] = new Array();
		buttons['createlink'].action   = 'CreateLink';
		buttons['createlink'].imgName  = 'bs_createLink';
		
		buttons['unlink'] = new Array();
		buttons['unlink'].action   = 'UnLink';
		buttons['unlink'].imgName  = 'bs_unLink';

		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['insertimage'] = new Array();
		buttons['insertimage'].action   = 'InsertImage';
		buttons['insertimage'].imgName  = 'bs_image';
		
		buttons['specialchars'] = new Array();
		buttons['specialchars'].action   = 'SpecialChars';
		buttons['specialchars'].imgName  = 'bs_specialChars';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		/*
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['inserttable'] = new Array();
		buttons['inserttable'].action   = 'InsertTable';
		buttons['inserttable'].imgName  = 'bs_table';
		buttons['inserttable'].group    = 'insertTable';
		*/
		
		/*
		buttons['x'] = new Array();
		buttons['x'].action   = 'x';
		buttons['x'].title    = 'CreateLink';
		buttons['x'].imgName  = 'bs_createLink';
		buttons['x'].helpText = 'CreateLink';
		*/
				
	}
	
	/**
	* @access private
	* @return void
	*/
	this._drawButtonBarWysiwyg = function() {
		toolbarWysiwyg = new Bs_ButtonBar();
		toolbarWysiwyg.useHelpBar = 'toolbarHelptext';
		if (typeof(this.buttonsWysiwyg) == 'undefined') this.loadButtonsWysiwyg();
		this._drawButtonBarHelper(this.buttonsWysiwyg, 'toolbarWysiwyg', 'wysiwyg');
	}
	
	
	/**
	* loads the buttons for the html bar.
	* @access public
	* @return void
	* @see    var this.buttonsHtml
	*/
	this.loadButtonsHtml = function() {
		var buttons = new Array();
		this.buttonsHtml = buttons;
		
		buttons['cut'] = new Array();
		buttons['cut'].action   = 'Cut';
		buttons['cut'].imgName  = 'bs_cut';
		
		buttons['copy'] = new Array();
		buttons['copy'].action   = 'Copy';
		buttons['copy'].imgName  = 'bs_copy';
		
		buttons['paste'] = new Array();
		buttons['paste'].action   = 'Paste';
		buttons['paste'].imgName  = 'bs_paste';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['undo'] = new Array();
		buttons['undo'].action   = 'Undo';
		buttons['undo'].imgName  = 'bs_undo';
		
		buttons['redo'] = new Array();
		buttons['redo'].action   = 'Redo';
		buttons['redo'].imgName  = 'bs_redo';
		
		var i = buttons.length;
		buttons[i] = '__SEPARATOR__';
		
		buttons['createlink'] = new Array();
		buttons['createlink'].action   = 'CreateLink';
		buttons['createlink'].imgName  = 'bs_createLink';
		
		buttons['insertimage'] = new Array();
		buttons['insertimage'].action   = 'InsertImage';
		buttons['insertimage'].imgName  = 'bs_image';
		
		buttons['specialchars'] = new Array();
		buttons['specialchars'].action   = 'SpecialChars';
		buttons['specialchars'].imgName  = 'bs_specialChars';
		
		buttons['color'] = new Array();
		buttons['color'].action   = 'Color';
		buttons['color'].imgName  = 'bs_bgColor';
	}
	
	/**
	* @access private
	* @return void
	*/
	this._drawButtonBarHtml = function() {
		toolbarHtml = new Bs_ButtonBar();
		toolbarHtml.useHelpBar = 'toolbarHelptext';
		if (typeof(this.buttonsHtml) == 'undefined') this.loadButtonsHtml();
		this._drawButtonBarHelper(this.buttonsHtml, 'toolbarHtml', 'html');
	}
	
	
	/**
	* @access private
	* @param  array buttonArr
	* @param  string toolbarName
	* @param  string buttonNamePrefix
	* @return void
	*/
	this._drawButtonBarHelper = function(buttonArr, toolbarName, buttonNamePrefix) {
		var lastWasSeparator = true; //never render 2 separaters next to each other. never start with a separator.
		
		for (var i in buttonArr) {
			if (bs_isNull(buttonArr[i])) {
				continue;
			

⌨️ 快捷键说明

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