Giter Site home page Giter Site logo

ng-clip's People

Contributors

asafdav avatar bitdeli-chef avatar bricejlin avatar cesarandreu avatar chrisrose avatar falci avatar ivanyeoh avatar just-boris avatar kcrwfrd avatar lorenzo-stoakes avatar mismith avatar niemyjski avatar pmowrer avatar rogeriopvl avatar sampsasaarela avatar sethflowers avatar urigo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ng-clip's Issues

ZeroClipboard no longer supports "moviePath" configuration. It now uses "swfPath".

The run block that configures ZeroClipboard is passing an unused "moviePath" configuration. This means we can no longer configure the path to the flash object.

  run(['ngClip', function(ngClip) {
    ZeroClipboard.config({
      moviePath: ngClip.path,
      trustedDomains: ["*"],
      allowScriptAccess: "always",
      forceHandCursor: true
    });
  }])

See the issue on ZeroClipboard:
zeroclipboard/zeroclipboard#323

In v2.x, I'll be updating the default configuration so that swfPath (the incoming replacement for moviePath) will be relative to the location of the ZeroClipboard JS file being used.

This is the commit that changed this option:
zeroclipboard/zeroclipboard@90b8a4e

set global on success on failure handlers.

I'd love to be able to define a global callback for on success and on failure where I could have my notification service say 'success!' or a failure occurred. This currently isn't possibly and isn't very DRY.

ZeroClipboard throws Uncaught Error: Error calling method on NPObject

Hey,

Great idea with ng-clip! really looked for a solution like this.
I'm having trouble adding it to my project.
When I go mouseover the object I added the ng-clip directive to, I get this error.
Uncaught Error: Error calling method on NPObject

I tried adding
allowScriptAccess: "always",trustedDomains: location.hostaname
to the directive but no luck there...

Any ideas?

Thanks again!

Multiple directives asking for new/isolated scope

I'm experimenting an issue when using multiple directives which has different instance scope modes.
One of them is bs-popover from AngularStrap's project

button.btn-link(bs-popover, clip-copy="copyToClipboard()")

Acording to Angular docs:

Example scenarios of multiple incompatible directives applied to the same element include:
Multiple directives requesting isolated scope.
Multiple directives publishing a controller under the same name.
Multiple directives declared with the transclusion option.
Multiple directives attempting to define a template or templateURL.

http://stackoverflow.com/questions/22303368/multiple-directives-mypopup-mydraggable-asking-for-new-isolated-scope

Console trace

Error: [$compile:multidir] Multiple directives [bsPopover, clipCopy] asking for new/isolated scope on: <html>...</html>

copy mime-type not working

I looked through the source, and this feature does not seem to be implemented anymore? I wanted to be able to copy HTML into the clipboard so that it could pasted with formatting. Was this intentionally removed?

How to re-init ng-clip if data is received from server-side.

Hello. I have datatables with server side processing
I return in each row column like this:

                    ->addColumn('token', function ($model) {
                        return '<button class="btn btn-sm btn-default" type="button" clip-copy="\'https://mysite.com/register?token=' . $model->activation_code . ' \'"><i class="fa fa-copy"></i></button>';
                    })

Looks like problem is that ng-clip inits on page load, but datatables returns all rows after page-load and ng-clip does not see those rows.
How can I re-init ng-clip so it would see those buttons ?

Still maintained?

It looks like this module has a good number of stars. There are also some great PRs open and valid issues.

Is it still being maintained, do you need some help knocking this stuff out?

Fails with ng-repeat

For some reason ng-clip fails with ng-repeat. Maybe it's related to directive binding somehow? It keeps on pointing at the first item. Fiddle.

ngClip.path refers to js file not swf

With default usage ngClip loads the zero clipboard js file rather than the swf. Line 8 should be changed to :

this.path = '//cdnjs.cloudflare.com/ajax/libs/zeroclipboard/1.2.3/ZeroClipboard.swf';

destroy not working properly

Is somebody else having problems with

          scope.$on('$destroy', function() {
            client.off('dataRequested', onDataRequested);
            client.unclip(element);
          });

?
I have case where I jump to another page after copying stuff to clipboard and when returning to page containing ng-clip directive events (datarequested) stopped working.

So for me running this with

          scope.$on('$destroy', function() {
            ZeroClipboard.destroy();
          });

works ok.

copy after http request?

It this somehow possible?
I am trying to get it working to copy data that I get after http success request. I get some text but it only does the copy if I click twice. First time it leaves the old value.
I basically process set some text, process the value in PHP which returns a new value which I want to copy to clipboard. But it always doesn't pick up the first time. Is there a way to make it wait until $scope is ready. Tried various timeout, scope.apply methods but couldn't get it to work.

    $scope.getTextToCopy = function() {
        return $scope.rez;
    };

    $scope.copyCode = function(show_id) {
      var textToCopy = "12345"
        $http({
            headers: {
              'Content-Type': 'application/x-www-form-urlencoded'
            },
            url: 'snippets/scripts/iframeObfuscate.php',
            method: "POST",
            data: $.param({
                "param": textToCopy
            })
        }).success(function(data) {
            $scope.rez = data;
        });
    };

Any advice is appreciated :)

p.s best bet is to invoke a method to copy in js file and not use the
data-clip-copy="getTextToCopy()" in html. I think that would solve the issue ?

No Error hanlder

Hey, there's no error handler which makes using the lib quite difficult.

