mirror of
https://github.com/convergencelabs/monaco-collab-ext.git
synced 2024-10-27 20:34:17 +00:00
Made the target editor readonly.
This commit is contained in:
parent
c743f8df2a
commit
985866071b
@ -19,7 +19,8 @@ require(['vs/editor/editor.main', 'MonacoCollabExt'], function(m, MonacoCollabEx
|
||||
const target = monaco.editor.create(document.getElementById("target-editor"), {
|
||||
value: editorContents,
|
||||
theme: "vs-dark'",
|
||||
language: 'javascript'
|
||||
language: 'javascript',
|
||||
readOnly: true
|
||||
});
|
||||
|
||||
const remoteCursorManager = new MonacoCollabExt.RemoteCursorManager({
|
||||
@ -68,13 +69,19 @@ require(['vs/editor/editor.main', 'MonacoCollabExt'], function(m, MonacoCollabEx
|
||||
const sourceContentManager = new MonacoCollabExt.EditorContentManager({
|
||||
editor: source,
|
||||
onInsert(index, text) {
|
||||
target.updateOptions({readOnly: false});
|
||||
targetContentManager.insert(index, text);
|
||||
target.updateOptions({readOnly: true});
|
||||
},
|
||||
onReplace(index, length, text) {
|
||||
target.updateOptions({readOnly: false});
|
||||
targetContentManager.replace(index, length, text);
|
||||
target.updateOptions({readOnly: true});
|
||||
},
|
||||
onDelete(index, length) {
|
||||
target.updateOptions({readOnly: false});
|
||||
targetContentManager.delete(index, length);
|
||||
target.updateOptions({readOnly: true});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user