Re: [twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2020-12-09 Thread ajarmund
Hi!

uplight-dev posted a nice way to catch anchor links 
 in story.js, and ids 
can easily added in heading.js 
,
 
so the problem I guess, as mentioned above, is making unique ids. I was 
wondering if it could be possible to generate ids in heading.js by keeping 
track of nested headings, say we have a tiddler called "tiddlertitle";

! Header1 <- id = tiddlertitle:Header1
!! Header2 <- id = tiddlertitle:Header1:Header2
!!! Header3 <- id = tiddlertitle:Header1:Header2:Header3
!! Header2b <- id = tiddlertitle:Header1:Header2b
!!! Header3 <- id = tiddlertitle:Header1:Header2b:Header3

Can the parser keep track of this, or will it be awfully complicated?

It wouldn't guarantee uniqueness, of course, but it could still be useful, 
especially if transclusions would be treated as "ordinary" tiddler content 
(inheriting the nesting from the transcluding tiddler). Is the structure of 
when/how different parts of the wiki/DOM is parsed documented anywhere?

Best,
Anders

torsdag 19. september 2019 kl. 10:48:21 UTC+2 skrev Riz:

> Hi Tony,
>
> Thanks for the reply. You are right, that would not have scaled well. 
> Plus, we have a solution. Possibly something we can expand upon too! See 
> above
>
> Sincerely,
> Riz
>
> On Thursday, 19 September 2019 13:33:38 UTC+5:30, TonyM wrote:
>>
>> Riz,
>>
>> I understand. This limitation is really because we have a dynamic HTML 
>> page here, and the HTML standards did not seem to predict how we can use it 
>> in tiddlywiki.
>>
>> One passing thought, what if select tiddlers not already in the "visible" 
>> story, could be display: none (as opposed to display: hidden) below the 
>> story and somehow displayed when an anchor to something in them is 
>> activated. This of course may not scale too well, but may work for a large 
>> number of cases. Come to think of it tiddlers are in memory anyway, perhaps 
>> its is not so silly.
>>
>> Tiddlers to be treated this way could be tagged as such, and those not in 
>> the current story are "display: None" and once opened and displayed are 
>> not. In some ways this would be an open tiddler cache and since present on 
>> the page should be fully addressable with anchors. This could also be used 
>> to activate on demand stylesheets.
>>
>> Regards
>> Tony
>>
>> On Thursday, September 19, 2019 at 3:40:20 PM UTC+10, Riz wrote:
>>>
>>> I am aware of that. However if I recall correctly, 
>>> 1. it only aids navigation if the link and id exists within same tiddler 
>>> or 
>>> will scroll to id if it is already present in storylist. 
>>> 2. Need to modify ids to fit its unconventional pattern. 
>>>
>>> You see, the code given in my original post already solved the issue of 
>>> scrolling to an id if it exists in the storylist, without having to 
>>> modify 
>>> ids in any manner. My issue was if the id is not present in the story 
>>> list, 
>>> it takes 2 clicks to achieve the navigation: first to bring tiddler to 
>>> storylist, second to scroll. 
>>>
>>> On 19 September 2019 11:02:41 AM TonyM  wrote: 
>>>
>>> > If it helps there is prior work on using anchors in tiddlywiki. It 
>>> relies 
>>> > on an unconventional use of ## 
>>> > 
>>> > Regards 
>>> > Tont 
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to a topic in the 
>>> > Google Groups "TiddlyWikiDev" group. 
>>> > To unsubscribe from this topic, visit 
>>> > 
>>> https://groups.google.com/d/topic/tiddlywikidev/NcCXnZu-OJE/unsubscribe. 
>>>
>>> > To unsubscribe from this group and all its topics, send an email to 
>>> > tiddly...@googlegroups.com. 
>>> > To view this discussion on the web visit 
>>> > 
>>> https://groups.google.com/d/msgid/tiddlywikidev/7dd87c37-15ad-447d-8316-6db99459c52c%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/8e7a0e06-8b8d-435e-8f32-419fb9e9f81bn%40googlegroups.com.


Re: [twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-19 Thread Riz
Hi Tony,

Thanks for the reply. You are right, that would not have scaled well. Plus, 
we have a solution. Possibly something we can expand upon too! See above

Sincerely,
Riz

On Thursday, 19 September 2019 13:33:38 UTC+5:30, TonyM wrote:
>
> Riz,
>
> I understand. This limitation is really because we have a dynamic HTML 
> page here, and the HTML standards did not seem to predict how we can use it 
> in tiddlywiki.
>
> One passing thought, what if select tiddlers not already in the "visible" 
> story, could be display: none (as opposed to display: hidden) below the 
> story and somehow displayed when an anchor to something in them is 
> activated. This of course may not scale too well, but may work for a large 
> number of cases. Come to think of it tiddlers are in memory anyway, perhaps 
> its is not so silly.
>
> Tiddlers to be treated this way could be tagged as such, and those not in 
> the current story are "display: None" and once opened and displayed are 
> not. In some ways this would be an open tiddler cache and since present on 
> the page should be fully addressable with anchors. This could also be used 
> to activate on demand stylesheets.
>
> Regards
> Tony
>
> On Thursday, September 19, 2019 at 3:40:20 PM UTC+10, Riz wrote:
>>
>> I am aware of that. However if I recall correctly, 
>> 1. it only aids navigation if the link and id exists within same tiddler 
>> or 
>> will scroll to id if it is already present in storylist. 
>> 2. Need to modify ids to fit its unconventional pattern. 
>>
>> You see, the code given in my original post already solved the issue of 
>> scrolling to an id if it exists in the storylist, without having to 
>> modify 
>> ids in any manner. My issue was if the id is not present in the story 
>> list, 
>> it takes 2 clicks to achieve the navigation: first to bring tiddler to 
>> storylist, second to scroll. 
>>
>> On 19 September 2019 11:02:41 AM TonyM  wrote: 
>>
>> > If it helps there is prior work on using anchors in tiddlywiki. It 
>> relies 
>> > on an unconventional use of ## 
>> > 
>> > Regards 
>> > Tont 
>> > 
>> > -- 
>> > You received this message because you are subscribed to a topic in the 
>> > Google Groups "TiddlyWikiDev" group. 
>> > To unsubscribe from this topic, visit 
>> > https://groups.google.com/d/topic/tiddlywikidev/NcCXnZu-OJE/unsubscribe. 
>>
>> > To unsubscribe from this group and all its topics, send an email to 
>> > tiddly...@googlegroups.com. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/tiddlywikidev/7dd87c37-15ad-447d-8316-6db99459c52c%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/16d33e2a-99df-452e-89b1-62fba39d8c15%40googlegroups.com.


[twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-19 Thread Riz
Thank you Mario!!!
Just saved me hours of further headbashing.

So status report. I don't have enough knowledge about the codebase to add a 
post navigation hook. 
Instead, I tried adding the event in handleNavigate function after the 
actual navigation code. This did not work either.

But settimeout worked!! Through trial and error, I reached the conclusion 
that 4ms is the minimum time delay required to let the browser find the 
newly added id.
My assumption is, this 5ms mark is either dependent on the specifications 
of the system running it, or dependent on some setting in TW5 code. 
However for my purposes, this is far more than enough. Now I have a widget 
that can navigate to an id defined midway in a tiddler, if the tiddler name 
and id name is given as parameters.


May I suggest something interesting that come up during this endeavor. As 
coda mentioned above, TW5 cannot use ids for subtiddler navigation. However 
we can use practically anything else.
Imagine an action widget that says

document.querySelector("div > p.myclass").scrollIntoView();



May be TW5 can even specify some data-Attribute value set aside for this? 
Like


val element = document.querySelector("h1[data-anchor=firstlink]");
element.scrollIntoView();


Sincerely
Riz


On Thursday, 19 September 2019 12:51:19 UTC+5:30, PMario wrote:
>
> Hi Riz, 
>
> You are right. The IDs are not available at the time the widget is called 
> the first time. 
>
> You could try an "ugly hack" with setTimeout(). You could wrap your if (
> document.getElementById(this.uniqueid) != null) {
> code into a function eg: delayScrollIntoView()... or something similar. 
> And call it from setTimeout() eg: $:/config/AnimationDuration + 50 ms
>
> Or hardcoded 450ms. .. 
>
> just an idea. 
>
> There is a th-navigating 
>  hook, but it is 
> called to early. ... So if you want a clean fix, it would be needed to 
> create a th-post-navigating hook. 
>
> have fun!
> mario
>
>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/2403e6df-9a2c-4a3c-b145-c2d2d48c7eaf%40googlegroups.com.


Re: [twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-19 Thread TonyM
Riz,

I understand. This limitation is really because we have a dynamic HTML page 
here, and the HTML standards did not seem to predict how we can use it in 
tiddlywiki.

On passing thought what if select tiddlers not already in the "visible" 
story, could be display: none (as opposed to display: hidden) below the 
story and somehow displayed when an anchor to something in them is 
activated. This of course may not scale too well, but may work for a large 
number of cases. Come to think of it tiddlers are in memory anyway, perhaps 
its is not so silly.

Tiddlers to be treated this way could be tagged as such, and those not in 
the current story are "display: None" and once opened and displayed are 
not. In some ways this would be an open tiddler cache and since present on 
the page should be fully addressable with anchors. This could also be used 
to activate on demand stylesheets.

Regards
Tony

On Thursday, September 19, 2019 at 3:40:20 PM UTC+10, Riz wrote:
>
> I am aware of that. However if I recall correctly, 
> 1. it only aids navigation if the link and id exists within same tiddler 
> or 
> will scroll to id if it is already present in storylist. 
> 2. Need to modify ids to fit its unconventional pattern. 
>
> You see, the code given in my original post already solved the issue of 
> scrolling to an id if it exists in the storylist, without having to modify 
> ids in any manner. My issue was if the id is not present in the story 
> list, 
> it takes 2 clicks to achieve the navigation: first to bring tiddler to 
> storylist, second to scroll. 
>
> On 19 September 2019 11:02:41 AM TonyM > 
> wrote: 
>
> > If it helps there is prior work on using anchors in tiddlywiki. It 
> relies 
> > on an unconventional use of ## 
> > 
> > Regards 
> > Tont 
> > 
> > -- 
> > You received this message because you are subscribed to a topic in the 
> > Google Groups "TiddlyWikiDev" group. 
> > To unsubscribe from this topic, visit 
> > https://groups.google.com/d/topic/tiddlywikidev/NcCXnZu-OJE/unsubscribe. 
>
> > To unsubscribe from this group and all its topics, send an email to 
> > tiddly...@googlegroups.com . 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/tiddlywikidev/7dd87c37-15ad-447d-8316-6db99459c52c%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/a6044dea-7a31-4a33-a807-ca3bfa6a0c67%40googlegroups.com.


[twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-19 Thread PMario
Hi Riz, 

You are right. The IDs are not available at the time the widget is called 
the first time. 

You could try an "ugly hack" with setTimeout(). You could wrap your if (
document.getElementById(this.uniqueid) != null) {
code into a function eg: delayScrollIntoView()... or something similar. And 
call it from setTimeout() eg: $:/config/AnimationDuration + 50 ms

Or hardcoded 450ms. .. 

just an idea. 

There is a th-navigating 
 hook, but it called 
to early. ... So if you want a clean fix, it would be needed to create a 
th-post-navigating hook. 

have fun!
mario


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/edf0d927-8e43-48b1-9d99-90fe1c2203a4%40googlegroups.com.


Re: [twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-18 Thread Rizwan Ishak

I am aware of that. However if I recall correctly,
1. it only aids navigation if the link and id exists within same tiddler or 
will scroll to id if it is already present in storylist.

2. Need to modify ids to fit its unconventional pattern.

You see, the code given in my original post already solved the issue of 
scrolling to an id if it exists in the storylist, without having to modify 
ids in any manner. My issue was if the id is not present in the story list, 
it takes 2 clicks to achieve the navigation: first to bring tiddler to 
storylist, second to scroll.


On 19 September 2019 11:02:41 AM TonyM  wrote:

If it helps there is prior work on using anchors in tiddlywiki. It relies 
on an unconventional use of ##


Regards
Tont

--
You received this message because you are subscribed to a topic in the 
Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/tiddlywikidev/NcCXnZu-OJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/7dd87c37-15ad-447d-8316-6db99459c52c%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/16d4808d750.2c2e.15c58acba4fc6f75abd783d5836e0254%40gmail.com.


Re: [twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-18 Thread TonyM


If it helps there is prior work on using anchors in tiddlywiki. It relies on an 
unconventional use of ## 

Regards
Tont

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/7dd87c37-15ad-447d-8316-6db99459c52c%40googlegroups.com.


Re: [twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-18 Thread coda coder
Sorry. My bad. I didn't read the whole thing. :blush:

On Wednesday, September 18, 2019 at 9:53:50 PM UTC-5, Riz wrote:
>
> Hey Coda,
> I understand that. This is a special case scenario where usual TW stuff 
> like transclusion won't be used. Plus, I cannot help the existence of ids 
> in the content. As I pointed out, I am merely saving content from the web, 
> which already has ids and id based navigation. 
>
> On 19 September 2019 8:14:08 AM coda coder  > wrote:
>
>> Hi Riz
>>
>> You should probably read my response here before you spend any more time 
>> with this: 
>> https://groups.google.com/d/msg/tiddlywikidev/C2JWmchpyaw/czI86aDvAAAJ
>>
>> But understand, no one will *stop* you creating ids... if they are 
>> replicated via transclusion, DOM APIs will return a node collection. But 
>> the problem there is, no one *expects* ids to be duplicated and return 
>> an array/collection.
>>
>> On Wednesday, September 18, 2019 at 9:28:31 PM UTC-5, Riz wrote:
>>>
>>> I was collecting a lot of articles in my TW. Now these HTML obviously 
>>> have tags with ids associated especially headings (eg: >> id="myid">Subheading). 
>>> I was trying to build a build a widget to navigate to these ids (I guess 
>>> the term is subtiddler navigation)
>>>
>>> The idea is to have a widget that takes two parameters: a title and an 
>>> id. It should then add the tiddler to the storylist followed by scrolling 
>>> to the id. 
>>>
>>> Now I was partially successful in getting what I want by tweaking 
>>> action-navigate widget. Below is the relevant part of widget.
>>>
>>> this.dispatchEvent({
>>> type: "tm-navigate",
>>> navigateTo: this.actionTo === undefined ? this.getVariable(
>>> "currentTiddler") : this.actionTo,
>>> navigateFromTitle: this.getVariable("storyTiddler"),
>>> navigateFromNode: triggeringWidget,
>>> navigateFromClientRect: bounds && { top: bounds.top, left: 
>>> bounds.left, width: bounds.width, right: bounds.right, bottom: bounds.
>>> bottom, height: bounds.height
>>> },
>>> navigateSuppressNavigation: true
>>> });
>>>
>>> 
>>> if (document.getElementById(this.uniqueid) != null) {
>>> document.getElementById(this.uniqueid).scrollIntoView();
>>> }
>>>
>>>
>>>
>>>
>>> As you can see, it only works if you double click the button. At first 
>>> click the tiddler is added to storylist, and second click scrolls the id 
>>> into view (Note that the navigateSuppressNavigation must be set to true for 
>>> this to work). 
>>>
>>> I assume it cannot find the *id* right after the navigation is beacuse 
>>> there is a need for a *refresh* between the two steps? 
>>>
>>> My question is: Is there a way to achieve this?
>>>
>>> PS: I tried a few other things namely
>>> 1. Have two calls of action-widget under the same button like:
>>> <$button>
>>> <$action-anchor $to="MyTiddler" $id="uniqueid"/>
>>> <$action-anchor $to="MyTiddler" $id="uniqueid"/>
>>> 
>>>
>>>
>>> 2. Programmatically simulate double click on the button with 
>>> document.getElementsByClassName('my-unique-class')[0].dispatchEvent(new 
>>> MouseEvent('dblclick', {'bubbles': true})) 
>>>
>>>
>>>
>>> I mean, it is e, but it shows how desperate I am to get this to work.
>>>
>>>
>>> Sincerely
>>> Riz
>>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "TiddlyWikiDev" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/tiddlywikidev/NcCXnZu-OJE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> tiddly...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywikidev/20d1c3fb-5f94-427b-a7f5-ca10c27773eb%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/2306d871-638c-40f7-9bc2-e0b1dfe4e4a7%40googlegroups.com.


Re: [twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-18 Thread Rizwan Ishak

Hey Coda,
I understand that. This is a special case scenario where usual TW stuff 
like transclusion won't be used. Plus, I cannot help the existence of ids 
in the content. As I pointed out, I am merely saving content from the web, 
which already has ids and id based navigation.


On 19 September 2019 8:14:08 AM coda coder  
wrote:

Hi Riz

You should probably read my response here before you spend any more time 
with this: 
https://groups.google.com/d/msg/tiddlywikidev/C2JWmchpyaw/czI86aDvAAAJ


But understand, no one will stop you creating ids... if they are replicated 
via transclusion, DOM APIs will return a node collection. But the problem 
there is, no one expects ids to be duplicated and return an array/collection.


On Wednesday, September 18, 2019 at 9:28:31 PM UTC-5, Riz wrote:
I was collecting a lot of articles in my TW. Now these HTML obviously have 
tags with ids associated especially headings (eg: id="myid">Subheading).
I was trying to build a build a widget to navigate to these ids (I guess 
the term is subtiddler navigation)


The idea is to have a widget that takes two parameters: a title and an id. 
It should then add the tiddler to the storylist followed by scrolling to 
the id.


Now I was partially successful in getting what I want by tweaking 
action-navigate widget. Below is the relevant part of widget.



this.dispatchEvent({
type: "tm-navigate",
navigateTo: this.actionTo === undefined ? 
this.getVariable("currentTiddler") : this.actionTo,

navigateFromTitle: this.getVariable("storyTiddler"),
navigateFromNode: triggeringWidget,
navigateFromClientRect: bounds && { top: bounds.top, left: bounds.left, 
width: bounds.width, right: bounds.right, bottom: bounds.bottom, height: 
bounds.height

},
navigateSuppressNavigation: true
});


if (document.getElementById(this.uniqueid) != null) {
document.getElementById(this.uniqueid).scrollIntoView();
}






As you can see, it only works if you double click the button. At first 
click the tiddler is added to storylist, and second click scrolls the id 
into view (Note that the navigateSuppressNavigation must be set to true for 
this to work).


I assume it cannot find the id right after the navigation is beacuse there 
is a need for a refresh between the two steps?


My question is: Is there a way to achieve this?

PS: I tried a few other things namely

1. Have two calls of action-widget under the same button like:
<$button>
<$action-anchor $to="MyTiddler" $id="uniqueid"/>
<$action-anchor $to="MyTiddler" $id="uniqueid"/>




2. Programmatically simulate double click on the button with
document.getElementsByClassName('my-unique-class')[0].dispatchEvent(new 
MouseEvent('dblclick', {'bubbles': true}))





I mean, it is e, but it shows how desperate I am to get this to work.


Sincerely
Riz
--
You received this message because you are subscribed to a topic in the 
Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/tiddlywikidev/NcCXnZu-OJE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
tiddlywikidev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/20d1c3fb-5f94-427b-a7f5-ca10c27773eb%40googlegroups.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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/16d47708ef0.2c2e.15c58acba4fc6f75abd783d5836e0254%40gmail.com.


[twdev] Re: How to navigate to ids within a tiddler? Or How to add refresh between two steps of a widget

2019-09-18 Thread coda coder
Hi Riz

You should probably read my response here before you spend any more time 
with this: 
https://groups.google.com/d/msg/tiddlywikidev/C2JWmchpyaw/czI86aDvAAAJ

But understand, no one will *stop* you creating ids... if they are 
replicated via transclusion, DOM APIs will return a node collection. But 
the problem there is, no one *expects* ids to be duplicated and return an 
array/collection.

On Wednesday, September 18, 2019 at 9:28:31 PM UTC-5, Riz wrote:
>
> I was collecting a lot of articles in my TW. Now these HTML obviously have 
> tags with ids associated especially headings (eg:  id="myid">Subheading). 
> I was trying to build a build a widget to navigate to these ids (I guess 
> the term is subtiddler navigation)
>
> The idea is to have a widget that takes two parameters: a title and an id. 
> It should then add the tiddler to the storylist followed by scrolling to 
> the id. 
>
> Now I was partially successful in getting what I want by tweaking 
> action-navigate widget. Below is the relevant part of widget.
>
> this.dispatchEvent({
> type: "tm-navigate",
> navigateTo: this.actionTo === undefined ? this.getVariable(
> "currentTiddler") : this.actionTo,
> navigateFromTitle: this.getVariable("storyTiddler"),
> navigateFromNode: triggeringWidget,
> navigateFromClientRect: bounds && { top: bounds.top, left: bounds.
> left, width: bounds.width, right: bounds.right, bottom: bounds.bottom, 
> height: bounds.height
> },
> navigateSuppressNavigation: true
> });
>
> 
> if (document.getElementById(this.uniqueid) != null) {
> document.getElementById(this.uniqueid).scrollIntoView();
> }
>
>
>
>
> As you can see, it only works if you double click the button. At first 
> click the tiddler is added to storylist, and second click scrolls the id 
> into view (Note that the navigateSuppressNavigation must be set to true for 
> this to work). 
>
> I assume it cannot find the *id* right after the navigation is beacuse 
> there is a need for a *refresh* between the two steps? 
>
> My question is: Is there a way to achieve this?
>
> PS: I tried a few other things namely
> 1. Have two calls of action-widget under the same button like:
> <$button>
> <$action-anchor $to="MyTiddler" $id="uniqueid"/>
> <$action-anchor $to="MyTiddler" $id="uniqueid"/>
> 
>
>
> 2. Programmatically simulate double click on the button with 
> document.getElementsByClassName('my-unique-class')[0].dispatchEvent(new 
> MouseEvent('dblclick', {'bubbles': true})) 
>
>
>
> I mean, it is e, but it shows how desperate I am to get this to work.
>
>
> Sincerely
> Riz
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/20d1c3fb-5f94-427b-a7f5-ca10c27773eb%40googlegroups.com.