本文整理汇总了TypeScript中@ephox/agar.Keys.space方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Keys.space方法的具体用法?TypeScript Keys.space怎么用?TypeScript Keys.space使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Keys
的用法示例。
在下文中一共展示了Keys.space方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
Logger.t('Press space at beginning of inline boundary', GeneralSteps.sequence([
tinyApis.sFocus,
tinyApis.sSetContent('<p>a <a href="#">b</a> c</p>'),
tinyApis.sSetCursor([0, 1, 0], 0),
tinyApis.sNodeChanged,
tinyActions.sContentKeystroke(Keys.space(), {}),
tinyApis.sAssertSelection([0, 1, 0], 1, [0, 1, 0], 1),
tinyApis.sAssertContent('<p>a <a href="#"> b</a> c</p>')
])),
Logger.t('Press space at end of inline boundary', GeneralSteps.sequence([
tinyApis.sFocus,
tinyApis.sSetContent('<p>a <a href="#">b</a> c</p>'),
tinyApis.sSetCursor([0, 1, 0], 1),
tinyApis.sNodeChanged,
tinyActions.sContentKeystroke(Keys.space(), {}),
tinyApis.sAssertSelection([0, 1, 0], 2, [0, 1, 0], 2),
tinyApis.sAssertContent('<p>a <a href="#">b </a> c</p>')
]))
], onSuccess, onFailure);
}, {
示例2: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({},
Log.steps('TBA', 'Anchor: Add anchor by selecting text content, then check that anchor is inserted correctly', [
tinyApis.sFocus,
tinyApis.sSetContent('<p>abc 123</p>'),
tinyApis.sSetSelection([0, 0], 4, [0, 0], 7),
tinyActions.sContentKeystroke(Keys.space(), {}),
tinyApis.sExecCommand('mceanchor'),
Chain.asStep(Element.fromDom(document.body), [
Chain.fromParent(UiFinder.cWaitForVisible('wait for dialog', 'div[role="dialog"].tox-dialog'),
[
Chain.fromChains([
UiFinder.cFindIn('input'),
UiControls.cSetValue('abc')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Save")'),
Mouse.cClick
])
]
)
]),
tinyApis.sAssertContent('<p>abc <a id="abc"></a>123</p>')
])
, onSuccess, onFailure);
}, {
示例3: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
tinyApis.sSetContent('<p>abc 123</p>'),
tinyApis.sSetSelection([0, 0], 4, [0, 0], 7),
tinyActions.sContentKeystroke(Keys.space(), {}),
tinyApis.sExecCommand('mceanchor'),
Chain.asStep(Element.fromDom(document.body), [
Chain.fromParent(UiFinder.cWaitForVisible('wait for dialog', 'div[aria-label="Anchor"][role="dialog"]'),
[
Chain.fromChains([
UiFinder.cFindIn('input'),
UiControls.cSetValue('abc')
]),
Chain.fromChains([
UiFinder.cFindIn('button:contains("Ok")'),
Mouse.cClick
])
]
)
]),
tinyApis.sAssertContent('<p>abc <a id="abc"></a>123</p>')
], onSuccess, onFailure);
}, {
示例4: function
const sContentActionTest = function (inputHtml, spath, soffset, fpath, foffset, expectedHtml, sAction) {
return GeneralSteps.sequence([
tinyApis.sSetContent(inputHtml),
tinyApis.sSetSelection(spath, soffset, fpath, foffset),
tinyActions.sContentKeystroke(Keys.space(), {}),
sAction,
tinyApis.sAssertContent(expectedHtml)
]);
};
示例5: function
return function (tinyApis, tinyActions, content) {
const padding = key === Keys.space() ? '\u00a0' : '';
const extraOffset = padding === '' ? 0 : 1;
return GeneralSteps.sequence([
tinyApis.sSetContent('<p>' + content + padding + '</p>'),
tinyApis.sFocus,
tinyApis.sSetCursor(
[0, 0],
content.length + extraOffset
),
tinyActions.sContentKeystroke(key, {})
]);
};
示例6: TinyUi
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyUi = TinyUi(editor);
const tinyApis = TinyApis(editor);
Pipeline.async({}, [
tinyApis.sSetContent('<p>a b</p>'),
// Need to trigger a keydown event to get the visual chars to show after calling set content
Keyboard.sKeydown(Element.fromDom(editor.getDoc()), Keys.space(), { }),
Waiter.sTryUntil('Wait for visual chars to show', tinyApis.sAssertContentStructure(sAssertSpanStruct), 50, 1000),
tinyUi.sClickOnToolbar('click on visualchars button', 'div[aria-label="Show invisible characters"] > button'),
tinyApis.sAssertContentStructure(sAssertNbspStruct),
tinyUi.sClickOnToolbar('click on visualchars button', 'div[aria-label="Show invisible characters"] > button'),
tinyApis.sAssertContentStructure(sAssertSpanStruct)
], onSuccess, onFailure);
}, {
示例7: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
sSetupLinkableContent(tinyApis),
tinyActions.sContentKeystroke(Keys.space(), {}),
sSelectAutoCompleteLink(tinyApis, 'a'),
tinyApis.sAssertContent(
'<h1 id="a"><a href="#b">a</a>bc</h1>\n' +
'<h2 id="b">abcd</h2>\n' +
'<h3 id="c">abce</h3>'
)
], onSuccess, onFailure);
}, {
示例8: function
const sSelectAutoCompleteLink = function (tinyApis, url) {
return Chain.asStep({}, [
Chain.fromParent(Toolbar.cWaitForToolbar, [
Toolbar.cClickButton('Insert/Edit link')
]),
Chain.fromParent(UiFinder.cFindIn('input'), [
UiControls.cSetValue(url),
cKeyStroke(Keys.space(), {}),
cKeyStroke(Keys.down(), {})
]),
Chain.inject(TinyDom.fromDom(document)),
Chain.fromParent(FocusTools.cGetFocused, [
cKeyStroke(Keys.down(), {}),
cKeyStroke(Keys.enter(), {})
]),
Chain.fromParent(Toolbar.cWaitForToolbar, [
Toolbar.cClickButton('Ok')
])
]);
};
示例9: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
tinyApis.sSetContent('<p style="height: 5000px">a</p><p>b</p>'),
tinyApis.sSetSelection([1], 0, [1], 1),
tinyActions.sContentKeystroke(Keys.space(), {}),
Chain.asStep({}, [
Toolbar.cWaitForToolbar,
Toolbar.cClickButton('Insert/Edit link')
]),
tinyActions.sUiKeydown(Keys.enter(), {}),
Step.sync(function () {
const offset = window.pageYOffset;
RawAssertions.assertEq('Should not be at top', offset > 0, true);
})
], onSuccess, onFailure);
}, {
示例10:
return Step.sync(function () {
editor.getBody().innerHTML = '<p>' + str + '</p>';
Keyboard.keystroke(Keys.space(), {}, TinyDom.fromDom(editor.getBody()));
});