Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

fixed pasting issue with generic ClipboardEvent in tagging mode #910

Closed
wants to merge 1 commit into from

Conversation

pyu10055
Copy link

@pyu10055 pyu10055 commented May 7, 2015

fixed pasting issue with generic ClipboardEvent in tagging mode, and allow pasting when the tagging function is not defined.

…allow pasting even the tagging function is not defined
@pyu10055
Copy link
Author

pyu10055 commented May 8, 2015

fixing bugs #704, #789, #848

@faisalferoz
Copy link

+1 any chance of this getting merged?

@pyu10055
Copy link
Author

bump, can someone take look at this fix?

@dmitry-dedukhin
Copy link

Actually, #704 is not fixed by this change.
Paste handler immediately calls ctrl.select in loop and in case tagging-label="false" ctrl.select tries to parse text from ctrl.search which is not filled in because e.preventDefault() was called in paste handler.

To fix this we could add timeout before calling ctrl.select from paste handler, and remove e.preventDefault() from it something like this:

ctrl.searchInput.on('paste', function (e) {
    var data = e.originalEvent.clipboardData.getData('text/plain');
    if (data && data.length > 0 && ctrl.taggingTokens.isActivated && ctrl.tagging.fct) {
        var items = data.split(ctrl.taggingTokens.tokens[0]); // split by first token only
        if (items && items.length > 0) {
            $timeout(function () {
                angular.forEach(items, function (item) {
                    var newItem = ctrl.tagging.fct(item);
                    if (newItem) {
                        ctrl.select(newItem, true);
                    }
                });
            });
            e.stopPropagation();
        }
    }
});

erikdubbelboer added a commit to atomx/ui-select that referenced this pull request Oct 26, 2015
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429
erikdubbelboer added a commit to atomx/ui-select that referenced this pull request Oct 27, 2015
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429
erikdubbelboer added a commit to atomx/ui-select that referenced this pull request Nov 9, 2015
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429
danielgrippi pushed a commit to viewthespace/ui-select that referenced this pull request Jan 12, 2016
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429

(cherry picked from commit 5b852b3)
aaronroberson added a commit that referenced this pull request Feb 18, 2016
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes #910, #704, #789, #848, #429
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants