zeroclipboard for plastiq
npm install plastiq-zeroclipboardA plastiq component for ZeroClipboard.
``js
var plastiq = require('plastiq');
var h = plastiq.html;
function render(model) {
return h('div',
h('input', {type: 'text', binding: [model, 'text']}),
zeroClipboard(model.text, h('button', 'copy'))
);
}
plastiq.append(document.body, render, {});
`
`js`
var vdom = zeroClipboard([options], data, buttonVdom);
* options.oncopy - function that is called after the copy has finished.options.onerror
* - function that is called when an error occurs, usually if flash isn't available. See the error event in ZeroClipboard documentation.data
* - either a string, a function that returns a string, or an object containing a string or function for each mime-type, e.g.:
`js`
{
'text/plain': 'some text',
'text/html': function () { return 'some html
'; }
}
* buttonVdom - a vdom element, usually a h('button'), to act as the copy button.
`js`
zeroClipboard.options({...});
A way to configure ZeroClipboard, just delegates straight to ZeroClipboard.options({...}), see options.
Most often you'll want to do this:
`js``
zeroClipboard.options({swfPath: '/path/to/ZeroClipboard.swf'});