wxxsd/upfiles/UEditor/_src/plugins/source.js
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
///import core
///import plugins/serialize.js
///import plugins/undo.js
///commands 查看源码
///commandsName Source
///commandsTitle 查看源码
(function (){
function SourceFormater(config){
config = config || {};
this.indentChar = config.indentChar || ' ';
this.breakChar = config.breakChar || '\n';
this.selfClosingEnd = config.selfClosingEnd || ' />';
}
var unhtml1 = function (){
var map = { '<': '<', '>': '>', '"': '"', "'": ''' };
function rep( m ){ return map[m]; }
return function ( str ) {
str = str + '';
return str ? str.replace( /[<>"']/g, rep ) : '';
};
}();
var inline = utils.extend({a:1,A:1},dtd.$inline,true);
function printAttrs(attrs){
var buff = [];
for (var k in attrs) {
buff.push(k + '="' + unhtml1(attrs[k]) + '"');
}
return buff.join(' ');
}
SourceFormater.prototype = {
format: function (html){
var node = UE.serialize.parseHTML(html);
this.buff = [];
this.indents = '';
this.indenting = 1;
this.visitNode(node);
return this.buff.join('');
},
visitNode: function (node){
if (node.type == 'fragment') {
this.visitChildren(node.children);
} else if (node.type == 'element') {
var selfClosing = dtd.$empty[node.tag];
this.visitTag(node.tag, node.attributes, selfClosing);
this.visitChildren(node.children);
if (!selfClosing) {
this.visitEndTag(node.tag);
}
} else if (node.type == 'comment') {
this.visitComment(node.data);
} else {
this.visitText(node.data,dtd.$notTransContent[node.parent.tag]);
}
},
visitChildren: function (children){
for (var i=0; i<children.length; i++) {
后面还有 283 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
