if (data.Get("text", &text))
writer.WriteText(text);
+ if (data.Get("rtf", &text)) {
+ std::string rtf = base::UTF16ToUTF8(text);
+ writer.WriteRTF(rtf);
+ }
+
if (data.Get("html", &html))
writer.WriteHTML(html, std::string());
writer.WriteText(text);
}
+void WriteRtf(const std::string& text, mate::Arguments* args) {
+ ui::ScopedClipboardWriter writer(GetClipboardType(args));
+ writer.WriteRTF(text);
+}
+
base::string16 ReadHtml(mate::Arguments* args) {
base::string16 data;
base::string16 html;
dict.SetMethod("write", &Write);
dict.SetMethod("readText", &ReadText);
dict.SetMethod("writeText", &WriteText);
+ dict.SetMethod("writeRtf", &WriteRtf);
dict.SetMethod("readHtml", &ReadHtml);
dict.SetMethod("writeHtml", &WriteHtml);
dict.SetMethod("readImage", &ReadImage);
Writes `image` to the clipboard.
+### `clipboard.writeRtf(text)`
+
+* `text` String
+
+Writes the `text` into the clipboard in RTF.
+
### `clipboard.clear([type])`
* `type` String (optional)