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


TypeScript Option.none方法代码示例

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


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

示例1: renderTextField

const renderTextarea = (spec: TextareaFoo, providersBackstage: UiFactoryBackstageProviders): SketchSpec => {
  return renderTextField({
    name: spec.name,
    multiline: true,
    label: spec.label,
    placeholder: spec.placeholder,
    flex: true,
    classname: 'tox-textarea',
    validation: Option.none(),
  }, providersBackstage);
};
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:TextField.ts

示例2: renderLabel

export const renderSelectBox = (spec: Types.SelectBox.SelectBox, providersBackstage: UiFactoryBackstageProviders): SketchSpec => {
  const translatedOptions = Arr.map(spec.items, (item) => {
    return {
      text: providersBackstage.translate(item.text),
      value: item.value
    };
  });

  // DUPE with TextField.
  const pLabel = spec.label.map((label) => renderLabel(label, providersBackstage));

  const pField = AlloyFormField.parts().field({
    // TODO: Alloy should not allow dom changing of an HTML select!
    dom: {  },
    selectAttributes: {
      size: spec.size
    },
    options: translatedOptions,
    factory: AlloyHtmlSelect,
    selectBehaviours: Behaviour.derive([
      Tabstopping.config({ }),
      AddEventsBehaviour.config('selectbox-change', [
        AlloyEvents.run(NativeEvents.change(), (component, _) => {
          AlloyTriggers.emitWith(component, formChangeEvent, { name: spec.name } );
        })
      ])
    ])
  });

  const chevron = spec.size > 1 ? Option.none() :
    Option.some({
        dom: {
          tag: 'div',
          classes: ['tox-selectfield__icon-js'],
          innerHtml: Icons.get('chevron-down', providersBackstage.icons)
        }
      });

  const selectWrap: SimpleSpec = {
    dom: {
      tag: 'div',
      classes: ['tox-selectfield']
    },
    components: Arr.flatten([[pField], chevron.toArray()])
  };

  return AlloyFormField.sketch({
    dom: {
      tag: 'div',
      classes: ['tox-form__group']
    },
    components: Arr.flatten<AlloySpec>([pLabel.toArray(), [selectWrap]])
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:54,代码来源:SelectBox.ts

示例3: function

 function (cells, _env) {
   if (cells.length === 0) {
     return Option.none();
   }
   return TableSelection.retrieveBox(table, Ephemera.firstSelectedSelector(), Ephemera.lastSelectedSelector()).bind(function (bounds) {
     return cells.length > 1 ? Option.some({
       bounds: Fun.constant(bounds),
       cells: Fun.constant(cells)
     }) : Option.none();
   });
 },
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:CellOperations.ts

示例4: if

const getCloneElements = (editor: Editor): Option<string[]> => {
  const cloneElements = editor.getParam('table_clone_elements');

  if (Type.isString(cloneElements)) {
    return Option.some(cloneElements.split(/[ ,]/));
  } else if (Array.isArray(cloneElements)) {
    return Option.some(cloneElements);
  } else {
    return Option.none();
  }
};
开发者ID:abstask,项目名称:tinymce,代码行数:11,代码来源:Settings.ts

示例5: getTextSetting

export const getLinkInformation = (editor: Editor): Option<LinkInformation> => {
  if (editor.settings.typeahead_urls === false) {
    return Option.none();
  }

  return Option.some({
    targets: LinkTargets.find(editor.getBody()),
    anchorTop: getTextSetting(editor.settings, 'anchor_top', '#top').getOrUndefined(),
    anchorBottom: getTextSetting(editor.settings, 'anchor_bottom', '#bottom').getOrUndefined()
  });
};
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:UrlInputBackstage.ts

示例6: renderButton

 (store, doc, body) => {
   return GuiFactory.build(
     renderButton({
       name: 'test-button',
       text: 'ButtonText',
       disabled: false,
       primary: true,
       icon: Option.none()
     }, store.adder('button.action'), TestProviders)
   );
 },
开发者ID:tinymce,项目名称:tinymce,代码行数:11,代码来源:DialogButtonTest.ts

示例7:

const findReplacementPattern = (patterns: ReplacementPattern[], startSearch: number, text: string): Option<ReplacementMatch> => {
  for (let i = 0; i < patterns.length; i++) {
    const index = text.lastIndexOf(patterns[i].start, startSearch);
    if (index !== -1) {
      return Option.some({
        pattern: patterns[i],
        startOffset: index
      });
    }
  }
  return Option.none();
};
开发者ID:danielpunkass,项目名称:tinymce,代码行数:12,代码来源:FindPatterns.ts

示例8: function

const getEditableImage = function (editor: Editor, elem) {
  const isImage = (imgNode) => editor.dom.is(imgNode, 'img:not([data-mce-object],[data-mce-placeholder])');
  const isEditable = (imgNode) => isImage(imgNode) && (isLocalImage(editor, imgNode) || isCorsImage(editor, imgNode) || editor.settings.imagetools_proxy);

  if (isFigure(editor, elem)) {
    const imgOpt = getFigureImg(elem);
    return imgOpt.map((img) => {
      return isEditable(img.dom()) ? Option.some(img.dom()) : Option.none();
    });
  }
  return isEditable(elem) ? Option.some(elem) : Option.none();
};
开发者ID:tinymce,项目名称:tinymce,代码行数:12,代码来源:Actions.ts

示例9: switch

const getListType = (list: Element): Option<ListType> => {
  switch (Node.name(list)) {
    case 'ol':
      return Option.some(ListType.OL);
    case 'ul':
      return Option.some(ListType.UL);
    case 'dl':
      return Option.some(ListType.DL);
    default:
      return Option.none();
  }
};
开发者ID:mdgbayly,项目名称:tinymce,代码行数:12,代码来源:ListType.ts


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