当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Schema.default函数代码示例

本文整理汇总了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);
  });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:28,代码来源:SchemaTest.ts

示例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;
  });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:28,代码来源:SaxParserTest.ts

示例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>');
 });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:7,代码来源:DomParserTest.ts


注:本文中的tinymce/core/html/Schema.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。