Try dialogs.share_text(editor.get_text()), I think that does what you're looking for. (It shares the text as if you pressed "Share..." on a text selection, rather than sharing the file.)