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


TypeScript Option.default方法代码示例

本文整理汇总了TypeScript中@ephox/katamari.Option.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Option.default方法的具体用法?TypeScript Option.default怎么用?TypeScript Option.default使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@ephox/katamari.Option的用法示例。


在下文中一共展示了Option.default方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: return

 return () => {
   const fontFamily = editor.queryCommandValue('FontName');
   const match = getMatchingValue();
   const text = match.fold(() => fontFamily, (item) => item.title);
   AlloyTriggers.emitWith(comp, updateMenuText, {
     text
   });
 };
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:FontSelect.ts

示例2: findClosestCorner

const getClosestCell = (getYAxisValue: GetAxisValue, isTargetCorner: IsTargetCorner, table: HTMLElement, x: number, y: number): Option<HTMLElement> => {
  const cells = SelectorFilter.descendants(Element.fromDom(table), 'td,th,caption').map((e) => e.dom());
  const corners = Arr.filter(getCorners(getYAxisValue, cells), (corner) => isTargetCorner(corner, y));

  return findClosestCorner(corners, x, y).map((corner) => {
    return corner.cell;
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:8,代码来源:TableCells.ts

示例3: getAttr

 return getAttr(c, `${Markings.dataAnnotationId()}`).bind((uid) =>
   getAttr(c, `${Markings.dataAnnotation()}`).map((name) => {
     const elements = findMarkers(editor, uid);
     return {
       uid,
       name,
       elements
     };
   })
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:Identification.ts

示例4: normalizeNbsps

const normalizeNbspsInEditor = (editor: Editor) => {
  const root = Element.fromDom(editor.getBody());

  if (editor.selection.isCollapsed()) {
    normalizeNbsps(root, CaretPosition.fromRangeStart(editor.selection.getRng())).each((pos) => {
      editor.selection.setRng(pos.toRange());
    });
  }
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:Nbsps.ts

示例5: findEntryDelegate

 return Options.findMap(list, (item) => {
   if (isGroup(item)) {
     return findEntryDelegate(item.items, value);
   } else if (item.value === value) {
     return Option.some(item);
   } else {
     return Option.none();
   }
 });
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:ListUtils.ts

示例6: findInlinePatternRec

const findNestedInlinePatterns = (dom: DOMUtils, patterns: InlinePattern[], rng: Range, space: boolean): InlinePatternMatch[] => {
  if (rng.collapsed === false) {
    return [];
  }

  const block = dom.getParent(rng.startContainer, dom.isBlock);

  return findInlinePatternRec(dom, patterns, rng.startContainer, rng.startOffset - (space ? 1 : 0), block).getOr([]);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:9,代码来源:FindPatterns.ts

示例7: parseLists

const listsIndentation = (editor: Editor, lists: Element[], indentation: Indentation) => {
  const entrySets: EntrySet[] = parseLists(lists, getItemSelection(editor));

  Arr.each(entrySets, (entrySet) => {
    indentSelectedEntries(entrySet.entries, indentation);
    InsertAll.before(entrySet.sourceList, composeEntries(editor, entrySet.entries));
    Remove.remove(entrySet.sourceList);
  });
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:ListsIndendation.ts

示例8: getInsertionPoint

const mergeBlockInto = (rootNode: Element, fromBlock: Element, toBlock: Element): Option<CaretPosition> => {
  trimBr(true, fromBlock);
  trimBr(false, toBlock);

  return getInsertionPoint(fromBlock, toBlock).fold(
    Fun.curry(sidelongBlockMerge, rootNode, fromBlock, toBlock),
    Fun.curry(nestedBlockMerge, rootNode, fromBlock, toBlock)
  );
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:9,代码来源:MergeBlocks.ts

示例9: nonEmptyAttr

const extractFromAnchor = (editor, settings, anchor: HTMLAnchorElement, selection) => {
  const dom = editor.dom;
  const onlyText = Utils.isOnlyTextSelected(selection.getContent());
  const text: Option<string> = onlyText ? Option.some(Utils.getAnchorText(selection, anchor)) : Option.none();
  const url: Option<string> = anchor ? Option.some(dom.getAttrib(anchor, 'href')) : Option.none();
  const target: Option<string> = anchor ? Option.from(dom.getAttrib(anchor, 'target')) : Option.none();
  const rel = nonEmptyAttr(dom, anchor, 'rel');
  const linkClass = nonEmptyAttr(dom, anchor, 'class');
  const title = nonEmptyAttr(dom, anchor, 'title');

  return {
    url,
    text,
    title,
    target,
    rel,
    linkClass
  };
};
开发者ID:tinymce,项目名称:tinymce,代码行数:19,代码来源:DialogInfo.ts

示例10: getPicker

const getPickerTypes = (settings: Record<string, any>): boolean | Record<string, boolean> => {
  const optFileTypes = Option.some(settings.file_picker_types).filter(isTruthy);
  const optLegacyTypes = Option.some(settings.file_browser_callback_types).filter(isTruthy);
  const optTypes = optFileTypes.or(optLegacyTypes).map(makeMap);
  return getPicker(settings).fold(
    () => false,
    (_picker) => optTypes.fold<boolean | Record<string, boolean>>(
      () => true,
      (types) => Obj.keys(types).length > 0 ? types : false)
  );
};
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:UrlInputBackstage.ts


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