Skip to content

Clipboard access for rx/presenters

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt
Notifications You must be signed in to change notification settings

coprl/clipboard_presenter_plugin

 
 

Repository files navigation

Clipboard Presenter Plugin

A COPRL presenter plugin that provides clipboard interaction.

Installation

Add this line to your application's Gemfile:

gem 'clipboard_presenter_plugin', git: 'https://github.com/coprl/clipboard_presenter_plugin', require: false

And then execute:

$ bundle

Actions

The clipboard_presenter_plugin provides the following actions:

  • Copy from an element: clipboard copy: :some_field
  • Cut from an element: clipboard cut: :some_field

Usage

Include the clipboard_presenter_plugin either globally via the plugins configuration setting

# config/initializers/presenters.rb
Coprl::Presenters::Settings.configure do |config|
  config.presenters.plugins << :clipboard
  # Now `clipboard` is available in every POM!
end

or on a per-POM basis via the plugin method.

# presenters/foos/view.pom
Coprl::Presenters.define(:view, namespace: :foos) do
  plugin :clipboard

  # ...
end

Then, use one of the clipboard actions in an event handler.

text_field id: :my_secret_token do
  value current_user.super_secret_token
end

button icon: :file_copy do
  tooltip 'Copy token'

  event :click do
    clipboard copy: :my_secret_token
    snackbar 'Copied token to clipboard!'
  end
end

Browser support

The following browsers are considered officially supported:

  • Chrome 42+
  • Edge 12+
  • Firefox 41+
  • Safari 10+

Building

  1. nvm use && npm i
  2. npm run type-check
  3. Compile TS to JS: npm run build (output: views/clipboard/build)
  4. Transpile and bundle via Babel and Webpack: npm run bundle:dev (output: dist/bundle.js)

Or, npm run watch to watch views/clipboard/src for changes and run steps 1-3 above.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/coprl/clipboard_presenter_plugin.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the COPRL project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Clipboard access for rx/presenters

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.txt

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 39.6%
  • JavaScript 38.7%
  • Ruby 21.0%
  • HTML 0.7%