+ // Upon receiving the data, it is important to disconnect the signal
+ // to avoid potential unintended pasting caused by subsequent requests.
+ mImpl->mClipboard.DataReceivedSignal().Disconnect(this, &Controller::PasteClipboardItemEvent);
+
+ // If the id is 0u, it is an invalid response.
+ if(id == 0u)
+ {
+ return;
+ }
+
+ // text-controller allows only plain text type.
+ if(!strncmp(mimeType, MIME_TYPE_TEXT_PLAIN, strlen(MIME_TYPE_TEXT_PLAIN)))
+ {
+ EventHandler::PasteClipboardItemEvent(*this, data);
+ }
+ else if(!strncmp(mimeType, MIME_TYPE_HTML, strlen(MIME_TYPE_HTML)))
+ {
+ // This does not mean that text controls can parse html.
+ // This is temporary code, as text controls do not support html type data.
+ // Simply remove the tags inside the angle brackets.
+ // Once multiple types and data can be stored in the clipboard, this code should be removed.
+ std::regex reg("<[^>]*>");
+ std::string result = regex_replace(data, reg, "");
+
+ EventHandler::PasteClipboardItemEvent(*this, result.c_str());
+ }