12345678910111213141516171819202122232425262728 |
- ///import core
- ///commands 清空文档
- ///commandsName ClearDoc
- ///commandsTitle 清空文档
- /**
- *
- * 清空文档
- * @function
- * @name baidu.editor.execCommand
- * @param {String} cmdName cleardoc清空文档
- */
- UE.commands['cleardoc'] = {
- execCommand : function( cmdName) {
- var me = this,
- enterTag = me.options.enterTag,
- range = me.selection.getRange();
- if(enterTag == "br"){
- me.body.innerHTML = "<br/>";
- range.setStart(me.body,0).setCursor();
- }else{
- me.body.innerHTML = "<p>"+(ie ? "" : "<br/>")+"</p>";
- range.setStart(me.body.firstChild,0).setCursor(false,true);
- }
- me.fireEvent("clearDoc");
- }
- };
|