[TW5] ViewTemplate strange behaviour

315 views
Skip to first unread message

mauloop

unread,
Oct 27, 2017, 6:17:28 PM10/27/17
to TiddlyWiki
I was playing with $:/core/ui/ViewTemplate in search of ways to change the tiddlers' look while I encountered something strange. It can be easily reproduced online on tiddlywiki.com site.

  1. Go to http://tiddlywiki.com/
  2. Edit the shadow tiddler $:/core/ui/ViewTemplate
  3. Find the opening <div> tag, immediately following the <$tiddler> widget declaration
    ...<$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>>...

  4. Place the cursor between the <$tiddler> and the <div> and insert a newline
    ...<$tiddler tiddler=<<currentTiddler>>>
    <div class=<<frame-classes>>>...

  5. Save and close, overwriting the shadow tiddler
Now click on any link in the page (both in the story or in the sidebar): it seems that tiddlers are opened, but the page doesn't scroll to the clicked tiddler. Il looks very strange to me that simply adding a newline could change the wiki behaviour. 

I first found something similar on a wiki I was working on, with a little different result. In that case I had a  working custom ViewTemplate with more changes and I inserted some newline to make the code more readable. When I saved the "beautified" ViewTemplate it happened that clicking on any link raised a Javascript error.

TypeError: this.getLastFrame(...).getBoundingClientRect is not a function

I rolled back my newline one by one, until I came to this and the error was fixed. So I decided to test it on the Tiddlywiki site to see if it was just because of my changes. As I said on the site the behaviour is also unexpected, even if a little bit different.

I was wandering why the ViewTemplate code has been written on a single line. Now I realize that maybe it was for a reason like this.

Also I don't understand the meaning of:

<$tiddler tiddler=<<currentTiddler>>>

since the TiddlerWidget reference tells: The TiddlerWidget is used to set a value for the current tiddler variable. I fell in a loop. Please, help me.

mauloop

unread,
Oct 27, 2017, 6:54:07 PM10/27/17
to TiddlyWiki
I run one more test on tiddlywiki.com

Changed all the stuff in the ViewTemplate from:

\define frame-classes()
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$
\end
\define folded-state()
$:/state/folded/$(currentTiddler)$
\end
<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>><$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
</div>
</$tiddler></$set></$set>

to (just added some newline):

\define frame-classes()
tc-tiddler-frame tc-tiddler-view-frame $(missingTiddlerClass)$ $(shadowTiddlerClass)$ $(systemTiddlerClass)$ $(tiddlerTagClasses)$
\end

\define folded-state()
$:/state/folded/$(currentTiddler)$
\end

<$set name="storyTiddler" value=<<currentTiddler>>><$set name="tiddlerInfoState" value=<<qualify "$:/state/popup/tiddler-info">>><$tiddler tiddler=<<currentTiddler>>><div class=<<frame-classes>>>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!has[draft.of]]" variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
</div>
</$tiddler>
</$set>
</$set>


It is no possible to separate with any kind  of blank (I tried newline and space) the two SetWidget, the TiddlerWidget and the Div. It is still possible, as usual, to insert newlines between the opening and closing tag brackets (<>).

I can survive with this. I just would like to understand why.

mauloop

unread,
Oct 31, 2017, 12:10:35 PM10/31/17
to TiddlyWiki
Is there someone here about that could help me to understand the reasons for the behaviour I described?
And also the meaning of <$tiddler tiddler=<<currentTiddler>>>?

Mark S.

unread,
Oct 31, 2017, 12:16:24 PM10/31/17
to TiddlyWiki
I've been waiting to see any responses re part #1. The whole mechanism for scrolling/navigating to a tiddler are a mystery. As far as I could tell looking through the development console, there is no <a name=> link exposed. Yet, the sidebar links are using <a href=#name> so maybe it's hidden away in the dom somewhere.

On part #2, my guess is that this is leftover code from development. When I tried the template without the <$tiddler... it worked fine.

Good luck,
Mark

mauloop

unread,
Oct 31, 2017, 1:46:01 PM10/31/17
to TiddlyWiki
Thanks, Mark. I am not experienced with HTML, nor with CSS. Every answer is chance for me to learn something.

@TiddlyTweeter

unread,
Oct 31, 2017, 2:15:49 PM10/31/17
to TiddlyWiki
Ciao Mark S. & mauloop

