|
@@ -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) {
|
|
|
|
- return config.viewInfo.renderLineNumbers;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.viewInfo.glyphMargin;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.viewInfo.minimap.enabled;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.viewInfo.roundedSelection;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.viewInfo.scrollBeyondLastLine;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.viewInfo.renderWhitespace;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.readOnly;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.wrappingInfo.isViewportWrapping;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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) {
|
|
|
|
- return config.contribInfo.folding;
|
|
|
|
|
|
+ function() {
|
|
|
|
+ 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;
|
|
@@ -346,4 +364,4 @@ ComboBox.prototype.set = function (name) {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
-});
|
|
|
|
|
|
+});
|