Create public API endpoint for copy()
Harlequin has to do this to copy data from the table:
```py
@on(DataTable.SelectionCopied)
def copy_data_to_clipboard(self, message: DataTable.SelectionCopied) -> None:
message.stop()
# Excel, sheets, and Snowsight all use a TSV format for copying tabular data
text = os.linesep.join("\t".join(map(str, row)) for row in message.values)
self.editor.text_input.clipboard = text
if self.editor.use_system_clipboard:
try:
self.editor.text_input.system_copy(text)
except Exception:
self.notify("Error copying data to system clipboard.", severity="error")
else:
self.notify("Selected data copied to clipboard.")
```
关闭于 2024-02-06 0 条评论