I assume this is part of default TW action going into play that behaves untypically--i.e. HTML IDs don't work in TW as you'd normally think? They are reserved for Tiddler Titles only, I think.

I found it VERY confusing when I started--that a tiddler can't use IDs (#) within it for normal business.

Josiah

mauloop

unread,
Oct 31, 2017, 2:50:19 PM10/31/17
to TiddlyWiki
I hope I will find the time to learn more about HTML IDs. But the fact is (by the point of view of an absolutely HTML newbye, that is just what I am) that i simply clicked between two tags and pressed the ENTER key, unaware of IDs, links mechanism and all that stuff.

I think that having the chance to override the shadows tiddler to customize the wiki to own's taste is a great feature. This combined with macros and widgets gives to people like me the opportunity to build a wiki that fit exactly their needs. But if one falls in troubles with strange behaviour like this there could be chances that  one gives away thinking the work is to hard for him.

I spent about an hour rolling back my changes one by one to find the trick. :^(((


Mark S.

unread,
Oct 31, 2017, 3:23:53 PM10/31/17
to TiddlyWiki
I understand your frustration, but I don't thing that in general you are encouraged to modify things that way. The closer you get to the core code, the touchier things are likely to be.

In general, you would modify the ViewTemplate by overwriting the tiddlers that are tagged with "$:/tags/ViewTemplate" and or adding your own components tagged "$:/tags/ViewTemplate" . If you want to rearrange things, you can play with the order of tiddler subsections in the list field of "$:/tags/ViewTemplate".

Good luck!
Mark

mauloop

unread,
Oct 31, 2017, 4:35:53 PM10/31/17
to TiddlyWiki
Why not?

Probably I will be burned as an heretic, but I have already overwritten the $:/core/ui/PageTemplate. This let me have custom view and edit templates, dinamically selected based on a tiddler field. It works for me (at least it seems to work since about one week ago, that is when I did it). What's wrong in this?

However I appreciate very much your suggestions. Thanks for the attention.

)+(auloop

BJ

unread,
Oct 31, 2017, 6:02:19 PM10/31/17
to TiddlyWiki
The problem is that when the next version is released, if the shadow tiddler you modified has been updated you will have to redo all you changes in the context of the new shadow tiddler.

mau loop

unread,
Oct 31, 2017, 6:05:10 PM10/31/17
to tiddl...@googlegroups.com
Yes, of course.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/_nZI7Kt-UR0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7a7359b3-cf27-4606-b740-386a6d0bfef1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

BJ

unread,
Oct 31, 2017, 6:14:48 PM10/31/17
to TiddlyWiki
sometimes there is no other way. I have a few plugins that modify the core, one of which allows custom template - http://bjtools.tiddlyspot.com/#typestemplate here I modified the $:/core/ui/PageTemplate/story




On Tuesday, October 31, 2017 at 11:05:10 PM UTC+1, mauloop wrote:
Yes, of course.

Il 31/Ott/2017 23:02, "BJ" <bugg...@gmail.com> ha scritto:
The problem is that when the next version is released, if the shadow tiddler you modified has been updated you will have to redo all you changes in the context of the new shadow tiddler.

On Tuesday, October 31, 2017 at 9:35:53 PM UTC+1, mauloop wrote:
Why not?

Probably I will be burned as an heretic, but I have already overwritten the $:/core/ui/PageTemplate. This let me have custom view and edit templates, dinamically selected based on a tiddler field. It works for me (at least it seems to work since about one week ago, that is when I did it). What's wrong in this?

However I appreciate very much your suggestions. Thanks for the attention.

)+(auloop

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/_nZI7Kt-UR0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

mau loop

unread,
Oct 31, 2017, 7:05:43 PM10/31/17
to tiddl...@googlegroups.com
Yes, I did the same. I mean I changed PageTemplate/story, not PageTemplate as I said before.

By the way, I tried your plugin but was not able  to make it work. I will give it another try. I do not want to reinvent the wheel.

To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

mauloop

unread,
Oct 31, 2017, 7:48:29 PM10/31/17
to TiddlyWiki
@BJ
Still cannot make your typestemplate plugin work. I tried it directly on your site. Maybe for this I should better open a new thread.

BJ

unread,
Nov 1, 2017, 2:46:57 AM11/1/17
to TiddlyWiki
unfortunately 'bjtools' is out of date, the current version of this plugin in 1.13.3. I will put up a new version.

PMario

unread,
Nov 1, 2017, 5:47:47 AM11/1/17
to tiddl...@googlegroups.com
Hi mauloop,

I'll create several responses.

On Saturday, October 28, 2017 at 12:17:28 AM UTC+2, mauloop wrote:
Also I don't understand the meaning of:

<$tiddler tiddler=<<currentTiddler>>>

since the TiddlerWidget reference tells: The TiddlerWidget is used to set a value for the current tiddler variable. I fell in a loop. Please, help me.

IMO you need to qoute much more:

The TiddlerWidget is used to set a value for the current tiddler variable, valid within the scope of the TiddlerWidget.

The tiddler widget assigns several useful CSS classes to variables that it creates:

 - missingTiddlerClass
 - shadowTiddlerClass
 - systemTiddlerClass
 - tiddlerTagClasses

Since here it does make a huge difference. ...

The "currentTiddler" variable is, as most things in TW, just a convention. ... It's a very strong one, since it is hardcoded many times in the core js code. It's used as the default variable for the "tiddler" attribute, if the attribute is missing. eg:

<$transclude />

Which on its own doesn't make sense. ...

Only, if you see it within its context eg:

<$tiddler tiddler="MyOtherTiddler">
<div class=<<missingTiddlerClass>>>
<$transclude/>  <- this shows nothing if the tiddler doesn't exist.
</div>
</$tiddler>

Now it does something useful. ... If you have a look with the browser dev tools!

missingTiddlerClass macro/variable contains: tc-tiddler-missing or tc-tiddler-exists depending on MyOtherTiddler which allows the devs to use those classes to style content in different
ways ....


have fun!
mario



PMario

unread,
Nov 1, 2017, 6:02:00 AM11/1/17
to TiddlyWiki
On Saturday, October 28, 2017 at 12:17:28 AM UTC+2, mauloop wrote:
... and I inserted some newline to make the code more readable. When I saved the "beautified" ViewTemplate it happened that clicking on any link raised a Javascript error.

Yea ... As you found out, in TiddlyWiki's wiki syntax whitespace matters. ... There are a lot of pros and cons, ... but that's how it is desigend.

So adding whitespace for readability will "kill" many templates! ... There is a "historical" reason, why most of our existing templates are really hard to read.

BUT

Starting with TW 5.1.15 (the next version as of this writing) we will have a new \whitespace pragma.

\whitespace trim
\whitespace notrim

Which will allow us "hackers" to create readable templates. ... Also the core can / could be improved. In a not backwards compatible way, which will be a tough decision.

have fun!
mario


Message has been deleted

PMario

unread,
Nov 1, 2017, 6:09:35 AM11/1/17
to tiddl...@googlegroups.com
Sorry folks,
Somehow google did "eat" my content. So here's the repost.


On Wednesday, November 1, 2017 at 11:02:00 AM UTC+1, PMario wrote:
Starting with TW 5.1.15 (the next version as of this writing) we will have a new \whitespace pragma.

\whitespace trim
\whitespace notrim

For every "hacker" reading this ... Don't cheer too much!

The "trim" setting will create its own set of unwanted side effects. So using it blindly, will make the code more readable, but it may also break it!

have fun!
mario


PMario

unread,
Nov 1, 2017, 6:11:44 AM11/1/17
to TiddlyWiki
Hi


On Tuesday, October 31, 2017 at 5:10:35 PM UTC+1, mauloop wrote:
Is there someone here about that could help me to understand the reasons for the behaviour I described?
And also the meaning of <$tiddler tiddler=<<currentTiddler>>>?

PMario

unread,
Nov 1, 2017, 6:14:33 AM11/1/17
to tiddl...@googlegroups.com
On Tuesday, October 31, 2017 at 5:10:35 PM UTC+1, mauloop wrote:
Is there someone here about that could help me to understand the reasons for the behaviour I described?
And also the meaning of <$tiddler tiddler=<<currentTiddler>>>?

You may be interested in this short video, that I made as part of my "Script / ToDo Manager HowTo" series.

Script Todo Manager - lists and dynamic variables - 14 -> https://www.youtube.com/edit?o=U&video_id=fn58eth7C4o

It should shed some light onto your question.

have fun!
mario

PMario

unread,
Nov 1, 2017, 7:04:36 AM11/1/17
to tiddl...@googlegroups.com
On Tuesday, October 31, 2017 at 7:15:49 PM UTC+1, @TiddlyTweeter wrote:
I assume this is part of default TW action going into play that behaves untypically--i.e. HTML IDs don't work in TW as you'd normally think?

HTML IDs work exactly as expected in TW. ... You just shouldn't use them for several reasons. The HTML spec says, that html IDs need to be unique. ... But the spec doesn't know anything about transclusion and content reuse.  So code like this:

A tiddler named: htmlContent  containing:
<div id="test">some content</div>

A second tiddler named: test
{{htmlContent}}

If you have opened both tiddlers at the same time, which is possible and common with TW. You'll violate the html spec and browsers are confused and they may do unexpected things. Which on the other hand is unexpected and strange behaviour for the user.

So: TW is absolutely fine with 100 IDs with the same name on one page. Users are not!!!
 
They are reserved for Tiddler Titles only, I think.

NO .. They are not used at all, because they don't make sense in a TW context, because they need to be unique. .. As the spec says.

Mozilla says: >>The id global attribute defines a unique identifier (ID) which must be unique in the whole document.<<
 
I found it VERY confusing when I started--that a tiddler can't use IDs (#) within it for normal business.

As I wrote. TW is fine. I'm sorry to say: Users are the problem here!

.... I did find a nice blog post, that also talks about problems with "Spcificity" that can come up, if you use IDs in stylesheets.

Have a look at: https://cssguidelin.es/#specificity ... Especially the "conclusion" at IDs in CSS says it all: It is just not worth introducing the risk.

The whole post may be a nice read. Last update was May 2017 (at the time of this writing). So it should be up to date. Which is the most important thing about CSS instructions.

have fun!
mario


PMario

unread,
Nov 1, 2017, 7:15:52 AM11/1/17
to tiddl...@googlegroups.com
On Tuesday, October 31, 2017 at 7:50:19 PM UTC+1, mauloop wrote:
I hope I will find the time to learn more about HTML IDs.

... Just don't. ... Go with CSS classes. The whole TW UI styles are based on classes.

It's not worth the problems they will cause!
 
But the fact is (by the point of view of an absolutely HTML newbye, that is just what I am) that i simply clicked between two tags and pressed the ENTER key, unaware of IDs, links mechanism and all that stuff.

Yes. In TW wiki syntax whitespace matters. ... Thats expected for content, but can be confusing in templates. That's one reason, why templates are "kind of" hidden.
 
I think that having the chance to override the shadows tiddler to customize the wiki to own's taste is a great feature.

Yes. It is!
 
This combined with macros and widgets gives to people like me the opportunity to build a wiki that fit exactly their needs.

That's cool!
 
But if one falls in troubles with strange behaviour like this there could be chances that  one gives away thinking the work is to hard for him.

That's why it's cool, that you took the "hurdle" and posted here, instead of just going away. ... We need conversations like this one, to improve "the core" and make it simpler.

Version 5.1.15 will be one step forward with the \whitespace pragma.
 
I spent about an hour rolling back my changes one by one to find the trick. :^(((

You finally found it! That's a good sign!

Have fun!
mario
 


PMario

unread,
Nov 1, 2017, 10:23:34 AM11/1/17
to tiddl...@googlegroups.com
On Saturday, October 28, 2017 at 12:17:28 AM UTC+2, mauloop wrote:
Now click on any link in the page (both in the story or in the sidebar): it seems that tiddlers are opened, but the page doesn't scroll to the clicked tiddler. Il looks very strange to me that simply adding a newline could change the wiki behaviour. 

Yea, ... You found a rare behaviour, that I did also experience some time ago, when I did experiment with my own custom ViewTemplates. ... The point here is, that the code, that you have to dig down, is buried deep in the "core internals". I was too lazy, and at that time I even couldn't, dig deep enough ;) ... I try to describe it as high level as possible :)

--- high level info

Scrolling in TW is handled by different story-views, that you can find in the "right-sidebar: tools" menu.

At tiddlywiki.com there are 3 story-views

 - classic (default)
 - pop
 - zooming

Each of them treat "showing, removing, scrolling" tiddlers in a slightly different way. ... There are several other plugins.

---- low level info

Every storyview has a corresponding javascript module. classic.js, pop.js and zooming.js. ...
Every js module implements a function named: .navigateTo()


---- high level info

We can trigger this navigation function with eg: tw messages like tm-navigate which are created by different elements. eg: buttons, (see link docs)

tm-navigate is a user facing message, that can work with tiddler names. ... that's nice and easy (for users :)

--- low level info

When tm-navigate is executed, internally somewhere in the code a new low level message is triggered: tm-scroll

The tm-scroll message can't be directly used by the user, since it needs a DOM element as a target parameter, which can only be created by javascript.

Within js we call this mechanism "event-mechanism" and tm-scroll is an event-name or short event.

--- higher level info

Starting with V5.1.9-beta jeremy introduced the scrollable-widget which allows us users access to some of these mechanisms. 

The widget docs says:

If a scrollable widget can't handle the tm-scroll message because the inner DIV fits within the outer DIV, then by default the message falls through to the parent widget. Setting the fallthrough attribute to no prevents this behaviour.

Let's try a ASCII-art for the "fallthrough" mechanism:

child
   |
   +-- parent
        |
        +-- grandparent

So "child" triggers an event, but can't handle it. (That happens from time to time ;)
That's why it hands the event down to the parent. ...

The parent thinks: "I have no time", that's perfect for grandparent, so it's handed down again

Grandparent knows what to do and does, what needs to be done ;)

... In case that the child want's to keep the event secret, it set's "fallthrough" to no and doesn't hand it over.

--- low level info

In case of the "new-line" that you introduced, it now looks like this. (still simplified)

child
   |
   + new-line (stranger)
   +-- parent
        |
        +-- grandparent

As every child should know. Don't trust strangers. So it doesn't pass on the event.

And that's exactly what happens in the code. It detects the "stranger" and doesn't pass on the event.

----

That's exactly what you describe.

I first found something similar on a wiki I was working on, with a little different result. In that case I had a  working custom ViewTemplate with more changes and I inserted some newline to make the code more readable. When I saved the "beautified" ViewTemplate it happened that clicking on any link raised a Javascript error.

TypeError: this.getLastFrame(...).getBoundingClientRect is not a function

This shouldn't happen, because there are several "stranger" tests along the line. The point is. We can't navigate to whitespace, because the browser API doesn't provide enough info. We can only navigate to "wrapping" DOM elements.

---- low low level.


----  high level

hope that makes sense and helps

have fun
mario

PMario

unread,
Nov 1, 2017, 10:25:27 AM11/1/17
to TiddlyWiki
On Wednesday, November 1, 2017 at 3:23:34 PM UTC+1, PMario wrote:

Let's try a ASCII-art for the "fallthrough" mechanism:

child
   |
   +-- parent
        |
        +-- grandparent

If we reverse this mechanism it's called "event-bubbling", which you'll find very often if you search for DOM event handling

grandparent
   |
   +-- parent
        |
        +-- child


just some 2 cents
-m

mauloop

unread,
Nov 1, 2017, 10:35:25 AM11/1/17
to TiddlyWiki
Hi, Mario.

Thanks for your several answers. I'm reading them on my phone, that is not much comfortable.

I plan to come back soon to review everything carefully and look at the threads, videos and other resources that you suggested.

But I can't wait to thank you for your kindness and express my admiration for your skill. You are a mine of knowledge.

I've already posted here in the past and every time I found kind people that spended some of their time for me. Thanks to everyone.

)+(auloop

Mark S.

unread,
Nov 1, 2017, 11:04:13 AM11/1/17
to TiddlyWiki
That's a very nice explanation, Mario.

But it begs the question: Why is a 'line feed' rendered as a DOM object (div even?) and not just wrapped up in either the next or prior element?

About the scroll mechanism -- does it actually send out a series of scroll commands in order to line up the tiddler? Does it use any of the old HTML technology? I ask because the sidebar links seem to be usuing <a href=*> .

Thanks!
Mark

BJ

unread,
Nov 1, 2017, 2:50:44 PM11/1/17
to TiddlyWiki


On Wednesday, November 1, 2017 at 12:48:29 AM UTC+1, mauloop wrote:

PMario

unread,
Nov 1, 2017, 6:14:39 PM11/1/17
to TiddlyWiki
On Wednesday, November 1, 2017 at 3:35:25 PM UTC+1, mauloop wrote:
But I can't wait to thank you for your kindness and express my admiration for your skill.

You are welcome!
 
You are a mine of knowledge.

:)
 

I've already posted here in the past and every time I found kind people that spended some of their time for me. Thanks to everyone.

)+(auloop


Yea. I think that's the cool thing here in this group, which makes it worth while to be here :)

have fun!
mario

PMario

unread,
Nov 1, 2017, 7:01:27 PM11/1/17
to TiddlyWiki
On Wednesday, November 1, 2017 at 4:04:13 PM UTC+1, Mark S. wrote:
That's a very nice explanation, Mario.

thx.
 
But it begs the question: Why is a 'line feed' rendered as a DOM object (div even?) and not just wrapped up in either the next or prior element?

IMO it's a rare bug. ... But as I did discover it the first time, I wasn't able track it down. ... As I had a closer look at this thread, I could remember, that I've probably seen this problem already. ...

A line-feed isn't rendered as a DOM element, an that's the problem. If it would be one, it would be possible to scroll to it.

The whole truth here is, that the tm-xx messages bubble up the widget tree and not the DOM elements. BUT at the end, the DOM elements are used to calculate the real sizes of the different tiddler wrappers. Those sizes are used to calculate the scroll positions.

The wrapper for a tiddler is the "div" that is tagged tc-tiddler-frame, which is defined in the $:/core/ui/ViewTemplate. But the actual handling is done in the "storyview" which is part of the second list-widget in $:/core/ui/PageTemplate/story tiddler.

So the TW navigate to is only designed to scroll to tiddlers ... And not to scroll to elements inside of tiddlers. 

---- low level warning.

Also as I did post above. There is this line https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/storyviews/classic.js#L30 of code, which stops the event bubbling in the widget tree. Which imo shouldn't be done. ... imo a bug.

About the scroll mechanism -- does it actually send out a series of scroll commands in order to line up the tiddler?

 
Does it use any of the old HTML technology?

Yes. see scroller.js .. That's all HTML hi-tech ;)
 
I ask because the sidebar links seem to be usuing <a href=*> .

Yes, ... and it also adds additional event handlers that catch the click (and some other) events. see: https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/link.js#L123 ... If you follow the handleClickEvent function in the link.js file, you'll see where it starts and how it is "dispatched" line 143 this.dispatchEvent({ and where it stopped propagating. line 159 event.stopPropagation()

have fun!
mario

BJ

unread,
Nov 2, 2017, 4:31:31 AM11/2/17
to TiddlyWiki
Great detective work Mario. One solution could be to have findFirstDomNode() take a search parameter, findFirstDomNode(class=tc-tiddler-view-frame)

mauloop

unread,
Nov 3, 2017, 2:33:11 PM11/3/17
to TiddlyWiki
Hi, Mario.


Yea, ... You found a rare behaviour, that I did also experience some time ago, ...

It makes me happy to know that I am not the only one that sometimes break the toy.

 
 
At tiddlywiki.com there are 3 story-views

 - classic (default)
 - pop
 - zooming

Each of them treat "showing, removing, scrolling" tiddlers in a slightly different way. ... There are several other plugins.


This could be an explanation for the following.


 
I first found something similar on a wiki I was working on, with a little different result. In that case I had a  working custom ViewTemplate with more changes and I inserted some newline to make the code more readable. When I saved the "beautified" ViewTemplate it happened that clicking on any link raised a Javascript error.

TypeError: this.getLastFrame(...).getBoundingClientRect is not a function

This shouldn't happen, because there are several "stranger" tests along the line. The point is. We can't navigate to whitespace, because the browser API doesn't provide enough info. We can only navigate to "wrapping" DOM elements.


The fact is that on my own wiki I was using an alternate story-view: TopStoryView from @felixhayashi Tiddlymap site. I was with this setup while experimenting the Javascript error, while the same ViewTemplate change, applied in the Tiddlywiki site with classic story view, resulted in an abnormal scrolling behaviour, but no errors.



In any case I go back home with a lesson learned: think twice before attempt to restyle someone else code ;^)))

I need to work hard before I will be able to deal with js event handling, fallthrough and bubbling mechanism and the whole DOM logic. Maybe I'll do it. In the meantime Tiddlywiki give me a chance to get little results, even if I still have a lot to learn.



Thank you for your support and the clear explanation.

mauloop

unread,
Nov 3, 2017, 2:42:24 PM11/3/17
to TiddlyWiki
I'll try it asap.

PMario

unread,
Nov 3, 2017, 7:24:25 PM11/3/17
to TiddlyWiki
I did create an Issue at github
-m

mauloop

unread,
Nov 4, 2017, 8:33:08 PM11/4/17
to TiddlyWiki
Finally I was able to make your typestemplate working. If I would have it before it would have saved a lot of work to me.
I did something similar, even if with wiki syntax macros only. If you would like to take a look here it is

Thanks for your help.

)+(auloop


Il giorno mercoledì 1 novembre 2017 19:50:44 UTC+1, BJ ha scritto:

BJ

unread,
Nov 5, 2017, 2:47:18 AM11/5/17
to TiddlyWiki
This is quite  advanced stuff! Your solution looks good, although the storyview seems not to work.

It is good to see how some else solves the same problem.

mau loop

unread,
Nov 5, 2017, 5:36:14 AM11/5/17
to tiddl...@googlegroups.com
What is not working? I changed the filter that PageTemplate/story uses to select tiddlers to display in order to make it choose just the one listed in {{$:/History list!!current-tiddler}} or alternately the first one in {{$:/Story list!!list}}.

This makes more sense if you set new tiddlers opening policies to open always at the top,  so when you close a tiddlers you fall back to last one viewed (in most cases).

This works for me, if this was the part you refer as not working, but it's not required for the rest of the template to work.

I appreciate your feedback. Thanks in advance,

)+(auloop



--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/_nZI7Kt-UR0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

BJ

unread,
Nov 5, 2017, 12:35:30 PM11/5/17
to TiddlyWiki
I am seeing only one tiddler in the story at a time - this is the same/similar to the 'zooming' storyview, but I have the 'classic' storyview selected from the controlpanel (setting tab), maybe this is what you meant to happen.


On Sunday, November 5, 2017 at 11:36:14 AM UTC+1, mauloop wrote:
What is not working? I changed the filter that PageTemplate/story uses to select tiddlers to display in order to make it choose just the one listed in {{$:/History list!!current-tiddler}} or alternately the first one in {{$:/Story list!!list}}.

This makes more sense if you set new tiddlers opening policies to open always at the top,  so when you close a tiddlers you fall back to last one viewed (in most cases).

This works for me, if this was the part you refer as not working, but it's not required for the rest of the template to work.

I appreciate your feedback. Thanks in advance,

)+(auloop


Il 05/Nov/2017 08:47, "BJ" <bugg...@gmail.com> ha scritto:
This is quite  advanced stuff! Your solution looks good, although the storyview seems not to work.

It is good to see how some else solves the same problem.



On Sunday, November 5, 2017 at 1:33:08 AM UTC+1, mauloop wrote:
Finally I was able to make your typestemplate working. If I would have it before it would have saved a lot of work to me.
I did something similar, even if with wiki syntax macros only. If you would like to take a look here it is

Thanks for your help.

)+(auloop

Il giorno mercoledì 1 novembre 2017 19:50:44 UTC+1, BJ ha scritto:
I've put a demo here:

http://typestemplatedemo.tiddlyspot.com/

On Wednesday, November 1, 2017 at 12:48:29 AM UTC+1, mauloop wrote:
@BJ
Still cannot make your typestemplate plugin work. I tried it directly on your site. Maybe for this I should better open a new thread.

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/_nZI7Kt-UR0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

mau loop

unread,
Nov 5, 2017, 1:49:12 PM11/5/17
to tiddl...@googlegroups.com
Yes, I set the story-filter to have one tiddler at a time. I forgot to disable it before to load the demo. Just edit $:/plugins/mau/CustomTemplate/story-filter and set it to [list[$:/Storylist]] to have the usual default page layout. 

I need this single-tiddler mode and I can't use the zooming view, since I also use Tiddlymap, which doesn't like zooming mode very much, especially while in full screen.

To unsubscribe from this group and all its topics, send an email to tiddlywiki+unsubscribe@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages