diff --git a/packages/fluent-editor/src/table/modules/table-operation-menu.ts b/packages/fluent-editor/src/table/modules/table-operation-menu.ts index f33c955..3bac2b3 100644 --- a/packages/fluent-editor/src/table/modules/table-operation-menu.ts +++ b/packages/fluent-editor/src/table/modules/table-operation-menu.ts @@ -89,6 +89,17 @@ export default class TableOperationMenu { const dom = this.table.cloneNode(true) const trArr = dom.querySelectorAll('tr[data-row]') trArr.forEach(tr => tr.removeAttribute('data-row')) + if (!navigator.clipboard || !navigator.clipboard.write) { + dom.style.position = 'fixed' + dom.style.top = 0 + dom.style.left = 0 + dom.style.clip = 'rect(0,0,0,0)' + document.body.appendChild(dom) + this.setCopyRange(dom) + document.execCommand('copy') + dom.remove() + return + } this.setCopyRange(dom) const blob = new Blob([dom.outerHTML], { type: 'text/html' }) const clipboardItem = new ClipboardItem({ 'text/html': blob }) @@ -461,6 +472,13 @@ export default class TableOperationMenu { async onCopy(operation) { const { selectedTds } = this.tableSelection const virtualTable = this.createVirtualTable(selectedTds, operation) + if (!navigator.clipboard || !navigator.clipboard.write) { + document.body.appendChild(virtualTable) + this.setCopyRange(virtualTable) + document.execCommand('copy') + virtualTable.remove() + return + } this.setCopyRange(virtualTable) this.tableSelection.preSelectedTable = virtualTable this.tableSelection.preSelectedTds = selectedTds