跳到主要内容

CreateNewHistoryPoint

创建新的历史记录点。

语法

expression.CreateNewHistoryPoint();

expression - 表示 ApiDocument 类的变量。

参数

此方法没有任何参数。

返回值

boolean

示例

创建新的历史记录点以标记文档中的撤消边界。

// How do I create a history point between two edits in a document?

// Separate text changes into distinct undo steps so each can be reversed independently in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is a sample text.");
doc.CreateNewHistoryPoint();
paragraph = Api.CreateParagraph();
paragraph.AddText("New history point was just created.");
doc.Push(paragraph);