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


TypeScript Node.attr函数代码示例

本文整理汇总了TypeScript中tinymce/core/api/html/Node.attr函数的典型用法代码示例。如果您正苦于以下问题:TypeScript attr函数的具体用法?TypeScript attr怎么用?TypeScript attr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了attr函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

const createPreviewIframeNode = function (editor: Editor, node: Node) {
  let previewWrapper;
  let previewNode;
  let shimNode;
  const name = node.name;

  previewWrapper = new Node('span', 1);
  previewWrapper.attr({
    'contentEditable': 'false',
    'style': node.attr('style'),
    'data-mce-object': name,
    'class': 'mce-preview-object mce-object-' + name
  });

  retainAttributesAndInnerHtml(editor, node, previewWrapper);

  previewNode = new Node(name, 1);
  previewNode.attr({
    src: node.attr('src'),
    allowfullscreen: node.attr('allowfullscreen'),
    style: node.attr('style'),
    class: node.attr('class'),
    width: node.attr('width'),
    height: node.attr('height'),
    frameborder: '0'
  });

  shimNode = new Node('span', 1);
  shimNode.attr('class', 'mce-shim');

  previewWrapper.append(previewNode);
  previewWrapper.append(shimNode);

  return previewWrapper;
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:35,代码来源:Nodes.ts

示例2: function

  suite.test('clone', function () {
    let root, node, clone;

    node = new Node('#text', 3);
    node.value = 'value';
    clone = node.clone();
    LegacyUnit.equal(clone.name, '#text');
    LegacyUnit.equal(clone.type, 3);
    LegacyUnit.equal(clone.value, 'value');
    LegacyUnit.equal(clone.parent, undefined);
    LegacyUnit.equal(clone.next, undefined);
    LegacyUnit.equal(clone.prev, undefined);

    root = new Node('#frag', 11);
    node = new Node('#text', 3);
    node.value = 'value';
    root.append(node);
    LegacyUnit.equal(clone.name, '#text');
    LegacyUnit.equal(clone.type, 3);
    LegacyUnit.equal(clone.value, 'value');
    LegacyUnit.equal(clone.parent, undefined);
    LegacyUnit.equal(clone.next, undefined);
    LegacyUnit.equal(clone.prev, undefined);

    node = new Node('b', 1);
    node.attr('id', 'id');
    node.attr('class', 'class');
    node.attr('title', 'title');
    clone = node.clone();
    LegacyUnit.equal(clone.name, 'b');
    LegacyUnit.equal(clone.type, 1);
    LegacyUnit.deepEqual(clone.attributes, [{ name: 'class', value: 'class' }, { name: 'title', value: 'title' }]);
    LegacyUnit.deepEqual(clone.attributes.map, { class: 'class', title: 'title' });
  });
开发者ID:abstask,项目名称:tinymce,代码行数:34,代码来源:NodeTest.ts

示例3: function

  Tools.each('keywords,description,author,copyright,robots'.split(','), function (name) {
    const nodes = headerFragment.getAll('meta');
    let i, meta;
    const value = data[name];

    for (i = 0; i < nodes.length; i++) {
      meta = nodes[i];

      if (meta.attr('name') === name) {
        if (value) {
          meta.attr('content', value);
        } else {
          meta.remove();
        }

        return;
      }
    }

    if (value) {
      elm = new Node('meta', 1);
      elm.attr('name', name);
      elm.attr('content', value);
      elm.shortEnded = true;

      addHeadNode(elm);
    }
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:28,代码来源:Parser.ts

示例4: function

const isWithinEmbedWrapper = function (node: Node) {
  while ((node = node.parent)) {
    if (node.attr('data-ephox-embed-iri') || isPageEmbedWrapper(node)) {
      return true;
    }
  }

  return false;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:Nodes.ts

示例5: Node

  const getFontTree = () => {
    const body = new Node('body', 1);
    const font = new Node('font', 1);
    const text = new Node('#text', 3);

    text.value = 'x';
    font.attr('size', '7');
    font.append(text);
    body.append(font);

    return body;
  };
开发者ID:abstask,项目名称:tinymce,代码行数:12,代码来源:EditorContentTest.ts

示例6: convertParagraphToLi

  function convertParagraphToLi(paragraphNode, listName, start?) {
    const level = paragraphNode._listLevel || lastLevel;

    // Handle list nesting
    if (level !== lastLevel) {
      if (level < lastLevel) {
        // Move to parent list
        if (currentListNode) {
          currentListNode = currentListNode.parent.parent;
        }
      } else {
        // Create new list
        prevListNode = currentListNode;
        currentListNode = null;
      }
    }

    if (!currentListNode || currentListNode.name !== listName) {
      prevListNode = prevListNode || currentListNode;
      currentListNode = new Node(listName, 1);

      if (start > 1) {
        currentListNode.attr('start', '' + start);
      }

      paragraphNode.wrap(currentListNode);
    } else {
      currentListNode.append(paragraphNode);
    }

    paragraphNode.name = 'li';

    // Append list to previous list if it exists
    if (level > lastLevel && prevListNode) {
      prevListNode.lastChild.append(currentListNode);
    }

    lastLevel = level;

    // Remove start of list item "1. " or "&middot; " etc
    removeIgnoredNodes(paragraphNode);
    trimListStart(paragraphNode, /^\u00a0+/);
    trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);
    trimListStart(paragraphNode, /^\u00a0+/);
  }
开发者ID:tinymce,项目名称:tinymce,代码行数:45,代码来源:WordFilter.ts


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