- Anno(context, selection, range, event, element, reverseSelector)
The
element
represents the closest common ancesstor of the nodes inrange
, which - in most cases - is limited to one element, anyways.- AnnoTip(settings) ⇒
AnnoTip
Initialize the annotation engine
The element
represents the closest common ancesstor of the nodes
in range
, which - in most cases - is limited to one element, anyways.
Kind: global function
Param | Type | Description |
---|---|---|
context | Object |
The context, as being passed to AnnoTip with the settings |
selection | String |
The content (text) that is selected |
range | Range |
The DOM nodes range, that this selection occupies |
event | Event |
The DOM Event that triggered the annotation mechanism |
element | Element |
The DOM element, holding the selection |
reverseSelector | String |
The CSS selector string pointing the the exact element. |
AnnoTip(settings) ⇒ AnnoTip
Initialize the annotation engine
Kind: global function
Returns: AnnoTip
- The instance just created.
Param | Type | Description |
---|---|---|
settings | Object |
Custom settings for the annotation engine. |
annoTip.attach(selector) ⇒ AnnoTip
This method can be invoked many times, with difference selectors.
Kind: instance method of AnnoTip
Returns: AnnoTip
- A self instance for chaining invocations.
Param | Type | Description |
---|---|---|
selector | String |
The jQuery selector to use for listing all elements to monitor. |
annoTip.applyAnnos(root, annos, handler) ⇒ AnnoTip
The routine initially fills the element
property of each annotation object, based
on the stored reverseSelector
and then, if a handler is passed, invokes it with the anno object.
Kind: instance method of AnnoTip
Returns: AnnoTip
- A self instance for chaining invocations.
Param | Type | Description |
---|---|---|
root | Element |
The base to be used for relative DOM paths stored in the annotations. |
annos | Array.<Anno> |
List of annotations in the same format, as they were created. |
handler | function |
The handler to be invoked for each annotation and located element. The expected format is: function (anno) . |
annoTip.discard() ⇒ AnnoTip
Close the annotation box, if it is openned at all.
Kind: instance method of AnnoTip
Returns: AnnoTip
- A self instance for chaining invocations.
annoTip.update(anno) ⇒ AnnoTip
Update the content and actions lines of the annotation box, based on the newly provided object.
Kind: instance method of AnnoTip
Returns: AnnoTip
- A self instance for chaining invocations.
Param | Type | Description |
---|---|---|
anno | Object |
The annotation object to be used for content resetting |
annoTip.detach() ⇒ AnnoTip
Detach the AnnoTip from the page.
Kind: instance method of AnnoTip
Returns: AnnoTip
- A self instance for chaining invocations.
Default settings.
Kind: static property of AnnoTip
The user-provided context to be added to each Anno created.
Kind: static property of defaults
Whether to install text selection monitoring. TextMonitor. Currently this is the only supported mode.
Kind: static property of defaults
Whether to install element click/handling mointoring. Not supported.
Kind: static property of defaults
A custom-provided HTML for action buttons, which are openned when a selection is recognized.
Kind: static property of defaults
Additional class-names to be applied to the annotation frame DOM element. Can be both array and string (with one or more class names).
Kind: static property of defaults
Options for css reverse selector, builder, used to construct the Anno
reverseSelector
property. Check https://www.npmjs.com/package/css-selector-generator.
Kind: static property of defaults
The settings to be passed to the underlying Tippy.js box engine. https://atomiks.github.io/tippyjs/.
Kind: static property of defaults
Handler to be invoked when a selection is made. The constructed Anno object is passed.
Kind: static property of defaults
Handler to be invoked on user action. The default actions are edit
, ok
and cancel
.
The constructed Anno object is passed.
Kind: static property of defaults
Handler to be invoked when the annotation box is about to be closed. The constructed Anno object is passed.
Kind: static property of defaults