當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。