本文整理匯總了TypeScript中@ephox/mcagar.TinyActions函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript TinyActions函數的具體用法?TypeScript TinyActions怎麽用?TypeScript TinyActions使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了TinyActions函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
Logger.t('Type text before cef inline element', GeneralSteps.sequence([
tinyApis.sSetContent('<p><span contenteditable="false">a</span></p>'),
tinyApis.sSelect('p', [1]),
tinyActions.sContentKeystroke(Keys.left(), {}),
TypeText.sTypeContentAtSelection(Element.fromDom(editor.getDoc()), 'bc'),
tinyApis.sAssertSelection([0, 0], 2, [0, 0], 2),
tinyApis.sAssertContent('<p>bc<span contenteditable="false">a</span></p>')
])),
Logger.t('Type after cef inline element', GeneralSteps.sequence([
tinyApis.sSetContent('<p><span contenteditable="false">a</span></p>'),
tinyApis.sSelect('p', [1]),
tinyActions.sContentKeystroke(Keys.right(), {}),
TypeText.sTypeContentAtSelection(Element.fromDom(editor.getDoc()), 'bc'),
tinyApis.sAssertSelection([0, 1], 3, [0, 1], 3),
tinyApis.sAssertContent('<p><span contenteditable="false">a</span>bc</p>')
])),
Logger.t('Type between cef inline elements', GeneralSteps.sequence([
tinyApis.sSetContent('<p><span contenteditable="false">a</span> <span contenteditable="false">b</span></p>'),
tinyApis.sSelect('p', [3]),
tinyActions.sContentKeystroke(Keys.left(), {}),
tinyActions.sContentKeystroke(Keys.left(), {}),
TypeText.sTypeContentAtSelection(Element.fromDom(editor.getDoc()), 'bc'),
tinyApis.sAssertSelection([0, 1], 3, [0, 1], 3),
tinyApis.sAssertContent('<p><span contenteditable="false">a</span>bc <span contenteditable="false">b</span></p>')
]))
], onSuccess, onFailure);
}, {
示例2: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
Logger.t('ul > li in table', GeneralSteps.sequence([
tinyApis.sSetContent('<table><tbody><tr><td><ul><li>a</li><li>b</li></ul></td></tr></tbody></table>'),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1], 1),
tinyActions.sContentKeystroke(Keys.tab(), {}),
sAssertTableInnerHTML(editor, '<tbody><tr><td><ul><li>a<ul><li>b</li></ul></li></ul></td></tr></tbody>')
])),
Logger.t('ol > li in table', GeneralSteps.sequence([
tinyApis.sSetContent('<table><tbody><tr><td><ol><li>a</li><li>b</li></ol></td></tr></tbody></table>'),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1], 1),
tinyActions.sContentKeystroke(Keys.tab(), {}),
sAssertTableInnerHTML(editor, '<tbody><tr><td><ol><li>a<ol><li>b</li></ol></li></ol></td></tr></tbody>')
])),
Logger.t('dl > dt in table', GeneralSteps.sequence([
tinyApis.sSetContent('<table><tbody><tr><td><dl><dt>a</dt><dt>b</dt></dl></td></tr></tbody></table>'),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1], 1),
tinyActions.sContentKeystroke(Keys.tab(), {}),
sAssertTableInnerHTML(editor, '<tbody><tr><td><dl><dt>a</dt><dd>b</dd></dl></td></tr></tbody>')
]))
], onSuccess, onFailure);
}, {
示例3: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
const steps = Utils.withTeardown(
[
Log.stepsAsStep('TBA', 'TextPattern: inline italic then undo', [
Utils.sSetContentAndPressSpace(tinyApis, tinyActions, '*a*'),
tinyApis.sAssertContentStructure(Utils.inlineStructHelper('em', 'a')),
tinyApis.sExecCommand('Undo'),
tinyApis.sAssertContent('<p>*a* </p>')
]),
Log.stepsAsStep('TBA', 'TextPattern: block italic then undo', [
Utils.sSetContentAndPressEnter(tinyApis, tinyActions, '*a*'),
tinyApis.sAssertContentStructure(Utils.inlineBlockStructHelper('em', 'a')),
tinyApis.sExecCommand('Undo'),
tinyApis.sAssertContent('<p>*a*</p>\n<p> </p>'),
tinyApis.sExecCommand('Undo'),
tinyApis.sAssertContent('<p>*a*</p>'),
]),
],
tinyApis.sSetContent('')
);
Pipeline.async({}, steps, onSuccess, onFailure);
}, {
示例4: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
const selectionChangeState = Cell(false);
Pipeline.async({}, Env.webkit ?
Log.steps('TBA', 'TestCase-Table-TBA-Create lists within table cells and verify keyboard navigation for the cells', [
tinyApis.sFocus,
tinyApis.sSetContent(
'<table><tbody><tr><td><ul><li>a</li><li>b</li></ul></td></tr><tr><td><ul><li>c</li><li>d</li></ul></td></tr></tbody></table>'
),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1, 0], 0),
tinyActions.sContentKeydown(Keys.down(), {}),
tinyApis.sSetCursor([0, 0, 1, 0, 0, 0, 0], 0),
Step.sync(function () {
editor.on('SelectionChange', function () {
selectionChangeState.set(true);
});
}),
Waiter.sTryUntil(
'editor did not have correct selection',
Step.sync(function () {
RawAssertions.assertEq('state is true', true, selectionChangeState.get());
}),
100, 3000
),
tinyApis.sAssertSelection([0, 0, 1, 0, 0, 0, 0], 0, [0, 0, 1, 0, 0, 0, 0], 0)
])
: [], onSuccess, onFailure);
}, {
示例5: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
const selectionChangeState = Cell(false);
Pipeline.async({}, Env.webkit ? [
tinyApis.sFocus,
tinyApis.sSetContent(
'<table><tbody><tr><td><ul><li>a</li><li>b</li></ul></td></tr><tr><td><ul><li>c</li><li>d</li></ul></td></tr></tbody></table>'
),
tinyApis.sSetCursor([0, 0, 0, 0, 0, 1, 0], 0),
tinyActions.sContentKeydown(Keys.down(), {}),
tinyApis.sSetCursor([0, 0, 1, 0, 0, 0, 0], 0),
Step.sync(function () {
editor.on('selectionchange', function () {
selectionChangeState.set(true);
});
}),
Waiter.sTryUntil(
'editor did not have correct selection',
Step.sync(function () {
RawAssertions.assertEq('state is true', true, selectionChangeState.get());
}),
100, 3000
),
tinyApis.sAssertSelection([0, 0, 1, 0, 0, 0, 0], 0, [0, 0, 1, 0, 0, 0, 0], 0)
] : [], onSuccess, onFailure);
}, {
示例6: 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);
}, {
示例7: 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);
}, {
示例8: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
sTestDeletePadd(editor, tinyApis, tinyActions)
], onSuccess, onFailure);
}, {
示例9: TinyApis
TinyLoader.setup((editor, onSuccess, onFailure) => {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
const steps = Utils.withTeardown([
Logger.t('Apply html replacement pattern on space', GeneralSteps.sequence([
Utils.sSetContentAndPressSpace(tinyApis, tinyActions, 'heading'),
tinyApis.sAssertContent('<h1>My Heading</h1>'),
tinyApis.sAssertSelection([0, 0], 10, [0, 0], 10)
])),
Logger.t('Apply html replacement pattern on enter', GeneralSteps.sequence([
Utils.sSetContentAndPressEnter(tinyApis, tinyActions, 'heading'),
tinyApis.sAssertContent('<h1>My Heading</h1><p> </p>'),
tinyApis.sAssertSelection([1], 0, [1], 0)
])),
Logger.t('Apply html replacement pattern on enter in middle of word', GeneralSteps.sequence([
tinyApis.sSetContent('<p>XheadingX</p>'),
tinyApis.sSetSelection([0, 0], 8, [0, 0], 8),
Utils.sPressEnter(tinyApis, tinyActions),
tinyApis.sAssertContent('<p>X</p><h1>My Heading</h1><p> </p><p>X</p>'),
tinyApis.sAssertSelection([2], 0, [2], 0)
])),
Logger.t('Apply complex html replacement pattern on enter', GeneralSteps.sequence([
tinyApis.sSetContent('<p>complex pattern</p>'),
tinyApis.sSetSelection([0, 0], 15, [0, 0], 15),
Utils.sPressEnter(tinyApis, tinyActions),
tinyApis.sAssertContent('<h1>Text</h1><p>More text</p><p> </p>'),
])),
Logger.t('Apply text replacement pattern on space', GeneralSteps.sequence([
Utils.sSetContentAndPressSpace(tinyApis, tinyActions, 'brb'),
tinyApis.sAssertContent('<p>Be Right Back</p>'),
tinyApis.sAssertSelection([0, 0], 13, [0, 0], 13)
])),
Logger.t('Apply text replacement pattern on space with content after', GeneralSteps.sequence([
tinyApis.sSetContent('<p>brbX</p>'),
tinyApis.sSetSelection([0, 0], 3, [0, 0], 3),
Utils.sPressSpace(tinyApis, tinyActions),
tinyApis.sAssertContent('<p>Be Right BackX</p>'),
tinyApis.sAssertSelection([0, 0], 14, [0, 0], 14)
])),
Logger.t('Apply text replacement pattern on enter', GeneralSteps.sequence([
tinyApis.sSetContent('<p>brb</p>'),
tinyApis.sSetSelection([0, 0], 3, [0, 0], 3),
Utils.sPressEnter(tinyApis, tinyActions),
tinyApis.sAssertContent('<p>Be Right Back</p><p> </p>'),
])),
Logger.t('Apply text replacement pattern on enter with content after', GeneralSteps.sequence([
tinyApis.sSetContent('<p>brbX</p>'),
tinyApis.sSetSelection([0, 0], 3, [0, 0], 3),
Utils.sPressEnter(tinyApis, tinyActions),
tinyApis.sAssertContent('<p>Be Right Back</p><p>X</p>'),
tinyApis.sAssertSelection([1, 0], 0, [1, 0], 0)
])),
], tinyApis.sSetContent(''));
Pipeline.async({}, steps, onSuccess, onFailure);
}, {
示例10: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyActions = TinyActions(editor);
Pipeline.async({}, [
tinyApis.sFocus,
Logger.t('Enter before HR in the beginning of content', GeneralSteps.sequence([
tinyApis.sSetContent('<hr /><p>a</p>'),
tinyApis.sSetCursor([], 0),
tinyActions.sContentKeystroke(Keys.enter(), {}),
tinyApis.sAssertContent('<p> </p><hr /><p>a</p>'),
tinyApis.sAssertSelection([0], 0, [0], 0)
])),
Logger.t('Enter after HR in the beginning of content', GeneralSteps.sequence([
tinyApis.sSetContent('<hr /><p>a</p>'),
tinyApis.sSetCursor([], 1),
tinyActions.sContentKeystroke(Keys.enter(), {}),
tinyApis.sAssertContent('<hr /><p> </p><p>a</p>'),
tinyApis.sAssertSelection([2, 0], 0, [2, 0], 0)
])),
Logger.t('Enter before HR in the middle of content', GeneralSteps.sequence([
tinyApis.sSetContent('<p>a</p><hr /><p>b</p>'),
tinyApis.sSetCursor([], 1),
tinyActions.sContentKeystroke(Keys.enter(), {}),
tinyApis.sAssertContent('<p>a</p><p> </p><hr /><p>b</p>'),
tinyApis.sAssertSelection([1], 0, [1], 0)
])),
Logger.t('Enter after HR in the middle of content', GeneralSteps.sequence([
tinyApis.sSetContent('<p>a</p><hr /><p>b</p>'),
tinyApis.sSetCursor([], 2),
tinyActions.sContentKeystroke(Keys.enter(), {}),
tinyApis.sAssertContent('<p>a</p><hr /><p> </p><p>b</p>'),
tinyApis.sAssertSelection([3, 0], 0, [3, 0], 0)
])),
Logger.t('Enter before HR in the end of content', GeneralSteps.sequence([
tinyApis.sFocus,
tinyApis.sSetContent('<p>a</p><hr />'),
tinyApis.sSetCursor([], 1),
tinyActions.sContentKeystroke(Keys.enter(), {}),
tinyApis.sAssertContent('<p>a</p><p> </p><hr />'),
tinyApis.sAssertSelection([1], 0, [1], 0)
])),
Logger.t('Enter after HR in the end of content', GeneralSteps.sequence([
tinyApis.sFocus,
tinyApis.sSetContent('<p>a</p><hr />'),
tinyApis.sSetCursor([], 2),
tinyActions.sContentKeystroke(Keys.enter(), {}),
tinyApis.sAssertContent('<p>a</p><hr /><p> </p>'),
tinyApis.sAssertSelection([2], 0, [2], 0)
]))
], onSuccess, onFailure);
}, {