Bookmark Class
A bookmark in the document.
Declaration
export class Bookmark
Remarks
The example below demonstrates how to create a bookmark:
var textInterval = richEdit.document.insertText(0, 'text');
var bookmark = richEdit.document.bookmarks.create(textInterval, 'bookmarkName');
Refer to the following topic for more examples: Bookmark.
Inheritance
Bookmark
Properties
index Property
Gets the bookmark’s index in a bookmark collection.
Declaration
get index(): number
Property Value
Type | Description |
---|---|
number | A zero-based index. |
interval Property
Gets the text buffer interval that contains the bookmark.
Declaration
get interval(): Interval
Property Value
Type | Description |
---|---|
Interval | The text buffer interval. |
Remarks
// returns a text of the specified bookmark
var bookmark = richEdit.document.bookmarks.find('bookmarkName')[0];
if (bookmark) {
var text = bookmark.subDocument.getText(bookmark.interval);
}
name Property
Returns a name of the bookmark.
Declaration
get name(): string
Property Value
Type | Description |
---|---|
string | The bookmark name. |
Remarks
A bookmark name should start with a letter and must be unique in the collection of bookmarks in the current document.
var bookmark = richEdit.document.bookmarks.find('bookmarkName')[0];
if (bookmark) {
var bookmarkInterval = bookmark.interval;
}
subDocument Property
Gets a sub-document where the bookmark is placed.
Declaration
get subDocument(): SubDocument
Property Value
Type | Description |
---|---|
SubDocument | The sub-document that contains the bookmark. |
Remarks
// returns a text of the specified bookmark
var bookmark = richEdit.document.bookmarks.find('bookmarkName')[0];
if (bookmark) {
var text = bookmark.subDocument.getText(bookmark.interval);
}
Methods
delete Method
Deletes the bookmark.
Declaration
delete(): void
Remarks
var bookmark = richEdit.document.bookmarks.find('bookmarkName')[0];
if (bookmark)
bookmark.delete();