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


TypeScript Arr.findIndex方法代码示例

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


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

示例1: function

      Step.sync(function () {
        const headStuff = editor.getDoc().head.querySelectorAll('link, style');
        const linkIndex = Arr.findIndex(headStuff, function (elm) {
          return Node.name(Element.fromDom(elm)) === 'link';
        }).getOrDie('could not find link elemnt');
        const styleIndex = Arr.findIndex(headStuff, function (elm) {
          return elm.innerText === contentStyle;
        }).getOrDie('could not find content style tag');

        Assertions.assertEq('style tag should be after link tag', linkIndex < styleIndex, true);
      })
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:11,代码来源:ContentStylePositionTest.ts

示例2:

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

示例3: function

const getParentInlines = function (rootElm, startElm) {
  const parents = Parents.parentsAndSelf(startElm, rootElm);
  return Arr.findIndex(parents, ElementType.isBlock).fold(
    Fun.constant(parents),
    function (index) {
      return parents.slice(0, index);
    }
  );
};
开发者ID:abstask,项目名称:tinymce,代码行数:9,代码来源:InlineFormatDelete.ts

示例4: function

 const closeNotification = function (notification) {
   Arr.findIndex(notifications, function (otherNotification) {
     return otherNotification === notification;
   }).each(function (index) {
     // Mutate here since third party might have stored away the window array
     // TODO: Consider breaking this api
     notifications.splice(index, 1);
   });
 };
开发者ID:abstask,项目名称:tinymce,代码行数:9,代码来源:NotificationManager.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 closeWindow = function (win) {
    Arr.findIndex(windows, function (otherWindow) {
      return otherWindow === win;
    }).each(function (index) {
      // Mutate here since third party might have stored away the window array, consider breaking this api
      windows.splice(index, 1);

      fireCloseEvent(win);

      // Move focus back to editor when the last window is closed
      if (windows.length === 0) {
        editor.focus();
      }
    });
  };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:15,代码来源:WindowManager.ts

示例7:

const detectSize = (comp: AlloyComponent, margin: number, selectorClass: string): Option<{ numColumns: number, numRows: number}> => {
  const descendants = SelectorFilter.descendants(comp.element(), '.' + selectorClass);

  // TODO: This seems to cause performance issues in the emoji dialog
  if (descendants.length > 0) {
    const columnLength = Arr.findIndex(descendants, (c) => {
      const thisTop = c.dom().getBoundingClientRect().top;
      const cTop = descendants[0].dom().getBoundingClientRect().top;
      return Math.abs(thisTop - cTop) > margin;

    }).getOr(descendants.length);

    return Option.some({
      numColumns: columnLength,
      numRows: Math.ceil(descendants.length / columnLength)
    });
  } else {
    return Option.none();
  }
};
开发者ID:tinymce,项目名称:tinymce,代码行数:20,代码来源:FlatgridAutodetect.ts

示例8:

const getCellIndex = (cells, cell) => {
  return Arr.findIndex(cells, (x) => Compare.eq(x, cell));
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:3,代码来源:TableDeleteAction.ts

示例9: function

const sizeToIndex = function (size) {
  return Arr.findIndex(candidates, function (v) {
    return v === size;
  });
};
开发者ID:abstask,项目名称:tinymce,代码行数:5,代码来源:FontSizes.ts

示例10: function

const hasItemName = function (namedMenuItems, name) {
  return Arr.findIndex(namedMenuItems, function (namedMenuItem) {
    return namedMenuItem.name === name;
  }).isSome();
};
开发者ID:howardjing,项目名称:tinymce,代码行数:5,代码来源:Menubar.ts


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