本文整理匯總了TypeScript中vs/editor/common/model/model.Model.applyEdits方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Model.applyEdits方法的具體用法?TypeScript Model.applyEdits怎麽用?TypeScript Model.applyEdits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/model/model.Model
的用法示例。
在下文中一共展示了Model.applyEdits方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('decorations are updated when inserting multiple lines text inside', () => {
addDecoration(thisModel, 1, 2, 3, 2, 'myType');
modelHasDecoration(thisModel, 1, 2, 3, 2, 'myType');
thisModel.applyEdits([EditOperation.insert(new Position(1, 3), 'Hallo\nI\'m inserting multiple\nlines')]);
modelHasDecoration(thisModel, 1, 2, 5, 2, 'myType');
});
示例2: test
test('model delete all text from a line', () => {
thisModel.applyEdits([EditOperation.delete(new Range(1, 1, 1, 14))]);
assert.equal(thisModel.getLineCount(), 5);
assert.equal(thisModel.getLineContent(1), '');
});
示例3: test
test('decorations are updated when inserting one line text before it', () => {
addDecoration(thisModel, 1, 2, 3, 2, 'myType');
modelHasDecoration(thisModel, 1, 2, 3, 2, 'myType');
thisModel.applyEdits([EditOperation.insert(new Position(1, 1), 'Hallo ')]);
modelHasDecoration(thisModel, 1, 8, 3, 2, 'myType');
});