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


TypeScript Chain.pipeline方法代碼示例

本文整理匯總了TypeScript中@ephox/agar.Chain.pipeline方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Chain.pipeline方法的具體用法?TypeScript Chain.pipeline怎麽用?TypeScript Chain.pipeline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@ephox/agar.Chain的用法示例。


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

示例1: Cell

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const lastEventArgs = Cell(null);

    editor.on('FullscreenStateChanged', function (e) {
      lastEventArgs.set(e);
    });

    const cAssertEditorAndLastEvent = (label, state) =>
      Chain.control(
        Chain.fromChains([
          Chain.op(() => Assertions.assertEq('Editor isFullscreen', state, editor.plugins.fullscreen.isFullscreen())),
          Chain.op(() => Assertions.assertEq('FullscreenStateChanged event', state, lastEventArgs.get().state))
        ]),
        Guard.addLogging(label)
      );

    const cAssertFullscreenClass = (label, shouldExist) => {
      const selector = shouldExist ? 'root:.tox-fullscreen' : 'root::not(.tox-fullscreen)';
      const label2 = `Body and Html should ${shouldExist ? '' : 'not '}have "tox-fullscreen" class`;
      return Chain.control(
        Chain.fromChains([
          Chain.inject(Body.body()),
          UiFinder.cFindIn(selector),
          Chain.inject(Element.fromDom(document.documentElement)),
          UiFinder.cFindIn(selector)
        ]),
        Guard.addLogging(`${label}: ${label2}`)
      );
    };

    const cCloseOnlyWindow =  Chain.control(
      Chain.op(() => {
        const dialogs = () => UiFinder.findAllIn(Body.body(), '[role="dialog"]');
        Assertions.assertEq('One window exists', 1, dialogs().length);
        editor.windowManager.close();
        Assertions.assertEq('No windows exist', 0, dialogs().length);
      }),
      Guard.addLogging('Close window')
    );

    Chain.pipeline(
      Log.chains('TBA', 'FullScreen: Toggle fullscreen on, open link dialog, insert link, close dialog and toggle fullscreen off', [
        cAssertFullscreenClass('Before fullscreen command', false),
        Chain.op(() => editor.execCommand('mceFullScreen', true)),
        cAssertEditorAndLastEvent('After fullscreen command', true),
        cAssertFullscreenClass('After fullscreen command', true),
        Chain.op(() => editor.execCommand('mceLink', true)),
        cWaitForDialog('Insert/Edit Link'),
        cCloseOnlyWindow,
        cAssertFullscreenClass('After window is closed', true),
        Chain.op(() => editor.execCommand('mceFullScreen')),
        cAssertEditorAndLastEvent('After fullscreen toggled', false),
        cAssertFullscreenClass('After fullscreen toggled', false),
      ])
    , onSuccess, onFailure);
  }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:56,代碼來源:FullScreenPluginTest.ts

示例2: function

UnitTest.asynctest('browser.tinymce.core.init.InitEditorOnHiddenElementTest', function () {
  const success = arguments[arguments.length - 2];
  const failure = arguments[arguments.length - 1];

  Theme();

  // Firefox specific test, errors were thrown when the editor was initialised on hidden element.
  Chain.pipeline([
    Editor.cFromHtml('<textarea style="display:none;"></textarea>', {
      base_url: '/project/tinymce/js/tinymce'
    }),
    ApiChains.cFocus
  ],
  function () {
    success();
  }, failure);
});
開發者ID:tinymce,項目名稱:tinymce,代碼行數:17,代碼來源:InitEditorOnHiddenElementTest.ts

示例3: next

 Chain.on((value, next, die, logs) => {
   Chain.pipeline([Chain.inject(value)].concat(chains), (_, newLogs) => next(Chain.wrap(value), newLogs), die, logs);
 }),
開發者ID:tinymce,項目名稱:tinymce,代碼行數:3,代碼來源:Helpers.ts


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