Announcement

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

#1 2005-09-22 22:21:59

bongobongo
New member
Registered: 2005-09-22
Posts: 7

How do I apply class to body of editor? How to insert HTML?

Hi.

I have currently been testing FCKeditor for a while.
It is an editor with great future possibilities but at the moment it
has to many compatibility conflicts between different browsers (IE / FF)
because of different handling of TAGs.

Lucky me, to find Xinha. Did some quick testing today and all my complaints
with FCKeditor actually works here.... Great.

What remains now is to ask some questions about how it deals with classes.

Questions:

1. How do I apply a class to the className of BODY of editor?
Hopefully by being able to set BODY className at editor startup or after it has initialized.
If that is not doable, is there a workaround.
Example please.

2. How do I change class for BODY dynamically?
I want to use javascript from the page where the editor is placed to change the body class after the
editor has initialized. Hopefully to be able to change the BODY className.
I need to do this from outside the buttons panel because I want to control two editor instances at the same time.
Is that possible out of the box?
If not, is there a workaround?

3. How do I insert HTML in the editor at cursor position using javascript?
I also want to do that from outside the editor buttons  area or eventually by creating a custom button.
Would like to see example of solution to both.

4. How do I enable classes for the inserted HTML ref. Q3?
The inserted HTML ref. Q3 are to use some classes.
Where do I enable those classes for the editor?
Note: The classes used for the inserted HTML should "normally" not be accessible for
the editor (writer).

5. I want enable some custom tags and inline styles for the editor. How do I make styles like the one below accessible from a dropdown inside the editor button area?
<span style="line-height:150%">SELECTED TEXT</span>
<span style="font-size:150%">SELECTED TEXT</span>

I want it to work like this:
Writer select some text and then select "FontSize=150%" from the dropdown.
Then code (custom or core) should put a SPAN tag around selected text with the inline style font-size:150%


Hope the above is doable and flexible....

Best luck with the project

Last edited by bongobongo (2005-09-23 04:43:42)

Offline

#2 2005-10-01 05:46:07

bongobongo
New member
Registered: 2005-09-22
Posts: 7

Re: How do I apply class to body of editor? How to insert HTML?

So, is it possible to do the things above?

Offline

#3 2005-10-03 03:42:07

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

Re: How do I apply class to body of editor? How to insert HTML?

1. How do I apply a class to the className of BODY of editor?
try this in your config:

editor._onGenerate = function() {
    this._doc.body.className = 'yourClass'
}

2. How do I change class for BODY dynamically?
you might use the same as in 1. - you conly must have access to the editor-object.

3. How do I insert HTML in the editor at cursor position using javascript?

editor.insertHTML('html...');

...again you must have the editor-object.

4. HTML ref. Q3 ?? what is that? please explain a bit more what you need...

5. use css-classes - the Stylist-plugin or the DynamicCSS-plugin or CSS-plugin will help you.


Niko

Offline

#4 2005-10-03 07:27:48

bongobongo
New member
Registered: 2005-09-22
Posts: 7

Re: How do I apply class to body of editor? How to insert HTML?

Hi and thanks for reply.

More regarding Question 4.

I want to insert some premade HTML into editor.
This HTML uses classes.
Example:

<div class="classname">
more HTML stuff here
</div>

So what I need is a way to tell Xinha editor which external stylesheet(s) should be enabled with the editor.

Best regards

Offline

#5 2005-10-03 08:34:42

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

Re: How do I apply class to body of editor? How to insert HTML?

using this you can specify the stylesheet:

editor.config.pageStyle = "@import url(yourfile.css);";

you can of course ave several @imports here.


Niko

Offline

#6 2005-10-03 10:37:33

bongobongo
New member
Registered: 2005-09-22
Posts: 7

Re: How do I apply class to body of editor? How to insert HTML?

Thanks for answers....

Will test soon. :-)

Offline

Board footer

Powered by FluxBB