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


TypeScript Arr.flatten方法代码示例

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


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

示例1: renderLabel

export const renderSelectBox = (spec: Types.SelectBox.SelectBox, providersBackstage: UiFactoryBackstageProviders): SketchSpec => {
  const translatedOptions = Arr.map(spec.items, (item) => {
    return {
      text: providersBackstage.translate(item.text),
      value: item.value
    };
  });

  // DUPE with TextField.
  const pLabel = spec.label.map((label) => renderLabel(label, providersBackstage));

  const pField = AlloyFormField.parts().field({
    // TODO: Alloy should not allow dom changing of an HTML select!
    dom: {  },
    selectAttributes: {
      size: spec.size
    },
    options: translatedOptions,
    factory: AlloyHtmlSelect,
    selectBehaviours: Behaviour.derive([
      Tabstopping.config({ }),
      AddEventsBehaviour.config('selectbox-change', [
        AlloyEvents.run(NativeEvents.change(), (component, _) => {
          AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
        })
      ])
    ])
  });

  const chevron = spec.size > 1 ? Option.none() :
    Option.some({
        dom: {
          tag: 'div',
          classes: ['tox-selectfield__icon-js'],
          innerHtml: Icons.get('chevron-down', providersBackstage.icons)
        }
      });

  const selectWrap: SimpleSpec = {
    dom: {
      tag: 'div',
      classes: ['tox-selectfield']
    },
    components: Arr.flatten([[pField], chevron.toArray()])
  };

  return AlloyFormField.sketch({
    dom: {
      tag: 'div',
      classes: ['tox-form__group']
    },
    components: Arr.flatten<AlloySpec>([pLabel.toArray(), [selectWrap]])
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:54,代码来源:SelectBox.ts

示例2: function

    return ApproxStructure.build(function (s, str/*, arr*/) {
      const children = Arr.map(texts, function (text, i) {
        return Arr.flatten([
          index === i && before ? [ s.text(str.is(Zwsp.ZWSP)) ] : [ ],
          [
            s.element(
              'a',
              {
                attrs: {
                  'data-mce-selected': str.none('inline-boundary'),
                  'data-mce-href': str.is('#'),
                  'href': str.is('#')
                },
                children: [
                  s.text(str.is(text))
                ]
              }
            )
          ],
          index === i && before === false ? [ s.text(str.is(Zwsp.ZWSP)) ] : [ ]
        ]);
      });

      return s.element('p', {
        children: addGeckoBr(s, str, Arr.flatten(children))
      });
    });
开发者ID:tinymce,项目名称:tinymce,代码行数:27,代码来源:ArrowKeysAnchorTest.ts

示例3: sAssertFocusOnItem

  return Arr.bind(navigation.concat(navigation.slice(0, 1)), (nav, i) => {
    const exploration = (nav.subitems.length > 0) ? [
      Keyboard.sKeydown(doc, Keys.right(), { }),
      sAssertFocusOnItem(doc, nav.subitems[0])
    ].concat(
      Arr.bind(
        nav.subitems.slice(1).concat(nav.subitems.slice(0, 1)),
        (si) => [
          Keyboard.sKeydown(doc, Keys.down(), { }),
          sDelay,
          sAssertFocusOnItem(doc, si)
        ]
      )
    ).concat([
      Keyboard.sKeydown(doc, Keys.escape(), { })
    ]) : [
      // Should do nothing
      Keyboard.sKeydown(doc, Keys.right(), { })
    ];

    return Arr.flatten([
      [ sAssertFocusOnItem(doc, nav.item) ],
      exploration,
      [ sAssertFocusOnItem(doc, nav.item) ],
      [ sDelay ],
      // Move to the next one
      i < navigation.length ? [ Keyboard.sKeydown(doc, Keys.down(), { }) ] : [ ]
    ]);
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:29,代码来源:MenuNavigationTestUtils.ts

示例4:

 const sBookmarkTest = (namedChains) => {
   return Chain.asStep({}, [
     NamedChain.asChain(Arr.flatten([
       [ cCreateNamedEditor ],
       namedChains,
       [ cRemoveEditor ]
     ])
   )]);
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:BookmarksTest.ts

示例5: getMenuClasses

const dom = (hasIcons: boolean, columns: Types.ColumnTypes, presets: Types.PresetTypes) => {
  const menuClasses = getMenuClasses(presets);
  return {
    tag: 'div',
    classes: Arr.flatten([
      [ menuClasses.menu, `tox-menu-${columns}-column` ],
      hasIcons ? [ menuClasses.hasIcons ] : [ ]
    ])
  };
};
开发者ID:tinymce,项目名称:tinymce,代码行数:10,代码来源:MenuParts.ts

示例6: function

 components: Arr.map(spec.fields, function (field, i) {
   return i <= spec.maxFieldIndex ? Container.sketch({
     dom: UiDomFactory.dom('<div class="${prefix}-serialised-dialog-screen"></div>'),
     components: Arr.flatten([
       [ navigationButton(-1, 'previous', (i > 0)) ],
       [ parts.field(field.name, field.spec) ],
       [ navigationButton(+1, 'next', (i < spec.maxFieldIndex)) ]
     ])
   }) : parts.field(field.name, field.spec);
 })
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:10,代码来源:SerialisedDialog.ts

示例7: sParseStyles

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    Pipeline.async({}, Arr.flatten([
      [
        sParseStyles(editor),
        sProtectConditionalCommentsInHeadFoot(editor)
      ],
      suite.toSteps(editor)
    ]), onSuccess, onFailure);

    teardown(editor);
  }, {
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:FullPagePluginTest.ts

示例8: TinyApis

  TinyLoader.setup((editor: Editor, onSuccess, onFailure) => {
      const uiContainer = Element.fromDom(editor.getContainer());
      const contentAreaContainer = Element.fromDom(editor.getContentAreaContainer());

      const tinyApis = TinyApis(editor);

      Pipeline.async({ }, Arr.flatten([
        sUiContainerTest(editor, uiContainer, tinyApis),
        sContentAreaContainerTest(contentAreaContainer)
      ]), onSuccess, onFailure);
    },
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:SilverInlineEditorTest.ts

示例9: renderInputButton

 const controlHWrapper = (): AlloySpec => {
   return {
     dom: {
       tag: 'div',
       classes: ['tox-form__controls-h-stack']
     },
     components: Arr.flatten([
       [memUrlBox.asSpec()],
       optUrlPicker.map(() => renderInputButton(spec.label, browseUrlEvent, 'tox-browse-url', 'browse', providersBackstage)).toArray()
     ])
   };
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:12,代码来源:UrlInput.ts

示例10: filterByQuery

 (linkInfo) => {
   const history = filterByQuery(term, historyTargets(urlBackstage.getHistory(fileType)));
   return fileType === 'file' ? joinMenuLists([
     history,
     filterByQuery(term, headerTargets(linkInfo)),
     filterByQuery(term, Arr.flatten([
       anchorTargetTop(linkInfo),
       anchorTargets(linkInfo),
       anchorTargetBottom(linkInfo)
     ]))
   ])
     : history;
 }
开发者ID:tinymce,项目名称:tinymce,代码行数:13,代码来源:UrlInput.ts


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