Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orion-dev] TextView - Changing and updating Options at runtime

I do not think we should expose the internal structure of the editor. It maybe change in the future.

Currently, the way we expect the font, color, background and a few other properties to change is by providing a style sheet and by setting the themeClass option of the text view. Sorry, the documentation in this area is not very clear yet.  The basic API (which should not change) are the CSS class names defined in textview.css These are:

textViewContainer     -> the whole editor including rulers and text area.
textview                         -> the scrollable portion of the editor
textviewContent         -> the contents of the editor - text area inside of scrollable area
textviewLeftRuler       -> left rulers area
textviewRightRuler    -> right rulers area

Take a look at "examples/textview/themes/orion.css" for an example:

.orion {
        color: black;

.orion .textview {
        background-color: #ffd400;


This style sheet specifies the ".orion .textview" selector which overwrites the background color of the scrollable area of the editor.  The style sheet is used by setting the themeClass option as follows:

textview.setOptions({themeClass: "orion"});


From:        lamine <laminba2003@xxxxxxxx>
To:        Silenio Quarti/Ottawa/IBM@IBMCA, Orion developer discussions <orion-dev@xxxxxxxxxxx>,
Cc:        "orion-dev-bounces@xxxxxxxxxxx" <orion-dev-bounces@xxxxxxxxxxx>, me <laminba2003@xxxxxxxx>
Date:        11/12/2012 04:23 PM
Subject:        Re: [orion-dev] TextView - Changing and updating Options at runtime

>Does this work better?
> var options = {};
> options[key] = value;
> editor.getTextView().setOptions(options);

Woow, thank your for your reply and the coincidence is absolutely troubling. I saw your mail when I just came to save my code to correct my mistake with the same solution written in the same form. And yes, you are right, in my desire to make it short, I have introduced a nasty bug ( {key:value}) but right now things are working quite well and I will update after my application in the Cloud.

And if I can add another thing, here is how I was able to change the font-size and the font-family of the TextView

if(key=='font-family' || key=='font-size'){

Wouldn't be nice and more cleaner if you can hide this internal detail and expose the TextView DomNode so I can avoid the use of the style class to get it?


De : Silenio Quarti <Silenio_Quarti@xxxxxxxxxx>
À :
lamine <laminba2003@xxxxxxxx>; Orion developer discussions <orion-dev@xxxxxxxxxxx>
Cc :
Envoyé le :
Lundi 12 novembre 2012 21h51
Objet :
Re: [orion-dev] TextView - Changing and updating Options at runtime

> Hi,
> My name is Mamadou Lamine Ba. I'm presently moving my IDE in the
> cloud and I have successfully integrated the Eclipse Orion editor into
> my application. And since I have the concept of a virtual editor
> which can integrate any _javascript_ source code or WYSIWYG editors, I have
> also integrated ACE, CodeMirror and EditArea. And as my first
> feedback, your editor is by far the most amazing even without
> theming and the support for the other languages.

Really good to know. Thanks for your feedback.

> One of my questions is : why the TextView does not update itself
> when I change its configuration  at runtime via the setOptions method.

> tab.setConfig=function(key,value){
> editor.getTextView().setOptions({key:value});
> };

This should work properly. It seems the bug is in the tab.setConfig() function because If I put a breakpoint in TextView.setOptions(), it gets called with an object like this:


       key: true


It should be something like:


       readonly: true


Does this work better?


 var options = {};

 options[key] = value;


Back to the top