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

📄 radeditortestmodule.js

📁 Telerik是很大的第三方软件制造商
💻 JS
字号:
/*--------------RadEditorTestModule module------------------------------*/
RadEditorTestModule.prototype = new RadEditorModuleBase();
RadEditorTestModule.prototype.base = RadEditorModuleBase.prototype.constructor;

/* Constructor - the module receives a moduleArgs object that helps for the intialization. You need to pass it to the base constuctor.
	this.Editor - the editor object	
	this.Localization  - the localization object 
	this.Document  - the document obect that is used to create dynamic HTML elements						
	this.TopElement - the module top element that gets shown when the module is made visible.	
	this.IsEnabled - shows whether the module is currently enabled.
 */
function RadEditorTestModule (moduleArgs)
{		
	moduleArgs.ModuleElement = moduleArgs.Document.createElement ("DIV");
	this.base(moduleArgs);				
};


/* Implement the OnCreate method which is called before the module is first shown */
RadEditorTestModule.prototype.OnCreate = function () 
{
	var selfPointer = this;		
	this.AttachEventHandler("RADEVENT_SEL_CHANGED",  function (){ selfPointer.DoSomething(); });
	this.DoSomething();
	
};

/* A method that does the actual work - it is usually attached to the "selection changed" editor event */
RadEditorTestModule.prototype.DoSomething = function ()
{		
	if (!this.IsEnabled) return;
			
	var span = this.Document.createElement ("SPAN");
	span.innerHTML = this.Editor.GetHtml();
	
	var imageCount = span.getElementsByTagName("IMG").length;
	var tableCount = span.getElementsByTagName("TABLE").length;
		
	this.ModuleElement.innerHTML = "TEST MODULE: Images: " + imageCount + " Tables: " + tableCount;
	this.ModuleElement.style.border = "1px solid blue";
	this.ModuleElement.style.backgroundColor = "yellow";
};

⌨️ 快捷键说明

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