Bookmark
Requires Revu 21.5 or above
Bookmark is an object that represents a bookmark in the Bookmarks Tab in Revu. See doc.bookmarkRoot to access the root bookmark node.
properties
children
Secure | Type | Access |
---|---|---|
No | array | R |
Returns an array of Bookmark objects representing the children of the bookmark. If there are no children, null is returned.
example:
function PrintBookmark(bookmark, indent) {
console.println(indent + bookmark.name)
var children = bookmark.children
if (children)
children.forEach(c => { PrintBookmark(c, indent + " ") })
}
PrintBookmark(this.bookmarkRoot, "")
color
Secure | Type | Access |
---|---|---|
No | array | R/W |
Color array specifying the bookmark's text color.
example:
this.bookmarkRoot.children[0].color = color.red
doc
Secure | Type | Access |
---|---|---|
No | object | R |
The Doc that contains the bookmark.
name
Secure | Type | Access |
---|---|---|
No | string | R/W |
The text of the bookmark. See children for an example.
open
Secure | Type | Access |
---|---|---|
No | boolean | R/W |
Specifies whether or not to show the bookmark collapsed in the tree.
example:
this.bookmarkRoot.children[0].open = false
parent
Secure | Type | Access |
---|---|---|
No | object | R |
The Bookmark object of the parent of the bookmark. If the bookmark is the root, then the parent is null.
style
Secure | Type | Access |
---|---|---|
No | number | R/W |
Text style of the bookmark
- 0: Normal
- 1: Italic
- 2: Bold
- 3: Bold-italic
this.bookmarkRoot.children[0].style = 2 // Bold
methods
createChild
Secure |
---|
No |
Creates a new bookmark
createChild(cName, cExpr, nIndex)
cName: The text of the new bookmark
cExpr: [optional] JavaScript expression to run when the bookmark is clicked. Default is ""
nIndex: [optional] The 0-based index into the children array. Default is 0
example:
this.bookmarkRoot.createChild("Click Me!", "app.alert('I was clicked')", 0)
execute
Secure |
---|
No |
Invokes the action of the bookmark
execute()
example:
this.bookmarkRoot.children[0].execute()
insertChild
Secure |
---|
No |
Moves an existing Bookmark to be a child of this bookmark.
insertChild(oBookmark, nIndex)
oBookmark: The existing Bookmark to move
nIndex: [optional] The 0 based index into the children array. Default is 0
remove
Secure |
---|
No |
Removes this bookmark and all its children
remove()
example:
this.bookmarkRoot.remove() // Removes all bookmarks
setAction
Secure |
---|
No |
Sets the bookmark action to the JavaScript expression
setAction(cScript)
cScript: JavaScript expression to run when the bookmark is clicked.
this.bookmarkRoot.children[0].setAction("app.alert('I was clicked')")