Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Get selected cells or the current cell
cells = editor.dom.select('td[data-mce-selected],th[data-mce-selected]');
cellElm = editor.dom.getParent(editor.selection.getStart(), 'td,th');
if (!cells.length && cellElm) {
cells.push(cellElm);
}
cellElm = cellElm || cells[0];
if (!cellElm) {
// If this element is null, return now to avoid crashing.
return;
}
// Get current data and find shared values between cells
const cellsData: CellData[] = Tools.map(cells,
(cellElm) => Helpers.extractDataFromCellElement(editor, cellElm, hasAdvancedCellTab(editor))
);
const data: CellData = Helpers.getSharedValues(cellsData);
const dialogTabPanel: Types.Dialog.TabPanelApi = {
type: 'tabpanel',
tabs: [
{
title: 'General',
name: 'general',
items: CellDialogGeneralTab.getItems(editor)
},
Helpers.getAdvancedTab()
]
};
const dialogPanel: Types.Dialog.PanelApi = {
const getItems = function (editor) {
return Tools.map(Settings.getLanguages(editor).split(','), function (langPair) {
langPair = langPair.split('=');
return {
name: langPair[0],
value: langPair[1]
};
});
};
const toBlockElements = function (text: string, rootTag: string, rootAttrs: RootAttrs) {
const blocks = text.split(/\n\n/);
const tagOpen = openContainer(rootTag, rootAttrs);
const tagClose = '';
const paragraphs = Tools.map(blocks, function (p) {
return p.split(/\n/).join('<br>');
});
const stitch = function (p) {
return tagOpen + p + tagClose;
};
return paragraphs.length === 1 ? paragraphs[0] : Tools.map(paragraphs, stitch).join('');
};
fetch : (callback) => {
const items = Tools.map(languageMenuItems, (languageItem) => {
return {
type: 'choiceitem',
value: languageItem.data,
text: languageItem.text
};
});
callback(items);
},
onItemAction: (splitButtonApi, value) => {
function toggleVisibility(state: boolean) {
let selectors;
selectors = Tools.map(handles, function (handle) {
return '#' + id + '-' + handle.name;
}).concat(Tools.map(blockers, function (blocker) {
return '#' + id + '-' + blocker;
})).join(',');
if (state) {
DomQuery(selectors, containerElm).show();
} else {
DomQuery(selectors, containerElm).hide();
}
}
const compileUserDefinedGroups = function (groups): Group[] {
return Tools.map(groups, function (group) {
return Tools.extend({}, group, {
original: group,
selectors: {},
filter: compileFilter(group.filter),
item: {
text: group.title,
menu: []
}
});
});
};
const findParentListItemsNodes = function (editor, elms) {
const listItemsElms = Tools.map(elms, function (elm) {
const parentLi = editor.dom.getParent(elm, 'li,dd,dt', getClosestListRootElm(editor, elm));
return parentLi ? parentLi : elm;
});
return DomQuery.unique(listItemsElms);
};
function toggleVisibility(state: boolean) {
let selectors;
selectors = Tools.map(handles, function (handle) {
return '#' + id + '-' + handle.name;
}).concat(Tools.map(blockers, function (blocker) {
return '#' + id + '-' + blocker;
})).join(',');
if (state) {
DomQuery(selectors, containerElm).show();
} else {
DomQuery(selectors, containerElm).hide();
}
}