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


TypeScript Traverse.children方法代码示例

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


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

示例1:

const getChildrenUntilBlockBoundary = (block: Element) => {
  const children = Traverse.children(block);
  return Arr.findIndex(children, ElementType.isBlock).fold(
    () => children,
    (index) => children.slice(0, index)
  );
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:MergeBlocks.ts

示例2: parser

const parseList: Parser = (depth: number, itemSelection: Option<ItemSelection>, selectionState: Cell<boolean>, list: Element): Entry[] => {
  return Arr.bind(Traverse.children(list), (element) => {
    const parser = isList(element) ? parseList : parseItem;
    const newDepth = depth + 1;
    return parser(newDepth, itemSelection, selectionState, element);
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:7,代码来源:ParseLists.ts

示例3: context

  const processElement = (elem) => {
    const ctx = context(editor, elem, 'span', Node.name(elem));

    switch (ctx) {
      case ChildContext.InvalidChild: {
        finishWrapper();
        const children = Traverse.children(elem);
        processElements(children);
        finishWrapper();
        break;
      }

      case ChildContext.Valid: {
        const w = getOrOpenWrapper();
        Insert.wrap(elem, w);
        break;
      }

      // INVESTIGATE: Are these sensible things to do?
      case ChildContext.Skipping:
      case ChildContext.Existing:
      case ChildContext.Caret: {
        // Do nothing.
      }
    }
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:26,代码来源:Wrapping.ts

示例4: function

const clamp = function (offset, element) {
  const max = Node.isText(element) ? Text.get(element).length : Traverse.children(element).length + 1;

  if (offset > max) {
    return max;
  } else if (offset < 0) {
    return 0;
  }

  return offset;
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:11,代码来源:SelectionBookmark.ts

示例5: function

const getChildrenUntilBlockBoundary = function (block) {
  const children = Traverse.children(block);
  return Arr.findIndex(children, ElementType.isBlock).fold(
    function () {
      return children;
    },
    function (index) {
      return children.slice(0, index);
    }
  );
};
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:MergeBlocks.ts

示例6: function

const getTableCaptionDeltaY = function (elm) {
  if (browser.isFirefox() && Node.name(elm) === 'table') {
    return firstElement(Traverse.children(elm)).filter(function (elm) {
      return Node.name(elm) === 'caption';
    }).bind(function (caption) {
      return firstElement(Traverse.nextSiblings(caption)).map(function (body) {
        const bodyTop = body.dom().offsetTop;
        const captionTop = caption.dom().offsetTop;
        const captionHeight = caption.dom().offsetHeight;
        return bodyTop <= captionTop ? -captionHeight : 0;
      });
    }).getOr(0);
  } else {
    return 0;
  }
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:16,代码来源:Position.ts

示例7: function

 const isActive = function () {
   return Traverse.children(container).length > 0;
 };
开发者ID:abstask,项目名称:tinymce,代码行数:3,代码来源:FakeSelection.ts

示例8: function

const hasOnlyOneChild = function (elm) {
  return Traverse.children(elm).length === 1;
};
开发者ID:abstask,项目名称:tinymce,代码行数:3,代码来源:InlineFormatDelete.ts

示例9: function

const isPaddedElement = function (elm) {
  return Arr.filter(Traverse.children(elm), isPaddingContents).length === 1;
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:3,代码来源:PaddingBr.ts

示例10: isList

const parseList: Parser = (depth: number, itemSelection: Option<ItemTuple>, selectionState: Cell<boolean>, list: Element): Entry[] => {
  const newDepth = depth + 1;
  return Arr.bind(Traverse.children(list), (child) =>
    isList(child) ? parseList(newDepth, itemSelection, selectionState, child) : parseItem(newDepth, itemSelection, selectionState, child)
  );
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:6,代码来源:ParseLists.ts


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