当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Option.some方法代码示例

本文整理汇总了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));
 },
开发者ID:tinymce,项目名称:tinymce,代码行数:3,代码来源:CefDeleteAction.ts

示例2:

 execute: (comp) => {
   AlloyTriggers.emit(comp, formSubmitEvent);
   return Option.some(true);
 },
开发者ID:tinymce,项目名称:tinymce,代码行数:4,代码来源:TextField.ts

示例3: function

const findDelta = function (outerWindow, cBody) {
  const last = getLastHeight(cBody);
  const current = outerWindow.innerHeight;
  return last > current ? Option.some(last - current) : Option.none();
};
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:5,代码来源:AndroidSetup.ts

示例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
    }));
  });
开发者ID:tinymce,项目名称:tinymce,代码行数:101,代码来源:CellSelection.ts

示例5:

 () => Option.some(newPos),
开发者ID:tinymce,项目名称:tinymce,代码行数:1,代码来源:LineReader.ts

示例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));
};
开发者ID:abstask,项目名称:tinymce,代码行数:5,代码来源:TableDelete.ts

示例7:

 .bind(function (endParentTable) {
   return Compare.eq(startParentTable, endParentTable) ? Option.some(startParentTable) : Option.none();
 });
开发者ID:enigmatic-user,项目名称:tinymce-1,代码行数:3,代码来源:TableDeleteAction.ts

示例8:

 return endTable.bind(function (tableEnd) {
   return Compare.eq(tableStart, tableEnd) ? Option.some(true) : Option.none();
 });
开发者ID:,项目名称:,代码行数:3,代码来源:

示例9: checkLast

 return Traverse.prevSibling(last).bind(function (prevLast) {
   return checkLast(prevLast) ? Option.some(prevLast) : getPrevLast(prevLast);
 });
开发者ID:,项目名称:,代码行数:3,代码来源:

示例10: renderBody

const renderInlineBody = (foo: WindowBodyFoo, contentId: string, backstage: UiFactoryBackstage, ariaAttrs: boolean) => {
  return renderBody(foo, Option.some(contentId), backstage, ariaAttrs);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:3,代码来源:SilverDialogBody.ts


注:本文中的@ephox/katamari.Option.some方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。