-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
What is the current behavior?
Tiled checks for text/tmx as the mime-type of your clipboard before enabling the Paste function (as defined in src/tiled/clipboardmanager.cpp). However, the content copied from and pasted into Tiled (as held in the clipboard) is simply Tiled XML in plain text.
Why is this a problem?
Using the mime-type text/tmx means it is only possible to copy and paste within Tiled itself. External programs (specifically web browsers) are not typically able to set their clipboard to uncommon mime-types (like text/tmx) thus eliminating any copy/paste interoperability between web browsers and Tiled which would otherwise be possible.
For example, I would like to create a web application that will generate Tiled XML objects with Custom Properties that I can paste into Tiled (without having to manually configure them in Tiled), but no modern web browser will allow the clipboard mime-type to be set to text/tmx thus the web app would be pointless (as you would have to download the generated TMX, open it in Tiled, copy the objects, then paste them in the destination TMX).
What is your proposed solution?
Change the mime-type on Line 50 in clipboardmanager.cpp to text/plain so programs like browsers are able to general valid Tiled XML that can be pasted directly into Tiled. Please see Pull Request 4289.
In my testing, simply changing the mime-type to text/plain allows Tiled XML to be directly pasted into open TMX maps without any obvious side effects (attempting to paste invalid XML or gibberish text fails and does not affect the Tiled map in any way).