chornij / yii2-zeroclipboard
The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
Installs: 6 701
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 2
Open Issues: 1
Language:JavaScript
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-06-07 22:02:33 UTC
README
The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist chornij/yii2-zeroclipboard "dev-master"
or add
"chornij/yii2-zeroclipboard": "dev-master"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by :
<?= chornij\zeroclipboard\Button::widget([ 'label' => '<span class="glyphicon glyphicon-copy"></span> ' . \Yii::t('app', 'Copy'), 'encodeLabel' => false, 'text' => "$('.copy-selector').text()", ]) ?> <div class="copy-selector"> My text to copy! </div>
Once clicked on Copy button it should change the status to Copied! If it does not change then make sure that your Flash Plugin is enabled in browser. If you are using Chrome check the following settings: chrome://plugins/ and make sure that Adobe Flash Player plugin is enabled.