Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const switchOffContentEditableTrue = (elm: Element) => {
Arr.each(SelectorFilter.descendants(elm, '*[contenteditable="true"]'), (elm) => {
Attr.set(elm, internalContentEditableAttr, 'true');
setContentEditable(elm, false);
});
};
const getClosestCell = (getYAxisValue: GetAxisValue, isTargetCorner: IsTargetCorner, table: HTMLElement, x: number, y: number): Option => {
type TableThing = HTMLTableDataCellElement | HTMLTableHeaderCellElement | HTMLTableCaptionElement;
const cells = SelectorFilter.descendants(Element.fromDom(table), 'td,th,caption').map((e) => e.dom() as TableThing);
const corners = Arr.filter(getCorners(getYAxisValue, cells), (corner) => isTargetCorner(corner, y));
return findClosestCorner(corners, x, y).map((corner) => {
return corner.cell;
});
};
const fireEvents = (editor: Editor, table) => {
Arr.each(SelectorFilter.descendants(table, 'tr'), (row) => {
fireNewRow(editor, row.dom());
Arr.each(SelectorFilter.descendants(row, 'th,td'), (cell) => {
fireNewCell(editor, cell.dom());
});
});
};
const switchOnContentEditableTrue = (elm: Element) => {
Arr.each(SelectorFilter.descendants(elm, `*[${internalContentEditableAttr}="true"]`), (elm) => {
Attr.remove(elm, internalContentEditableAttr);
setContentEditable(elm, true);
});
};
const switchOnContentEditableTrue = (elm: Element) => {
Arr.each(SelectorFilter.descendants(elm, `*[${internalContentEditableAttr}="true"]`), (elm) => {
Attr.remove(elm, internalContentEditableAttr);
setContentEditable(elm, true);
});
};
Traverse.parent(table).map((parent) => calculatePercentageWidth(table, parent)).each((tablePercentage) => {
Css.set(table, 'width', tablePercentage);
Arr.each(SelectorFilter.descendants(table, 'tr'), (tr) => {
Arr.each(Traverse.children(tr), (td) => {
Css.set(td, 'width', calculatePercentageWidth(td, tr));
});
});
});
};
const switchOffContentEditableTrue = (elm: Element) => {
Arr.each(SelectorFilter.descendants(elm, '*[contenteditable="true"]'), (elm) => {
Attr.set(elm, internalContentEditableAttr, 'true');
setContentEditable(elm, false);
});
};
Arr.each(SelectorFilter.descendants(table, 'tr'), (row) => {
fireNewRow(editor, row.dom());
Arr.each(SelectorFilter.descendants(row, 'th,td'), (cell) => {
fireNewCell(editor, cell.dom());
});
});
};