mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 22:02:55 +01:00
Adopt latest API breakage
This commit is contained in:
parent
dc793af002
commit
e0636d94ff
1 changed files with 49 additions and 31 deletions
|
|
@ -179,98 +179,116 @@ function createButton(label, onClick) {
|
||||||
function createOptions(editor) {
|
function createOptions(editor) {
|
||||||
var options = document.getElementById('options');
|
var options = document.getElementById('options');
|
||||||
|
|
||||||
|
let lineNumbers;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'lineNumbers',
|
'lineNumbers',
|
||||||
function(config) {
|
function() {
|
||||||
return config.viewInfo.renderLineNumbers;
|
return (lineNumbers === false ? false : true);
|
||||||
},
|
},
|
||||||
function(editor, newValue) {
|
function(editor, newValue) {
|
||||||
editor.updateOptions({ lineNumbers: newValue ? 'on': 'off' });
|
lineNumbers = newValue;
|
||||||
}
|
editor.updateOptions({ lineNumbers: lineNumbers ? 'on' : 'off' });
|
||||||
|
},
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let glyphMargin;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'glyphMargin',
|
'glyphMargin',
|
||||||
function(config) {
|
function() {
|
||||||
return config.viewInfo.glyphMargin;
|
return (glyphMargin === false ? false : true);
|
||||||
},
|
},
|
||||||
function(editor, newValue) {
|
function(editor, newValue) {
|
||||||
editor.updateOptions({ glyphMargin: newValue });
|
glyphMargin = newValue;
|
||||||
|
editor.updateOptions({ glyphMargin: glyphMargin });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let minimap;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'minimap',
|
'minimap',
|
||||||
function(config) {
|
function() {
|
||||||
return config.viewInfo.minimap.enabled;
|
return (minimap === false ? false : true);
|
||||||
},
|
},
|
||||||
function(editor, newValue) {
|
function(editor, newValue) {
|
||||||
editor.updateOptions({ minimap: { enabled: newValue } });
|
minimap = newValue;
|
||||||
|
editor.updateOptions({ minimap: { enabled: minimap } });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let roundedSelection;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'roundedSelection',
|
'roundedSelection',
|
||||||
function(config) {
|
function() {
|
||||||
return config.viewInfo.roundedSelection;
|
return (roundedSelection === false ? false : true);
|
||||||
},
|
},
|
||||||
function(editor, newValue) {
|
function(editor, newValue) {
|
||||||
editor.updateOptions({ roundedSelection: newValue });
|
roundedSelection = newValue;
|
||||||
|
editor.updateOptions({ roundedSelection: roundedSelection });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let scrollBeyondLastLine;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'scrollBeyondLastLine',
|
'scrollBeyondLastLine',
|
||||||
function(config) {
|
function() {
|
||||||
return config.viewInfo.scrollBeyondLastLine;
|
return (scrollBeyondLastLine === false ? false : true);
|
||||||
}, function(editor, newValue) {
|
}, function(editor, newValue) {
|
||||||
editor.updateOptions({ scrollBeyondLastLine: newValue });
|
scrollBeyondLastLine = newValue;
|
||||||
|
editor.updateOptions({ scrollBeyondLastLine: scrollBeyondLastLine });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let renderWhitespace;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'renderWhitespace',
|
'renderWhitespace',
|
||||||
function(config) {
|
function() {
|
||||||
return config.viewInfo.renderWhitespace;
|
return (renderWhitespace === true ? true : false);
|
||||||
}, function(editor, newValue) {
|
}, function(editor, newValue) {
|
||||||
editor.updateOptions({ renderWhitespace: newValue });
|
renderWhitespace = newValue;
|
||||||
|
editor.updateOptions({ renderWhitespace: renderWhitespace });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let readOnly;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'readOnly',
|
'readOnly',
|
||||||
function(config) {
|
function() {
|
||||||
return config.readOnly;
|
return (readOnly === true ? true : false);
|
||||||
},
|
},
|
||||||
function(editor, newValue) {
|
function(editor, newValue) {
|
||||||
editor.updateOptions({ readOnly: newValue });
|
readOnly = newValue;
|
||||||
|
editor.updateOptions({ readOnly: readOnly });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let wordWrap;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'wordWrap',
|
'wordWrap',
|
||||||
function(config) {
|
function() {
|
||||||
return config.wrappingInfo.isViewportWrapping;
|
return (wordWrap === true ? true : false);
|
||||||
}, function(editor, newValue) {
|
}, function(editor, newValue) {
|
||||||
editor.updateOptions({ wordWrap: newValue ? 'on' : 'off' });
|
wordWrap = newValue;
|
||||||
|
editor.updateOptions({ wordWrap: wordWrap ? 'on' : 'off' });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
let folding;
|
||||||
options.appendChild(createOptionToggle(
|
options.appendChild(createOptionToggle(
|
||||||
editor,
|
editor,
|
||||||
'folding',
|
'folding',
|
||||||
function(config) {
|
function() {
|
||||||
return config.contribInfo.folding;
|
return (folding === false ? false : true);
|
||||||
}, function(editor, newValue) {
|
}, function(editor, newValue) {
|
||||||
editor.updateOptions({ folding: newValue });
|
folding = newValue;
|
||||||
|
editor.updateOptions({ folding: folding });
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -290,7 +308,7 @@ function createOptionToggle(editor, labelText, stateReader, setState) {
|
||||||
domNode.appendChild(label);
|
domNode.appendChild(label);
|
||||||
|
|
||||||
var renderState = function() {
|
var renderState = function() {
|
||||||
input.checked = stateReader(editor.getConfiguration());
|
input.checked = stateReader();
|
||||||
};
|
};
|
||||||
|
|
||||||
renderState();
|
renderState();
|
||||||
|
|
@ -298,7 +316,7 @@ function createOptionToggle(editor, labelText, stateReader, setState) {
|
||||||
renderState();
|
renderState();
|
||||||
});
|
});
|
||||||
input.onchange = function() {
|
input.onchange = function() {
|
||||||
setState(editor, !stateReader(editor.getConfiguration()));
|
setState(editor, !stateReader());
|
||||||
};
|
};
|
||||||
|
|
||||||
return domNode;
|
return domNode;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue