本文整理汇总了TypeScript中@ephox/katamari.Obj.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Obj.get方法的具体用法?TypeScript Obj.get怎么用?TypeScript Obj.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@ephox/katamari.Obj
的用法示例。
在下文中一共展示了Obj.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const getCellPaddingCellSpacing = () => {
const spacing = Obj.get(style, 'border-spacing').or(Obj.get(attrs, 'cellspacing')).fold( () => ({}), (cellspacing) => ({ cellspacing }));
const padding = Obj.get(style, 'border-padding').or(Obj.get(attrs, 'cellpadding')).fold( () => ({}), (cellpadding) => ({ cellpadding }));
return {
...spacing,
...padding
};
};
示例2: rgbToHex
const extractAdvancedStyleData = (dom) => {
const rgbToHex = (value: string) => Strings.startsWith(value, 'rgb') ? dom.toHex(value) : value;
const borderStyle = Obj.get(style, 'border-style').getOr('');
const borderColor = Obj.get(style, 'border-color').getOr('');
const bgColor = Obj.get(style, 'background-color').getOr('');
return {
borderstyle: borderStyle,
bordercolor: rgbToHex(borderColor),
backgroundcolor: rgbToHex(bgColor)
};
};
示例3:
Arr.each([ 'width', 'height' ], (prop) => {
Obj.get(snippetData, prop).each((value) => {
const dimensions = nuData.dimensions || {};
dimensions[prop] = value;
nuData.dimensions = dimensions;
});
});
示例4: tooltipWorker
const tooltipBehaviour = (meta: Record<string, any>, sharedBackstage: UiFactoryBackstageShared): Behaviour.NamedConfiguredBehaviour<Behaviour.BehaviourConfigSpec, Behaviour.BehaviourConfigDetail>[] => {
return Obj.get(meta, 'tooltipWorker').map((tooltipWorker: TooltipWorker) => {
return [
Tooltipping.config({
lazySink: sharedBackstage.getSink,
tooltipDom: {
tag: 'div',
classes: [ 'tox-tooltip-worker-container' ]
},
tooltipComponents: [
],
anchor: (comp) => ({
anchor: 'submenu',
item: comp,
overrides: {
// NOTE: this avoids it setting overflow and max-height.
maxHeightFunction: MaxHeight.expandable
}
}),
mode: 'follow-highlight',
onShow: (component, _tooltip) => {
tooltipWorker((elm) => {
Tooltipping.setComponents(component, [
GuiFactory.external({element: Element.fromDom(elm) })
]);
});
}
})
];
}).getOr([]);
};
示例5: r
() => {
return Obj.get(bespokeButtons, toolbarItem.toLowerCase()).map((r) => {
return r(editor, extras);
}).orThunk(() => {
// TODO: Add back after TINY-3232 is implemented
// console.error('No representation for toolbarItem: ' + toolbarItem);
return Option.none();
});
},
示例6: createPatternSet
const getPatternSet = (editorSettings): PatternSet => {
const patterns = Obj.get(editorSettings, 'textpattern_patterns').getOr(defaultPatterns);
if (!Type.isArray(patterns)) {
error('The setting textpattern_patterns should be an array');
return {
inlinePatterns: [],
blockPatterns: [],
};
}
const normalized = Results.partition(Arr.map(patterns, normalizePattern));
Arr.each(normalized.errors, (err) => error(err.message, err.pattern));
return createPatternSet(normalized.values);
};
示例7: render
const extractFrom = (spec: ToolbarButton, extras: Extras): Option<AlloySpec> => {
return Obj.get(types, spec.type).fold(
() => {
console.error('skipping button defined by', spec);
return Option.none();
},
(render) => {
return Option.some(
render(spec, extras)
);
}
);
};
示例8:
return Options.findMap(ps, (prefix) => {
return Obj.get(buttons, prefix + toolbarItem.toLowerCase());
});