Skip to content

Commit fd520d8

Browse files
committed
Replace github specific table criteria with data-layout-table
1 parent edd2575 commit fd520d8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/paste-markdown-table.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function parseTable(html: string): HTMLElement | null {
9595
return el.querySelector('table')
9696
}
9797

98-
function hasTable(transfer: DataTransfer): HTMLElement | null | void {
98+
function hasTable(transfer: DataTransfer): HTMLElement | void {
9999
if (Array.from(transfer.types).indexOf('text/html') === -1) return
100100

101101
const html = transfer.getData('text/html')
@@ -104,8 +104,8 @@ function hasTable(transfer: DataTransfer): HTMLElement | null | void {
104104
const table = parseTable(html)
105105
if (!table) return
106106

107-
// Edge copies the surrounding table from our issue comment text.
108-
if (table.closest('.js-comment')) return
107+
// Prevent pasting layout table
108+
if (table.closest('[data-layout-table]')) return
109109

110-
return /\b(js|blob|diff)-./.test(table.className) ? null : table
110+
return table
111111
}

0 commit comments

Comments
 (0)