Merge branch 'master' of github.com:ajaxorg/ace
This commit is contained in:
commit
6e3b05dc2f
1 changed files with 51 additions and 45 deletions
|
|
@ -130,19 +130,18 @@ function setupContainer(element, getValue) {
|
||||||
|
|
||||||
var parentNode = element.parentNode;
|
var parentNode = element.parentNode;
|
||||||
|
|
||||||
// This will hold the Bespin editor.
|
// This will hold the editor.
|
||||||
var container = document.createElement('div');
|
var container = document.createElement('div');
|
||||||
|
|
||||||
// To put Bespin in the place of the textarea, we have to copy a
|
// To put Ace in the place of the textarea, we have to copy a few of the
|
||||||
// few of the textarea's style attributes to the div container.
|
// textarea's style attributes to the div container.
|
||||||
//
|
//
|
||||||
// The problem is, that the properties have to get computed (they
|
// The problem is that the properties have to get computed (they might be
|
||||||
// might be defined by a CSS file on the page - you can't access
|
// defined by a CSS file on the page - you can't access such rules that
|
||||||
// such rules that apply to an element via elm.style). Computed
|
// apply to an element via elm.style). Computed properties are converted to
|
||||||
// properties are converted to pixels although the dimension might
|
// pixels although the dimension might be given as percentage. When the
|
||||||
// be given as percentage. When the window resizes, the dimensions
|
// window resizes, the dimensions defined by percentages changes, so the
|
||||||
// defined by percentages changes, so the properties have to get
|
// properties have to get recomputed to get the new/true pixels.
|
||||||
// recomputed to get the new/true pixels.
|
|
||||||
var resizeEvent = function() {
|
var resizeEvent = function() {
|
||||||
var style = 'position:relative;';
|
var style = 'position:relative;';
|
||||||
[
|
[
|
||||||
|
|
@ -152,20 +151,20 @@ function setupContainer(element, getValue) {
|
||||||
getCSSProperty(element, container, item) + ';';
|
getCSSProperty(element, container, item) + ';';
|
||||||
});
|
});
|
||||||
|
|
||||||
// Calculating the width/height of the textarea is somewhat
|
// Calculating the width/height of the textarea is somewhat tricky. To
|
||||||
// tricky. To do it right, you have to include the paddings
|
// do it right, you have to include the paddings to the sides as well
|
||||||
// to the sides as well (eg. width = width + padding-left, -right).
|
// (eg. width = width + padding-left, -right). This works well, as
|
||||||
// This works well, as long as the width of the element is not
|
// long as the width of the element is not set or given in pixels. In
|
||||||
// set or given in pixels. In this case and after the textarea
|
// this case and after the textarea is hidden, getCSSProperty(element,
|
||||||
// is hidden, getCSSProperty(element, container, 'width') will
|
// container, 'width') will still return pixel value. If the element
|
||||||
// still return pixel value. If the element has realtiv dimensions
|
// has realtiv dimensions (e.g. width='95<percent>')
|
||||||
// (e.g. width='95<percent>') getCSSProperty(...) will return pixel values
|
// getCSSProperty(...) will return pixel values only as long as the
|
||||||
// only as long as the textarea is visible. After it is hidden
|
// textarea is visible. After it is hidden getCSSProperty will return
|
||||||
// getCSSProperty will return the relativ dimensions as they
|
// the relative dimensions as they are set on the element (in the case
|
||||||
// are set on the element (in the case of width, 95<percent>).
|
// of width, 95<percent>).
|
||||||
// Making the sum of pixel vaules (e.g. padding) and realtive
|
// Making the sum of pixel vaules (e.g. padding) and realtive values
|
||||||
// values (e.g. <percent>) is not possible. As such the padding styles
|
// (e.g. <percent>) is not possible. As such the padding styles are
|
||||||
// are ignored.
|
// ignored.
|
||||||
|
|
||||||
// The complete width is the width of the textarea + the padding
|
// The complete width is the width of the textarea + the padding
|
||||||
// to the left and right.
|
// to the left and right.
|
||||||
|
|
@ -367,6 +366,10 @@ function setupApi(editor, editorDiv, settingDiv, ace, options) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "useSoftTabs":
|
||||||
|
session.setUseSoftTabs(toBool(value));
|
||||||
|
break;
|
||||||
|
|
||||||
case "showPrintMargin":
|
case "showPrintMargin":
|
||||||
renderer.setShowPrintMargin(toBool(value));
|
renderer.setShowPrintMargin(toBool(value));
|
||||||
break
|
break
|
||||||
|
|
@ -403,7 +406,8 @@ function setupSettingPanel(settingDiv, settingOpener, api, options) {
|
||||||
theme: "Theme:",
|
theme: "Theme:",
|
||||||
fontSize: "Font Size:",
|
fontSize: "Font Size:",
|
||||||
softWrap: "Soft Wrap:",
|
softWrap: "Soft Wrap:",
|
||||||
showPrintMargin: "Show Print Margin:"
|
showPrintMargin: "Show Print Margin:",
|
||||||
|
useSoftTabs: "Use Soft Tabs:"
|
||||||
}
|
}
|
||||||
|
|
||||||
var optionValues = {
|
var optionValues = {
|
||||||
|
|
@ -447,7 +451,8 @@ function setupSettingPanel(settingDiv, settingOpener, api, options) {
|
||||||
80: "80",
|
80: "80",
|
||||||
free: "Free"
|
free: "Free"
|
||||||
},
|
},
|
||||||
showPrintMargin: BOOL
|
showPrintMargin: BOOL,
|
||||||
|
useSoftTabs: BOOL
|
||||||
}
|
}
|
||||||
|
|
||||||
var table = [];
|
var table = [];
|
||||||
|
|
@ -511,7 +516,8 @@ window.__ace_shadowed__.options = {
|
||||||
gutter: "false",
|
gutter: "false",
|
||||||
fontSize: "12px",
|
fontSize: "12px",
|
||||||
softWrap: "off",
|
softWrap: "off",
|
||||||
showPrintMargin: "false"
|
showPrintMargin: "false",
|
||||||
|
useSoftTabs: "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue