Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2005-05-08 08:04:36

zwiedly
New member
Registered: 2005-05-08
Posts: 2

problem with styles

I am a xinha newbie, and I am also not an expert in JS, so I met some basic problems with configuring xinha.

My editor work properly but I realy do not know how to set up panel with my own css styles in editor. I ve read related topics and tickets, but still can't get no effect.

Can somebody explain to dummy like me how to do it (what code I have to use and where I need to put it ?)   

I will be thankful for your help.

regards
zwiedly

Offline

#2 2005-05-09 09:31:25

niko
Xinha Authority
From: Salzburg/Austria
Registered: 2005-02-14
Posts: 338

Re: problem with styles

all newbies follow this:
http://xinha.python-hosting.com/wiki/NewbieGuide

and information for the stylist-plugin you get here:
http://xinha.python-hosting.com/wiki/Stylist


Niko

Offline

#3 2005-10-26 11:19:28

Zippyy
New member
Registered: 2005-10-21
Posts: 1

Re: problem with styles

I'm confused as to where the code from http://xinha.python-hosting.com/wiki/Stylist needs to go.  Being a newbie, I'm hesitant that I might break something.  Does it need to go in my_config.js?  Or stylist.js?

What I need to happen is pretty simple.  I'm using Xinha so people can edit the content of their pages quickly, easily, and remotely.  The only thing I have left to figure out is how to apply to the Xinha content the same stylesheets that are applied to these pages, so employees can see exactly how their page will appear.  The css needs to be applied only to the content within Xinha.

Pretty sure the Stylist info contains my solution, I just need to figure out where to put it. smile

Offline

#4 2005-10-27 11:00:40

Random Bits
Xinha Community Member
Registered: 2005-10-24
Posts: 19

Re: problem with styles

I too would like the site CSS to be applied.

If I insert  code like:

The current activity is <span id="site_active">soccer</span> Register today!

The user can choose from several CSS files (via preferences). So the actual values for site_active depend on the user selection.

Ideally Xinha would allow my to specify the CSS file, and it would be use with-in the editor.

Offline

#5 2006-02-20 02:32:08

jamesczar
New member
From: Cincinnati, OH
Registered: 2006-02-20
Posts: 2
Website

Re: problem with styles

I too would like to know where this code pointing to my external css file needs to do.  None of the forum entries or any of the documentation on the site tells what file to modify.  In the entire HTMLArea directory there are no files containing the code

cfg.stylistLoadStylesheet

I can't find it anywhere.

In /htmlarea/xinha-nightly/plugins/Stylist/stylist.js there is

HTMLArea.Config.prototype.css_style = { };

/**
* This method loads an external stylesheet and uses it in the stylist
*/
HTMLArea.Config.prototype.stylistLoadStylesheet = function(url, altnames)
{
  if(!altnames) altnames = { };
  var newStyles = HTMLArea.ripStylesFromCSSFile(url);
  for(var i in newStyles)
  {
    if(altnames[i])
    {
      this.css_style[i] = altnames[i];
    }
    else
    {
      this.css_style[i] = newStyles[i];
    }
  }
  this.pageStyleSheets[this.pageStyleSheets.length] = url;
};

but I can't figure out what to replace there.  I've tried replacing the word "url" in the above, but that doesn't work.

Can you please tell me what file this code is in where I need to specify my external url for Stylist.  Thank you.

Offline

#6 2006-02-20 16:08:57

raj
New member
Registered: 2006-01-28
Posts: 6

Re: problem with styles

Hi James -

I was able to get the Stylist plugin to work my putting the following in my my_config.js file:

     xinha_config.stylistLoadStylesheet('/path/to/stylesheet.css');

I did this in after *Step 3* in my_config.js, after you define xinha_config.

As a side note, I was able to get mine to work using a relative path, by putting the stylesheet in the same directory as xinha. If that doesn't work, be sure to use an absolute path.

Hope this helps!

Offline

#7 2006-02-20 18:45:06

jamesczar
New member
From: Cincinnati, OH
Registered: 2006-02-20
Posts: 2
Website

Re: problem with styles

Raj,

I appreciate your reply.  Unfortunately in my case (as is the case of other Drupal users), I didn't have to go through all the steps in the Newbie Guide, because for Drupal all you have to do is unpack xinha-nightly into the HTMLArea directory, and the HTMLArea.module file already has the code to call on the Xinha functionality.

Problem is, since I did not need to create a my_config.js, I don't know where to put this snippet of code.  I've tried putting it in the htmlarea.js file that's in the xinha-nightly directory, but that doesn't work.  I put it just above the line

