What element is nodecontent.children[0].children[0] ?
If it is the <a> element that is created perhaps you can do something like:
nodeContent.querySelector("a.tc-tiddlylink");
On Friday, May 21, 2021 at 2:10:48 PM UTC+2 [email protected] wrote:
> I did do a *very ugly test* and it works (by overwriting the
> $:/plugins/ihm/tidgraph/utils.js tiddler).
>
> Now I need some help to get to the correct child nodecontent. Any ideas?
>
> Thanks for your help!!!
>
> This works in tidgraphs util.js:
> function makeNodeDiv(node) {
> var esctitle = encodeURIComponent(node.id);
> var title = getNodeTitle(node.id,tidtree);
> var isMissing = !$tw.wiki.tiddlerExists(node.id);
> var linkclass = isMissing ?
> "tc-tiddlylink-missing":"tc-tiddlylink-resolves";
> var linkclass = "tc-tiddlylink " + linkclass;
> var nodeclass = getNodeClasses(node);
> var nodecontent;
> if ( node.template ) {
> nodecontent = dm('div',{ "class": nodeclass,
> innerHTML: getRenderedNode(node) } );
> } else {
> var tidlink = dm('a',{"class": linkclass,
> text: title,
> attributes: { href: '#'+esctitle }
> });
> nodecontent = dm('div', {"class": nodeclass,
> children: [tidlink] });
> }
> // HACK TEST. NOT OK -> getting domNode by children array :( :(
> if (node && nodecontent && nodecontent.children[0] &&
> nodecontent.children[0].children[0]) {
> $tw.utils.makeDraggable({
> domNode: nodecontent.children[0].children[0],
> dragTiddlerFn: function() {return node.id;},
> widget: node.widget
> });
> }
> return nodecontent;
> }
>
> Op vrijdag 21 mei 2021 om 11:34:59 UTC+2 schreef Lean Product Innovation -
> Jonas Van Poucke:
>
>> Thanks, exactly! Thanks for the pointer.
>> I'll try to fix this myself but feel novice in this area..
>>
>> So if someone could hepl with adding this to TidGraph... :D
>>
>> Jonas
>>
>> Op vrijdag 21 mei 2021 om 11:06:29 UTC+2 schreef [email protected]:
>>
>>>
>>>
>>>> Given:
>>>> Nodes in tidgraph are rendered with <$link/>, just as in the demo's
>>>>
>>>
>>> I am not sure that this is correct. At first glance it seems like
>>> tidgraph creates <a> elements that look like they might have been generated
>>> by the <$link> widget, but have not.
>>>
>>> This is the core function that attaches the event listeners needed for
>>> drag and drop:
>>> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/utils/dom/dragndrop.js#L24
>>>
>>> This is how the link widget uses it:
>>> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/link.js#L134
>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/7b096a50-ed70-489b-ade8-8465a2820e2fn%40googlegroups.com.