Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Jeremy Ruston
Your code is working for me in Chrome. I copied your tiddler text into a
new tiddler in editions/tw5.com/tiddlers, and then rebuilt index.html. On
opening it in the browser, I saw:

jscolor.js invoked $:/plugins/skeeve/jscolor.js:15
Leaving jscolor.js $:/plugins/skeeve/jscolor.js:21
EditTextWidget PostRender Called

The final message was because of rendering the search box in the sidebar.
If I then open the control panel I see:


$:/core/modules/utils/logger.js:30
5EditTextWidget PostRender Called

There's one postrender for each edit-text widget in the basic tab of the
control panel.

If I flick a tiddler into edit mode and add a field I see a number of
further notifications.

Best wishes

Jeremy






On Wed, Apr 9, 2014 at 11:09 AM, Stephan Hradek stephan.hra...@gmail.comwrote:

 I tried to get it to work, but I seem to fail.

 This is a minimal widget I wrote for testing:

 /*\
 title: $:/plugins/skeeve/jscolor.js
 type: application/javascript
 module-type: widget
 \*/
 (function(){

 /*jslint node: true, browser: true */
 /*global $tw: false */
 use strict;

 var EditTextWidget =
 require($:/core/modules/widgets/edit-text.js)[edit-text];

 console.log(jscolor.js invoked);

 EditTextWidget.prototype.postRender = function() {
 console.log(EditTextWidget PostRender Called);
 };

 console.log(Leaving jscolor.js);

 })();

 I see the jscolor.js invoked and the Leaving jscolor.js messages in
 the console, but I'd expect the EditTextWidget PostRender Called for
 every field editor to appear, but nothing happens.

 Does someone spot any mistake I made?




-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Stephan Hradek
Tested with a fresh download and it works as expected.

It did not work with the node.js version. I'm going to update that and test 
again.

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Stephan Hradek
Updated to 5.0.9prerelease and No! No EditTextWidget PostRender Called 
message at all :(

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Jeremy Ruston
 Updated to 5.0.9prerelease and No! No EditTextWidget PostRender Called
message at all :(

I ran my experiments against 5.0.9, too. Weird.

Best wishes

Jeremy



On Wed, Apr 9, 2014 at 1:11 PM, Stephan Hradek stephan.hra...@gmail.comwrote:

 Updated to 5.0.9prerelease and No! No EditTextWidget PostRender Called
 message at all :(




-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Stephan Hradek
So I've managed to get jscolor to display the picker for the color fields 
now.

The disadvantage is: The changes are not reflected in TW as jscolor is (of 
course) overwriting the focus and input events and I'm not understanding 
how I could solve that issue properly :(

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Stephan Hradek
I tried to call handleInputEvent alas I have no idea how to get it.

I tried this:

jscolor.color( domNode, { hash : true, onImmediateChange : 
EditTextWidget.prototype.handleInputEvent } );

But this gives me JavaScript errors.

I gues I need to get the handler somehow from my domNodeā€¦

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Jeremy Ruston
Hi Stephan

You'd have to pass a reference to the implementation of handleInputEvent.
Something like this:

var self = this;
...
jscolor.color( domNode, { hash : true, onImmediateChange :
self.handleInputEvent
} );

Best wishes

Jeremy



On Wed, Apr 9, 2014 at 3:42 PM, Stephan Hradek stephan.hra...@gmail.comwrote:

 I tried to call handleInputEvent alas I have no idea how to get it.

 I tried this:

 jscolor.color( domNode, { hash : true, onImmediateChange :
 EditTextWidget.prototype.handleInputEvent } );

 But this gives me JavaScript errors.

 I gues I need to get the handler somehow from my domNodeā€¦




-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Jeremy Ruston
Hi Stephan

I don't get it :(

 the handleInputEvent is attached to the domNode, right? So this is what I
 *thought* should work:


No, the handleInputEvent is a method on the edit-text widget.



 EditTextWidget.prototype.postRender = function() {
 var domNode = this.domNodes[0];
 if($tw.browser  this.document !== $tw.fakeDocument 
 domNode.getAttribute(type) === color) {
 jscolor.color( domNode, { hash : true, onImmediateChange :
 domNode.handleInputEvent } );
 }
 };

 I also ried:

 EditTextWidget.prototype.postRender = function() {
 var domNode = this.domNodes[0];
 if($tw.browser  this.document !== $tw.fakeDocument 
 domNode.getAttribute(type) === color) {
 jscolor.color( domNode, { hash : true, onImmediateChange :
 this.handleInputEvent } );
 }
 };

 But this throws JavaScript errors telling me that this.domNodes is
 undefined.


I don't know enough about how jscolor works. I'd expect it to be invoked on
an input element, and to augment that element with additional DOM nodes for
the colour picker. Does it hide the original input element, or try to
delete it?

this.domNodes is an array of the DOM nodes generated by a widget. The
widget is responsible for maintaining it as it creates and deletes DOM
nodes.

It might be helpful if you could share more of your code?

Best wishes

Jeremy



-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-09 Thread Stephan Hradek
I think I have it:

EditTextWidget.prototype.postRender = function() {
var domNode = this.domNodes[0];
var self = this;
if($tw.browser  this.document !== $tw.fakeDocument  
domNode.getAttribute(type) === color) {
jscolor.color( domNode, { hash : true, onImmediateChange : 
function() { self.handleInputEvent(this); } } );
}
};

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


[twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-07 Thread Stephan Hradek
The nightly FF won't run on my old OS X :(

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-07 Thread Stephan Hradek


Am Montag, 7. April 2014 18:53:22 UTC+2 schrieb Jeremy Ruston:

 Hi Stephan

 The edit-text widget has a postRender method that is called immediately 
 after the DOM nodes for the text input have been created. So if you 
 subclass it you can define that method and have it call jscolor to 
 initialise the picker.

 We could also replace the current instances of the colour picker in the 
 core templates with a transclusion or macro that you could more easily 
 override?


Both sounds promising. Could you give me links to github where I could find 
the relevant stuff? 

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.


Re: [twdev] Re: [TW5] Is anyone able to turn jscolor into a plugin?

2014-04-07 Thread Jeremy Ruston
 Both sounds promising. Could you give me links to github where I could
 find the relevant stuff?


Sure. The edit-text widget is here (highlighted on the line that invokes
postRender):

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/edit-text.js#L66


You'll find instances of the edit-text widget with type=color
in $:/snippets/paletteeditor and $:/TagManager

Best wishes

Jeremy


-- 
Jeremy Ruston
mailto:jeremy.rus...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
TiddlyWikiDev group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/d/optout.