diff --git a/Readme.md b/Readme.md index 0ae1af29..68edb3d0 100644 --- a/Readme.md +++ b/Readme.md @@ -117,6 +117,7 @@ After the checkout Ace works out of the box. No build step is required. Open 'ed Or using Node.JS ```bash + npm install mime ./static.js ``` diff --git a/build/demo/kitchen-sink/kitchen-sink-uncompressed.js b/build/demo/kitchen-sink/kitchen-sink-uncompressed.js index cb7933f2..33b244cf 100644 --- a/build/demo/kitchen-sink/kitchen-sink-uncompressed.js +++ b/build/demo/kitchen-sink/kitchen-sink-uncompressed.js @@ -645,9 +645,9 @@ bindDropdown("split", function(value) { } else { var newEditor = (sp.getSplits() == 1); if (value == "below") { - sp.setOriantation(sp.BELOW); + sp.setOrientation(sp.BELOW); } else { - sp.setOriantation(sp.BESIDE); + sp.setOrientation(sp.BESIDE); } sp.setSplits(2); @@ -20973,7 +20973,7 @@ var Split = function(container, theme, splits) { this.$splits = 0; this.$editorCSS = ""; this.$editors = []; - this.$oriantation = this.BESIDE; + this.$orientation = this.BESIDE; this.setSplits(splits || 1); this.$cEditor = this.$editors[0]; @@ -21130,15 +21130,15 @@ var Split = function(container, theme, splits) { return session; }; - this.getOriantation = function() { - return this.$oriantation; + this.getOrientation = function() { + return this.$orientation; }; - this.setOriantation = function(oriantation) { - if (this.$oriantation == oriantation) { + this.setOrientation = function(orientation) { + if (this.$orientation == orientation) { return; } - this.$oriantation = oriantation; + this.$orientation = orientation; this.resize(); }; @@ -21147,7 +21147,7 @@ var Split = function(container, theme, splits) { var height = this.$container.clientHeight; var editor; - if (this.$oriantation == this.BESIDE) { + if (this.$orientation == this.BESIDE) { var editorWidth = width / this.$splits; for (var i = 0; i < this.$splits; i++) { editor = this.$editors[i]; diff --git a/build/src/ace-uncompressed.js b/build/src/ace-uncompressed.js index 52fa9e95..6b742739 100644 --- a/build/src/ace-uncompressed.js +++ b/build/src/ace-uncompressed.js @@ -11975,6 +11975,7 @@ var VirtualRenderer = function(container, theme) { // full if (changes & this.CHANGE_FULL) { + this.$textLayer.checkForSizeChanges(); this.$textLayer.update(this.layerConfig); if (this.showGutter) this.$gutterLayer.update(this.layerConfig); @@ -12950,6 +12951,11 @@ var Text = function(parentEl) { } + // Size and width can be null if the editor is not visible or + // detached from the document + if (!this.element.offsetWidth) + return null; + var style = this.$measureNode.style; var computedStyle = dom.computedStyle(this.element); for (var prop in this.$fontStyles) @@ -12964,7 +12970,6 @@ var Text = function(parentEl) { // detached from the document if (size.width == 0 && size.height == 0) return null; - return size; }; diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 2765d1b6..63a87fe1 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -455,9 +455,9 @@ bindDropdown("split", function(value) { } else { var newEditor = (sp.getSplits() == 1); if (value == "below") { - sp.setOriantation(sp.BELOW); + sp.setOrientation(sp.BELOW); } else { - sp.setOriantation(sp.BESIDE); + sp.setOrientation(sp.BESIDE); } sp.setSplits(2); diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js index 69e917ae..6e3509bf 100644 --- a/lib/ace/layer/text.js +++ b/lib/ace/layer/text.js @@ -132,6 +132,11 @@ var Text = function(parentEl) { } } + + // Size and width can be null if the editor is not visible or + // detached from the document + if (!this.element.offsetWidth) + return null; var style = this.$measureNode.style; var computedStyle = dom.computedStyle(this.element); diff --git a/lib/ace/mode/coldfusion_highlight_rules.js b/lib/ace/mode/coldfusion_highlight_rules.js index e469ab8e..71d792e2 100644 --- a/lib/ace/mode/coldfusion_highlight_rules.js +++ b/lib/ace/mode/coldfusion_highlight_rules.js @@ -70,7 +70,7 @@ var ColdfusionHighlightRules = function() { }, { token : "meta.tag", regex : "<(?=\s*style)", - next : "css" + next : "style" }, { token : "meta.tag", // opening tag regex : "<\\/?", @@ -109,7 +109,7 @@ var ColdfusionHighlightRules = function() { }; xml_util.tag(this.$rules, "tag", "start"); - xml_util.tag(this.$rules, "css", "css-start"); + xml_util.tag(this.$rules, "style", "css-start"); xml_util.tag(this.$rules, "script", "js-start"); this.embedRules(JavaScriptHighlightRules, "js-", [{ diff --git a/lib/ace/mode/html_highlight_rules.js b/lib/ace/mode/html_highlight_rules.js index 55b0b135..6d2221e3 100644 --- a/lib/ace/mode/html_highlight_rules.js +++ b/lib/ace/mode/html_highlight_rules.js @@ -69,7 +69,7 @@ var HtmlHighlightRules = function() { }, { token : "meta.tag", regex : "<(?=\s*style\\b)", - next : "css" + next : "style" }, { token : "meta.tag", // opening tag regex : "<\\/?", @@ -108,7 +108,7 @@ var HtmlHighlightRules = function() { }; xmlUtil.tag(this.$rules, "tag", "start"); - xmlUtil.tag(this.$rules, "css", "css-start"); + xmlUtil.tag(this.$rules, "style", "css-start"); xmlUtil.tag(this.$rules, "script", "js-start"); this.embedRules(JavaScriptHighlightRules, "js-", [{ diff --git a/lib/ace/mode/xml_util.js b/lib/ace/mode/xml_util.js index cc3166e0..63e6b1b7 100644 --- a/lib/ace/mode/xml_util.js +++ b/lib/ace/mode/xml_util.js @@ -56,7 +56,7 @@ function string(state) { token : "string", // multi line string start merge : true, regex : '["].*', - next : state + "-qqstring" + next : state + "_qqstring" }, { token : "string", regex : "'.*?'" @@ -64,7 +64,7 @@ function string(state) { token : "string", // multi line string start merge : true, regex : "['].*", - next : state + "-qstring" + next : state + "_qstring" }]; } @@ -113,17 +113,17 @@ exports.tag = function(states, name, nextState) { }, merge : true, regex : "[-_a-zA-Z0-9:!]+", - next : name + "embed-attribute-list" + next : name + "_embed_attribute_list" }, { token: "empty", regex: "", - next : name + "embed-attribute-list" + next : name + "_embed_attribute_list" }]; - states[name + "-qstring"] = multiLineString("'", name + "embed-attribute-list"); - states[name + "-qqstring"] = multiLineString("\"", name + "embed-attribute-list"); + states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list"); + states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list"); - states[name + "embed-attribute-list"] = [{ + states[name + "_embed_attribute_list"] = [{ token : "meta.tag", merge : true, regex : "\/?>", diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index a195e372..925e7b4a 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -423,6 +423,7 @@ var VirtualRenderer = function(container, theme) { // full if (changes & this.CHANGE_FULL) { + this.$textLayer.checkForSizeChanges(); this.$textLayer.update(this.layerConfig); if (this.showGutter) this.$gutterLayer.update(this.layerConfig); @@ -666,7 +667,7 @@ var VirtualRenderer = function(container, theme) { }; this.getScrollLeft = function() { - return this.session.getScrollTop(); + return this.session.getScrollLeft(); }; this.getScrollTopRow = function() { @@ -726,12 +727,10 @@ var VirtualRenderer = function(container, theme) { var canvasPos = this.scroller.getBoundingClientRect(); var col = Math.round( - (pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) - / this.characterWidth + (pageX + this.scrollLeft - canvasPos.left - this.$padding - dom.getPageScrollLeft()) / this.characterWidth ); var row = Math.floor( - (pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) - / this.lineHeight + (pageY + this.scrollTop - canvasPos.top - dom.getPageScrollTop()) / this.lineHeight ); return this.session.screenToDocumentPosition(row, Math.max(col, 0));