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


TypeScript mcagar.ActionChains類代碼示例

本文整理匯總了TypeScript中@ephox/mcagar.ActionChains的典型用法代碼示例。如果您正苦於以下問題:TypeScript ActionChains類的具體用法?TypeScript ActionChains怎麽用?TypeScript ActionChains使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: function

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

  Theme();

  const settings = {
    skin_url: '/project/js/tinymce/skins/lightgray',
    inline: true
  };

  Pipeline.async({}, [
    Logger.t('Pressing shift+enter in brMode inside a h1 should insert a br', Chain.asStep({}, [
      Editor.cFromHtml('<h1>ab</h1>', Merger.merge(settings, { forced_root_block: false })),
      ApiChains.cFocus,
      ApiChains.cSetCursor([0], 1),
      ActionChains.cContentKeystroke(Keys.enter(), { shift: true }),
      ApiChains.cAssertContent('a<br />b'),
      Editor.cRemove
    ]))
  ], function () {
    success();
  }, failure);
});
開發者ID:aha-app,項目名稱:tinymce-word-paste-filter,代碼行數:24,代碼來源:EnterKeyInlineTest.ts

示例2: table

    TinyLoader.setup(function (editor, onSuccess, onFailure) {
      Pipeline.async({}, [
        Logger.t('FakeCaret before/after table', GeneralSteps.sequence(browser.isEdge() || browser.isFirefox() ? [
          Logger.t('Move fake caret left before table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.left()),
            ApiChains.cAssertContentStructure(buildBody([ caretBefore(), table('1'), visualCaretBefore() ])),
            ApiChains.cAssertSelection([0], 0, [0], 0)
          ])),
          Logger.t('Move fake caret right after table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.right()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), visualCaretAfter() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake caret right after table then right again before other table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
            ActionChains.cContentKeystroke(Keys.right()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0),
            ActionChains.cContentKeystroke(Keys.right()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake caret left before table then left again after other table', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
            ApiChains.cSetCursor([1, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
            ActionChains.cContentKeystroke(Keys.left()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0),
            ActionChains.cContentKeystroke(Keys.left()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake up for when table is first element', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.up()),
            ApiChains.cAssertContentStructure(buildBody([ block, table('1') ])),
            ApiChains.cAssertSelection([0], 0, [0], 0)
          ])),
          Logger.t('Move fake down for when table is last element', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.down()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), block ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ])),
          Logger.t('Move fake up for when table is first element but not when caret is not as start', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.up()),
            ApiChains.cAssertContentStructure(buildBody([ block, table('1') ])),
            ApiChains.cAssertSelection([0], 0, [0], 0)
          ])),
          Logger.t('Move fake down for when table is last element but not when caret is not as end', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
            ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
            ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
            ActionChains.cContentKeystroke(Keys.down()),
            ApiChains.cAssertContentStructure(buildBody([ table('1'), block ])),
            ApiChains.cAssertSelection([1], 0, [1], 0)
          ]))] : []
        )),

        Logger.t('Table cell navigation', GeneralSteps.sequence([
          Logger.t('Should move to the cell above the current cell on key up', Chain.asStep(editor, [
            ApiChains.cFocus,
            ApiChains.cSetContent(`
              <table>
                <tbody>
                  <tr><td>1</td><td>2</td></tr>
                  <tr><td>2</td><td>3</td></tr>
                </tbody>
              </table>
            `),
            ApiChains.cSetCursor([0, 0, 1, 1, 0], 0),
            ActionChains.cContentKeystroke(Keys.up()),
            ApiChains.cAssertSelection([0, 0, 0, 1, 0], 0, [0, 0, 0, 1, 0], 0)
          ])),
          Logger.t('Should move to the cell below the current cell on key down', Chain.asStep(editor, [
            ApiChains.cFocus,
//.........這裏部分代碼省略.........
開發者ID:danielpunkass,項目名稱:tinymce,代碼行數:101,代碼來源:ArrowKeysTableTest.ts

示例3: table

 TinyLoader.setup(function (editor, onSuccess, onFailure) {
   Pipeline.async({}, browser.isEdge() || browser.isFirefox() ? [
     Logger.t('Move fake caret left before table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.left()),
       ApiChains.cAssertContentStructure(buildBody([ caretBefore(), table('1'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([0], 0, [0], 0)
     ])),
     Logger.t('Move fake caret right after table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.right()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake caret right after table then right again before other table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
       ActionChains.cContentKeystroke(Keys.right()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0),
       ActionChains.cContentKeystroke(Keys.right()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake caret left before table then left again after other table', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table><table><tbody><tr><td>2</td></tr></tbody></table>'),
       ApiChains.cSetCursor([1, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), table('2') ])),
       ActionChains.cContentKeystroke(Keys.left()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretBefore(), table('2'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0),
       ActionChains.cContentKeystroke(Keys.left()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), table('2'), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake up for when table is first element', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.up()),
       ApiChains.cAssertContentStructure(buildBody([ caretBefore(), table('1'), visualCaretBefore() ])),
       ApiChains.cAssertSelection([0], 0, [0], 0)
     ])),
     Logger.t('Move fake down for when table is last element', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.down()),
       ApiChains.cAssertContentStructure(buildBody([ table('1'), caretAfter(), visualCaretAfter() ])),
       ApiChains.cAssertSelection([1], 0, [1], 0)
     ])),
     Logger.t('Move fake up for when table is first element but not when caret is not as start', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 1),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.up()),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ApiChains.cAssertSelection([0, 0, 0, 0, 0], 1, [0, 0, 0, 0, 0], 1)
     ])),
     Logger.t('Move fake down for when table is last element but not when caret is not as end', Chain.asStep(editor, [
       ApiChains.cFocus,
       ApiChains.cSetContent('<table><tbody><tr><td>1</td></tr></tbody></table>'),
       ApiChains.cSetCursor([0, 0, 0, 0, 0], 0),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ActionChains.cContentKeystroke(Keys.down()),
       ApiChains.cAssertContentStructure(buildBody([ table('1') ])),
       ApiChains.cAssertSelection([0, 0, 0, 0, 0], 0, [0, 0, 0, 0, 0], 0)
     ]))
   ] : [], onSuccess, onFailure);
 }, {
開發者ID:,項目名稱:,代碼行數:82,代碼來源:


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