Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const matchColor = function (editorBody: SugarElement) {
// in iOS you can overscroll, sometimes when you overscroll you can reveal the bgcolor of an element beneath,
// by matching the bg color and clobbering ensures any reveals are 'camouflaged' the same color
const color = Css.get(editorBody, 'background-color');
return (color !== undefined && color !== '') ? 'background-color:' + color + '!important' : bgFallback;
};
// Get the document or window/viewport height
let maxHeight;
if (isFixed) {
maxHeight = Math.max(documentElement.clientHeight, window.innerHeight);
} else {
maxHeight = Math.max(documentElement.offsetHeight, documentElement.scrollHeight);
}
// Determine the current height taken up by the tabview panel
const tabviewHeight = Height.get(tabview);
const isTabListBeside = tabview.dom().offsetLeft >= tablist.dom().offsetLeft + Width.get(tablist);
const currentTabHeight = isTabListBeside ? Math.max(Height.get(tablist), tabviewHeight) : tabviewHeight;
// Get the dialog height, making sure to account for any margins on the dialog
const dialogTopMargin = parseInt(Css.get(dialog, 'margin-top'), 10) || 0;
const dialogBottomMargin = parseInt(Css.get(dialog, 'margin-bottom'), 10) || 0;
const dialogHeight = Height.get(dialog) + dialogTopMargin + dialogBottomMargin;
const chromeHeight = dialogHeight - currentTabHeight;
return maxHeight - chromeHeight;
};
const getMaxTabviewHeight = (dialog: Element, tabview: Element, tablist: Element) => {
const documentElement = Traverse.documentElement(dialog).dom();
const rootElm = SelectorFind.ancestor(dialog, '.tox-dialog-wrap').getOr(dialog) as Element;
const isFixed = Css.get(rootElm, 'position') === 'fixed';
// Get the document or window/viewport height
let maxHeight;
if (isFixed) {
maxHeight = Math.max(documentElement.clientHeight, window.innerHeight);
} else {
maxHeight = Math.max(documentElement.offsetHeight, documentElement.scrollHeight);
}
// Determine the current height taken up by the tabview panel
const tabviewHeight = Height.get(tabview);
const isTabListBeside = tabview.dom().offsetLeft >= tablist.dom().offsetLeft + Width.get(tablist);
const currentTabHeight = isTabListBeside ? Math.max(Height.get(tablist), tabviewHeight) : tabviewHeight;
// Get the dialog height, making sure to account for any margins on the dialog
const dialogTopMargin = parseInt(Css.get(dialog, 'margin-top'), 10) || 0;
const getIndentStyleName = (useMargin: boolean, element: Element) => {
const indentStyleName = useMargin || isTable(element) ? 'margin' : 'padding';
const suffix = Css.get(element, 'direction') === 'rtl' ? '-right' : '-left';
return indentStyleName + suffix;
};
.exists((elm: Element) => isPreValue(Css.get(elm, 'white-space')));
};
return SelectorFind.descendant(Util.getBody(editor), 'table[data-mce-id="__mce"]').map((table) => {
if (isPixelsForced(editor)) {
Css.set(table, 'width', Css.get(table, 'width'));
}
Attr.remove(table, 'data-mce-id');
fireEvents(editor, table);
selectFirstCellInTable(editor, table);
return table.dom();
}).getOr(null);
};
const isImageBlock = (node: DomNode) => {
return node.nodeName === 'IMG' && Css.get(Element.fromDom(node as HTMLImageElement), 'display') === 'block';
};