XMLArea extension development

Author Message

STEVO +

Wednesday 09 March 2005 7:47:32 am

liu -

i think i've fixed the virtual host url problems in the latest svn could you report back please?

fraser + others -

the rule your using looks ok. mine's prolly not as secure:

RewriteRule !\.(php|gif|jpe?g|png|css|js|html|htm|pdf|jar)$ index.php

perhaps the problem lies elsewhere like these dodgy paths? could you try to pop up a window (eg insert table) and post the url that is trying be reached.

cheers

liu spider

Wednesday 09 March 2005 3:33:30 pm

yes, works fine now, with a little bit modification:
in the beginning of file design/standard/templates/content/datatype/edit/ezxmltext.tpl, a '}' is missing at the end of the default instruction. (This prevents the xmlarea from loading)

thanks.

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

liu spider

Wednesday 09 March 2005 5:51:30 pm

I'd see that currently xmlarea is almost mature enough for a stable release.

However, concerning the future of xlmarea, as htmlarea 2/3 was not continued any more, I think maybe migrating xmlarea to some other WYSIWYG html editor is a wise choice. I think fckeditor is a perfect candidate.

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

STEVO +

Thursday 10 March 2005 9:08:27 am

are you <i>sure</i> you're not psychic, liu? i only just downloaded fckeditor yesterday!

you're right that htmlarea isn't continued + fckeditor would be a better choice. unfortunately i started hacking this thing together with htmlarea + migrating now isn't an appealing idea. there's only so much javascript you can do for free without losing the plot.

so i'm afraid i'll be getting xmlarea stable as it is + then forgetting about it for a long time.

liu spider

Thursday 10 March 2005 2:36:10 pm

;) really appreciate all your effort.

As eZ 3.6 is coming, the new object relation system is approaching. I think xmlarea needs to be updated to support the newly added possibilities, such as using node id rather than friendly url to link to an internal page.

again, thanks for your great contribute to eZ community.

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

liu spider

Thursday 10 March 2005 2:38:46 pm

I'd like to add more custom tags. I just wonder whether I can achieve it by only editing some ini files and adding several tpl files. Am I right?

Oh, I have also to add buttons in the xmlarea toolbar, right? Then could you enlighten me which js file I should edit to add buttons?

thanks.

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

STEVO +

Friday 11 March 2005 7:42:00 am

my timing's impeccable isn't it? i release xmlarea just after online editor 2 appears. then i get it just about stable before the ezxml spec changes.

i will be supporting the new system.

stay tuned for a custom tags tutorial...

liu spider

Friday 11 March 2005 7:53:12 am

thanks, really looking forward to it.

May I suggest that tutorial contains howto customize the apperance of tags in the editor itself as well?

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

STEVO +

Friday 11 March 2005 8:43:35 am

<b>how to add custom tags to xmlarea</b>

let's say we want to add a custom tag to render text in a monospaced font. we'll call the new tag 'mono'.

first off we add the tag to content.ini as usual

[CustomTagSettings]
...
AvailableCustomTags[]=mono
IsInline[mono]=true

next we need to think how the tag can be represented in the editor with a single html tag. you can use pretty much any tag other than PRE that accepts a 'lang' or 'language' attribute (most do). for our example TT fits the bill.

in xmlarea.ini we define this tag

[CustomTagSettings]
...
StartTags[mono]=tt
EndTags[mono]=tt

these details are used by the toolbar button to add + remove the tags. if you don't specify them, a SPAN will be used if your custom tag is inline or a DIV if not.

then we add details of the button:
- a tooltip, which appears when you hover over the button + in the context menu (if not specified, the tagname is used)
- the filename of an 18x18px icon relative to xmlarea/design/standard/javascript/images/ (if not specified a ? icon is used)

[CustomTagSettings]
...
Tooltips[mono]=Monospace
Icons[mono]=ed_mono.gif

the last step in xmlarea.ini adding the button where we want it in the toolbar. the name of the button will be 'custom_mono'. if we want it after the italic button then:

[CustomTagSettings]
...
xmlareaButtons[]=italic
xmlareaButtons[]=custom_mono

finally we need to create a template for the tag called 'mono.tpl' in xmlarea/design/standard/templates/xmlarea/ezxmltags/ which looks like this:

<tt id="custom_mono"{section show=$classification} class="{$classification}"{/section} language="{$attstr}">{$content}</tt>

note the following:
- we use the same tag as we specified in xmlarea.ini. if we didn't specify one, we use a DIV or SPAN (depending on wether it's inline or not).
- the ID is required. it must be the name of the custom tag button.
- the $classification section isn't required but it allows us to alter the css class of the html tag + so alter it's appearance.
- the LANG or LANGUAGE attribute (depending on your html tag) is required if you want to allow custom attributes to be added.
- you can access other custom attributes by the attribute name eg. {$title} in factbox but don't place anything inside the tag other than it's content.

