@github/paste-markdown
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -153,13 +153,17 @@ function insertText(textarea, text) { | ||
return; | ||
const html = transfer.getData('text/html'); | ||
let html = transfer.getData('text/html'); | ||
if (!/<table/i.test(html)) | ||
return; | ||
html = html.replace(/<meta.*?>/, ''); | ||
const el = document.createElement('div'); | ||
el.innerHTML = html; | ||
let table = el.querySelector('table'); | ||
table = !table || table.closest('[data-paste-markdown-skip]') ? null : table; | ||
if (!table) | ||
return; | ||
const formattedTable = tableMarkdown(table); | ||
return html.replace(/<meta.*?>/, '').replace(/<table[.\S\s]*<\/table>/, `\n${formattedTable}`); | ||
const tables = el.querySelectorAll('table'); | ||
for (const table of tables) { | ||
if (table.closest('[data-paste-markdown-skip]')) { | ||
table.replaceWith(new Text(table.textContent || '')); | ||
} | ||
const formattedTable = tableMarkdown(table); | ||
table.replaceWith(new Text(formattedTable)); | ||
} | ||
return el.innerHTML; | ||
} | ||
@@ -166,0 +170,0 @@ |
@@ -159,13 +159,17 @@ (function (global, factory) { | ||
return; | ||
const html = transfer.getData('text/html'); | ||
let html = transfer.getData('text/html'); | ||
if (!/<table/i.test(html)) | ||
return; | ||
html = html.replace(/<meta.*?>/, ''); | ||
const el = document.createElement('div'); | ||
el.innerHTML = html; | ||
let table = el.querySelector('table'); | ||
table = !table || table.closest('[data-paste-markdown-skip]') ? null : table; | ||
if (!table) | ||
return; | ||
const formattedTable = tableMarkdown(table); | ||
return html.replace(/<meta.*?>/, '').replace(/<table[.\S\s]*<\/table>/, `\n${formattedTable}`); | ||
const tables = el.querySelectorAll('table'); | ||
for (const table of tables) { | ||
if (table.closest('[data-paste-markdown-skip]')) { | ||
table.replaceWith(new Text(table.textContent || '')); | ||
} | ||
const formattedTable = tableMarkdown(table); | ||
table.replaceWith(new Text(formattedTable)); | ||
} | ||
return el.innerHTML; | ||
} | ||
@@ -172,0 +176,0 @@ |
{ | ||
"name": "@github/paste-markdown", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Paste spreadsheet cells as a Markdown table.", | ||
@@ -5,0 +5,0 @@ "repository": "github/paste-markdown", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17464
415
1