當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。