Merge pull request #13787 from jipexu/checkcontenteditable
Checkcontenteditable
This commit is contained in:
@@ -238,8 +238,9 @@ export const shiftKeyOnly = function (mapBrowserEvent) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return `true` if the target element is not editable, i.e. not a `<input>`-,
|
* Return `true` if the target element is not editable, i.e. not an `input`,
|
||||||
* `<select>`- or `<textarea>`-element, `false` otherwise.
|
* `select`, or `textarea` element and no `contenteditable` attribute is
|
||||||
|
* set or inherited, `false` otherwise.
|
||||||
*
|
*
|
||||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||||
* @return {boolean} True only if the target element is not editable.
|
* @return {boolean} True only if the target element is not editable.
|
||||||
@@ -250,7 +251,15 @@ export const targetNotEditable = function (mapBrowserEvent) {
|
|||||||
mapBrowserEvent.originalEvent
|
mapBrowserEvent.originalEvent
|
||||||
);
|
);
|
||||||
const tagName = /** @type {Element} */ (originalEvent.target).tagName;
|
const tagName = /** @type {Element} */ (originalEvent.target).tagName;
|
||||||
return tagName !== 'INPUT' && tagName !== 'SELECT' && tagName !== 'TEXTAREA';
|
return (
|
||||||
|
tagName !== 'INPUT' &&
|
||||||
|
tagName !== 'SELECT' &&
|
||||||
|
tagName !== 'TEXTAREA' &&
|
||||||
|
// `isContentEditable` is only available on `HTMLElement`, but it may also be a
|
||||||
|
// different type like `SVGElement`.
|
||||||
|
// @ts-ignore
|
||||||
|
!originalEvent.target.isContentEditable
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user