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 <codacoder...@outlook.com > <javascript:>> 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: <h2 >>> id="myid">Subheading</h2>). >>> 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"/> >>> </$button> >>> >>> >>> 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 ewwww, 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 <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/tiddlywikidev/20d1c3fb-5f94-427b-a7f5-ca10c27773eb%40googlegroups.com >> >> <https://groups.google.com/d/msgid/tiddlywikidev/20d1c3fb-5f94-427b-a7f5-ca10c27773eb%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > >
-- 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.