obsidian-sortable icon indicating copy to clipboard operation
obsidian-sortable copied to clipboard

Install `onClick` event only for table headers

Open alexandru-dinu opened this issue 3 years ago • 0 comments

Current implementation:

function onClick(evt: MouseEvent): void {
    const htmlEl = (<HTMLInputElement>evt.target);
    
    const th = htmlEl.closest('thead th');
    
    // click was not performed in a table, exit
    if (th == null) { return; }
    
    // click was performed in a table
    // ...
}

Maybe it's better to do this rather than registering onClick events for all table headers in the current page?

alexandru-dinu avatar May 04 '21 21:05 alexandru-dinu