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