本文整理匯總了TypeScript中@ephox/sugar.Hierarchy.follow方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Hierarchy.follow方法的具體用法?TypeScript Hierarchy.follow怎麽用?TypeScript Hierarchy.follow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/sugar.Hierarchy
的用法示例。
在下文中一共展示了Hierarchy.follow方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
return Chain.op(function (blockBoundaryOption) {
const expectedFromBlock = Hierarchy.follow(Element.fromDom(viewBlock.get()), fromBlockPath).getOrDie();
const expectedToBlock = Hierarchy.follow(Element.fromDom(viewBlock.get()), toBlockPath).getOrDie();
const blockBoundary = blockBoundaryOption.getOrDie();
Assertions.assertDomEq('Should be expected from block', expectedFromBlock, blockBoundary.from().block());
Assertions.assertDomEq('Should be expected to block', expectedToBlock, blockBoundary.to().block());
});
示例2: next
return Step.stateful(function (value, next, die) {
const startContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie();
const endContainer = Hierarchy.follow(Element.fromDom(viewBlock.get()), endPath).getOrDie();
const rng = document.createRange();
rng.setStart(startContainer.dom(), startOffset);
rng.setEnd(endContainer.dom(), endOffset);
next(rng);
});
示例3:
return Chain.op(function (rng: any) {
const startContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), startPath).getOrDie();
const endContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), endPath).getOrDie();
Assertions.assertDomEq('Should be expected start container', startContainer, Element.fromDom(rng.startContainer));
Assertions.assertEq('Should be expected start offset', startOffset, rng.startOffset);
Assertions.assertDomEq('Should be expected end container', endContainer, Element.fromDom(rng.endContainer));
Assertions.assertEq('Should be expected end offset', endOffset, rng.endOffset);
});
示例4: function
const assertRawRange = function (element, rng, startPath, startOffset, endPath, endOffset) {
const startContainer = Hierarchy.follow(element, startPath).getOrDie();
const endContainer = Hierarchy.follow(element, endPath).getOrDie();
Assertions.assertDomEq('Should be expected start container', startContainer, Element.fromDom(rng.startContainer));
Assertions.assertEq('Should be expected start offset', startOffset, rng.startOffset);
Assertions.assertDomEq('Should be expected end container', endContainer, Element.fromDom(rng.endContainer));
Assertions.assertEq('Should be expected end offset', endOffset, rng.endOffset);
};
示例5:
return Chain.op(function () {
const sc = Hierarchy.follow(Element.fromDom(viewBlock.get()), startPath).getOrDie('invalid startPath');
const fc = Hierarchy.follow(Element.fromDom(viewBlock.get()), finishPath).getOrDie('invalid finishPath');
const win = Traverse.defaultView(sc);
WindowSelection.setExact(
win.dom(), sc, soffset, fc, foffset
);
});
示例6:
return Chain.binder(function (_) {
const tableElm = Element.fromHtml(html);
const startElm = Hierarchy.follow(tableElm, startPath).getOrDie();
const endElm = Hierarchy.follow(tableElm, endPath).getOrDie();
return SimpleTableModel.subsection(SimpleTableModel.fromDom(tableElm), startElm, endElm).fold(
Fun.constant(Result.error('Failed to get the subsection')),
Result.value
);
});
示例7: function
const setSelection = function (editor, start, soffset, finish, foffset) {
const sc = Hierarchy.follow(Element.fromDom(editor.getBody()), start).getOrDie();
const fc = Hierarchy.follow(Element.fromDom(editor.getBody()), start).getOrDie();
const rng = document.createRange();
rng.setStart(sc.dom(), soffset);
rng.setEnd(fc.dom(), foffset);
editor.selection.setRng(rng);
};
示例8:
return Chain.op(function (editor) {
const startContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), startPath).getOrDie();
const endContainer = Hierarchy.follow(Element.fromDom(editor.getBody()), endPath).getOrDie();
const rng = editor.dom.createRng();
rng.setStart(startContainer.dom(), startOffset);
rng.setEnd(endContainer.dom(), endOffset);
editor.selection.setRng(rng);
});
示例9: function
const assertRange = function (root, range, startPath, startOffset, endPath, endOffset) {
const sc = Hierarchy.follow(Element.fromDom(root), startPath).getOrDie();
const ec = Hierarchy.follow(Element.fromDom(root), endPath).getOrDie();
const actualRange = range.getOrDie('Should be some');
Assertions.assertDomEq('Should be expected start container', sc, Element.fromDom(actualRange.startContainer));
Assertions.assertEq('Should be expected start offset', startOffset, actualRange.startOffset);
Assertions.assertDomEq('Should be expected end container', ec, Element.fromDom(actualRange.endContainer));
Assertions.assertEq('Should be expected end offset', endOffset, actualRange.endOffset);
};