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