now, after we've cleared our caches, we're done.

to alter the appearance of the tag, edit xmlarea/design/standard/javascript/pagestyle.js. this is a simple javscript file containing lines of css. our tag is TT with an ID="custom_mono" so we might add a line like:

'tt#custom_mono { font-weight: bold } '

we could also alter it's appearance if it's class were set to 'red':

'tt#custom_mono.red { color: #f00 } '

in release 0.2.2 you can also use an IMG tag to represent a custom tag. you might do this as follows.

content.ini

[CustomTagSettings]
...
AvailableCustomTags[]=newtag
IsInline[newtag]=true

xmlarea.ini

[CustomTagSettings]
...
xmlareaButtons[]=custom_newtag

StartTags[newtag]=img src="/full/path/from/root.gif"
Tooltips[newtag]=My New Tag
Icons[newtag]=ed_newtagicon.gif

xmlarea/design/standard/templates/xmlarea/ezxmltags/newtag.tpl:

<img src="/full/path/from/root.gif" id="custom_newtag"{section show=$classification} class="{$classification}"{/section} lang="{$attstr}" />

that's all i can think of. hope this makes some sense!

liu spider

Friday 11 March 2005 10:02:32 am

So quick, beyond my expectation :)

thanks a lot. I will try this out and give feedbacks.

Another suggestion (again), do you think it would be good if you publish this tutorial in your own site, with all the possible tags available in xmlarea ;)

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

liu spider

Friday 11 March 2005 4:47:58 pm

I'd like to update extension/xmlarea/design/standard/templates/xmlarea/ezxmltags/factbox.tpl file to make factbox in editor appear as it would be on my user site

Is it possible for me to retreive a parameter? say "title" of factbox, because I need to display it in the factbox.tpl.

thanks.

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

liu spider

Friday 11 March 2005 5:37:17 pm

I just discovered another small (but annoying enough) bug:

howto reproduce:
1. create a new article,
2. in the body, write two paragraph
3. select the first paragraph, and click "factbox" button, this will create a factbox
4. save draft (or publish)
5. all is fine. Then edit the draft again (if you published it, then edit it)
6. do not change anything just click the "save draft" again (or publish again)
7. an extra " " is displayed in the place where you inserted a factbox.

if I edit it again, after removing the " " and publishing, all is fine, until next time you edit it.

Could you check it? Thanks.

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

liu spider

Saturday 12 March 2005 5:10:12 pm

Every apperance of " will be replaced with &quot; even under literal

currently, I use this workaround:

remove the wash(xhtml) from design/standard/templates/content/datatype/view/ezxmltags/literal.tpl and extension/xmlarea/design/standard/templates/xmlarea/ezxmltags/literal.tpl

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

STEVO +

Tuesday 15 March 2005 5:14:37 am

liu - i think i've fixed the   + &quot; problems in pubsvn.

with regards to your factbox, i'm afraid you won't be able to display any attributes of a custom tag in xmlarea, only it's content within a simple html tag. it just creates far too many problems to do it any other way. i'll make the attributes available in the templates, though, in case you wanted to use them in another way (such as in the alt attribute of an image tag etc).

liu spider

Tuesday 15 March 2005 5:47:08 am

thanks a lot. I will try it out.

If possible, I think that would be nice.

http://liucougar.scim-im.org
SCIM Input Method Platform
http://scim.sf.net
SJSD Online Editor
http://sf.net/projects/sjsd

STEVO +

Wednesday 16 March 2005 1:50:55 am

just realised that custom tag attributes are already available in the xmlarea tag templates by their name eg. {$title} etc.

Rami Grossman

Wednesday 16 March 2005 2:09:18 am

I have installed this extention. It looks promissing!
Our use of eZ publish online editor is mainly copying and pasting text from word and html. I guess that this way is commonly used by many people. eZ publish online editor knows to remove unsupported tags. This editor only alerts but doesn't remove it. So for us this is a dead end.

Is this a bug? Becouse I think it sould have removed those tags like eZ editor.

STEVO +

Wednesday 16 March 2005 2:28:22 am

rami - yes i s'pose that is a bug! thanks for bringing it to my attention.

a workaround for now is to use the <> toggle edit mode button this with alert you of invalid tag structures + also remove them.

Rami Grossman

Wednesday 16 March 2005 3:07:58 am

Thanks for the fast reply! aother thing -
Is it possible to attach the editor buttons to the edit box?
I gave it to fiew people to use and they couldn't find the editor buttons, and those are power users. What if I'll put it on the site, open for everyone...

STEVO +

Wednesday 16 March 2005 8:07:39 am

latest revision in pubsvn now removes invalid tags + attributes on publishing.

rami, you're not the first person to ask for buttons attached to the edit box. i can't see what the appeal is myself, but i will do it eventually. maybe next month.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.