本文整理匯總了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);
};
示例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]])
});
};
示例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();
});
},
示例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();
}
};
示例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()
});
};
示例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)
);
},
示例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();
};
示例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();
};
示例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();
}
};