Bookmark handling methods and properties
Properties:
Name | Type | Description |
---|---|---|
currentMark |
number | Currently focused bookmark for navigation |
visible |
boolean | Are bookmarks currently expanded |
Requires
Methods
add(num, byHeadline) → {boolean}
Add a bookmark or replace at specified index for current location
Parameters:
Name | Type | Description |
---|---|---|
num |
number | Bookmark index to add or replace at |
byHeadline |
boolean | Bookmark nearest headline |
Returns:
Success or failure
- Type
- boolean
Example
// Adds a bookmark for current position to first available slot 0-9
Marked.bookmarks.add();
bind(bool)
Enable or disable resize and update events
Parameters:
Name | Type | Description |
---|---|---|
bool |
boolean | whether to enable or disable bound events |
Example
// Enables resize and update listeners
Marked.bookmarks.bind(true);
// Disables listeners
Marked.bookmarks.bind(false);
clearAll()
Clear all stored bookmarks
Example
Marked.bookmarks.clearAll();
clearCurrent()
Clear the currently focused bookmark
Example
Marked.bookmarks.clearCurrent();
get(index) → {array}
Retrieve a collection of bookmarks or specific bookmark for the document
Parameters:
Name | Type | Description |
---|---|---|
index |
number | if set return bookmark at specific index |
Returns:
array of objects [{x:0,y:0,el:elementID[,elOffset:offset]}]
or
single object
- Type
- array
Example
// returns all bookmarks as an array
Marked.bookmarks.get();
// returns bookmark at index 1 (2nd bookmark)
Marked.bookmarks.get(1);
getPosition(index) → {object}
Get the current position of a bookmark, accounting for collapsed sections
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Index of bookmark to retrieve |
Returns:
Bookmark object {x,y,el,[elOffset]}
- Type
- object
Example
Marked.bookmarks.getPosition(2);
hide()
Compresses bookmarks to their almost-hidden size
Example
Marked.bookmarks.hide();
highlight()
Update the position of the scroll highlight on the minimap
Example
Marked.bookmarks.highlight();
save()
Store bookmark array to app memory
Example
Marked.bookmarks.get();
Marked.bookmarks.save();
scrollToIndex(index)
Scroll to document position by bookmark index
Parameters:
Name | Type | Description |
---|---|---|
index |
number | Index in bookmarks array |
Example
Marked.bookmarks.scrollToIndex(3);
set(index)
Set and store the current bookmark index for navigation
Parameters:
Name | Type | Description |
---|---|---|
index |
number | index of bookmark to set |
Example
Marked.bookmarks.set(4)
show()
Displays minimap and bookmarks
Example
Marked.bookmarks.show();
toggle()
Toggle expand/shrink bookmarks
Example
Marked.bookmarks.toggle()
update()
Update bookmark display
Example
Marked.bookmarks.update();
updateMap()
Force refresh the minimap
Example
Marked.bookmarks.updateMap();