Skip to content

Conversation

@sstok
Copy link
Contributor

@sstok 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;
});

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.__
@alexgorbatchev
Copy link
Owner

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

@sstok
Copy link
Contributor Author

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.

…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.

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

		if (newLabel)
		{
			data.name = newLabel;

                        // Perform the update now
			self.tagUpdate(true);
		}
	});
@sstok
Copy link
Contributor Author

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
@alexgorbatchev
Copy link
Owner

@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
Copy link
Contributor Author

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants