本文整理匯總了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);
}, {