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


TypeScript Keyboard.sKeypress方法代码示例

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


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

示例1:

 const sSetContentAndTrigger = (content: string, triggerCharCode: number) => {
   return GeneralSteps.sequence([
     tinyApis.sSetContent(`<p>${content}</p>`),
     tinyApis.sSetCursor([ 0, 0 ], content.length),
     Keyboard.sKeydown(eDoc, triggerCharCode, { }),
     Keyboard.sKeypress(eDoc, triggerCharCode, { })
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:AutocompleterTest.ts

示例2: function

const sTypeChar = function (doc, chr) {
  return GeneralSteps.sequence([
    Keyboard.sKeydown(doc, chr, {}),
    Keyboard.sKeypress(doc, chr, {}),
    sInsertCharAtSelection(doc, chr),
    Keyboard.sKeyup(doc, chr, {})
  ]);
};
开发者ID:abstask,项目名称:tinymce,代码行数:8,代码来源:TypeText.ts

示例3: sAssertAutocompleterStructure

 const sTestAutocompleter = (scenario: { triggerChar: string, structure: AutocompleterStructure, choice: Step<any, any>, assertion: Step<any, any>, content?: string }) => {
   const content = scenario.content || scenario.triggerChar;
   return GeneralSteps.sequence([
     store.sClear,
     tinyApis.sSetContent(`<p>${content}</p>`),
     tinyApis.sSetCursor([ 0, 0 ], content.length),
     Keyboard.sKeypress(eDoc, scenario.triggerChar.charCodeAt(0), { }),
     tinyUi.sWaitForPopup('wait for autocompleter to appear', '.tox-autocompleter div[role="menu"]'),
     sAssertAutocompleterStructure(scenario.structure),
     scenario.choice,
     sWaitForAutocompleteToClose,
     scenario.assertion
   ]);
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:14,代码来源:AutocompleterTest.ts

示例4: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const eDoc = Element.fromDom(editor.getDoc());

    Pipeline.async({},
      Log.steps('TBA', 'Charmap: Autocomplete, trigger an autocomplete and check it appears', [
        tinyApis.sFocus,
        tinyApis.sSetContent('<p>:co</p>'),
        tinyApis.sSetCursor([ 0, 0 ], 3),
        Keyboard.sKeypress(eDoc, 'o'.charCodeAt(0), { }),
        UiFinder.sWaitForVisible('Waiting for autocomplete menu', Body.body(), '.tox-autocompleter'),
        Keyboard.sKeydown(eDoc, Keys.enter(), { }),

        // This assertion does not pass on Phantom. The editor content
        // is empty. Not sure if it's an encoding issue for entities.
        navigator.userAgent.indexOf('PhantomJS') > -1 ? Step.pass : tinyApis.sAssertContent('<p>₡</p>')
      ])
    , onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:19,代码来源:CharmapAutocompletionTest.ts

示例5: TinyApis

  TinyLoader.setup(function (editor, onSuccess, onFailure) {
    const tinyApis = TinyApis(editor);
    const eDoc = Element.fromDom(editor.getDoc());

    // NOTE: This is almost identical to charmap
    Pipeline.async({},
      Log.steps('TBA', 'Emoticons: Autocomplete, trigger an autocomplete and check it appears', [
        tinyApis.sFocus,
        tinyApis.sSetContent('<p>:ha</p>'),
        tinyApis.sSetCursor([ 0, 0 ], 3),
        Keyboard.sKeypress(eDoc, 'a'.charCodeAt(0), { }),
        UiFinder.sWaitForVisible('Waiting for autocomplete menu', Body.body(), '.tox-autocompleter .tox-collection__item'),
        Keyboard.sKeydown(eDoc, Keys.right(), { }),
        Keyboard.sKeydown(eDoc, Keys.right(), { }),
        Keyboard.sKeydown(eDoc, Keys.enter(), { }),
        tinyApis.sAssertContent('<p>😂</p>')
      ])
    , onSuccess, onFailure);
  }, {
开发者ID:tinymce,项目名称:tinymce,代码行数:19,代码来源:EmoticonAutocompletionTest.ts


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