This repository was archived by the owner on Aug 31, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1+ # Synthesize clipboardData[ "styledText"] from plain text on the clipboard
2+
Original file line number Diff line number Diff line change @@ -837,7 +837,7 @@ bool MCClipboard::CopyAsLiveCodeStyledText(MCDataRef& r_pickled_text) const
837837 }
838838 }
839839
840- // Could not grab as either styled text or RTF. One last try with HTML.. .
840+ // Could not grab as either styled text or RTF. Try with HTML.
841841 MCAutoDataRef t_html;
842842 if (CopyAsData (kMCRawClipboardKnownTypeHTML , &t_html))
843843 {
@@ -850,6 +850,19 @@ bool MCClipboard::CopyAsLiveCodeStyledText(MCDataRef& r_pickled_text) const
850850 }
851851 }
852852
853+ // Finally, try plain text.
854+ MCAutoStringRef t_plain_text;
855+ if (CopyAsText (&t_plain_text))
856+ {
857+ // Convert to LiveCode styled text
858+ MCDataRef t_pickled_text = ConvertTextToStyledText (*t_plain_text);
859+ if (t_pickled_text != NULL )
860+ {
861+ r_pickled_text = t_pickled_text;
862+ return true ;
863+ }
864+ }
865+
853866 // There was nothing on the clipboard that could be converted to LiveCode
854867 // styled text.
855868 return false ;
You can’t perform that action at this time.
0 commit comments