Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const doEnrich = (items): FormatItem[] => {
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;
const splitFonts = (fontFamily: string): string[] => {
const fonts = fontFamily.split(/\s*,\s*/);
return Arr.map(fonts, (font) => font.replace(/^['"]+|['"]+$/g, ''));
};
const getMultipleToolbarsSetting = (editor: Editor): Option => {
const keys = Obj.keys(editor.settings);
const toolbarKeys = Arr.filter(keys, (key) => /^toolbar([1-9])$/.test(key));
const toolbars = Arr.map(toolbarKeys, (key) => editor.getParam(key, false, 'string'));
const toolbarArray = Arr.filter(toolbars, (toolbar) => typeof toolbar === 'string');
return toolbarArray.length > 0 ? Option.some(toolbarArray) : Option.none();
};
const getBlocksToIndent = (editor: Editor) => {
return Arr.filter(Arr.map(editor.selection.getSelectedBlocks(), Element.fromDom), (el) =>
!isListComponent(el) && !parentIsListComponent(el) && isEditable(el)
) as Element[];
};
const renderHeader = (header: string[]) => ({
dom: {
tag: 'thead'
},
components: [
{
dom: {
tag: 'tr'
},
components: Arr.map(header, renderTh)
}
]
});
const renderTd = (text: string) => ({ dom: { tag: 'td', innerHtml: providersBackstage.translate(text) } });
const processNodes = (nodes) => {
const elems = Arr.map(nodes, Element.fromDom);
processElements(elems);
};
getItems: (value) => {
return Arr.map([
{
text: 'Cat'
},
{
text: 'Dog'
}
], (d) => makeItem(d.text));
}
}, backstage);
}, function (rows) {
return Arr.map(rows, function (row) {
return row.dom();
});
});
};
const renderRows = (rows: string[][]) => ({ dom: { tag: 'tbody' }, components: Arr.map(rows, renderTr) });
return {
const makeTabs = () => {
return Arr.map(charMap, (charGroup) => {
return {
title: charGroup.name,
name: charGroup.name,
items: makeGroupItems()
};
});
};