本文整理汇总了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, { })
]);
};
示例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, {})
]);
};
示例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
]);
};
示例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);
}, {
示例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);
}, {