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


TypeScript Writer.default函数代码示例

本文整理汇总了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>');
  });
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:WriterTest.ts

示例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();
};
开发者ID:abstask,项目名称:tinymce,代码行数:27,代码来源:HtmlUtils.ts

示例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();
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:57,代码来源:Sanitize.ts

示例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">&nbsp;<span contenteditable="false">X</span>&nbsp;</div>b</p>');
   LegacyUnit.equal(writer.getContent(), '<p>a b</p>');
   LegacyUnit.deepEqual(counter.counts, { start: 1, end: 1, text: 2 });
 });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:SaxParserTest.ts


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