本文整理汇总了TypeScript中vs/editor/contrib/linesOperations/common/linesOperations.JoinLinesAction类的典型用法代码示例。如果您正苦于以下问题:TypeScript JoinLinesAction类的具体用法?TypeScript JoinLinesAction怎么用?TypeScript JoinLinesAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JoinLinesAction类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: JoinLinesAction
], {}, (editor, cursor) => {
let model = editor.getModel();
let joinLinesAction = new JoinLinesAction();
editor.setSelections([
/** primary cursor */
new Selection(5, 2, 5, 2),
new Selection(1, 2, 1, 2),
new Selection(3, 2, 4, 2),
new Selection(5, 4, 6, 3),
new Selection(7, 5, 8, 4),
new Selection(10, 1, 10, 1)
]);
joinLinesAction.run(null, editor);
assert.equal(model.getLinesContent().join('\n'), 'hello world\nhello world\nhello world\nhello world\n\nhello world', '001');
assert.deepEqual(editor.getSelections().toString(), [
/** primary cursor */
new Selection(3, 4, 3, 8),
new Selection(1, 6, 1, 6),
new Selection(2, 2, 2, 8),
new Selection(4, 5, 4, 9),
new Selection(6, 1, 6, 1)
].toString(), '002');
/** primary cursor */
assert.deepEqual(editor.getSelection().toString(), new Selection(3, 4, 3, 8).toString(), '003');
});
示例2: JoinLinesAction
], {}, (editor, cursor) => {
let model = editor.getModel();
let joinLinesAction = new JoinLinesAction();
editor.setSelection(new Selection(1, 6, 1, 6));
editor.trigger('keyboard', Handler.Type, { text: ' my dear' });
assert.equal(model.getLineContent(1), 'hello my dear');
assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14));
joinLinesAction.run(null, editor);
assert.equal(model.getLineContent(1), 'hello my dear world');
assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14));
editor.trigger('keyboard', Handler.Undo, {});
assert.equal(model.getLineContent(1), 'hello my dear');
assert.deepEqual(editor.getSelection(), new Selection(1, 14, 1, 14));
});