zeroClipboard events not firing with Angular 1.2.3

First of all, thanks for your contribution, your code is organized and well structured.

When using parts of you code for my own implementation of retrieving a unique hash from the server upon interaction with the user via a deferred object, I ran into some troubles.

The ZeroClipboard event just don't seem to fire, tried:
setting priority above 0(up to 100),
an incognito window with no adons (add block, etc),
using a local instance of the script and swf, and also the following settings:

        var clip = new ZeroClipboard( angular.element(element), {
           moviePath: ZeroClipboardPath,
           trustedDomains: ['*'],
           allowScriptAccess: "always"          
         });

tried using angular.element() and $() on the element, even tried to use an jquery css selector with an explicit id, but now luck.

Any ideas?

Tried your original module, doesn't work either

Doesn't work in IE

Hi,

I tested my app with ngClip and your demo on a few up-to-date browsers (Chrome, FF and IE) and it doesn't work on IE. Any fix for this?

Thanks,
Yaniv

how to change current dom attribute with clip-click?

The dom like this:
< input type = "text" ng-model = "hostname" />
< span class="input-group-addon" clip-copy="hostname" clip-click="copy2clipboard()" title="copy" tooltip> < a data-container="body"> < i class="fa fa-copy">

what I want is that after pressed span tag button, use clip-click attribute specified method copy2clipboard() to change span dom's title attribute to 'it is copied!'

Bind fallback function in case flash is unavailable

Would you be interested in a PR to add another attribute, e.g. clip-click-fallback, so that a fallback function may be fired in the event that flash is unavailable?

ZeroClipboard.isFlashUnusable() returns if flash is unavailable. If true, I would bind the clip-click-fallback function to the element, otherwise proceed with the rest of your linking function.

Automatically hide element when no flash is detected.

In my old app, I'd hide the element when flash wasn't detected by doing this:

        var clip = new ZeroClipboard($("button.clipboard"));
        clip.on('noflash wrongflash', () => $("button.clipboard").hide());

It would be nice if this was possible with an attribute like clip-hide-no-flash

How do I know what to set ngClipProvider to?

In the Usage document, I think the document assumes that the user is already very familiar with ZeroClipboard and knows why and what to set the path of the .swf file to. However, as a new user I don't know it.
In the ZeroClipboard instructions.md file, it says: "... If this file is located in the same directory as your web page, then it will work out of the box. However, if the SWF file is hosted elsewhere, you need to set the URL like this...."
Since the file in question does not seem to be part of the installation, I assume it gets created by the software at some point.... as to where it should go, I don't see how I determine that.

ng-clip doesn't work in chrome apps.

When I use ng-clip in web page,it can work well.When I use it in the chrome app,it doesn't work.I use your demo first code segments in my project.

clip-click not working

I've setted up a function to show a message saying that data was copied to the clipboard, but when I click it the text gets copied but nothing happens after... no message :(

$scope.copiedClick = () ->
        logger.logSuccess = 'Data copied'

$scope.getPullUrlToCopy = (skinId) ->
        return 'text to copy'
<button title="Copy Data" type="button" class="btn btn-info" clip-copy="getPullUrlToCopy(item.id)" clip-click="copiedClick()"><i class="fa fa-key"></i></button>

clipboard data does not update in fist time.

i have a problem about ng-clip
step 1: i copy a data by ctrl + c,it works well 'aaa'
step 2: i click a button (use ng-clip) 'bbb'
step 3: ctrl + v ,the result is 'aaa'
step 4: ctrl + v ,the result is 'bbb'

i don't know why , This is my code link.

Testing the module

Hi Asaf, I am now writing tests for this module using mocha, the problem is that for the module to be testable the ZeroClipboard instances will have to be stored inside a service \ factory, in order to call the getText() method from the test(probably service...)

Now I am thinking about about a good way to implement this, and the only way I've been able to come up with so far is a hash map that will contain the zeroClipboard object as value, and the key will be the element id(not good, don't want to force the users to set an id attribute for the element they bind the plugin to)

Any ideas?

Can't get this to work

It seems the flash file gets loaded correctly, but the funcionality does not work at all. I tried both Chrome and Firefox with no success

I tried to put together a JSFiddle reproducing this, can anybody tell me what's the fix here?
http://jsfiddle.net/ztekqn4h/

Flash overlay persisting between pages?

I'm working on a Single Page Application written in Angular, where I'm trying to apply this module to a button

This seems to create an overlay with the flash object on top of the button. But when I click somewhere else to change the page (making the button disapear), the overlay stays there. It's still invisible, but I notice I can't over on anything where the button used to be

Fails to copy to clipboard when value is JavaScript

I'm creating a "copy code" function that currently is working perfectly copying HTML and SCSS. When I do an attempt to copy a field with JS, nothing happens. If I replace the JS with something else (text, HTML or CSS i.e) it works perfectly. How can we make the script copy JS code?

Adds QueryString to the html page title on IE

Once navigated to the page with clip-copy directive used in, the page title will become
Assigned pagetitle Plus (htmlpagetitle#/htmlpagename/session id)and stays that way , the zeroclipboard version is v2.1.6 .

ng-clip and bootstrap's tooltip

Hi Asaf,

What is the best way to have bootstrap's tooltip and ng-clip working together?

The following does not work:

<a href="" clip-copy="getTextToCopy()" tooltip="copy to clipboard">Copy</a>

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.