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


TypeScript Tools.each函数代码示例

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


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

示例1: function

  Tools.each(emoticons, function (row) {
    emoticonsHtml += '<tr>';

    Tools.each(row, function (icon) {
      const emoticonUrl = pluginUrl + '/img/smiley-' + icon + '.gif';

      emoticonsHtml += '<td><a href="#" data-mce-url="' + emoticonUrl + '" data-mce-alt="' + icon + '" tabindex="-1" ' +
        'role="option" aria-label="' + icon + '"><img src="' +
        emoticonUrl + '" style="width: 18px; height: 18px" role="presentation" /></a></td>';
    });

    emoticonsHtml += '</tr>';
  });
开发者ID:danielpunkass,项目名称:tinymce,代码行数:13,代码来源:PanelHtml.ts

示例2: function

const replaceVals = function (editor, e) {
  const dom = editor.dom, vl = Settings.getTemplateReplaceValues(editor);

  Tools.each(dom.select('*', e), function (e) {
    Tools.each(vl, function (v, k) {
      if (dom.hasClass(e, k)) {
        if (typeof vl[k] === 'function') {
          vl[k](e);
        }
      }
    });
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:Templates.ts

示例3: function

  suite.test('loadCSS', function () {
    let c = 0;

    DOM.loadCSS('tinymce/dom/test.css?a=1,tinymce/dom/test.css?a=2,tinymce/dom/test.css?a=3');

    Tools.each(document.getElementsByTagName('link'), function (n) {
      if (n.href.indexOf('test.css?a=') !== -1) {
        c++;
      }
    });

    LegacyUnit.equal(c, 3);
  });
开发者ID:abstask,项目名称:tinymce,代码行数:13,代码来源:DomUtilsTest.ts

示例4: function

const buildMenuItems = function (listName: string, languageValues) {
  const items = [];

  Tools.each(languageValues, function (languageValue) {
    items.push({
      selectable: true,
      text: languageValue.name,
      data: languageValue.value
    });
  });

  return items;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:Buttons.ts

示例5: function

const unwrapElements = function (editor, elms) {
  let bookmark, dom, selection;

  dom = editor.dom;
  selection = editor.selection;
  bookmark = Bookmark.create(dom, selection.getRng());

  Tools.each(elms, function (elm) {
    editor.dom.remove(elm, true);
  });

  selection.setRng(Bookmark.resolve(dom, bookmark));
};
开发者ID:,项目名称:,代码行数:13,代码来源:

示例6: function

const findMatchingValue = function (items, pt, px) {
  let value;

  Tools.each(items, function (item) {
    if (item.value === px) {
      value = px;
    } else if (item.value === pt) {
      value = pt;
    }
  });

  return value;
};
开发者ID:abstask,项目名称:tinymce,代码行数:13,代码来源:FontSizeSelect.ts

示例7: function

const toggleMultipleLists = function (editor, parentList, lists, listName, detail) {
  if (parentList.nodeName === listName && !hasListStyleDetail(detail)) {
    flattenListSelection(editor);
  } else {
    const bookmark = Bookmark.createBookmark(editor.selection.getRng(true));

    Tools.each([parentList].concat(lists), function (elm) {
      updateList(editor.dom, elm, listName, detail);
    });

    editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:13,代码来源:ToggleList.ts

示例8: function

const getSelectedTextBlocks = function (editor, rng, root) {
  const textBlocks = [], dom = editor.dom;

  const startNode = getEndPointNode(editor, rng, true, root);
  const endNode = getEndPointNode(editor, rng, false, root);
  let block;
  const siblings = [];

  for (let node = startNode; node; node = node.nextSibling) {
    siblings.push(node);

    if (node === endNode) {
      break;
    }
  }

  Tools.each(siblings, function (node) {
    if (NodeType.isTextBlock(editor, node)) {
      textBlocks.push(node);
      block = null;
      return;
    }

    if (dom.isBlock(node) || NodeType.isBr(node)) {
      if (NodeType.isBr(node)) {
        dom.remove(node);
      }

      block = null;
      return;
    }

    const nextSibling = node.nextSibling;
    if (BookmarkManager.isBookmarkNode(node)) {
      if (NodeType.isTextBlock(editor, nextSibling) || (!nextSibling && node.parentNode === root)) {
        block = null;
        return;
      }
    }

    if (!block) {
      block = dom.create('p');
      node.parentNode.insertBefore(block, node);
      textBlocks.push(block);
    }

    block.appendChild(node);
  });

  return textBlocks;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:51,代码来源:ToggleList.ts

示例9: function

const removeList = function (editor) {
  const bookmark = Bookmark.createBookmark(editor.selection.getRng(true));
  const root = Selection.getClosestListRootElm(editor, editor.selection.getStart(true));
  let listItems = Selection.getSelectedListItems(editor);
  const emptyListItems = Tools.grep(listItems, function (li) {
    return editor.dom.isEmpty(li);
  });

  listItems = Tools.grep(listItems, function (li) {
    return !editor.dom.isEmpty(li);
  });

  Tools.each(emptyListItems, function (li) {
    if (NodeType.isEmpty(editor.dom, li)) {
      Outdent.outdent(editor, li);
      return;
    }
  });

  Tools.each(listItems, function (li) {
    let node, rootList;

    if (li.parentNode === editor.getBody()) {
      return;
    }

    for (node = li; node && node !== root; node = node.parentNode) {
      if (NodeType.isListNode(node)) {
        rootList = node;
      }
    }

    SplitList.splitList(editor, rootList, li);
    NormalizeLists.normalizeLists(editor.dom, rootList.parentNode);
  });

  editor.selection.setRng(Bookmark.resolveBookmark(bookmark));
};
开发者ID:abstask,项目名称:tinymce,代码行数:38,代码来源:ToggleList.ts


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