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