本文整理汇总了TypeScript中tinymce/core/html/Schema.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
suite.test('Whildcard element rule', function () {
let schema;
schema = Schema({ valid_elements: '*[id|class]' });
LegacyUnit.deepEqual(schema.getElementRule('b').attributes, { id: {}, class: {} });
LegacyUnit.deepEqual(schema.getElementRule('b').attributesOrder, ['id', 'class']);
schema = Schema({ valid_elements: 'b*[id|class]' });
LegacyUnit.deepEqual(schema.getElementRule('b').attributes, { id: {}, class: {} });
LegacyUnit.deepEqual(schema.getElementRule('b').attributesOrder, ['id', 'class']);
LegacyUnit.deepEqual(schema.getElementRule('body').attributes, { id: {}, class: {} });
LegacyUnit.deepEqual(schema.getElementRule('body').attributesOrder, ['id', 'class']);
LegacyUnit.equal(schema.getElementRule('img'), undefined);
schema = Schema({ valid_elements: 'b?[id|class]' });
LegacyUnit.deepEqual(schema.getElementRule('b').attributes, { id: {}, class: {} });
LegacyUnit.deepEqual(schema.getElementRule('b').attributesOrder, ['id', 'class']);
LegacyUnit.deepEqual(schema.getElementRule('bx').attributes, { id: {}, class: {} });
LegacyUnit.deepEqual(schema.getElementRule('bx').attributesOrder, ['id', 'class']);
LegacyUnit.equal(schema.getElementRule('body'), undefined);
schema = Schema({ valid_elements: 'b+[id|class]' });
LegacyUnit.deepEqual(schema.getElementRule('body').attributes, { id: {}, class: {} });
LegacyUnit.deepEqual(schema.getElementRule('body').attributesOrder, ['id', 'class']);
LegacyUnit.deepEqual(schema.getElementRule('bx').attributes, { id: {}, class: {} });
LegacyUnit.deepEqual(schema.getElementRule('bx').attributesOrder, ['id', 'class']);
LegacyUnit.equal(schema.getElementRule('b'), undefined);
});
示例2: function
suite.test('Remove internal elements', function () {
let counter, parser, schema;
schema = Schema({ valid_elements: 'b' });
counter = createCounter(writer);
counter.validate = true;
counter.remove_internals = true;
parser = new SaxParser(counter, schema);
writer.reset();
parser.parse('<span id="id"><b>text</b></span><span id="id" data-mce-type="something"></span>');
LegacyUnit.equal(writer.getContent(), '<b>text</b>', 'Remove internal span element without any span schema rule.');
schema = Schema({ valid_elements: 'b,span[class]' });
counter = createCounter(writer);
counter.validate = true;
counter.remove_internals = true;
parser = new SaxParser(counter, schema);
writer.reset();
parser.parse('<span id="id" class="class"><b>text</b></span><span id="id" data-mce-type="something"></span>');
LegacyUnit.equal(
writer.getContent(),
'<span class="class"><b>text</b></span>',
'Remove internal span element with a span schema rule.'
);
// Reset
counter.remove_internals = false;
});
示例3: function
suite.test('Remove empty nodes', function () {
parser = DomParser({}, Schema({ valid_elements: '-p,-span[id]' }));
root = parser.parse(
'<p>a<span></span><span> </span><span id="x">b</span><span id="y"></span></p><p></p><p><span></span></p><p> </p>'
);
LegacyUnit.equal(serializer.serialize(root), '<p>a <span id="x">b</span><span id="y"></span></p>');
});