Hi Vincent,
inline elements get their widths from the content width, so to get through
this, we have to understand the inline elements styling well.. this article
is helpful: [1]. From there, I get the idea that it is padding that should
be set. A simple solution: add to CSS
span[refresh="content"] { padding: 0 1em; }
or may be 0 1px. Try it, it allows to edit empty section transclusion. Now,
this has a number of drawbacks that you can see if you add this to
StyleSheet and use some transclusion, especially in
MainMenu/SideBarCommands, all of them originate from the fact that all
tiddler macros get padding, not only empty ones. So, something like [2] can
be done (after wikifying/refreshing) either with changing the display
property or with just changing padding.
I've tried to edit a section and a slice using this trick in the tiddler:
test
<<tiddler [[test##section]]>>
<<tiddler [[test::slice]]>>
|slice||
!section
Section is edited.. well, there comes the bug I've mentioned previously,
but the content of the section becomes what it was expected to become
(although, couple of times I got the content appended to !section without a
linebreak, but I can't reproduce that). But when I edit the slice through
the transclusion, I always get the content put to the wrong place: I write
"text" to the second transclusion, and get text|slice|| line saved instead
of |slice|text|.
Best regards,
Yakov.
[1] http://www.maxdesign.com.au/articles/inline/
[2]
http://stackoverflow.com/questions/11572905/min-width-on-inline-not-inline-block-behaving-element
четверг, 14 августа 2014 г., 18:09:38 UTC+4 пользователь Vincent Yeh
написал:
>
> Yakov,
>
> Thanks for the reply that showed me different results from what I had and
> got me to look further into the details for a cause. Fortunately I found
> it. It was the ExternalTiddlerPlugin that kept me from getting the empty
> slices. In the handler function of ExternalTiddlerPlugin (that overrides
> that of the original config.macros.tiddler.handler), an empty content is
> considered non-existing and gets skipped, without even creating the SPAN
> element. That's why I couldn't find it with an empty slice value.
>
> Removing the ExternalTiddlerPlugin I got the same results as you did: the
> original config.macros.tiddler.handler got executed and an empty SPAN got
> created. However, even though there is an empty SPAN created for an empty
> slice, the *twve* still cannot find it with the mouse pointer, *because
> the empty SPAN has zero width*. I'll need to think of some way
> particularly for that. Shall take a short while.
>
> Have Fun!
> Vincent
>
> On Sunday, August 10, 2014 10:21:45 PM UTC+8, Yakov wrote:
>
> Hi Vincent,
>
> basically, when you work with the mode changing/refreshing of the story,
> you shouldn't rely on displayMessage: in some cases, it fails to display
> messages (or, probably, the message is shown and closed so quickly that
> even the display doesn't actually show it). Instead, use console.log or
> alert (don't use the last one if you expect many messages, though; on the
> other hand, there are some cases when messages in the console are shown in
> an unexpected order).
>
> On the other hand, when I tried this plugin:
> //{{{
> config.macros.tiddler.handler =
> function(place,macroName,params,wikifier,paramString,tiddler)
> {
> console.log("msg");
> displayMessage("msg");
>
> var allowEval = true;
> var stack = config.macros.tiddler.tiddlerStack;
> if(stack.length > 0 && config.evaluateMacroParameters == "system") {
> // included tiddler and "system" evaluation required, so check
> tiddler tagged appropriately
> var title = stack[stack.length-1];
> var pos = title.indexOf(config.textPrimitives.sectionSeparator);
> if(pos != -1)
> title = title.substr(0,pos); // get the base tiddler title
>
> var t = store.getTiddler(title);
> if(!t || t.tags.indexOf("systemAllowEval") == -1)
> allowEval = false;
> }
> params = paramString.parseParams("name",null,allowEval,false,true);
> var names = params[0]["name"];
> var tiddlerName = names[0];
> var className = names[1] || null;
> var args = params[0]["with"];
> var wrapper = createTiddlyElement(place,"span",null,className,null,{
> refresh: "content", tiddler: tiddlerName
> });
> if(args!==undefined)
> wrapper.setAttribute("args","[["+args.join("]] [[")+"]]");
> this.transclude(wrapper,tiddlerName,args);
> };
> //}}}
>
> and these tiddlers:
> t1
> text
> |slice|slice value|
> |emptySlice||
> !section
> section text
> !empty section
> transcluding t1
> <<tiddler [[t1::slice]]>>
> <<tiddler [[t1::emtpySlice]]>>
> <<tiddler [[t1##section]]>>
> <<tiddler [[t1##empty section]]>>
>
> I've got this result: when I open "transcluding t1", no messages are shown
> at top-right corner of the screen and 4 messages are shown in console; when
> I open that tiddler in the edit mode and then press esc to return, I get
> all 4 message in both top-right and console. Finally, if I open the text in
> inline-edit mode, I get 4 messages and when I press esc, I have no
> messages. But most interesting part is when I actually add changes: when I
> enter the edit mode, change text and press "done", I get 2 messages at
> top-right and 4 messages in console. Counting messages after inline-editing
> is hindered by their amount..
>
> As for the DOM, I can see all 4 spans, but those that were created by
> empty transclusion, are empty as well..
>
> Best regards,
> Yakov.
>
> суббота, 9 августа 2014 г., 6:10:53 UTC+4 пользователь Vincent Yeh написал:
>
> Yakov,
>
> I was wrong about the empty slice/section things. I am having a problem
> beyond my knowledge and need help.
>
> After some tests I realized empty slices are not editable because (in the
> childNodes property of the parent) the *twve* cannot find the SPAN
> element created by <<tiddler>> macro to hold the empty slice.
>
> Then I looked into the *invokeMacro* and config.macros.*tiddler.handler*
> functions of TW2.8.1 and realized that *with empty slice value the
> handler function was called*
>
> ...
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.