本文整理汇总了TypeScript中tinymce/core/api/html/Writer.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.test('Doctype', function () {
let writer;
writer = Writer();
writer.doctype(' text');
LegacyUnit.equal(writer.getContent(), '<!DOCTYPE text>');
writer = Writer();
writer.doctype('');
LegacyUnit.equal(writer.getContent(), '<!DOCTYPE>');
});
示例2: function
const normalizeHtml = function (html) {
const writer = Writer();
SaxParser({
validate: false,
comment: writer.comment,
cdata: writer.cdata,
text: writer.text,
end: writer.end,
pi: writer.pi,
doctype: writer.doctype,
start (name, attrs, empty) {
attrs.sort(function (a, b) {
if (a.name === b.name) {
return 0;
}
return a.name > b.name ? 1 : -1;
});
writer.start(name, attrs, empty);
}
}).parse(html);
return writer.getContent();
};
示例3: function
const sanitize = function (editor, html) {
if (Settings.shouldFilterHtml(editor) === false) {
return html;
}
const writer = Writer();
let blocked;
SaxParser({
validate: false,
allow_conditional_comments: false,
special: 'script,noscript',
comment (text) {
writer.comment(text);
},
cdata (text) {
writer.cdata(text);
},
text (text, raw) {
writer.text(text, raw);
},
start (name, attrs, empty) {
blocked = true;
if (name === 'script' || name === 'noscript') {
return;
}
for (let i = 0; i < attrs.length; i++) {
if (attrs[i].name.indexOf('on') === 0) {
return;
}
if (attrs[i].name === 'style') {
attrs[i].value = editor.dom.serializeStyle(editor.dom.parseStyle(attrs[i].value), name);
}
}
writer.start(name, attrs, empty);
blocked = false;
},
end (name) {
if (blocked) {
return;
}
writer.end(name);
}
}, Schema({})).parse(html);
return writer.getContent();
};
示例4: Schema
suite.test('remove bogus elements even if not part of valid_elements', () => {
const schema = Schema({ valid_elements: 'p,span,' });
const writer = Writer();
const counter = createCounter(writer);
const parser = SaxParser(counter, schema);
parser.parse('<p>a <div data-mce-bogus="all"> <span contenteditable="false">X</span> </div>b</p>');
LegacyUnit.equal(writer.getContent(), '<p>a b</p>');
LegacyUnit.deepEqual(counter.counts, { start: 1, end: 1, text: 2 });
});