Hello everybody,
i try to get the editor work with custom tags of the Fluid Template Engine (link). There are a hundred threads for custom tags, but a solution is still missing.
I try to get this to work:
<f:for each="{menu.courses}" as="course"> <b>{course.type}</b><br /> <f:if condition="{course.text} != {course.type}"> <f:format.raw>{course.text}<br /></f:format.raw> </f:if> <br /><br /><br /> </f:for>
My Result (Source Code View):
<f:for as="course" each="{menu.courses}"> <b>{course.type}</b><br /> <f:if condition="{course.text} != {course.type}"> <f:format.raw>{course.text}</f:format.raw></f:if></f:for><br /> <br /> <br /> <br />
I tried hours to get it to work by defining EDITOR.dtd values. But im not able to tell the editor to leave the br-tags in place (inside the f:for-element).
Example:
CKEDITOR.dtd['f:format.raw'] = 1; CKEDITOR.dtd['f:if'] = 1; CKEDITOR.dtd['f:for'] = 1; CKEDITOR.dtd['$block']['f:format.raw'] = 1; CKEDITOR.dtd['$block']['f:if'] = 1; CKEDITOR.dtd['$block']['f:for'] = 1; ...
I also use an allowExtraContent definition:
config.extraAllowedContent = "f:for[!each,!as];f:if[!condition];f:format.raw;...";
And in addition i tried to set allowContent to true:
config.allowedContent = true;
I played hours with all those settings, but without a satisfying result.
I only want, that the editor leaves all the tags where they are.
Can anyone Help me???
Kind Regards
Have you checked the
Have you checked the HTMLWriter?
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Hello sebstefanov,
Hello sebstefanov,
thanks for your reply. But the problem in not the display format, like indentation etc.
The Problem is, that the ordering of the tags/elements will be changed:
Is changed to:
The br-tags are moved to the end; outside the f:* elements (except of the first one).
Any ideas?
Unfortunately you're trying
Unfortunately you're trying to abuse CKEditor. It is not supposed to be handling some special template engine extending HTML. It might be configured to accept some custom elements and by modifying the DTD you can more or less define how those elements should be handled by editor, but that will not affect the browser, which handles important part of editing as well (the entire HTML is passed through browser). Additionally, there are some special situations and elements like the <br> in your case. In contenteditable they have special meaning when used at the end of other elements (they are so called bogus <br>s) and you will not be able to control them fully. That's because of browsers and editor as well, which must handle them in similar way to browsers.
So, in short, you're not using CKEditor in the correct way. It's a content editor, not some code editor with templates language support. Read more in the CKEditor basic concepts guide.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Ok, thanks a lot. Its a
Ok, thanks a lot. Its a little disappointing, but i understand the reasons.
Is there an easy way to "hide" these cusom tags, i.e. the "f:for"-tag, from the browsers DOM an replace them with placeholder tags while editing and rereplace them on save action? Maybe by a custom plugin? A link to a documentation page or a tiny code snippet would be nice, if there is a way to do this.
Thanks and regard