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