本文整理汇总了TypeScript中@ephox/sugar.WindowSelection.setExact方法的典型用法代码示例。如果您正苦于以下问题:TypeScript WindowSelection.setExact方法的具体用法?TypeScript WindowSelection.setExact怎么用?TypeScript WindowSelection.setExact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/sugar.WindowSelection
的用法示例。
在下文中一共展示了WindowSelection.setExact方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
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
);
});
示例2: getCursorY
return Step.stateful(function (value, next, die) {
const pageBody = iframe.dom().contentWindow.document.body;
const editorBody = pageBody.querySelector('iframe').contentWindow.document.body;
const target = Option.from(editorBody.querySelectorAll(selector)[index]).map(Element.fromDom).getOrDie('no index ' + index + ' for selector: ' + selector);
WindowSelection.setExact(editorBody.ownerDocument.defaultView, target, 0, target, 0);
const socket = pageBody.querySelector('.tinymce-mobile-editor-socket');
socket.scrollTop = target.dom().getBoundingClientRect().top - 100 - keyboardHeight;
pageBody.style.setProperty('margin-bottom', '2000px');
pageBody.ownerDocument.defaultView.scrollTo(0, keyboardHeight);
//
const cursorY = getCursorY(target);
const newValue = Merger.deepMerge(
value,
{
target,
cursorY
}
);
console.log('newValue', newValue);
next(newValue);
});
示例3:
WindowSelection.getExact(win).orThunk(function () {
const fbody = Element.fromDom(frame.dom().contentWindow.document.body);
const elem = Cursors.calculateOne(fbody, [ 0 ]);
WindowSelection.setExact(win, elem, 0, elem, 0);
return Option.none();
});
示例4: function
return function (start, soffset, finish, foffset) {
WindowSelection.setExact(win, start, soffset, finish, foffset);
};