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


TypeScript SelectorFind.ancestor方法代码示例

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


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

示例1: getMaxTabviewHeight

const updateTabviewHeight = (dialogBody: Element, tabview: Element, maxTabHeight: Cell<Option<number>>) => {
  SelectorFind.ancestor(dialogBody, '[role="dialog"]').each((dialog) => {
    maxTabHeight.get().map((height) => {
      // Set the tab view height to 0, so we can calculate the max tabview height, without worrying about overflows
      Css.set(tabview, 'height', '0');
      return Math.min(height, getMaxTabviewHeight(dialog, dialogBody));
    }).each((height) => {
      Css.set(tabview, 'height', height + 'px');
    });
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:DialogTabHeight.ts

示例2:

const getMaxTabviewHeight = (dialog: Element, dialogBody: Element) => {
  const rootElm = SelectorFind.ancestor(dialog, '.tox-dialog-wrap').getOr(dialog);
  const isFixed = Css.get(rootElm, 'position') === 'fixed';
  // Get the document or window/viewport height
  let maxHeight;
  if (isFixed) {
    maxHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);
  } else {
    maxHeight = Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight);
  }
  // Determine the max dialog body height
  const dialogChrome = dialog.dom().getBoundingClientRect().height - dialogBody.dom().getBoundingClientRect().height;
  return maxHeight - dialogChrome;
};
开发者ID:tinymce,项目名称:tinymce,代码行数:14,代码来源:DialogTabHeight.ts

示例3:

const getClosestTable = (cell, isRoot) => {
  return SelectorFind.ancestor(cell, 'table', isRoot);
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:3,代码来源:TableDeleteAction.ts

示例4: function

const getParentTable = function (rootElm, cell) {
  return SelectorFind.ancestor(cell, 'table', Fun.curry(Compare.eq, rootElm));
};
开发者ID:howardjing,项目名称:tinymce,代码行数:3,代码来源:FragmentReader.ts

示例5: function

const sketch = function (settings) {
  const dataset = convert(settings.formats, function () {
    return memMenu;
  });
  // Turn settings into a tiered menu data.

  const memMenu = Memento.record(TieredMenu.sketch({
    dom: {
      tag: 'div',
      classes: [ Styles.resolve('styles-menu') ]
    },
    components: [ ],

    // Focus causes issues when the things being focused are offscreen.
    fakeFocus: true,
    // For animations, need things to stay around in the DOM (at least until animation is done)
    stayInDom: true,

    onExecute (tmenu, item) {
      const v = Representing.getValue(item);
      settings.handle(item, v.value);
    },
    onEscape () {
    },
    onOpenMenu (container, menu) {
      const w = Width.get(container.element());
      Width.set(menu.element(), w);
      Transitioning.jumpTo(menu, 'current');
    },
    onOpenSubmenu (container, item, submenu) {
      const w = Width.get(container.element());
      const menu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
      const menuComp = container.getSystem().getByDom(menu).getOrDie();

      Width.set(submenu.element(), w);

      Transitioning.progressTo(menuComp, 'before');
      Transitioning.jumpTo(submenu, 'after');
      Transitioning.progressTo(submenu, 'current');
    },

    onCollapseMenu (container, item, menu) {
      const submenu = SelectorFind.ancestor(item.element(), '[role="menu"]').getOrDie('hacky');
      const submenuComp = container.getSystem().getByDom(submenu).getOrDie();
      Transitioning.progressTo(submenuComp, 'after');
      Transitioning.progressTo(menu, 'current');
    },

    navigateOnHover: false,

    openImmediately: true,
    data: dataset.tmenu,

    markers: {
      backgroundMenu: Styles.resolve('styles-background-menu'),
      menu: Styles.resolve('styles-menu'),
      selectedMenu: Styles.resolve('styles-selected-menu'),
      item: Styles.resolve('styles-item'),
      selectedItem: Styles.resolve('styles-selected-item')
    }
  }));

  return memMenu.asSpec();
};
开发者ID:abstask,项目名称:tinymce,代码行数:64,代码来源:StylesMenu.ts

示例6: function

const getClosestTable = function (cell, isRoot) {
  return SelectorFind.ancestor(cell, 'table', isRoot);
};
开发者ID:enigmatic-user,项目名称:tinymce-1,代码行数:3,代码来源:TableDeleteAction.ts


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