mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Comments plugin: several enhancements
As proposed in #3378 * Experimental support for comments on the entire wiki (enable in the plugin config panel). Implemented as comments on $:/SiteTitle, with the comments appearing at the top of the story river * Refactor the "add comment" button actions so that they can be reused * Refactor the comment toolbar to be extensible via a system tag * Add an $:/AdvancedSearch canned filter for accessing all comments
This commit is contained in:
parent
097c87fa7b
commit
ec18a55033
8
plugins/tiddlywiki/comments/above-story.tid
Normal file
8
plugins/tiddlywiki/comments/above-story.tid
Normal file
@ -0,0 +1,8 @@
|
||||
title: $:/plugins/tiddlywiki/comments/above-story
|
||||
tags: $:/tags/AboveStory
|
||||
|
||||
<$reveal state="$:/config/Comments/EnableWikiComments" type="match" text="yes" default="no">
|
||||
<$tiddler tiddler="$:/SiteTitle">
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/comments/comments-template" mode="inline"/>
|
||||
</$tiddler>
|
||||
</$reveal>
|
@ -1,10 +1,7 @@
|
||||
title: $:/plugins/tiddlywiki/comments/add-comment-button
|
||||
|
||||
<$reveal state="$:/status/IsReadOnly" type="match" text="no" default="no" tag="div" class="tc-comment-button">
|
||||
<$button class="tc-btn-invisible">
|
||||
<$set name="username" value={{$:/status/UserName}} emptyValue="(anonymous)">
|
||||
<$action-createtiddler $basetitle={{{ [[Comment by ']addsuffix<username>addsuffix[' on ']addsuffix<currentTiddler>addsuffix[']] }}} comment-target=<<currentTiddler>> text="" edit-mode="yes"/>
|
||||
</$set>
|
||||
<$button class="tc-btn-invisible" actions={{$:/plugins/tiddlywiki/comments/add-comment-button}}>
|
||||
add comment {{$:/core/images/add-comment}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
|
@ -7,30 +7,9 @@ title: $:/plugins/tiddlywiki/comments/comments-template
|
||||
<div class="tc-comment-entry">
|
||||
<div class="tc-comment-entry-heading">
|
||||
<$link>{{!!creator}} at <$view field="modified" format="date" template="0hh:0mm:0ss DDD DDth MMM YYYY"/></$link>
|
||||
<$reveal state="$:/status/IsReadOnly" type="match" text="no" default="no" tag="span">
|
||||
<$reveal type="match" state="!!edit-mode" text="yes">
|
||||
<$button>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="edit-mode" $value="no"/>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="text" $value={{!!saved-text}}/>
|
||||
cancel
|
||||
</$button>
|
||||
<$button>
|
||||
<$action-deletetiddler $tiddler=<<currentTiddler>>/>
|
||||
delete
|
||||
</$button>
|
||||
<$button>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="edit-mode" $value="no"/>
|
||||
save
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="nomatch" state="!!edit-mode" text="yes">
|
||||
<$button>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="edit-mode" $value="yes"/>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="saved-text" $value={{!!text}}/>
|
||||
edit
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$reveal>
|
||||
<$list filter="[all[shadows+tiddlers]tag[$:/tags/CommentToolbarButton]!has[draft.of]]" variable="listItem">
|
||||
<$transclude tiddler=<<listItem>> mode="inline"/>
|
||||
</$list>
|
||||
</div>
|
||||
<div class="tc-comment-entry-body">
|
||||
<$reveal type="match" state="!!edit-mode" text="yes">
|
||||
|
@ -7,6 +7,12 @@ $description$
|
||||
</$button>
|
||||
\end
|
||||
|
||||
! Wiki Comments
|
||||
|
||||
<$checkbox tiddler="$:/config/Comments/EnableWikiComments" field="text" checked="yes" unchecked="no" default="no"> <$link to="$:/config/Comments/EnableWikiComments">Allow wiki-level comments as well as tiddler comments</$link> </$checkbox>
|
||||
|
||||
! Tiddler Comments
|
||||
|
||||
This filter expression determines which tiddlers will have commenting enabled:
|
||||
|
||||
<$edit-text tiddler="$:/config/Comments/EnableFilter" tag="input"/>
|
||||
|
5
plugins/tiddlywiki/comments/filter-all-comments.tid
Normal file
5
plugins/tiddlywiki/comments/filter-all-comments.tid
Normal file
@ -0,0 +1,5 @@
|
||||
title: $:/plugins/tiddlywiki/comments/filter-all-comments
|
||||
tags: $:/tags/Filter
|
||||
filter: [has[comment-target]!sort[modified]]
|
||||
description: All comments
|
||||
|
@ -8,3 +8,4 @@ This plugin provides a simple means for adding threaded comments to tiddlers.
|
||||
* Comments are attributed to the username stored in the system tiddler [[$:/status/UserName]]
|
||||
* By default, comments are available on all non-system tiddlers. The ''config'' tab lets you customise which tiddlers can accept comments by specifying a filter extension
|
||||
* The buttons for adding and editing comments are only available if the system tiddler [[$:/status/IsReadOnly]] is not set to `yes`
|
||||
* Use the "All comments" option in the $:/AdvancedSearch ''Filter'' tab to see or export all comments
|
||||
|
9
plugins/tiddlywiki/comments/sidebar-segment.tid
Normal file
9
plugins/tiddlywiki/comments/sidebar-segment.tid
Normal file
@ -0,0 +1,9 @@
|
||||
title: $:/plugins/tiddlywiki/comments/sidebar-segment
|
||||
tags: $:/tags/SideBarSegment
|
||||
list-after: $:/core/ui/SideBarSegments/site-subtitle
|
||||
|
||||
<$reveal state="$:/config/Comments/EnableWikiComments" type="match" text="yes" default="no">
|
||||
<$tiddler tiddler="$:/SiteTitle">
|
||||
<$transclude tiddler="$:/plugins/tiddlywiki/comments/add-comment-button" mode="inline"/>
|
||||
</$tiddler>
|
||||
</$reveal>
|
@ -17,6 +17,11 @@ tags: [[$:/tags/Stylesheet]]
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tc-sidebar-scrollable .tc-comment-button button {
|
||||
width: auto;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tc-comment-button button svg {
|
||||
fill: #26cb56;
|
||||
height: 2em;
|
||||
|
2
plugins/tiddlywiki/comments/tagsCommentToolbarButton.tid
Normal file
2
plugins/tiddlywiki/comments/tagsCommentToolbarButton.tid
Normal file
@ -0,0 +1,2 @@
|
||||
title: $:/tags/CommentToolbarButton
|
||||
list: [[$:/plugins/tiddlywiki/comments/toolbar-button-cancel]] [[$:/plugins/tiddlywiki/comments/toolbar-button-delete]] [[$:/plugins/tiddlywiki/comments/toolbar-button-save]] [[$:/plugins/tiddlywiki/comments/toolbar-button-edit]]
|
12
plugins/tiddlywiki/comments/toolbar-button-cancel.tid
Normal file
12
plugins/tiddlywiki/comments/toolbar-button-cancel.tid
Normal file
@ -0,0 +1,12 @@
|
||||
title: $:/plugins/tiddlywiki/comments/toolbar-button-cancel
|
||||
tags: $:/tags/CommentToolbarButton
|
||||
|
||||
<$reveal state="$:/status/IsReadOnly" type="match" text="no" default="no" tag="span">
|
||||
<$reveal type="match" state="!!edit-mode" text="yes">
|
||||
<$button>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="edit-mode" $value="no"/>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="text" $value={{!!saved-text}}/>
|
||||
cancel
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$reveal>
|
11
plugins/tiddlywiki/comments/toolbar-button-delete.tid
Normal file
11
plugins/tiddlywiki/comments/toolbar-button-delete.tid
Normal file
@ -0,0 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/comments/toolbar-button-delete
|
||||
tags: $:/tags/CommentToolbarButton
|
||||
|
||||
<$reveal state="$:/status/IsReadOnly" type="match" text="no" default="no" tag="span">
|
||||
<$reveal type="match" state="!!edit-mode" text="yes">
|
||||
<$button>
|
||||
<$action-deletetiddler $tiddler=<<currentTiddler>>/>
|
||||
delete
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$reveal>
|
12
plugins/tiddlywiki/comments/toolbar-button-edit.tid
Normal file
12
plugins/tiddlywiki/comments/toolbar-button-edit.tid
Normal file
@ -0,0 +1,12 @@
|
||||
title: $:/plugins/tiddlywiki/comments/toolbar-button-edit
|
||||
tags: $:/tags/CommentToolbarButton
|
||||
|
||||
<$reveal state="$:/status/IsReadOnly" type="match" text="no" default="no" tag="span">
|
||||
<$reveal type="nomatch" state="!!edit-mode" text="yes">
|
||||
<$button>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="edit-mode" $value="yes"/>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="saved-text" $value={{!!text}}/>
|
||||
edit
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$reveal>
|
11
plugins/tiddlywiki/comments/toolbar-button-save.tid
Normal file
11
plugins/tiddlywiki/comments/toolbar-button-save.tid
Normal file
@ -0,0 +1,11 @@
|
||||
title: $:/plugins/tiddlywiki/comments/toolbar-button-save
|
||||
tags: $:/tags/CommentToolbarButton
|
||||
|
||||
<$reveal state="$:/status/IsReadOnly" type="match" text="no" default="no" tag="span">
|
||||
<$reveal type="match" state="!!edit-mode" text="yes">
|
||||
<$button>
|
||||
<$action-setfield $tiddler=<<currentTiddler>> $field="edit-mode" $value="no"/>
|
||||
save
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$reveal>
|
Loading…
Reference in New Issue
Block a user