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


TypeScript Step.stateful方法代码示例

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


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

示例1: function

const mTeardownKeyLogger = function (body, expected) {
  return Step.stateful(function (state, next, die) {
    Assertions.assertEq('Checking key log outside context (on teardown)', expected, state.log);
    state.onKeydown.unbind();
    next({});
  });
};
开发者ID:abstask,项目名称:tinymce,代码行数:7,代码来源:GuiSetup.ts

示例2: function

 const mAssertSetSelectionEventArgs = function (editor, expectedForward) {
   return Step.stateful(function (value: any, next, die) {
     Assertions.assertEq('Should be expected forward flag', expectedForward, value.eventArgs.get().forward);
     assertSelectAllRange(editor, value.eventArgs.get().range);
     next(value);
   });
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:7,代码来源:SelectionEventsTest.ts

示例3: function

  const mShowKeyboard = function (selector, index) {
    const keyboardHeight = 200;
    return Step.stateful(function (value, next, die) {
      const pageBody = iframe.dom().contentWindow.document.body;
      const editorBody = pageBody.querySelector('iframe').contentWindow.document.body;
      const target: any = Option.from(editorBody.querySelectorAll(selector)[index]).map(Element.fromDom).getOrDie('no index ' + index + ' for selector: ' + selector);
      WindowSelection.setExact(editorBody.ownerDocument.defaultView, target, 0, target, 0);
      const socket = pageBody.querySelector('.tinymce-mobile-editor-socket');
      socket.scrollTop = target.dom().getBoundingClientRect().top - 100 - keyboardHeight;
      pageBody.style.setProperty('margin-bottom', '2000px');
      pageBody.ownerDocument.defaultView.scrollTo(0, keyboardHeight);

      //
      const cursorY = getCursorY(target);
      const newValue = Merger.deepMerge(
        value,
        {
          target,
          cursorY
        }
      );
      // tslint:disable-next-line:no-console
      console.log('newValue', newValue);
      next(newValue);
    });
  };
开发者ID:tinymce,项目名称:tinymce,代码行数:26,代码来源:IosRealmTest.ts

示例4: function

 const mCreateRange = function (startPath, startOffset, endPath, endOffset) {
   return Step.stateful(function (value, next, die) {
     const startContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
     const endContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), endPath).getOrDie();
     const rng = document.createRange();
     rng.setStart(startContainer.dom(), startOffset);
     rng.setEnd(endContainer.dom(), endOffset);
     next(rng);
   });
 };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:10,代码来源:RangeNormalizerTest.ts

示例5: function

 const mAssertScrollIntoViewEventInfo = function (editor, expectedElementSelector, expectedAlignToTop) {
   return Step.stateful(function (value: any, next, die) {
     const expectedTarget = Element.fromDom(editor.dom.select(expectedElementSelector)[0]);
     const actualTarget = Element.fromDom(value.state.get().elm);
     Assertions.assertDomEq('Target should be expected element', expectedTarget, actualTarget);
     Assertions.assertEq('Align to top should be expected value', expectedAlignToTop, value.state.get().alignToTop);
     editor.off('ScrollIntoView', value.handler);
     next({});
   });
 };
开发者ID:danielpunkass,项目名称:tinymce,代码行数:10,代码来源:ScrollIntoViewTest.ts

示例6: TinyApis

 TinyLoader.setup(function (editor, onSuccess, onFailure) {
   const tinyApis = TinyApis(editor);
   Pipeline.async({}, [
     tinyApis.sFocus,
     Logger.t('SetSelectionRange event', GeneralSteps.sequence([
       mBindEvent(editor, 'SetSelectionRange'),
       tinyApis.sSetContent('<p>a</p>'),
       sSetRng(editor, undefined),
       mAssertSetSelectionEventArgs(editor, undefined),
       sSetRng(editor, true),
       mAssertSetSelectionEventArgs(editor, true),
       sSetRng(editor, false),
       mAssertSetSelectionEventArgs(editor, false),
       mUnbindEvent(editor, 'SetSelectionRange')
     ])),
     Logger.t('AfterSetSelectionRange event', GeneralSteps.sequence([
       mBindEvent(editor, 'AfterSetSelectionRange'),
       tinyApis.sSetContent('<p>a</p>'),
       sSetRng(editor, undefined),
       Step.stateful(function (value, next, die) {
         Assertions.assertEq('', 'undefined', typeof value.eventArgs.get().forward);
         next(value);
       }),
       sSetRng(editor, true),
       mAssertSetSelectionEventArgs(editor, true),
       sSetRng(editor, false),
       mAssertSetSelectionEventArgs(editor, false),
       mUnbindEvent(editor, 'AfterSetSelectionRange')
     ])),
     Logger.t('GetSelectionRange event', GeneralSteps.sequence([
       mBindEventMutator(editor, 'GetSelectionRange', selectAll),
       tinyApis.sSetContent('<p>a</p>'),
       tinyApis.sSetCursor([0, 0], 0),
       sGetRng(editor),
       Step.stateful(function (value, next, die) {
         assertSelectAllRange(editor, editor.selection.getRng());
         assertSelectAllRange(editor, value.eventArgs.get().range);
         next(value);
       }),
       mUnbindEvent(editor, 'GetSelectionRange')
     ]))
   ], onSuccess, onFailure);
 }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:43,代码来源:SelectionEventsTest.ts


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