當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript sugar.Compare類代碼示例

本文整理匯總了TypeScript中@ephox/sugar.Compare的典型用法代碼示例。如果您正苦於以下問題:TypeScript Compare類的具體用法?TypeScript Compare怎麽用?TypeScript Compare使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Compare類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: if

const outdentDlItem = (editor: Editor, item: Element): void => {
  if (Compare.is(item, 'DD')) {
    Replication.mutate(item, 'DT');
  } else if (Compare.is(item, 'DT')) {
    Traverse.parent(item).each((dl) => SplitList.splitList(editor, dl.dom(), item.dom()));
  }
};
開發者ID:mdgbayly,項目名稱:tinymce,代碼行數:7,代碼來源:Indendation.ts

示例2:

 Focus.active().each(function (active) {
   // INVESTIGATE: This predicate may not be required. The purpose of it is to ensure
   // that the content window's frame element is not unnecessarily blurred before giving
   // it focus.
   if (! Compare.eq(active, frame)) {
     Focus.blur(active);
   }
 });
開發者ID:abstask,項目名稱:tinymce,代碼行數:8,代碼來源:ResumeEditing.ts

示例3: function

const getInsertionPoint = function (fromBlock, toBlock) {
  if (Compare.contains(toBlock, fromBlock)) {
    return Traverse.parent(fromBlock).bind(function (parent) {
      return Compare.eq(parent, toBlock) ? Option.some(fromBlock) : findParentInsertPoint(toBlock, fromBlock);
    });
  } else {
    return Option.none();
  }
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:9,代碼來源:MergeBlocks.ts

示例4: dropLast

const parentsUntil = (start: Element, root: Element, predicate: (elm: Element) => boolean): Element[] => {
  if (Compare.contains(root, start)) {
    return dropLast(Traverse.parents(start, function (elm) {
      return predicate(elm) || Compare.eq(elm, root);
    }));
  } else {
    return [];
  }
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:9,代碼來源:Parents.ts

示例5: getCollapsedNode

 return getCollapsedNode(rng).bind(function (node) {
   if (ElementType.isTableSection(node)) {
     return Option.some(node);
   } else if (Compare.contains(root, node) === false) {
     return Option.some(root);
   } else {
     return Option.none();
   }
 });
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:9,代碼來源:EditorFocus.ts

示例6: function

const parentsUntil = function (startNode, rootElm, predicate) {
  if (Compare.contains(rootElm, startNode)) {
    return dropLast(Traverse.parents(startNode, function (elm) {
      return predicate(elm) || Compare.eq(elm, rootElm);
    }));
  } else {
    return [];
  }
};
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:9,代碼來源:Parents.ts

示例7:

 SelectorFind.closest(se.event().target(), '.' + MenuButtonClasses.Button).each((hoveredButton) => {
   if (! Compare.eq(activeButton, hoveredButton)) {
     // Now, find the components, and expand the hovered one, and close the active one
     comp.getSystem().getByDom(activeButton).each((activeComp) => {
       comp.getSystem().getByDom(hoveredButton).each((hoveredComp) => {
         Dropdown.expand(hoveredComp);
         Dropdown.close(activeComp);
         Focusing.focus(hoveredComp);
       });
     });
   }
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:12,代碼來源:SilverMenubar.ts

示例8: function

  ], function (block1, block2) {
    if (Compare.eq(block1, block2) === false) {
      rng.deleteContents();

      MergeBlocks.mergeBlocks(rootNode, true, block1, block2).each(function (pos) {
        selection.setRng(pos.toRange());
      });

      return true;
    } else {
      return false;
    }
  }).getOr(false);
開發者ID:abstask,項目名稱:tinymce,代碼行數:13,代碼來源:BlockRangeDelete.ts

示例9: function

const findElementPos = function (table, element) {
  const rows = table.rows();
  for (let y = 0; y < rows.length; y++) {
    const cells = rows[y].cells();
    for (let x = 0; x < cells.length; x++) {
      if (Compare.eq(cells[x], element)) {
        return Option.some(cellPosition(x, y));
      }
    }
  }

  return Option.none();
};
開發者ID:abstask,項目名稱:tinymce,代碼行數:13,代碼來源:SimpleTableModel.ts

示例10: function

const mergeLiElements = function (dom, fromElm, toElm) {
  let node, listNode;
  const ul = fromElm.parentNode;

  if (!NodeType.isChildOfBody(dom, fromElm) || !NodeType.isChildOfBody(dom, toElm)) {
    return;
  }

  if (NodeType.isListNode(toElm.lastChild)) {
    listNode = toElm.lastChild;
  }

  if (ul === toElm.lastChild) {
    if (NodeType.isBr(ul.previousSibling)) {
      dom.remove(ul.previousSibling);
    }
  }

  node = toElm.lastChild;
  if (node && NodeType.isBr(node) && fromElm.hasChildNodes()) {
    dom.remove(node);
  }

  if (NodeType.isEmpty(dom, toElm, true)) {
    dom.$(toElm).empty();
  }

  moveChildren(dom, fromElm, toElm);

  if (listNode) {
    toElm.appendChild(listNode);
  }

  const contains = Compare.contains(Element.fromDom(toElm), Element.fromDom(fromElm));

  const nestedLists = contains ? dom.getParents(fromElm, NodeType.isListNode, toElm) : [];

  dom.remove(fromElm);

  Arr.each(nestedLists, (list) => {
    if (NodeType.isEmpty(dom, list) && list !== dom.getRoot()) {
      dom.remove(list);
    }
  });
};
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:45,代碼來源:Delete.ts


注:本文中的@ephox/sugar.Compare類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。