Allow for changing an tag when clicking on it #13

merged 2 commits into from Feb 19, 2012


None yet

2 participants

sstok commented Jan 23, 2012

I have add an new tagClick event which allows for changing the value of an tag by clicking on it.

The event will receive the data as Item and must return it as an Item.
Writing an automated test-case was not possible since I don''t have the software for running them.

The usage is actually self explanatory.

// Data is the data as it was added
textarea.bind('tagClick', function (e, Data){
    // Normally you would use something more fancy, like jQuery UI dialog.
    var newLabel = window.prompt('New value', Data);

    if (newLabel)
        Data = newLabel;
@sstok sstok Added new event tagClick, for changing the tags current value
The event will receive the data as Item and must return it as an Item.
An actual test-case is currently missing but will be added shortly.

__Apparently I also removed some trailing whitespace.__

Thank you for the patch, I'll check it out shortly!

sstok commented Jan 25, 2012

There still some issues, the trigger expects an return. But that is not possible with dialogs that works with callbacks like most of them do.

So there must be a second method that will actually trigger the update.
Now I need to find a way to make a reference to that 'trigger' function possible from inside the callback.
And that where I'm stuck right now... My best shot is registering an internal callback that gets fired from inside the callback of the dialog.

@sstok sstok Changed the 'tagClick' event, the event must now call tagUpdate() exp…
…licitly to perform an update.

This fixes the previous issue of not being able to update the tag when using an dialog that uses callbacks.

	textarea.bind('tagClick', function(e, data, tag, self) {
		var newLabel = window.prompt('New value',;

		if (newLabel)
		{ = newLabel;

                        // Perform the update now
sstok commented Feb 16, 2012

The issue has been resolved, any change on seeing this getting merged soon?

@alexgorbatchev alexgorbatchev merged commit 8b3fbcb into alexgorbatchev:master Feb 19, 2012

@sstok Thanks for the path and idea. I've reimplemented it slightly to be more consistent with the rest of the code base. Please have a look 22edd91#L2R131

sstok commented Feb 20, 2012

Great! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment