本文整理汇总了TypeScript中@ephox/agar.Chain.mapper方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Chain.mapper方法的具体用法?TypeScript Chain.mapper怎么用?TypeScript Chain.mapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/agar.Chain
的用法示例。
在下文中一共展示了Chain.mapper方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const sTestBookmark = function (html, path) {
const dom = DOMUtils.DOM;
const elm = TinyDom.fromDom(dom.create('div', {}, html));
return Chain.asStep(elm, [
Cursors.cFollowPath(Cursors.pathFrom(path)),
Chain.mapper(toNativeRange),
Chain.mapper(rangeToBookmark(dom)),
Chain.mapper(bookmarkToRange(dom)),
cAssertRangeEq(Cursors.calculate(elm, Cursors.pathFrom(path)))
]);
};
示例2: getClosestCellBelow
const cGetClosestCellBelow = (x: number, y: number) => {
return Chain.mapper(function (viewBlock) {
const table = SelectorFind.descendant(Element.fromDom(viewBlock.get()), 'table').getOrDie('Could not find table').dom();
const rect = table.getBoundingClientRect();
return getClosestCellBelow(table, rect.left + x, rect.top + y);
});
};
示例3:
const sAssertValue = (label, expected, component) => Logger.t(
'sAssertValue: ' + label,
Chain.asStep(component, [
Chain.mapper(Representing.getValue),
Assertions.cAssertEq(label, expected)
])
);
示例4: function
const cMergeBlocks = function (forward, block1Path, block2Path) {
return Chain.mapper(function (viewBlock: any) {
const block1 = Hierarchy.follow(Element.fromDom(viewBlock.get()), block1Path).getOrDie();
const block2 = Hierarchy.follow(Element.fromDom(viewBlock.get()), block2Path).getOrDie();
return MergeBlocks.mergeBlocks(Element.fromDom(viewBlock.get()), forward, block1, block2);
});
};
示例5: function
const sAssertErrorMessage = function (html) {
return Step.label('Check notification message', Chain.asStep(TinyDom.fromDom(document.body), [
UiFinder.cWaitFor('Find notification', '.tox-notification__body > p'),
Chain.label('Get notification HTML', Chain.mapper(Html.get)),
Chain.label('Assert HTML matches expected', Assertions.cAssertHtml('Message html does not match', html))
]));
};
示例6: TinyApis
TinyLoader.setup(function (editor, onSuccess, onFailure) {
const tinyApis = TinyApis(editor);
const tinyUi = TinyUi(editor);
Pipeline.async({}, [
tinyApis.sFocus,
tinyUi.sClickOnToolbar('click emoticons', 'button'),
Chain.asStep({}, [
tinyUi.cWaitForPopup('wait for popup', 'div[role="dialog"]'),
]),
Waiter.sTryUntil(
'Wait for emojis to load',
UiFinder.sNotExists(Body.body(), '.tox-spinner'),
100,
1000
),
Chain.asStep(Body.body(), [
UiFinder.cFindAllIn('[role="tab"]'),
Chain.mapper((elements: Element[]) => {
return Arr.map(elements, (elm: Element) => {
return elm.dom().textContent;
});
}),
Assertions.cAssertEq('Categories match', categories)
])
], onSuccess, onFailure);
}, {
示例7: function
const sWaitForAndAssertNotification = function (expected) {
return Chain.asStep(TinyDom.fromDom(document.body), [
UiFinder.cWaitFor('Could not find notification', 'div.mce-notification-inner'),
Chain.mapper(Html.get),
Assertions.cAssertHtml('Plugin list html does not match', expected)
]);
};
示例8: findClosestHorizontalPosition
const cFindClosestHorizontalPosition = (path: number[], offset: number) => {
return Chain.mapper(function (positions: CaretPosition[]) {
const container = Hierarchy.follow(Element.fromDom(viewBlock.get()), path).getOrDie();
const pos = CaretPosition(container.dom(), offset);
return findClosestHorizontalPosition(positions, pos);
});
};
示例9: getPositionsBelow
const cGetBelowPositions = (path: number[], offset: number) => {
return Chain.mapper(function (scope: any) {
const container = Hierarchy.follow(Element.fromDom(scope.get()), path).getOrDie();
const pos = CaretPosition(container.dom(), offset);
return getPositionsBelow(scope.get(), pos);
});
};
示例10: predicate
const cVisualCaretCheck = (predicate, path: number[], offset: number) => {
return Chain.mapper(function (scope: any) {
const container = Hierarchy.follow(Element.fromDom(scope.get()), path).getOrDie();
const pos = CaretPosition(container.dom(), offset);
return predicate(scope.get(), pos);
});
};