merge: upstream
This commit is contained in:
commit
11628e4b6a
285 changed files with 3413 additions and 1913 deletions
|
|
@ -104,14 +104,16 @@ const updateWidget = (id, data) => {
|
|||
};
|
||||
|
||||
function onContextmenu(widget: Widget, ev: MouseEvent) {
|
||||
const isLink = (el: HTMLElement) => {
|
||||
const element = ev.target as HTMLElement | null;
|
||||
const isLink = (el: HTMLElement): boolean => {
|
||||
if (el.tagName === 'A') return true;
|
||||
if (el.parentElement) {
|
||||
return isLink(el.parentElement);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
if (isLink(ev.target)) return;
|
||||
if (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(ev.target.tagName) || ev.target.attributes['contenteditable']) return;
|
||||
if (element && isLink(element)) return;
|
||||
if (element && (['INPUT', 'TEXTAREA', 'IMG', 'VIDEO', 'CANVAS'].includes(element.tagName) || element.attributes['contenteditable'])) return;
|
||||
if (window.getSelection()?.toString() !== '') return;
|
||||
|
||||
os.contextMenu([{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue