當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。