本文整理汇总了TypeScript中wed/editor.Editor类的典型用法代码示例。如果您正苦于以下问题:TypeScript Editor类的具体用法?TypeScript Editor怎么用?TypeScript Editor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Editor类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it("undoing an attribute value change undoes the value change", () => {
let initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
caretManager.setCaret(initial, 4);
assert.equal(initial.data, "rend_value", "initial value");
editor.type("blah");
// We have to refetch because the decorations have been redone.
initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
assert.equal(initial.data, "rendblah_value");
caretCheck(editor, initial, 8, "caret after text insertion");
// Check that the data is also modified
const dataNode = editor.toDataNode(initial) as Attr;
assert.equal(dataNode.value, "rendblah_value");
editor.undo();
// We have to refetch because the decorations have been redone.
initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
assert.equal(initial.data, "rend_value");
caretCheck(editor, initial, 4, "caret after undo");
// Check that the data change has been undone.
assert.equal(dataNode.value, "rend_value", "value undone");
});
开发者ID:lddubeau,项目名称:wed,代码行数:25,代码来源:wed-undo-redo-test.ts
示例2: waitForSuccess
it("changing label visibility level", async () => {
// Changing label visibility does not merely refresh the errors but
// recreates them because errors that were visible may become invisible or
// errors that were invisible may become visible.
await processRunner.onCompleted();
// tslint:disable-next-line:no-any
const errorLayer = (editor as any).errorLayer.el as Element;
let orig = _slice.call(errorLayer.children);
// Reduce the visibility level.
editor.type(keyConstants.LOWER_LABEL_VISIBILITY);
let after;
await waitForSuccess(() => {
after = _slice.call(errorLayer.children);
assertNewMarkers(orig, after, "decreasing the level");
});
orig = after;
// Increase visibility level
editor.type(keyConstants.INCREASE_LABEL_VISIBILITY);
await waitForSuccess(() => {
assertNewMarkers(orig, _slice.call(errorLayer.children),
"increasing the level");
});
});
开发者ID:lddubeau,项目名称:wed,代码行数:27,代码来源:wed-validation-error-test.ts
示例3: it
it("doing an attribute deletion changes the data", () => {
const p = ps[7];
const dataP = editor.toDataNode(p) as Element;
const attrNames = getAttributeNamesFor(p);
let attrValues = getAttributeValuesFor(p);
const initialLength = attrValues.length;
assert.isTrue(initialLength > 0, "the paragraph should have attributes");
const attr = editor.toDataNode(attrValues[0]) as Attr;
const decodedName = attrNames[0].textContent!;
const trs = editor.modeTree.getMode(attr).getContextualActions(
["delete-attribute"], decodedName, attr);
caretManager.setCaret(attr, 0);
caretCheck(editor, attrValues[0].firstChild!, 0,
"the caret should be in the attribute");
trs[0].execute({ node: attr, name: decodedName });
attrValues = getAttributeValuesFor(p);
assert.equal(attrValues.length, initialLength - 1,
"one attribute should be gone");
caretCheck(editor, attrValues[0].firstChild!, 0,
"the caret should be in the first attribute value");
assert.isNull(attr.ownerElement,
"the old attribute should not have an onwer element");
assert.isNull(dataP.getAttribute(attr.name));
});
开发者ID:lddubeau,项目名称:wed,代码行数:26,代码来源:wed-transformation-test.ts
示例4: it
it("searches forward", () => {
editor.type(QUICKSEARCH_FORWARD);
editor.type("abc", WedEventTarget.MINIBUFFER);
checkHighlightRanges(firstABCText);
editor.type(QUICKSEARCH_FORWARD, WedEventTarget.MINIBUFFER);
checkHighlightRanges(pFiveFirstThree);
editor.type(ESCAPE, WedEventTarget.MINIBUFFER);
});
开发者ID:lddubeau,项目名称:wed,代码行数:8,代码来源:quick-search-test.ts
示例5: waitForSuccess
it("modification status shows an unmodified document after save", () => {
// Text node inside title.
const initial = titles[0].childNodes[1];
caretManager.setCaret(initial, 0);
editor.type(" ");
assert.isTrue($modificationStatus.hasClass("label-warning"));
editor.type(keyConstants.SAVE);
return waitForSuccess(() => {
assert.isTrue($modificationStatus.hasClass("label-success"));
});
});
开发者ID:lddubeau,项目名称:wed,代码行数:12,代码来源:wed-file-state-test.ts
示例6: it
it("that takes completions", () => {
const p = ps[9];
const attrVals = getAttributeValuesFor(p);
caretManager.setCaret(attrVals[0].firstChild, 0);
contextMenuHasOption(editor, /^Y$/);
editor.type("Y");
// The context menu should be gone.
const menu = editor.window.document.
getElementsByClassName("wed-context-menu")[0];
assert.isUndefined(menu, "the menu should not exist");
editor.type(keyConstants.REPLACEMENT_MENU);
contextMenuHasOption(editor, /^Y$/);
});
开发者ID:lddubeau,项目名称:wed,代码行数:13,代码来源:wed-menu-test.ts
示例7: getAttributeValuesFor
"attribute is not visible", () => {
// Reduce visibility to 0 so that no attribute is visible.
editor.setLabelVisibilityLevel(0);
const attrVals = getAttributeValuesFor(ps[9]);
caretManager.setCaret(attrVals[0].firstChild, 0);
let menu = editor.window.document.
getElementsByClassName("wed-context-menu")[0];
assert.isUndefined(menu, "the menu should not exist");
// The menu won't come up with a the shortcut.
editor.type(keyConstants.REPLACEMENT_MENU);
menu = editor.window.document.
getElementsByClassName("wed-context-menu")[0];
assert.isUndefined(menu, "the menu should not exist");
});
开发者ID:lddubeau,项目名称:wed,代码行数:14,代码来源:wed-menu-test.ts
示例8: it
it("typing multiple spaces in an attribute normalizes the space", () => {
// Text node inside title.
let initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
caretManager.setCaret(initial, 0);
assert.equal(initial.data, "rend_value");
editor.type(" ");
// We have to refetch because the decorations have been redone.
initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
assert.equal(initial.data, " rend_value");
caretCheck(editor, initial, 1, "caret after text insertion");
// Check that the data is also modified
const dataNode = editor.toDataNode(initial) as Attr;
assert.equal(dataNode.value, " rend_value");
editor.type(" ");
// We have to refetch because the decorations have been redone.
initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
assert.equal(initial.data, " rend_value");
caretCheck(editor, initial, 1, "caret after text insertion");
// Check that the data is also modified
assert.equal(dataNode.value, " rend_value");
caretManager.setCaret(initial, 11);
editor.type(" ");
// We have to refetch because the decorations have been redone.
initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
assert.equal(initial.data, " rend_value ");
caretCheck(editor, initial, 12, "caret after text insertion");
// Check that the data is also modified
assert.equal(dataNode.value, " rend_value ");
editor.type(" ");
// We have to refetch because the decorations have been redone.
initial = getAttributeValuesFor(ps[7])[0].firstChild as Text;
assert.equal(initial.data, " rend_value ");
caretCheck(editor, initial, 12, "caret after text insertion");
// Check that the data is also modified
assert.equal(dataNode.value, " rend_value ");
});
开发者ID:lddubeau,项目名称:wed,代码行数:49,代码来源:wed-typing-test.ts
示例9: it
it("searches forward", () => {
editor.type(SEARCH_FORWARD);
typeInSearch("abc");
checkHighlightRanges(firstABCText);
clickFind();
checkHighlightRanges(pFiveFirstThree);
});
开发者ID:lddubeau,项目名称:wed,代码行数:7,代码来源:dialog-search-replace-test.ts
注:本文中的wed/editor.Editor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论