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