]> git.ardis.lu - event-hashes/commitdiff
Prevent text wrapping on copied HTML
authorArdis Lu <ardisglu@gmail.com>
Sun, 17 Mar 2024 04:47:06 +0000 (21:47 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 17 Mar 2024 04:47:06 +0000 (21:47 -0700)
Better presentation when copied into spreadsheets

index.html

index d02febcabb249f4bec151ff7998f450005a020b9..8f6cc8090de1e4032994148b54fc99d1f9be142c 100644 (file)
       else {
         const data = [new ClipboardItem({
           'text/plain': new Blob([table.innerText], { type: 'text/plain' }),
-          'text/html': new Blob([table.outerHTML], { type: 'text/html' })
+          'text/html': new Blob([`<style>table{white-space:nowrap}</style>${table.outerHTML}`], { type: 'text/html' })
         })];
         navigator.clipboard.write(data);
       }
This page took 0.034883 seconds and 4 git commands to generate.