Remove buffers option since only a single is supported
This commit is contained in:
		
					parent
					
						
							
								8f35afd941
							
						
					
				
			
			
				commit
				
					
						5adf9c47fc
					
				
			
		
					 2 changed files with 1 additions and 19 deletions
				
			
		| 
						 | 
					@ -4,8 +4,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "atom/common/api/atom_api_clipboard.h"
 | 
					#include "atom/common/api/atom_api_clipboard.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <map>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "atom/common/native_mate_converters/image_converter.h"
 | 
					#include "atom/common/native_mate_converters/image_converter.h"
 | 
				
			||||||
#include "atom/common/native_mate_converters/string16_converter.h"
 | 
					#include "atom/common/native_mate_converters/string16_converter.h"
 | 
				
			||||||
#include "base/strings/utf_string_conversions.h"
 | 
					#include "base/strings/utf_string_conversions.h"
 | 
				
			||||||
| 
						 | 
					@ -68,7 +66,6 @@ void Clipboard::Write(const mate::Dictionary& data, mate::Arguments* args) {
 | 
				
			||||||
  ui::ScopedClipboardWriter writer(GetClipboardType(args));
 | 
					  ui::ScopedClipboardWriter writer(GetClipboardType(args));
 | 
				
			||||||
  base::string16 text, html, bookmark;
 | 
					  base::string16 text, html, bookmark;
 | 
				
			||||||
  gfx::Image image;
 | 
					  gfx::Image image;
 | 
				
			||||||
  std::map<std::string, v8::Local<v8::Value>> customBuffers;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (data.Get("text", &text)) {
 | 
					  if (data.Get("text", &text)) {
 | 
				
			||||||
    writer.WriteText(text);
 | 
					    writer.WriteText(text);
 | 
				
			||||||
| 
						 | 
					@ -87,14 +84,6 @@ void Clipboard::Write(const mate::Dictionary& data, mate::Arguments* args) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (data.Get("image", &image))
 | 
					  if (data.Get("image", &image))
 | 
				
			||||||
    writer.WriteImage(image.AsBitmap());
 | 
					    writer.WriteImage(image.AsBitmap());
 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (data.Get("buffers", &customBuffers)) {
 | 
					 | 
				
			||||||
    for (auto i = customBuffers.begin(); i != customBuffers.end(); ++i) {
 | 
					 | 
				
			||||||
      writer.WriteData(node::Buffer::Data(i->second),
 | 
					 | 
				
			||||||
                       node::Buffer::Length(i->second),
 | 
					 | 
				
			||||||
                       ui::Clipboard::GetFormatType(i->first));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
base::string16 Clipboard::ReadText(mate::Arguments* args) {
 | 
					base::string16 Clipboard::ReadText(mate::Arguments* args) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -173,17 +173,10 @@ Writes the `buffer` into the clipboard as `format`.
 | 
				
			||||||
  * `image` [NativeImage](native-image.md) (optional)
 | 
					  * `image` [NativeImage](native-image.md) (optional)
 | 
				
			||||||
  * `rtf` String (optional)
 | 
					  * `rtf` String (optional)
 | 
				
			||||||
  * `bookmark` String (optional) - The title of the url at `text`.
 | 
					  * `bookmark` String (optional) - The title of the url at `text`.
 | 
				
			||||||
  * `buffers` {[format: String]: Buffer} (optional) _Experimental_ - The buffers for each format you want to write
 | 
					 | 
				
			||||||
* `type` String (optional)
 | 
					* `type` String (optional)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```javascript
 | 
					```javascript
 | 
				
			||||||
const {clipboard} = require('electron')
 | 
					const {clipboard} = require('electron')
 | 
				
			||||||
clipboard.write({
 | 
					clipboard.write({text: 'test', html: '<b>test</b>'})
 | 
				
			||||||
  text: 'test',
 | 
					 | 
				
			||||||
  html: '<b>test</b>',
 | 
					 | 
				
			||||||
  buffers: {
 | 
					 | 
				
			||||||
    'com.adobe.pdf': pdfData
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
Writes `data` to the clipboard.
 | 
					Writes `data` to the clipboard.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue