| author | Mihai Sucan | 2011-06-28 16:31:11 (EDT) |
|---|---|---|
| committer | Mark Macdonald | 2011-06-29 11:12:42 (EDT) |
| commit | 57ebe544926278089e85b430c3e6ddd83ccdd366 (patch) (side-by-side diff) | |
| tree | 5cc7af9816aab192964053bd97633a3f52ce6135 | |
| parent | 4492e94d56a26278aea90267b9cb4bef3fb3e2ac (diff) | |
| download | org.eclipse.orion.client-57ebe544926278089e85b430c3e6ddd83ccdd366.zip org.eclipse.orion.client-57ebe544926278089e85b430c3e6ddd83ccdd366.tar.gz org.eclipse.orion.client-57ebe544926278089e85b430c3e6ddd83ccdd366.tar.bz2 | |
Fix for bug 350636.v20110630-0200
4 files changed, 27 insertions, 10 deletions
diff --git a/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.html b/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.html index 4f3dda9..d230f00 100644 --- a/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.html +++ b/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.html @@ -43,6 +43,7 @@ Create the view by clicking one of the buttons at the bottom. </table> <span id='createJavaSample' class="button">Java file</span> <span id='createJavaScriptSample' class="button">JavaScript file</span> +<span id='createHtmlSample' class="button">HTML file</span> <span id='createPlainTextSample' class="button">Plain Text</span> <span id='createBidiTextSample' class="button">Bidi Text</span> <span id='clearLog' class="button">ClearConsole</span> diff --git a/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.js b/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.js index 683cec3..cfeb834 100644 --- a/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.js +++ b/bundles/org.eclipse.orion.client.editor/web/examples/textview/demo.js @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Mihai Sucan (Mozilla Foundation) - fix for bug 350636 *******************************************************************************/ /*globals window define document navigator setTimeout XMLHttpRequest PerformanceTest */ @@ -39,10 +40,12 @@ function log (text) { "orion/textview/textView", "orion/textview/rulers", "orion/textview/undoStack", + "orion/editor/textMateStyler", + "orion/editor/htmlGrammar", "examples/textview/textStyler", "tests/textview/test-performance"], -function(mKeyBinding, mTextModel, mTextView, mRulers, mUndoStack, mTextStyler) { +function(mKeyBinding, mTextModel, mTextView, mRulers, mUndoStack, mTextMateStyler, mHtmlGrammar, mTextStyler) { var view = null; var styler = null; var isMac = navigator.platform.indexOf("Mac") !== -1; @@ -71,7 +74,8 @@ function(mKeyBinding, mTextModel, mTextView, mRulers, mUndoStack, mTextStyler) { var stylesheets = [ "/orion/textview/textview.css", "/orion/textview/rulers.css", - "/examples/textview/textstyler.css" + "/examples/textview/textstyler.css", + "/examples/editor/htmlStyles.css", ]; var options = { parent: "divParent", @@ -146,6 +150,17 @@ function(mKeyBinding, mTextModel, mTextView, mRulers, mUndoStack, mTextStyler) { styler = new mTextStyler.TextStyler(view, "js"); view.setText(file); } + + function createHtmlSample() { + checkView(); + var file = getFile("/examples/textview/demo.html"); + if (styler) { + styler.destroy(); + styler = null; + } + styler = new mTextMateStyler.TextMateStyler(view, mHtmlGrammar.HtmlGrammar.grammar); + view.setText(file); + } function createPlainTextSample() { checkView(); @@ -190,6 +205,7 @@ function(mKeyBinding, mTextModel, mTextView, mRulers, mUndoStack, mTextStyler) { /* Adding events */ document.getElementById("createJavaSample").onclick = createJavaSample; document.getElementById("createJavaScriptSample").onclick = createJavaScriptSample; + document.getElementById("createHtmlSample").onclick = createHtmlSample; document.getElementById("createPlainTextSample").onclick = createPlainTextSample; document.getElementById("createBidiTextSample").onclick = createBidiTextSample; document.getElementById("clearLog").onclick = clearLog; diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js index 0ca9ee3..61fe067 100644 --- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js +++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/htmlGrammar.js @@ -9,7 +9,7 @@ ******************************************************************************/ /*jslint */ -/*global dojo orion:true*/ +/*global orion:true*/ var orion = orion || {}; diff --git a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js index 9ba2d93..fc86dbe 100644 --- a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js +++ b/bundles/org.eclipse.orion.client.editor/web/orion/editor/textMateStyler.js @@ -9,7 +9,7 @@ ******************************************************************************/ /*jslint regexp:false laxbreak:true*/ -/*global define dojo window*/ +/*global define window*/ var orion = orion || {}; orion.editor = orion.editor || {}; @@ -518,11 +518,11 @@ orion.editor.TextMateStyler = (function() { */ addStyles: function(scope) { if (scope && !this._styles[scope]) { - this._styles[scope] = dojo.map(scope.split("."), - function(segment, i, segments) { - return segments.slice(0, i+1).join("-"); - }); -// console.debug("add style for " + scope + " = [" + this._styles[scope].join(", ") + "]"); + this._styles[scope] = []; + var scopeArray = scope.split("."); + for (var i = 0; i < scopeArray.length; i++) { + this._styles[scope].push(scopeArray.slice(0, i + 1).join("-")); + } } }, /** @private */ @@ -1374,7 +1374,7 @@ orion.editor.TextMateStyler = (function() { }()); if (typeof window !== "undefined" && typeof window.define !== "undefined") { - define(['dojo'], function() { + define([], function() { return orion.editor; }); } |

