From acaa07a964a004759ddb8fb755484918b3322815 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 21 Jun 2018 08:36:15 +0100 Subject: [PATCH] First stab at a threaded commenting plugin --- core/images/add-comment.tid | 4 ++ editions/prerelease/tiddlywiki.info | 3 +- plugins/tiddlywiki/comments/EnableFilter.tid | 3 + .../comments/add-comment-button.tid | 10 +++ .../tiddlywiki/comments/comments-template.tid | 49 +++++++++++++++ plugins/tiddlywiki/comments/config.tid | 18 ++++++ .../comments/footer-view-template-segment.tid | 10 +++ .../comments/header-view-template-segment.tid | 9 +++ plugins/tiddlywiki/comments/plugin.info | 7 +++ plugins/tiddlywiki/comments/readme.tid | 10 +++ plugins/tiddlywiki/comments/sidebar.tid | 16 +++++ plugins/tiddlywiki/comments/styles.tid | 61 +++++++++++++++++++ 12 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 core/images/add-comment.tid create mode 100644 plugins/tiddlywiki/comments/EnableFilter.tid create mode 100644 plugins/tiddlywiki/comments/add-comment-button.tid create mode 100644 plugins/tiddlywiki/comments/comments-template.tid create mode 100644 plugins/tiddlywiki/comments/config.tid create mode 100644 plugins/tiddlywiki/comments/footer-view-template-segment.tid create mode 100644 plugins/tiddlywiki/comments/header-view-template-segment.tid create mode 100644 plugins/tiddlywiki/comments/plugin.info create mode 100644 plugins/tiddlywiki/comments/readme.tid create mode 100644 plugins/tiddlywiki/comments/sidebar.tid create mode 100644 plugins/tiddlywiki/comments/styles.tid diff --git a/core/images/add-comment.tid b/core/images/add-comment.tid new file mode 100644 index 000000000..3e77ed518 --- /dev/null +++ b/core/images/add-comment.tid @@ -0,0 +1,4 @@ +title: $:/core/images/add-comment +tags: $:/tags/Image + + \ No newline at end of file diff --git a/editions/prerelease/tiddlywiki.info b/editions/prerelease/tiddlywiki.info index 2a3216490..7ca277ce2 100644 --- a/editions/prerelease/tiddlywiki.info +++ b/editions/prerelease/tiddlywiki.info @@ -15,7 +15,8 @@ "tiddlywiki/savetrail", "tiddlywiki/external-attachments", "tiddlywiki/dynaview", - "tiddlywiki/codemirror" + "tiddlywiki/codemirror", + "tiddlywiki/comments" ], "themes": [ "tiddlywiki/vanilla", diff --git a/plugins/tiddlywiki/comments/EnableFilter.tid b/plugins/tiddlywiki/comments/EnableFilter.tid new file mode 100644 index 000000000..c5d46cec8 --- /dev/null +++ b/plugins/tiddlywiki/comments/EnableFilter.tid @@ -0,0 +1,3 @@ +title: $:/config/Comments/EnableFilter + +[all[current]!is[system]] diff --git a/plugins/tiddlywiki/comments/add-comment-button.tid b/plugins/tiddlywiki/comments/add-comment-button.tid new file mode 100644 index 000000000..49110c5ec --- /dev/null +++ b/plugins/tiddlywiki/comments/add-comment-button.tid @@ -0,0 +1,10 @@ +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 ']addsuffixaddsuffix[' on ']addsuffixaddsuffix[']] }}} comment-target=<> text="" edit-mode="yes"/> + +add comment {{$:/core/images/add-comment}} + + diff --git a/plugins/tiddlywiki/comments/comments-template.tid b/plugins/tiddlywiki/comments/comments-template.tid new file mode 100644 index 000000000..485e1d3c9 --- /dev/null +++ b/plugins/tiddlywiki/comments/comments-template.tid @@ -0,0 +1,49 @@ +title: $:/plugins/tiddlywiki/comments/comments-template + +
+
    +<$list filter="[all[tiddlers+shadows]comment-targetsort[created]!has[draft.of]]"> +
  1. +
    +
    +<$link>{{!!creator}} at <$view field="modified" format="date" template="0hh:0mm:0ss DDD DDth MMM YYYY"/> +<$reveal state="$:/status/IsReadOnly" type="match" text="no" default="no" tag="span"> +<$reveal type="match" state="!!edit-mode" text="yes"> +<$button> +<$action-setfield $tiddler=<> $field="edit-mode" $value="no"/> +<$action-setfield $tiddler=<> $field="text" $value={{!!saved-text}}/> +cancel + +<$button> +<$action-deletetiddler $tiddler=<>/> +delete + +<$button> +<$action-setfield $tiddler=<> $field="edit-mode" $value="no"/> +save + + +<$reveal type="nomatch" state="!!edit-mode" text="yes"> +<$button> +<$action-setfield $tiddler=<> $field="edit-mode" $value="yes"/> +<$action-setfield $tiddler=<> $field="saved-text" $value={{!!text}}/> +edit + + + +
    +
    +<$reveal type="match" state="!!edit-mode" text="yes"> +<$edit-text tiddler=<> tag="textarea"/> + +<$reveal type="nomatch" state="!!edit-mode" text="yes"> +<$transclude tiddler=<> mode="block"/> +<$transclude tiddler="$:/plugins/tiddlywiki/comments/add-comment-button" mode="inline"/> + +
    +
    +<$transclude tiddler="$:/plugins/tiddlywiki/comments/comments-template" mode="inline"/> +
  2. + +
+
diff --git a/plugins/tiddlywiki/comments/config.tid b/plugins/tiddlywiki/comments/config.tid new file mode 100644 index 000000000..5a58c659d --- /dev/null +++ b/plugins/tiddlywiki/comments/config.tid @@ -0,0 +1,18 @@ +title: $:/plugins/tiddlywiki/comments/config + +\define select(description,filter) +<$button> +<$action-setfield $tiddler="$:/config/Comments/EnableFilter" $value=<<__filter__>>/> +$description$ + +\end + +This filter expression determines which tiddlers will have commenting enabled: + +<$edit-text tiddler="$:/config/Comments/EnableFilter" tag="input"/> + +Or you can choose a preselected filter: + +* <> +* <