mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
b590ce1b95
closes https://github.com/TryGhost/Team/issues/411 - adds "Create snippet" icon to the editor toolbar - uses the same link input component design for specifying snippet titles - snippets are loaded in the background when the editor is accessed - snippets are listed at the bottom of the card menus of the + and / menus - clicking a snippet inserts the snippet's contents in place of the current blank section
14 lines
455 B
JavaScript
14 lines
455 B
JavaScript
export default function getScrollParent(node) {
|
|
const isElement = node instanceof HTMLElement;
|
|
const overflowY = isElement && window.getComputedStyle(node).overflowY;
|
|
const isScrollable = overflowY !== 'visible' && overflowY !== 'hidden';
|
|
|
|
if (!node) {
|
|
return null;
|
|
} else if (isScrollable && node.scrollHeight >= node.clientHeight) {
|
|
return node;
|
|
}
|
|
|
|
return getScrollParent(node.parentNode) || document.body;
|
|
}
|