本文整理汇总了TypeScript中@ephox/katamari.Option.some方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Option.some方法的具体用法?TypeScript Option.some怎么用?TypeScript Option.some使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Option
的用法示例。
在下文中一共展示了Option.some方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
function (elm) {
return Option.some(DeleteAction.remove(elm));
},
示例2:
execute: (comp) => {
AlloyTriggers.emit(comp, formSubmitEvent);
return Option.some(true);
},
示例3: function
const findDelta = function (outerWindow, cBody) {
const last = getLastHeight(cBody);
const current = outerWindow.innerHeight;
return last > current ? Option.some(last - current) : Option.none();
};
示例4: function
//.........这里部分代码省略.........
keyHandlers.keyup(wrappedEvent, start, rng.startOffset, end, rng.endOffset).each(function (response) {
handleResponse(wrappedEvent, response);
});
}
};
const keydown = function (event: KeyboardEvent) {
const wrappedEvent = wrapEvent(event);
lazyResize().each(function (resize) {
resize.hideBars();
});
const rng = editor.selection.getRng();
const startContainer = Element.fromDom(editor.selection.getStart());
const start = Element.fromDom(rng.startContainer);
const end = Element.fromDom(rng.endContainer);
const direction = Direction.directionAt(startContainer).isRtl() ? SelectionKeys.rtl : SelectionKeys.ltr;
keyHandlers.keydown(wrappedEvent, start, rng.startOffset, end, rng.endOffset, direction).each(function (response) {
handleResponse(wrappedEvent, response);
});
lazyResize().each(function (resize) {
resize.showBars();
});
};
const isMouseEvent = (event: any): event is MouseEvent => event.hasOwnProperty('x') && event.hasOwnProperty('y');
const wrapEvent = function (event: MouseEvent | KeyboardEvent) {
// IE9 minimum
const target = Element.fromDom(event.target as HTMLElement);
const stop = function () {
event.stopPropagation();
};
const prevent = function () {
event.preventDefault();
};
const kill = Fun.compose(prevent, stop); // more of a sequence than a compose, but same effect
// FIX: Don't just expose the raw event. Need to identify what needs standardisation.
return {
target: Fun.constant(target),
x: Fun.constant(isMouseEvent(event) ? event.x : null),
y: Fun.constant(isMouseEvent(event) ? event.y : null),
stop,
prevent,
kill,
raw: Fun.constant(event)
};
};
const isLeftMouse = function (raw: MouseEvent) {
return raw.button === 0;
};
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
const isLeftButtonPressed = function (raw: MouseEvent) {
// Only added by Chrome/Firefox in June 2015.
// This is only to fix a 1px bug (TBIO-2836) so return true if we're on an older browser
if (raw.buttons === undefined) {
return true;
}
// use bitwise & for optimal comparison
return (raw.buttons & 1) !== 0;
};
const mouseDown = function (e: MouseEvent) {
if (isLeftMouse(e) && hasInternalTarget(e)) {
mouseHandlers.mousedown(wrapEvent(e));
}
};
const mouseOver = function (e: MouseEvent) {
if (isLeftButtonPressed(e) && hasInternalTarget(e)) {
mouseHandlers.mouseover(wrapEvent(e));
}
};
const mouseUp = function (e: MouseEvent) {
if (isLeftMouse(e) && hasInternalTarget(e)) {
mouseHandlers.mouseup(wrapEvent(e));
}
};
editor.on('mousedown', mouseDown);
editor.on('mouseover', mouseOver);
editor.on('mouseup', mouseUp);
editor.on('keyup', keyup);
editor.on('keydown', keydown);
editor.on('NodeChange', syncSelection);
handlers = Option.some(handlerStruct({
mousedown: mouseDown,
mouseover: mouseOver,
mouseup: mouseUp,
keyup,
keydown
}));
});
示例6: isDeleteOfLastCharPos
const deleteCaretInsideCaption = (editor: Editor, rootElm, forward: boolean, fromCaption, from: CaretPosition) => {
return CaretFinder.navigate(forward, editor.getBody(), from).bind((to) => {
return isDeleteOfLastCharPos(fromCaption, forward, from, to) ? emptyCaretCaption(editor, fromCaption) : validateCaretCaption(rootElm, fromCaption, to);
}).or(Option.some(true));
};
示例7:
.bind(function (endParentTable) {
return Compare.eq(startParentTable, endParentTable) ? Option.some(startParentTable) : Option.none();
});
示例8:
return endTable.bind(function (tableEnd) {
return Compare.eq(tableStart, tableEnd) ? Option.some(true) : Option.none();
});
示例9: checkLast
return Traverse.prevSibling(last).bind(function (prevLast) {
return checkLast(prevLast) ? Option.some(prevLast) : getPrevLast(prevLast);
});
示例10: renderBody
const renderInlineBody = (foo: WindowBodyFoo, contentId: string, backstage: UiFactoryBackstage, ariaAttrs: boolean) => {
return renderBody(foo, Option.some(contentId), backstage, ariaAttrs);
};