HTMLArea.makeEditors = function(editor_names, default_config, plugin_names)

but that doesn't work.

Has anyone else implemented this plugin with Drupal?  Has anyone else worked with Xinha with Drupal?  Can anyone give anymore insight into where this code goes?

James

Last edited by jamesczar (2006-02-20 18:49:54)

Offline

#8 2006-02-21 12:22:10

raj
New member
Registered: 2006-01-28
Posts: 6

Re: problem with styles

Well, you can think of htmlarea.js as the class file and my_config.js as the file that instantiates the class and controls all the configuration information. Since this happens per page, you'll notice in the examples that my_config.js and htmlarea.js are called on the page that contains the xinha editor. I'd take a look at the page that contains the xinha editor and see what file is being called. This might be more complex in Drupal since it probably is generating the page as a php include or something ...

Good luck - hopefully someone with more xinha knowledge or Drupal experience can help out.

Offline

#9 2007-07-24 14:19:38

hermes
New member
Registered: 2007-07-23
Posts: 6

Re: problem with styles

For any/all Newbies out there, I hope this helps to use the Stylist plugin:

I just went through the (in my opinion) poorly documented process of using the Stylist plugin. Here are the steps I took to use an existing stylesheet with the Stylist plugin:

0: If you're REALLY new to javascript, you should know that the statements between the "/*" and "*/" statements are comments. Stuff between them is just for us humans to say to one another, for clarity's sake or whatnot. The browser won't do anything with them. They're similar to the "<!-- -->" html tags. Therefore the edits I mention below won't have any effect if you put them inside the "/* */" statements. They'll be commented out... so please be careful to make your edits in the NOT commented out sections.

1: Make sure the 'Stylist' plugin is being initialized:
In your config statement ( the stuff that starts off with the "xinha_editors = null;" stuff)... this might be up in the head of your html document, or might be in an externally loaded .js file...
In the 'Step 1' section
In the "xinha_plugins = xinha_plugins ? xinha_plugins :" statement ... (which is like 22 in my .js file)
Make sure that the word 'Stylist' one of the words inside the brackets.

Therefore if you have

xinha_plugins = xinha_plugins ? xinha_plugins : [ ];

Change it to:

xinha_plugins = xinha_plugins ? xinha_plugins : ['Stylist' ];

You'll notice that the Stylist plugin is enabled in the config suggestion on the 'Newbie Guide' page as of this writing (July 24, 2007)

xinha_plugins = xinha_plugins ? xinha_plugins :
      [
       'CharacterMap',
       'ContextMenu',
       'ListType',
       'SpellChecker',
       'Stylist',
       'SuperClean',
       'TableOperations'
      ];

2:Make the Stylist plugin load in the style sheet you'd like the xinha area to use
Still in the config statement that we edited in the last step...
In the 'Step 3' section
right AFTER the 'xinha_config' line, which should look very similar to:

xinha_config = xinha_config ? xinha_config() : new Xinha.Config();

place in the line which tells the Stylist plugin to import your stylesheet that you want the user to be working with when they edit the text. Therefore if the stylesheet is "http://www.yoursite.com/styles.css" your code would be:

xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
xinha_config.stylistLoadStylesheet('/styles.css');

Furthermore if you want to load in TWO stylesheets ("http://www.yoursite.com/styles.css" and "http://www.yoursite.com/folder/folder2/styles2.css" for example) your code would be:

xinha_config = xinha_config ? xinha_config() : new Xinha.Config();
xinha_config.stylistLoadStylesheet('/styles.css');
xinha_config.stylistLoadStylesheet('/folder/folder2/styles2.css');

If your config file has "xinha_config" as some other name, then just use that other name in the above statements. Example:

WHATEVER = xinha_config ? xinha_config() : new Xinha.Config();
WHATEVER.stylistLoadStylesheet('/styles.css');

3: Done!

For examples of changing the display name in the Stylist window of a particular style please see http://xinha.gogo.co.nz/punbb/viewtopic.php?id=770
For discussion of how to load only CERTAIN styles from a style sheet into the Stylist window please see http://xinha.gogo.co.nz/punbb/viewtopic.php?id=853

Last edited by hermes (2007-07-24 14:25:00)

Offline

#10 2007-07-25 12:32:09

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: problem with styles

Thanks for you contribution, hermes. Please don't hesitate sharing any other insights you might have smile

Offline

#11 2007-07-26 12:19:43

hermes
New member
Registered: 2007-07-23
Posts: 6

Re: problem with styles

You're very welcome! I'd love to help out this project, and am very thankful for those that have put work into it thus far, so that I can use it myself.

Offline

Board footer

Powered by FluxBB