Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Arr.map(items, (item) => {
const keys = Obj.keys(item);
// If it is a submenu, enrich all the subitems.
if (Objects.hasKey(item, 'items')) {
const newItems = doEnrich(item.items);
return Merger.deepMerge(
enrichMenu(item),
{
getStyleItems: () => newItems
}
) as FormatItem;
} else if (Objects.hasKey(item, 'format')) {
return enrichSupported(item);
// NOTE: This branch is added from the original StyleFormats in mobile
} else if (keys.length === 1 && Arr.contains(keys, 'title')) {
return Merger.deepMerge(item, { type: 'separator' }) as FormatItem;
} else {
return enrichCustom(item);
}
});
const changeStyle2 = (parseStyle: Helpers['parseStyle'], serializeStyle: Helpers['serializeStyle'], data: ImageDialogData): ImageDialogData => {
const css = Utils.mergeMargins(parseStyle(data.style));
const dataCopy: ImageDialogData = Merger.deepMerge({}, data);
// Move opposite equal margins to vspace/hspace field
dataCopy.vspace = calcVSpace(css);
dataCopy.hspace = calcHSpace(css);
// Move border-width
dataCopy.border = calcBorderWidth(css);
// Move border-style
dataCopy.borderstyle = calcBorderStyle(css);
// Reserialize style
dataCopy.style = calcStyle(parseStyle, serializeStyle, css);
return dataCopy;
};
}).map((items) => {
return Option.from(createTieredDataFrom(
Merger.deepMerge(
createPartialChoiceMenu(
Id.generate('menu-value'),
items,
(value) => {
spec.onItemAction(comp, value);
},
spec.columns,
spec.presets,
ItemResponse.CLOSE_ON_EXECUTE,
// No colour is ever selected on opening
() => false,
sharedBackstage.providers
),
{
movement: deriveMenuMovement(spec.columns, spec.presets)
}
const iframeSettings = Merger.deepMerge(generalSettings, {
toolbar: 'fontsizeselect fontselect insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | ' +
'bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons table codesample code | ltr rtl'
});
const inlineSettings = Merger.deepMerge(generalSettings, {
inline: true,
toolbar: [
'fontsizeselect fontselect insertfile undo redo | styleselect',
'bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
'print preview media fullpage | forecolor backcolor emoticons table codesample code | ltr rtl'
]
});
tinymce.init(Merger.deepMerge(iframeSettings, {
selector: '#left textarea',
ui_container: '#left'
}));
tinymce.init(Merger.deepMerge(inlineSettings, {
selector: '#left div.tinymce',
ui_container: '#left'
}));
tinymce.init(Merger.deepMerge(iframeSettings, {
selector: '#right textarea',
ui_container: '#right'
}));
tinymce.init(Merger.deepMerge(inlineSettings, {
selector: '#right div.tinymce',
onControlDetached(spec, editorOffCell)
]),
AddEventsBehaviour.config('menubutton-update-display-text', [
AlloyEvents.run(updateMenuText, (comp, se) => {
optMemDisplayText.bind((mem) => mem.getOpt(comp)).each((displayText) => {
Replacing.set(displayText, [ GuiFactory.text(sharedBackstage.providers.translate(se.event().text())) ] );
});
}),
AlloyEvents.run(updateMenuIcon, (comp, se) => {
optMemDisplayIcon.bind((mem) => mem.getOpt(comp)).each((displayIcon) => {
Replacing.set(displayIcon, [ renderReplacableIconFromPack(se.event().icon(), sharedBackstage.providers.icons) ] );
});
})
])
]),
eventOrder: Merger.deepMerge(toolbarButtonEventOrder, {
mousedown: [ 'focusing', 'alloy.base.behaviour', 'item-type-events', 'normal-dropdown-events' ]
}),
sandboxBehaviours: Behaviour.derive([
Keying.config({
mode: 'special',
onLeft: onLeftOrRightInMenu,
onRight: onLeftOrRightInMenu
})
]),
lazySink: sharedBackstage.getSink,
toggleClass: `${prefix}--active`,
parts: {
return (parts, spec, backstage) => {
const iframeSpec = Merger.deepMerge(spec, {
source: 'dynamic'
});
return make(render)(parts, iframeSpec, backstage);
};
};
const changeAStyle = (helpers: Helpers, info: ImageDialogInfo, api: API) => {
const data: ImageDialogData = Merger.deepMerge(fromImageData(info.image), api.getData());
const style = getStyleValue(helpers.normalizeCss, toImageData(data));
api.setData({ style });
};
const updateDataWithForm = (form: AlloyComponent): void => {
const formData = Representing.getValue(form);
const validData = toValidValues(formData).getOr({ });
const currentData = storedValue.get();
const newData = Merger.deepMerge(currentData, validData);
storedValue.set(newData);
};
const formFillFromMeta = (info: ImageDialogInfo, api: API) => {
const data = api.getData();
const meta = data.src.meta;
if (meta !== undefined) {
const newData = Merger.deepMerge({}, data);
formFillFromMeta2(info, newData, meta);
api.setData(newData);
}
};
const updateDataWithForm = (form: AlloyComponent): void => {
const formData = Representing.getValue(form);
const validData = toValidValues(formData).getOr({ });
const currentData = storedValue.get();
const newData = Merger.deepMerge(currentData, validData);
storedValue.set(newData);
};