diff --git a/plugins/tiddlywiki/dynannotate/examples/viewtemplate-text.tid b/plugins/tiddlywiki/dynannotate/examples/viewtemplate-text.tid new file mode 100644 index 000000000..15588c420 --- /dev/null +++ b/plugins/tiddlywiki/dynannotate/examples/viewtemplate-text.tid @@ -0,0 +1,98 @@ +title: $:/plugins/tiddlywiki/dynannotate/examples/viewtemplate/text + +\define click-annotation-actions() +<$action-setfield $tiddler="$:/temp/dynannotate/demo/annotation-title" $value=<>/> +\end + +\define create-annotation-actions() +<$action-createtiddler + $basetitle="$:/plugins/tiddlywiki/dynannotate/demo-annotation" + $savetitle={{{ [addprefix[$:/state/dynannotate/temp-save-title/]] }}} + annotate-tiddler=<> + annotate-text=<> + annotate-prefix=<> + annotate-suffix=<> + annotate-colour=<> +/> +<$set name="popup-coords" value={{{ [addprefix[$:/state/dynannotate/popup-selection/]get[text]] }}}> +<$action-deletetiddler $tiddler={{{ [addprefix[$:/state/dynannotate/popup-selection/]] }}}/> +<$action-setfield $tiddler="$:/temp/dynannotate/demo/annotation-title" $value={{{ [addprefix[$:/state/dynannotate/temp-save-title/]get[text]] }}}/> +<$action-popup $state={{{ [addprefix[$:/state/dynannotate/popup-annotation/]] }}} $coords=<>/> + +\end + +<$reveal tag="div" class="tc-tiddler-body" type="nomatch" stateTitle=<> text="hide" retain="yes" animate="yes"> +<$list filter="[all[current]!has[plugin-type]!field:hide-body[yes]]"> +
+<$dynannotate + filter="[all[shadows+tiddlers]!has[draft.of]annotate-tiddler]" + actions=<> + popup={{{ [addprefix[$:/state/dynannotate/popup-annotation/]] }}} + selection={{{ [addprefix[$:/state/dynannotate/selection/]] }}} + selectionPrefix={{{ [addprefix[$:/state/dynannotate/selection-prefix/]] }}} + selectionSuffix={{{ [addprefix[$:/state/dynannotate/selection-suffix/]] }}} + selectionPopup={{{ [addprefix[$:/state/dynannotate/popup-selection/]] }}} + search={{$:/temp/search}} + searchClass="tc-dynannotation-search-overlay-blurred" + searchMinLength={{$:/config/Search/MinLength}} +> +<$transclude mode="block"> +<$transclude tiddler="$:/language/MissingTiddler/Hint"/> + + +<$reveal type="popup" state={{{ [addprefix[$:/state/dynannotate/popup-annotation/]] }}} position="belowright" animate="yes" retain="yes" style="overflow-y:hidden;"> +
+
+<$tiddler tiddler={{$:/temp/dynannotate/demo/annotation-title}}> +

+

+This is an annotation +

+

+

+The annotation is stored in the tiddler: +

+

+<$link><$view field="title"/> +

+

+The annotated text is ''<$view field="annotate-text"/>''. +

+

+Annotation Colour: +<$macrocall $name='colour-picker' actions=""" +<$action-setfield $field="annotate-colour" $value=<>/> +"""/> +

+ +
+
+ +<$reveal type="popup" state={{{ [addprefix[$:/state/dynannotate/popup-selection/]] }}} position="belowright" animate="yes" retain="yes" style="overflow-y:hidden;"> +
+
+<$vars + text={{{ [addprefix[$:/state/dynannotate/selection/]get[text]] }}} + prefix={{{ [addprefix[$:/state/dynannotate/selection-prefix/]get[text]] }}} + suffix={{{ [addprefix[$:/state/dynannotate/selection-suffix/]get[text]] }}} + colour={{{ [addprefix[$:/state/dynannotate/annotation-colour/]get[text]] }}} +> +<$button actions=<>> +Create annotation + +

+Text: <$text text=<>/> +

+

+Prefix: <$text text=<>/> +

+

+Suffix: <$text text=<>/> +

+ +
+
+ +
+ + diff --git a/plugins/tiddlywiki/dynannotate/examples/viewtemplate.tid b/plugins/tiddlywiki/dynannotate/examples/viewtemplate.tid new file mode 100644 index 000000000..5922fd8d3 --- /dev/null +++ b/plugins/tiddlywiki/dynannotate/examples/viewtemplate.tid @@ -0,0 +1,29 @@ +title: $:/plugins/tiddlywiki/dynannotate/examples/viewtemplate +tags: $:/tags/dynannotateExamples +caption: View Template + +
+ +!! Using Dynannotate in the view template + +This example shows how to override the core view template with a custom template that includes dynannotate. It is disabled by default but can be enabled by clicking the button below. (Clicking the button below copies the custom view template from $:/plugins/tiddlywiki/dynannotate/examples/viewtemplate/text to $:/core/ui/ViewTemplate/body). + +Once enabled, this example demonstrates several features: + +* Highlighting of search results within tiddler bodies +* Creating annotations on any tiddler by selecting text and then clicking a colour in the resulting dropdown + +
+ +<$button> +<$action-setfield $tiddler="$:/core/ui/ViewTemplate/body" $field="text" $value={{$:/plugins/tiddlywiki/dynannotate/examples/viewtemplate/text}}/> +<$action-setfield $tiddler="$:/core/ui/ViewTemplate/body" $field="tags" $value="$:/tags/ViewTemplate"/> +Click here to use the custom view template + + +<$button> +<$action-deletetiddler $tiddler="$:/core/ui/ViewTemplate/body"/> +Click here to revert to the core view template + + +<$codeblock code={{$:/plugins/tiddlywiki/dynannotate/examples/viewtemplate/text}}/>