support dynamic change of selection style
This commit is contained in:
parent
3e8639596a
commit
e37af546d5
4 changed files with 47 additions and 15 deletions
|
|
@ -55,16 +55,20 @@
|
|||
<body>
|
||||
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="select_style">Full line selections</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="container">
|
||||
|
|
@ -87,6 +91,16 @@ function getMode() {
|
|||
return modes[modeEl.value];
|
||||
}
|
||||
|
||||
var selectEl = document.getElementById("select_style");
|
||||
selectEl.onchange = function() {
|
||||
if (selectEl.checked) {
|
||||
editor.setSelectionStyle("line");
|
||||
} else {
|
||||
editor.setSelectionStyle("text");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var container = document.getElementById("container");
|
||||
var editor = new ace.Editor(
|
||||
new ace.VirtualRenderer(container),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue