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