本文整理匯總了TypeScript中@ephox/katamari.Fun.curry方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Fun.curry方法的具體用法?TypeScript Fun.curry怎麽用?TypeScript Fun.curry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@ephox/katamari.Fun
的用法示例。
在下文中一共展示了Fun.curry方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
const getTableSelectionFromRng = function (rootNode, rng) {
const isRoot = Fun.curry(Compare.eq, rootNode);
return getCellRng(rng, isRoot)
.map(function (cellRng) {
return getTableSelectionFromCellRng(cellRng, isRoot);
});
};
示例2: function
const findLocation = function (forward, isInlineTarget, rootNode, pos) {
const from = InlineUtils.normalizePosition(forward, pos);
const fromLocation = readLocation(isInlineTarget, rootNode, from);
return readLocation(isInlineTarget, rootNode, from).bind(Fun.curry(findLocationSimple, forward)).orThunk(function () {
return findLocationTraverse(forward, isInlineTarget, rootNode, fromLocation, pos);
});
};
示例3: function
const insert = function (editor, evt?) {
const anchorLocation = readInlineAnchorLocation(editor);
if (anchorLocation.isSome()) {
anchorLocation.each(Fun.curry(insertBrOutsideAnchor, editor));
} else {
insertBrAtCaret(editor, evt);
}
};
示例4: function
const findLocation = function (editor, caret, forward) {
const rootNode = editor.getBody();
const from = CaretPosition.fromRangeStart(editor.selection.getRng());
const isInlineTarget = Fun.curry(InlineUtils.isInlineTarget, editor);
const location = BoundaryLocation.findLocation(forward, isInlineTarget, rootNode, from);
return location.bind(function (location) {
return renderCaretLocation(editor, caret, location);
});
};
示例5: function
return function () {
return editor._scanForImages().
then(Fun.curry(findSelectedBlob, editor)).
then(ResultConversions.blobToImageResult).
then(fn).
then(function (imageResult) {
return updateSelectedImage(editor, imageResult, false, imageUploadTimerState, size);
}, function (error) {
displayError(editor, error);
});
};
示例6: function
const applyStyle = function (dom, name, value) {
return Fun.curry(function (name, value, node) {
dom.setStyle(node, name, value);
if (node.getAttribute('style') === '') {
node.removeAttribute('style');
}
unwrapEmptySpan(dom, node);
}, name, value);
};
示例7: function
const scrollIntoView = function (cWin, socket, dropup, top, bottom) {
const greenzone = DeviceZones.getGreenzone(socket, dropup);
const refreshCursor = Fun.curry(CursorRefresh.refresh, cWin);
if (top > greenzone || bottom > greenzone) {
IosScrolling.moveOnlyScroll(socket, socket.dom().scrollTop - greenzone + bottom).get(refreshCursor);
} else if (top < 0) {
IosScrolling.moveOnlyScroll(socket, socket.dom().scrollTop + top).get(refreshCursor);
} else {
// do nothing
}
};
示例8: getWinFromFrame
return getWinFromFrame(frame).map(function (win) {
const html = Element.fromDom(doc.dom().documentElement);
const getCursorBox = editor.getCursorBox.getOrThunk(function () {
return function () {
return WindowSelection.get(win).bind(function (sel) {
return WindowSelection.getFirstRect(win, sel).orThunk(function () {
return tryFallbackBox(win);
});
});
};
});
const setSelection = editor.setSelection.getOrThunk(function () {
return function (start, soffset, finish, foffset) {
WindowSelection.setExact(win, start, soffset, finish, foffset);
};
});
const clearSelection = editor.clearSelection.getOrThunk(function () {
return function () {
WindowSelection.clear(win);
};
});
return {
body: Fun.constant(body),
doc: Fun.constant(doc),
win: Fun.constant(win),
html: Fun.constant(html),
getSelection: Fun.curry(getSelectionFromFrame, frame),
setSelection,
clearSelection,
frame: Fun.constant(frame),
onKeyup: getOrListen(editor, doc, 'onKeyup', 'keyup'),
onNodeChanged: getOrListen(editor, doc, 'onNodeChanged', 'selectionchange'),
onDomChanged: editor.onDomChanged, // consider defaulting with MutationObserver
onScrollToCursor: editor.onScrollToCursor,
onScrollToElement: editor.onScrollToElement,
onToReading: editor.onToReading,
onToEditing: editor.onToEditing,
onToolbarScrollStart: editor.onToolbarScrollStart,
onTouchContent: editor.onTouchContent,
onTapContent: editor.onTapContent,
onTouchToolstrip: editor.onTouchToolstrip,
getCursorBox
};
});
示例9: function
const findLineNodeRects = (root: Node, targetNodeRect: NodeClientRect): ClientRectLine[] => {
let clientRects = [];
const collect = (checkPosFn, node) => {
let lineRects;
lineRects = Arr.filter(getClientRects([node]), function (clientRect) {
return !checkPosFn(clientRect, targetNodeRect);
});
clientRects = clientRects.concat(lineRects);
return lineRects.length === 0;
};
clientRects.push(targetNodeRect);
walkUntil(VDirection.Up, root, Fun.curry(collect, GeomClientRect.isAbove), targetNodeRect.node);
walkUntil(VDirection.Down, root, Fun.curry(collect, GeomClientRect.isBelow), targetNodeRect.node);
return clientRects;
};
示例10: CaretWalker
const getHorizontalRange = (editor, forward: boolean): Range => {
const caretWalker = CaretWalker(editor.getBody());
const getNextVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.next);
const getPrevVisualCaretPosition = Fun.curry(getVisualCaretPosition, caretWalker.prev);
let newRange;
const direction = forward ? HDirection.Forwards : HDirection.Backwards;
const getNextPosFn = forward ? getNextVisualCaretPosition : getPrevVisualCaretPosition;
const range = editor.selection.getRng();
newRange = moveToCeFalseHorizontally(direction, editor, getNextPosFn, range);
if (newRange) {
return newRange;
}
newRange = exitPreBlock(editor, direction, range);
if (newRange) {
return newRange;
}
return null;
};