tiddly-gittly / intention-tower-knowledge-graph

ITKG is a knowledge and task management framework for tiddlywiki.
https://tiddly-gittly.github.io/intention-tower-knowledge-graph/
MIT License
4 stars 1 forks source link

控制展示无法控制tabs #35

Closed dongrentianyu closed 1 year ago

dongrentianyu commented 1 year ago

用reveal只能控制展示显示正文与否,不能控制是否显示在tabs中。因为tabs是用标签来控制的。

image

日历记录下面没有正文,但日历记录这个条目还在。而且还不能通过text为空来判断。目前想到的方法是通过把条目标题前缀替换成控制条目的前缀然后判断正文里为show才表示这个条目能加入到tabs中。但这样并不好处理。如果这样处理不了,我觉得应该要替换掉tabs,用另一种方式来展示。

另一个小问题是修改了任务条目名称,原有的任务没有跟着改过去。而且也没有加上超级标签。

image

所以旁边都显示成空白了。但我看这个好像是写了一个宏来处理的,还比较复杂,有机会再看看怎么修复。

linonetwo commented 1 year ago

这个为啥官方侧边栏标签就能做到呢?可以参考一下他们的

dongrentianyu commented 1 year ago

官方侧边栏应该也是去除标签或者添加标签。我们不去除标签,而用reveal控制。而且官方也没有控制选项可以选。

dongrentianyu commented 1 year ago
<$macrocall
    $name="tabs"
    tabsList=" [all[tiddlers+shadows]tag[$:/tags/ITKG/UnderIntention]] -[prefix[$:/config/intention-tower-knowledge-graph/ViewTemplate]get[text]compare:string:eq[hide]search-replace[$:/config/],[$:/plugins/linonetwo/]] "
default="$:/plugins/linonetwo/intention-tower-knowledge-graph/ViewTemplate/ProjectsUnderThisIntentionFlowChartEcharts"
 />

用上面的方式也不生效。从prefix前缀筛选出控制条目,然后得到正文判断是hide,再把这些控制条目替换成正文条目,但同样失败。我觉得这背后还是太微某些机制不够方便,但我又说不上来是什么。或者确实有可以判断出来的方法。我去论坛搜索一下吧。如果没有合适的解决办法还是考虑换一种方式,写个div标签展示应该也可以。

dongrentianyu commented 1 year ago
<$macrocall
    $name="tabs"
    tabsList="[all[tiddlers+shadows]tag[$:/tags/ITKG/UnderIntention]] -[enlist{$:/config/HideMoreSideBarTabs}]"
default="$:/plugins/linonetwo/intention-tower-knowledge-graph/ViewTemplate/ProjectsUnderThisIntentionFlowChartEcharts"
 />

我真是愚蠢,原来有一种更好的方式。刚看论坛才明白过来。我们完全不需要通过reveal来控制,直接在$:/config/HideMoreSideBarTabs条目里写上内容。当然我们可以用按钮搞得自动化一点。这样某个条目就不会展示出来了。

dongrentianyu commented 1 year ago

我回头修改一下,提交pr。把之前写的reveal控制方式都删了。

dongrentianyu commented 1 year ago

这个按钮有点难做。要不写段文字让用户自己去编辑好了。再想想,又没有更好一点的办法。

dongrentianyu commented 1 year ago
\define itkg-checkbox(configname,realname)
 <$button 
    tooltip="去除条目" 
    aria-label="去除条目" 
    class=<<tv-config-toolbar-class>> >
    <$action-listops $tiddler="$configname$" $field="text"  $filter="[enlist:raw{!!text}] +[[$realname$]]"
  />
去除条目
  </$button>
 <$button 
    tooltip="显示条目" 
    aria-label="显示条目" 
    class=<<tv-config-toolbar-class>> >
<$action-listops $tiddler="$configname$" $field="text"  
 $filter="[enlist:raw{!!text}] -[[$realname$]]"  />
显示条目
  </$button>
\end

<<itkg-checkbox  
"$:/config/ViewTemplate/UnderProject"
"$:/plugins/linonetwo/intention-tower-knowledge-graph/ViewTemplate/AddProject">>

<<itkg-checkbox 
"$:/config/ViewTemplate/UnderProject"
"$:/plugins/linonetwo/intention-tower-knowledge-graph/ViewTemplate/TaskContext"  >>

上面的代码也不行,但还是贴上来,以免后续用到。主要的难点在于,需要把$:/config/ViewTemplate/UnderProject,能够同时删除或者添加,并且还需要前后添加空格。这个用action-listops来进行主导追加应该是能做到的,但不知道为什么没成功。其中也用了enlist等筛选器什么的,操作不了。

dongrentianyu commented 1 year ago

用enlist来处理。让用户手动复制一下,比做按钮要简单。