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


TypeScript Compare.contains方法代码示例

本文整理汇总了TypeScript中@ephox/sugar.Compare.contains方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Compare.contains方法的具体用法?TypeScript Compare.contains怎么用?TypeScript Compare.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/sugar.Compare的用法示例。


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: fromDomSafe

 return fromDomSafe(rawContainer).map(function (container) {
   return Compare.contains(Traverse.owner(container), container);
 }).getOr(false);
开发者ID:danielpunkass,项目名称:tinymce,代码行数:3,代码来源:EditorView.ts

示例7: function

const isOrContains = function (root, elm) {
  return Compare.contains(root, elm) || Compare.eq(root, elm);
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:3,代码来源:SelectionBookmark.ts

示例8: function

const getParentBlock = function (rootNode, elm) {
  return Compare.contains(rootNode, elm) ? PredicateFind.closest(elm, function (element) {
    return ElementType.isTextBlock(element) || ElementType.isListItem(element);
  }, isBeforeRoot(rootNode)) : Option.none();
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:5,代码来源:DeleteUtils.ts

示例9: function

const isAttachedToDom = function (node) {
  return !!(node && node.ownerDocument) && Compare.contains(Element.fromDom(node.ownerDocument), Element.fromDom(node));
};
开发者ID:howardjing,项目名称:tinymce,代码行数:3,代码来源:Selection.ts

示例10: findInsertionPoint

const getInsertionPoint = (fromBlock: Element, toBlock: Element): Option<Element> => {
  return Compare.contains(toBlock, fromBlock) ? findInsertionPoint(toBlock, fromBlock) : Option.none();
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:3,代码来源:MergeBlocks.ts


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