From 9b48a1c82955d1050c426fef559f42f4b8ec56e7 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 11 Mar 2020 16:55:19 +0000 Subject: [PATCH] Introducing "Dynannotate" plugin for overlaying annotations --- editions/prerelease/tiddlywiki.info | 1 + .../tiddlywiki/dynannotate/docs/history.tid | 33 ++ .../tiddlywiki/dynannotate/docs/readme.tid | 108 +++++ .../dynannotate/examples/combined.tid | 111 +++++ .../examples/example-annotation-1.tid | 5 + .../examples/example-annotation-2.tid | 5 + .../examples/example-annotation-3.tid | 5 + .../examples/example-annotation-4.json | 10 + .../dynannotate/examples/example-text.multids | 19 + .../dynannotate/examples/examples.tid | 4 + .../dynannotate/examples/simple.tid | 100 +++++ .../dynannotate/examples/snippets.tid | 56 +++ .../dynannotate/modules/dynannotate.js | 418 ++++++++++++++++++ .../dynannotate/modules/selection-tracker.js | 116 +++++ .../tiddlywiki/dynannotate/modules/textmap.js | 177 ++++++++ plugins/tiddlywiki/dynannotate/plugin.info | 9 + plugins/tiddlywiki/dynannotate/styles.tid | 44 ++ 17 files changed, 1221 insertions(+) create mode 100644 plugins/tiddlywiki/dynannotate/docs/history.tid create mode 100644 plugins/tiddlywiki/dynannotate/docs/readme.tid create mode 100644 plugins/tiddlywiki/dynannotate/examples/combined.tid create mode 100644 plugins/tiddlywiki/dynannotate/examples/example-annotation-1.tid create mode 100644 plugins/tiddlywiki/dynannotate/examples/example-annotation-2.tid create mode 100644 plugins/tiddlywiki/dynannotate/examples/example-annotation-3.tid create mode 100644 plugins/tiddlywiki/dynannotate/examples/example-annotation-4.json create mode 100644 plugins/tiddlywiki/dynannotate/examples/example-text.multids create mode 100644 plugins/tiddlywiki/dynannotate/examples/examples.tid create mode 100644 plugins/tiddlywiki/dynannotate/examples/simple.tid create mode 100644 plugins/tiddlywiki/dynannotate/examples/snippets.tid create mode 100644 plugins/tiddlywiki/dynannotate/modules/dynannotate.js create mode 100644 plugins/tiddlywiki/dynannotate/modules/selection-tracker.js create mode 100644 plugins/tiddlywiki/dynannotate/modules/textmap.js create mode 100644 plugins/tiddlywiki/dynannotate/plugin.info create mode 100644 plugins/tiddlywiki/dynannotate/styles.tid diff --git a/editions/prerelease/tiddlywiki.info b/editions/prerelease/tiddlywiki.info index e09b17189e..2dba4aed62 100644 --- a/editions/prerelease/tiddlywiki.info +++ b/editions/prerelease/tiddlywiki.info @@ -12,6 +12,7 @@ "tiddlywiki/savetrail", "tiddlywiki/external-attachments", "tiddlywiki/dynaview", + "tiddlywiki/dynannotate", "tiddlywiki/codemirror", "tiddlywiki/comments", "tiddlywiki/menubar" diff --git a/plugins/tiddlywiki/dynannotate/docs/history.tid b/plugins/tiddlywiki/dynannotate/docs/history.tid new file mode 100644 index 0000000000..2bfba30f3c --- /dev/null +++ b/plugins/tiddlywiki/dynannotate/docs/history.tid @@ -0,0 +1,33 @@ +title: $:/plugins/tiddlywiki/dynannotate/history + +!! v0.0.5 + +* Added support for displaying search snippets +* Fixed animated popups in the combined demo +* Added minimum length for dynannotate search string +* Added custom classes for search overlays +* Fix crash for malformed regexps + +!! v0.0.4 + +* Fix crash with Chrome search-in-page +* Improve docs + +!! v0.0.3 + +* Add support for showing the selection popup even for a zero length selection (ie clicking within the text without dragging) +* Add support for searching +* Refresh when browser or wrapper resizes +** Note that Dynannotate now requires the core TiddlyWiki plugin Dynaview +* Fixes problem with selections within HTML textareas or inputs +* Improved presentation of examples + +!! v0.0.2 + +* Adds support for Mobile Safari +* Split demo into multiple chunks +* Only show the selection popup when the selection is entirely within a selection container + +!! v0.0.1 + +Initial release diff --git a/plugins/tiddlywiki/dynannotate/docs/readme.tid b/plugins/tiddlywiki/dynannotate/docs/readme.tid new file mode 100644 index 0000000000..9142e16c25 --- /dev/null +++ b/plugins/tiddlywiki/dynannotate/docs/readme.tid @@ -0,0 +1,108 @@ +title: $:/plugins/tiddlywiki/dynannotate/readme + +The ''Dynannotate'' plugin allows annotations on textual content to be created and displayed. It has three components: + +* The dynannotate widget overlays clickable textual annotations, search highlights and search snippets on the content that it contains +* The selection tracker displays a popup that tracks the selection, and keeps track of the selected text. It also tracks a prefix and suffix that can be used to disambiguate the selected text within the container +* The `<$action-popup>` widget is used for some specialised popup switching in the demo + +''Note that the TiddlyWiki core plugin __Dynaview__ is required for correct operation of __Dynannotate__'' + +!! Dynannotate Widget + +The attributes of the `<$dynannotate>` widget describe annotations to be overlaid over the text contained within its child widgets. A single annotation can be directly applied using the attributes or multiple annotations can be applied by providing a filter identifying the "annotation tiddlers" that specify each annotation. + +The content of the `<$dynannotate>` widget should not contain HTML `` or `