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


TypeScript Chain.mapper方法代碼示例

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


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

示例1: function

  const sTestBookmark = function (html, path) {
    const dom = DOMUtils.DOM;
    const elm = TinyDom.fromDom(dom.create('div', {}, html));

    return Chain.asStep(elm, [
      Cursors.cFollowPath(Cursors.pathFrom(path)),
      Chain.mapper(toNativeRange),
      Chain.mapper(rangeToBookmark(dom)),
      Chain.mapper(bookmarkToRange(dom)),
      cAssertRangeEq(Cursors.calculate(elm, Cursors.pathFrom(path)))
    ]);
  };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:12,代碼來源:BookmarkTest.ts

示例2: getClosestCellBelow

 const cGetClosestCellBelow = (x: number, y: number) => {
   return Chain.mapper(function (viewBlock) {
     const table = SelectorFind.descendant(Element.fromDom(viewBlock.get()), 'table').getOrDie('Could not find table').dom();
     const rect = table.getBoundingClientRect();
     return getClosestCellBelow(table, rect.left + x, rect.top + y);
   });
 };
開發者ID:abstask,項目名稱:tinymce,代碼行數:7,代碼來源:TableCellsTest.ts

示例3:

const sAssertValue = (label, expected, component) => Logger.t(
  'sAssertValue: ' + label,
  Chain.asStep(component, [
    Chain.mapper(Representing.getValue),
    Assertions.cAssertEq(label, expected)
  ])
);
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:ReperesentingSteps.ts

示例4: function

 const cMergeBlocks = function (forward, block1Path, block2Path) {
   return Chain.mapper(function (viewBlock: any) {
     const block1 = Hierarchy.follow(Element.fromDom(viewBlock.get()), block1Path).getOrDie();
     const block2 = Hierarchy.follow(Element.fromDom(viewBlock.get()), block2Path).getOrDie();
     return MergeBlocks.mergeBlocks(Element.fromDom(viewBlock.get()), forward, block1, block2);
   });
 };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:7,代碼來源:MergeBlocksTest.ts

示例5: function

 const sAssertErrorMessage = function (html) {
   return Step.label('Check notification message', Chain.asStep(TinyDom.fromDom(document.body), [
     UiFinder.cWaitFor('Find notification', '.tox-notification__body > p'),
     Chain.label('Get notification HTML', Chain.mapper(Html.get)),
     Chain.label('Assert HTML matches expected', Assertions.cAssertHtml('Message html does not match', html))
   ]));
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:ImageToolsErrorTest.ts

示例6: TinyApis

    TinyLoader.setup(function (editor, onSuccess, onFailure) {
      const tinyApis = TinyApis(editor);
      const tinyUi = TinyUi(editor);

      Pipeline.async({}, [
          tinyApis.sFocus,
          tinyUi.sClickOnToolbar('click emoticons', 'button'),
          Chain.asStep({}, [
            tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
          ]),
          Waiter.sTryUntil(
            'Wait for emojis to load',
            UiFinder.sNotExists(Body.body(), '.tox-spinner'),
            100,
            1000
          ),
          Chain.asStep(Body.body(), [
            UiFinder.cFindAllIn('[role="tab"]'),
            Chain.mapper((elements: Element[]) => {
              return Arr.map(elements, (elm: Element) => {
                return elm.dom().textContent;
              });
            }),
            Assertions.cAssertEq('Categories match', categories)
          ])
        ], onSuccess, onFailure);
    }, {
開發者ID:tinymce,項目名稱:tinymce,代碼行數:27,代碼來源:DifferentEmojiDatabaseTest.ts

示例7: function

 const sWaitForAndAssertNotification = function (expected) {
   return Chain.asStep(TinyDom.fromDom(document.body), [
     UiFinder.cWaitFor('Could not find notification', 'div.mce-notification-inner'),
     Chain.mapper(Html.get),
     Assertions.cAssertHtml('Plugin list html does not match', expected)
   ]);
 };
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:7,代碼來源:IsCachedResponseTest.ts

示例8: findClosestHorizontalPosition

 const cFindClosestHorizontalPosition = (path: number[], offset: number) => {
   return Chain.mapper(function (positions: CaretPosition[]) {
     const container = Hierarchy.follow(Element.fromDom(viewBlock.get()), path).getOrDie();
     const pos = CaretPosition(container.dom(), offset);
     return findClosestHorizontalPosition(positions, pos);
   });
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:LineReaderTest.ts

示例9: getPositionsBelow

 const cGetBelowPositions = (path: number[], offset: number) => {
   return Chain.mapper(function (scope: any) {
     const container = Hierarchy.follow(Element.fromDom(scope.get()), path).getOrDie();
     const pos = CaretPosition(container.dom(), offset);
     return getPositionsBelow(scope.get(), pos);
   });
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:LineReaderTest.ts

示例10: predicate

 const cVisualCaretCheck = (predicate, path: number[], offset: number) => {
   return Chain.mapper(function (scope: any) {
     const container = Hierarchy.follow(Element.fromDom(scope.get()), path).getOrDie();
     const pos = CaretPosition(container.dom(), offset);
     return predicate(scope.get(), pos);
   });
 };
開發者ID:tinymce,項目名稱:tinymce,代碼行數:7,代碼來源:LineReaderTest.ts


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