Add editor.html dropdown Soft Wrap
This commit is contained in:
parent
fa7bfdeb10
commit
e6e01a3ed1
4 changed files with 41 additions and 16 deletions
|
|
@ -150,7 +150,11 @@ exports.launch = function(env) {
|
||||||
modeEl.value = "text";
|
modeEl.value = "text";
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapModeEl.checked = doc.getUseWrapMode() ? "checked" : "";
|
if (!doc.getUseWrapMode()) {
|
||||||
|
wrapModeEl.value = "off";
|
||||||
|
} else {
|
||||||
|
wrapModeEl.value = doc.getWrapLimit();
|
||||||
|
}
|
||||||
env.editor.focus();
|
env.editor.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -163,11 +167,32 @@ exports.launch = function(env) {
|
||||||
});
|
});
|
||||||
|
|
||||||
bindDropdown("keybinding", function(value) {
|
bindDropdown("keybinding", function(value) {
|
||||||
env.editor.setKeyboardHandler(keybindings[value]);
|
env.editor.setKeyboardHandler(keybindings[value]);
|
||||||
});
|
});
|
||||||
|
|
||||||
bindDropdown("fontsize", function(value) {
|
bindDropdown("fontsize", function(value) {
|
||||||
document.getElementById("editor").style["font-size"] = value;
|
document.getElementById("editor").style["font-size"] = value;
|
||||||
|
});
|
||||||
|
|
||||||
|
bindDropdown("soft_wrap", function(value) {
|
||||||
|
var session = env.editor.getSession();
|
||||||
|
var renderer = env.editor.renderer;
|
||||||
|
switch (value) {
|
||||||
|
case "off":
|
||||||
|
session.setUseWrapMode(false);
|
||||||
|
renderer.setPrintMarginColumn(80);
|
||||||
|
break;
|
||||||
|
case "40":
|
||||||
|
session.setUseWrapMode(true);
|
||||||
|
session.setWrapLimit(40);
|
||||||
|
renderer.setPrintMarginColumn(40);
|
||||||
|
break;
|
||||||
|
case "80":
|
||||||
|
session.setUseWrapMode(true);
|
||||||
|
session.setWrapLimit(80);
|
||||||
|
renderer.setPrintMarginColumn(80);
|
||||||
|
break;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bindCheckbox("select_style", function(checked) {
|
bindCheckbox("select_style", function(checked) {
|
||||||
|
|
@ -190,10 +215,6 @@ exports.launch = function(env) {
|
||||||
env.editor.renderer.setShowPrintMargin(checked);
|
env.editor.renderer.setShowPrintMargin(checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
bindCheckbox("soft_wrap", function(checked) {
|
|
||||||
env.editor.getSession().setUseWrapMode(checked);
|
|
||||||
});
|
|
||||||
|
|
||||||
function bindCheckbox(id, callback) {
|
function bindCheckbox(id, callback) {
|
||||||
var el = document.getElementById(id);
|
var el = document.getElementById(id);
|
||||||
var onCheck = function() {
|
var onCheck = function() {
|
||||||
|
|
|
||||||
13
editor.html
13
editor.html
|
|
@ -74,7 +74,6 @@
|
||||||
<option value="php">PHP</option>
|
<option value="php">PHP</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<label for="keybinding">Key Binding:</label>
|
<label for="keybinding">Key Binding:</label>
|
||||||
<select id="keybinding" size="1">
|
<select id="keybinding" size="1">
|
||||||
|
|
@ -84,6 +83,14 @@
|
||||||
<option value="custom">Custom</option>
|
<option value="custom">Custom</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
<td align="right">
|
||||||
|
<label for="soft_wrap">Soft Wrap:</label>
|
||||||
|
<select id="soft_wrap" size="1">
|
||||||
|
<option value="off">Off</option>
|
||||||
|
<option value="40">40 Chars</option>
|
||||||
|
<option value="80">80 Chars</option>
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<label for="show_gutter">Show Gutter</label>
|
<label for="show_gutter">Show Gutter</label>
|
||||||
<input type="checkbox" id="show_gutter" checked>
|
<input type="checkbox" id="show_gutter" checked>
|
||||||
|
|
@ -92,10 +99,6 @@
|
||||||
<label for="show_print_margin">Show Print Margin</label>
|
<label for="show_print_margin">Show Print Margin</label>
|
||||||
<input type="checkbox" id="show_print_margin" checked>
|
<input type="checkbox" id="show_print_margin" checked>
|
||||||
</td>
|
</td>
|
||||||
<td align="right">
|
|
||||||
<label for="soft_wrap">Soft Wrap</label>
|
|
||||||
<input type="checkbox" id="soft_wrap">
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -656,6 +656,7 @@ var EditSession = function(text, mode) {
|
||||||
if (wrapLimit != this.$wrapLimit) {
|
if (wrapLimit != this.$wrapLimit) {
|
||||||
this.$wrapLimit = wrapLimit;
|
this.$wrapLimit = wrapLimit;
|
||||||
this.$updateWrapData(0, this.getLength() - 1);
|
this.$updateWrapData(0, this.getLength() - 1);
|
||||||
|
this._dispatchEvent("changeWrapMode");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue