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

Copy
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

Copy
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

Copy
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

Example

Copy
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

Copy
this.bookmarkRoot.createChild("Click Me!", "app.alert('I was clicked')", 0)

execute

Secure
No

Invokes the action of the bookmark.

execute()

Example

Copy
this.bookmarkRoot.children[0].execute()

insertChild

Secure
No

Moves an existing Bookmark to be a child of the 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 the bookmark and all its children.

remove()

Example

Copy
this.bookmarkRoot.remove() // Removes all bookmarks

setAction

Secure
No

Sets the bookmark action to the JavaScript expression.

setAction(cScript)

Example

Copy
this.bookmarkRoot.children[0].setAction("app.alert('I was clicked')")

Resources

Revu 21

Revu JavaScript

JavaScript

The Revu API Reference Guide documents all JavaScript capabilities available in Revu.