本文整理汇总了TypeScript中@ephox/sugar.Selection类的典型用法代码示例。如果您正苦于以下问题:TypeScript Selection类的具体用法?TypeScript Selection怎么用?TypeScript Selection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Selection类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
const normalizeRng = function (rng) {
return Selection.range(
rng.start(),
clamp(rng.soffset(), rng.start()),
rng.finish(),
clamp(rng.foffset(), rng.finish())
);
};
示例2: function
const getCellFirstCursorPosition = function (editor, cell) {
const selection = Selection.exact(cell, 0, cell, 0);
return WindowSelection.toNative(selection);
};
示例3:
return Traverse.parent(start).bind(function (parent) {
const selection = Selection.exact(start, range.startOffset, parent, Awareness.getEnd(parent));
const optRect = WindowSelection.getFirstRect(range.startContainer.ownerDocument.defaultView, selection);
return optRect.map(collapsedRect).map(Arr.pure);
}).getOr([ ]);
示例4:
.map(function (bm) {
return Selection.range(bm.start(), bm.soffset() + startPad, bm.finish(), bm.foffset() + finishPad);
});
示例5:
response.selection().each(function (ns) {
const relative = Selection.relative(ns.start(), ns.finish());
const rng = SelectionDirection.asLtrRange(win, relative);
editor.selection.setRng(rng);
});
示例6:
getSelection: () => {
const rng = editor.selection.getRng();
return Option.some(
Selection.range(Element.fromDom(rng.startContainer), rng.startOffset, Element.fromDom(rng.endContainer), rng.endOffset)
);
}