返回介绍

tinymce-dom-BookmarkManager

发布于 2019-05-06 06:49:52 字数 3757 浏览 1267 评论 0 收藏 0

Constructors

namesummarydefined by
BookmarkManager()Constructs a new BookmarkManager instance for a specific selection instance.tinymce.dom.BookmarkManager

Methods

namesummarydefined by
getBookmark()Returns a bookmark location for the current selection. This bookmark object can then be used to restore the selection after some content modification to the document.tinymce.dom.BookmarkManager
isBookmarkNode()Returns true/false if the specified node is a bookmark node or not.tinymce.dom.BookmarkManager
moveToBookmark()Restores the selection to the specified bookmark.tinymce.dom.BookmarkManager

Constructors

BookmarkManager

public constructor function BookmarkManager(selection:tinymce.dom.Selection)

Constructs a new BookmarkManager instance for a specific selection instance.

Parameters
  • selection (tinymce.dom.Selection) - Selection instance to handle bookmarks for.

Methods

getBookmark

getBookmark(type:Number, normalized:Boolean):Object

Returns a bookmark location for the current selection. This bookmark object can then be used to restore the selection after some content modification to the document.

Examples
// Stores a bookmark of the current selection
var bm = tinymce.activeEditor.selection.getBookmark();

tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');

// Restore the selection bookmark
tinymce.activeEditor.selection.moveToBookmark(bm);
Parameters
  • type (Number) - Optional state if the bookmark should be simple or not. Default is complex.
  • normalized (Boolean) - Optional state that enables you to get a position that it would be after normalization.
Return value
  • Object - Bookmark object, use moveToBookmark with this object to restore the selection.

isBookmarkNode

isBookmarkNode(node:DOMNode):Boolean

Returns true/false if the specified node is a bookmark node or not.

Parameters
  • node (DOMNode) - DOM Node to check if it's a bookmark node or not.
Return value
  • Boolean - true/false if the node is a bookmark node or not.

moveToBookmark

moveToBookmark(bookmark:Object):Boolean

Restores the selection to the specified bookmark.

Examples
// Stores a bookmark of the current selection
var bm = tinymce.activeEditor.selection.getBookmark();

tinymce.activeEditor.setContent(tinymce.activeEditor.getContent() + 'Some new content');

// Restore the selection bookmark
tinymce.activeEditor.selection.moveToBookmark(bm);
Parameters
  • bookmark (Object) - Bookmark to restore selection from.
Return value
  • Boolean - true/false if it was successful or not.

Can't find what you're looking for? Let us know.

Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文