bugfix: utils file

This commit is contained in:
Braks
2021-07-09 19:55:06 +02:00
parent af077caeaa
commit c9779467a3
2 changed files with 4 additions and 4 deletions

View File

@@ -58,7 +58,7 @@ export const baseConfig = ({ mainFile = pkg.main, moduleFile = pkg.module, injec
babel({
extensions: [...DEFAULT_BABEL_EXTENSIONS, '.ts', '.tsx'],
exclude: 'node_modules/**',
babelHelpers: 'inline'
babelHelpers: 'bundled'
})
]
});

View File

@@ -1,9 +1,9 @@
import { Dimensions, XYPosition, NodeExtent } from '../types';
export const isInputDOMNode = (e: MouseEvent | /* DraggableEvent | */ KeyboardEvent): boolean => {
const target = e?.target as HTMLElement;
const target = e.target as HTMLElement;
return ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON'].includes(target?.nodeName) || target?.hasAttribute('contenteditable');
return ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON'].includes(target?.nodeName) || target.hasAttribute('contenteditable');
};
export const getDimensions = (node: HTMLDivElement): Dimensions => ({
@@ -19,4 +19,4 @@ export const clampPosition = (position: XYPosition, extent: NodeExtent) => ({
});
export const getHostForElement = (element: HTMLElement): Document | ShadowRoot =>
(element.getRootNode?.() as Document | ShadowRoot) || window?.document;
(element.getRootNode() as Document | ShadowRoot) || window.document;