本文整理汇总了TypeScript中wed/editor.Editor.redo方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Editor.redo方法的具体用法?TypeScript Editor.redo怎么用?TypeScript Editor.redo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wed/editor.Editor
的用法示例。
在下文中一共展示了Editor.redo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("does not try to act on undo/redo changes", () => {
makeSplitMergeInputTrigger(
editor, mode, pSelector, key.makeKey(";"), BACKSPACE, DELETE);
let ps = editor.dataRoot.querySelectorAll("body p");
assert.equal(ps.length, 1);
editor.caretManager.setCaret(ps[0], 0);
// Synthetic event
const event = makeFakePasteEvent({
types: ["text/plain"],
getData: () => "ab;cd;ef",
});
editor.$guiRoot.trigger(event);
ps = editor.dataRoot.querySelectorAll("body p");
assert.equal(ps.length, 3);
assert.equal(cleanNamespace(ps[0].outerHTML), "<p>ab</p>");
assert.equal(cleanNamespace(ps[1].outerHTML), "<p>cd</p>");
assert.equal(cleanNamespace(ps[2].outerHTML),
"<p>efBlah blah <term>blah</term><term>blah2</term> blah.</p>",
"first split: 3rd part");
editor.undo();
ps = editor.dataRoot.querySelectorAll("body p");
assert.equal(ps.length, 1);
assert.equal(cleanNamespace(ps[0].outerHTML),
"<p>Blah blah <term>blah</term><term>blah2</term> blah.</p>",
"after undo");
editor.redo();
ps = editor.dataRoot.querySelectorAll("body p");
assert.equal(ps.length, 3, "after redo: length");
assert.equal(cleanNamespace(ps[0].outerHTML), "<p>ab</p>",
"after redo: 1st part");
assert.equal(cleanNamespace(ps[1].outerHTML), "<p>cd</p>",
"after redo: 2nd part");
assert.equal(cleanNamespace(ps[2].outerHTML),
"<p>efBlah blah <term>blah</term><term>blah2</term> blah.</p>",
"after redo: 3rd part");
});
示例2: it
it("redo redoes typed text as a group", () => {
// Text node inside title.
const initial = titles[0].childNodes[1];
const parent = initial.parentNode!;
caretManager.setCaret(initial, 0);
// There was a version of wed which would fail this test. The fake caret
// would be inserted inside the text node, which would throw off the
// nodeToPath/pathToNode calculations.
editor.type("blah");
assert.equal(initial.nodeValue, "blahabcd", "text after edit");
assert.equal(parent.childNodes.length, 3);
editor.undo();
assert.equal(initial.nodeValue, "abcd", "text after undo");
assert.equal(parent.childNodes.length, 3);
caretCheck(editor, initial, 0, "caret after undo");
editor.redo();
assert.equal(initial.nodeValue, "blahabcd", "text after undo");
assert.equal(parent.childNodes.length, 3);
caretCheck(editor, initial, 4, "caret after redo");
});