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


TypeScript alloy.SplitToolbar類代碼示例

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


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

示例1:

 toolbar.each((tb) => {
   const overflow = SplitToolbar.getOverflow(tb);
   overflow.each((overf) => {
     Class.add(overf.element(), 'tox-toolbar__overflow--closed');
   });
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:6,代碼來源:Inline.ts

示例2:

 return toolbar.bind((toolbar) => {
   return SplitToolbar.getMoreButton(toolbar);
 });
開發者ID:tinymce,項目名稱:tinymce,代碼行數:3,代碼來源:OuterContainer.ts

示例3:

 memOverflow.getOpt(sink).fold(() => {
   // overflow isn't there yet ... so add it, and return the built thing
   const builtoverFlow = GuiFactory.build(memOverflow.asSpec());
   Attachment.attach(sink, builtoverFlow);
   Positioning.position(sink, toolbarSpec.backstage.shared.anchors.toolbarOverflow(), builtoverFlow);
   SplitAlloyToolbar.refresh(toolbar);
   SplitAlloyToolbar.getMoreButton(toolbar).each(Focusing.focus);
   Keying.focusIn(builtoverFlow);
   // return builtoverFlow;
 }, (builtOverflow) => {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:10,代碼來源:CommonToolbar.ts

示例4: renderToolbarGroupCommon

const renderMoreToolbar = (toolbarSpec: ToolbarSpec) => {
  const modeName: any = toolbarSpec.cyclicKeying ? 'cyclic' : 'acyclic';

  const memOverflow = Memento.record(
    AlloyToolbar.sketch({
      dom: {
        tag: 'div',
        classes: ['tox-toolbar__overflow']
      },
      toolbarBehaviours: Behaviour.derive([
        Keying.config({
        // THIS IS USED FOR FLOATING AND NOT SLIDING
        mode: 'cyclic',
          onEscape: () => {
            AlloyTriggers.emit(toolbarSpec.moreDrawerData.lazyToolbar(), 'alloy.toolbar.toggle');
            Keying.focusIn(toolbarSpec.moreDrawerData.lazyMoreButton());
            return Option.some(true);
          }
        })
      ])
    })
  );

  const getOverflow = (toolbar) => {
    return toolbarSpec.getSink().toOption().bind((sink) => {
      return memOverflow.getOpt(sink).bind(
        (overflow) => {
          return SplitAlloyToolbar.getMoreButton(toolbar).bind((_moreButton) => {
            if (overflow.getSystem().isConnected()) {
              // you have the build thing, so just return it
              Positioning.position(sink, toolbarSpec.backstage.shared.anchors.toolbarOverflow(), overflow);
              return Option.some(overflow);
            } else {
              return Option.none();
            }
          });
        }
      );
    });
  };

  const primary = SplitAlloyToolbar.parts().primary({
    dom: {
      tag: 'div',
      classes: ['tox-toolbar__primary']
    }
  });

  const splitToolbarComponents = toolbarSpec.moreDrawerData.floating ? [
    primary
  ] : [
    primary,
    SplitAlloyToolbar.parts().overflow({
      dom: {
        tag: 'div',
        classes: [ 'tox-toolbar__overflow' ]
      }
    })
  ];

  return SplitAlloyToolbar.sketch({
    uid: toolbarSpec.uid,
    dom: {
      tag: 'div',
      classes: ['tox-toolbar-overlord']
    },
    floating: toolbarSpec.moreDrawerData.floating,
    overflow: getOverflow,
    parts: {
      // This already knows it is a toolbar group
      'overflow-group': renderToolbarGroupCommon({
        title: Option.none(),
        items: []
      }),
      'overflow-button': renderIconButtonSpec({
        name: 'more',
        icon: Option.some('more-drawer'),
        disabled: false,
        tooltip: Option.some('More...')
      }, Option.none(), toolbarSpec.backstage.shared.providers)
    },
    components: splitToolbarComponents,
    markers: {
      openClass: 'tox-toolbar__overflow--open',
      closedClass: 'tox-toolbar__overflow--closed',
      growingClass: 'tox-toolbar__overflow--growing',
      shrinkingClass: 'tox-toolbar__overflow--shrinking',
      overflowToggledClass: ToolbarButtonClasses.Ticked
    },
    splitToolbarBehaviours: getToolbarbehaviours(toolbarSpec, modeName, Option.some(memOverflow))
  });
};
開發者ID:tinymce,項目名稱:tinymce,代碼行數:92,代碼來源:CommonToolbar.ts


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