本文整理汇总了TypeScript中@ephox/agar.Chain.pipeline方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Chain.pipeline方法的具体用法?TypeScript Chain.pipeline怎么用?TypeScript Chain.pipeline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Chain
的用法示例。
在下文中一共展示了Chain.pipeline方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Cell
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const lastEventArgs = Cell(null);
editor.on('FullscreenStateChanged', function (e) {
lastEventArgs.set(e);
});
const cAssertEditorAndLastEvent = (label, state) =>
Chain.control(
Chain.fromChains([
Chain.op(() => Assertions.assertEq('Editor isFullscreen', state, editor.plugins.fullscreen.isFullscreen())),
Chain.op(() => Assertions.assertEq('FullscreenStateChanged event', state, lastEventArgs.get().state))
]),
Guard.addLogging(label)
);
const cAssertFullscreenClass = (label, shouldExist) => {
const selector = shouldExist ? 'root:.tox-fullscreen' : 'root::not(.tox-fullscreen)';
const label2 = `Body and Html should ${shouldExist ? '' : 'not '}have "tox-fullscreen" class`;
return Chain.control(
Chain.fromChains([
Chain.inject(Body.body()),
UiFinder.cFindIn(selector),
Chain.inject(Element.fromDom(document.documentElement)),
UiFinder.cFindIn(selector)
]),
Guard.addLogging(`${label}: ${label2}`)
);
};
const cCloseOnlyWindow = Chain.control(
Chain.op(() => {
const dialogs = () => UiFinder.findAllIn(Body.body(), '[role="dialog"]');
Assertions.assertEq('One window exists', 1, dialogs().length);
editor.windowManager.close();
Assertions.assertEq('No windows exist', 0, dialogs().length);
}),
Guard.addLogging('Close window')
);
Chain.pipeline(
Log.chains('TBA', 'FullScreen: Toggle fullscreen on, open link dialog, insert link, close dialog and toggle fullscreen off', [
cAssertFullscreenClass('Before fullscreen command', false),
Chain.op(() => editor.execCommand('mceFullScreen', true)),
cAssertEditorAndLastEvent('After fullscreen command', true),
cAssertFullscreenClass('After fullscreen command', true),
Chain.op(() => editor.execCommand('mceLink', true)),
cWaitForDialog('Insert/Edit Link'),
cCloseOnlyWindow,
cAssertFullscreenClass('After window is closed', true),
Chain.op(() => editor.execCommand('mceFullScreen')),
cAssertEditorAndLastEvent('After fullscreen toggled', false),
cAssertFullscreenClass('After fullscreen toggled', false),
])
, onSuccess, onFailure);
}, {
示例2: function
UnitTest.asynctest('browser.tinymce.core.init.InitEditorOnHiddenElementTest', function () {
const success = arguments[arguments.length - 2];
const failure = arguments[arguments.length - 1];
Theme();
// Firefox specific test, errors were thrown when the editor was initialised on hidden element.
Chain.pipeline([
Editor.cFromHtml('<textarea style="display:none;"></textarea>', {
base_url: '/project/tinymce/js/tinymce'
}),
ApiChains.cFocus
],
function () {
success();
}, failure);
});
示例3: next
Chain.on((value, next, die, logs) => {
Chain.pipeline([Chain.inject(value)].concat(chains), (_, newLogs) => next(Chain.wrap(value), newLogs), die, logs);
}),