01.code/LanweiUI/UEditor/_src/plugins/lineheight.js
(完整代码) 1KB///import core
///import plugins\paragraph.js
///commands 行间距
///commandsName LineHeight
///commandsTitle 行间距
/**
* @description 设置行内间距
* @name baidu.editor.execCommand
* @param {String} cmdName lineheight设置行内间距
* @param {String} value 值
* @author zhuwenxuan
*/
UE.plugins['lineheight'] = function(){
var me = this;
me.setOpt({'lineheight':['1', '1.5','1.75','2', '3', '4', '5']});
me.commands['lineheight'] = {
execCommand : function( cmdName,value ) {
this.execCommand('paragraph','p',{style:'line-height:'+ (value == "1" ? "normal" : value + 'em') });
return true;
},
queryCommandValue : function() {
var pN = utils.findNode(this.selection.getStartElementPath(),null,function(node){return domUtils.isBlockElm(node)});
if(pN){
var value = domUtils.getComputedStyle(pN,'line-height');
return value == 'normal' ? 1 : value.replace(/[^\d.]*/ig,"")
}
},
queryCommandState : function(){
return this.highlight ? -1 :0;
}
};
};
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
