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


TypeScript Chain.async方法代码示例

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


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

示例1: Theme

UnitTest.asynctest('browser.tinymce.core.InlineEditorSaveTest', (success, failure) =>  {
  Theme();

  const settings = {
    inline: true,
    base_url: '/project/tinymce/js/tinymce'
  };

  const cAssertBogusExist = Chain.async((val, next, die) => {
    UiFinder.findIn(Body.body(), '[data-mce-bogus]').fold(
      () => {
        die('Should be data-mce-bogus tags present');
      },
      () => {
        next(val);
      }
    );
  });

  const cSaveEditor = Chain.op((editor: Editor) => editor.save());

  Pipeline.async({}, [
    Logger.t('Saving inline editor should not remove data-mce-bogus tags', Chain.asStep({}, [
        McEditor.cFromHtml('<div></div>', settings),
        ApiChains.cSetRawContent('<p data-mce-bogus="all">b</p><p data-mce-bogus="1">b</p>'),
        cSaveEditor,
        cAssertBogusExist,
        McEditor.cRemove,
      ]),
    )
  ], function () {
    success();
  }, failure);
});
开发者ID:tinymce,项目名称:tinymce,代码行数:34,代码来源:InlineEditorSaveTest.ts

示例2: function

 const cAssertDialogContents = function (data) {
   return Chain.async(function (element, next, die) {
     getDialogByElement(element).fold(() => die('No dialog assocated with element'), function (win) {
       Assertions.assertEq('asserting dialog contents', data, win.toJSON());
       next(element);
     });
   });
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:AllowUnsafeLinkTargetTest.ts

示例3: function

 const cFindChildWithState = function (selector, predicate) {
   return Chain.async(function (scope: Element, next, die) {
     const children = PredicateFilter.descendants(scope, function (element) {
       return Selectors.is(element, selector) && predicate(element);
     });
     children.length ? next(children[0]) : die('No children with state');
   });
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:8,代码来源:ImageOps.ts

示例4: function

  const cValidateBookmark = function (rootPath) {
    return Chain.async(function (input: any, next, die) {
      const root = Hierarchy.follow(Element.fromDom(viewBlock.get()), rootPath).getOrDie();

      return input.each(function (b) {
        return next(SelectionBookmark.validate(root, b));
      });
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:SelectionBookmarkTest.ts

示例5: function

 const cAssertEditorContent = function (label, expected) {
   return Chain.control(
     Chain.async(function (editor: any, next, die) {
       Assertions.assertHtml(label || 'Asserting editors content', expected, editor.getContent());
       next(editor);
     }),
     Guard.addLogging(`Assert editor content ${expected}`)
   );
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:PlainTextPasteTest.ts

示例6: function

  const cAssertEditorDimension = function (dimension, value) {
    return Chain.async(function (editor: any, next, die) {
      const container = editor.iframeElement;
      const getter = dimension === 'width' ? Width.get : Height.get;
      const actualValue = typeof value === 'string' ? container.style[dimension] : getter(Element.fromDom(container));

      Assertions.assertEq('Editors content area has expected ' + dimension, value, actualValue);

      next(editor);
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:11,代码来源:DimensionsTest.ts

示例7: function

 const cPopupToDialog = function (selector) {
   return Chain.fromChains([
     ui.cWaitForPopup('Locate popup', selector),
     Chain.async(function (container, next, die) {
       return Arr.find(editor.windowManager.getWindows(), function (win) {
         return container.dom().id === win._id;
       }).fold(() => die('Could not find popup window'), function (win) {
         next(win);
       });
     })
   ]);
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:12,代码来源:UploadTabTest.ts

示例8: function

  const cCreateInlineEditor = function (settings) {
    return Chain.async(function (viewBlock: any, next, die) {
      viewBlock.update('<div id="inline-tiny"></div>');

      EditorManager.init(Merger.merge({
        selector: '#inline-tiny',
        inline: true,
        skin_url: '/project/js/tinymce/skins/lightgray',
        setup (editor) {
          editor.on('SkinLoaded', function () {
            next(editor);
          });
        }
      }, settings));
    });
  };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:16,代码来源:PasteSettingsTest.ts


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