|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Question about extending the SimpleDocument to allow the addition of class attributes.Hi,
Can someone help? I was hoping to be able to extend the (standard) Rich editor that you see with the SimpleDocument part type to allow the saving of class and id attributes. At the moment, if you create a new SimpleDocument and click on the <> icon to the right, you're allowed to freely enter xhtml markup. Unfortunately, if you try and add class attributes to, say, p, h[x], or a tags, these classes are all "stripped" from the body content as the document is saved. So, in this view: <p class="red">red</p> becomes: <p>red</p> After the document has been saved and re-opened for editing. I've looked around found this page in the docs (http://www.daisycms.org/daisydocs-2_1/374-cd/499-cd.html) and it suggests that you can create a file called variables.xml containing something like this: <variables> <variableSources> <variableDocument id="6-DSY"/> </variableSources> <variablesInAttributes allAttributes="false"> <element name="a" attributes="class, id"/> <element name="span" attributes="class, id"/> <element name="p" attributes="class, id"/> <element name="h3" attributes="class, id"/> </variablesInAttributes> </variables> Although this still seems to strip out the class attributes once the doc (in this case "6-DSY") is saved. So my 2 questions are: 1. is the variables.xml approach the way to do this? Or is there another way (from reading the docs, is sounded more like variables.xml was supposed to resolve specific values, not allow the use of extra attributes). 2. If this is the right approach, what else might I need to do if I want to ensure class attributes aren't being deleted on save? Also, is there any way to apply rules for all documents in the wiki? The example seemed to suggest that you need to apply those rules to specific documents (e.g. 6-DSY). Would there be a way to Extend the SimpleDocument editor to allow someone to write some rich text, then go to the markup view and add some class attributes in and save them knowing they will be preserved? Thanks in advance for any info/advice. A |
|
|
Re: Question about extending the SimpleDocument to allow the addition of class attributes.Hi,
Managed to find what looks like a solution for this: in $DAISY_HOME/dasiywiki/webapp/daisy/resources/conf there's a file called htmlcleaner.xml I edited that, restarted the repository and the wiki and it worked. Hope that helps. Example (to allow adding class attributes to links): <!-- linking --> <element name="a"> <attribute name="href"/> <attribute name="class"/> </element> |
|
|
Re: Question about extending the SimpleDocument to allow the addition of class attributes.The documentation about variables is not relevant for your problem.
See the links below for relevant documentation: [0] Wiki editor usage notes http://www.daisycms.org/daisydocs-2_3/374-cd/24-cd.html (Read the part about "Supported HTML Subset and HTML Cleaning.) [1] Adding a writing style http://www.daisycms.org/wiki/g1/215-cd.html HTH, Karel On Tue, Jun 23, 2009 at 12:21 AM, Alex Bleasdale<rhodlite78@...> wrote: > > Hi, > > Can someone help? I was hoping to be able to extend the (standard) Rich > editor that you see with the SimpleDocument part type to allow the saving of > class and id attributes. > > At the moment, if you create a new SimpleDocument and click on the <> icon > to the right, you're allowed to freely enter xhtml markup. Unfortunately, > if you try and add class attributes to, say, p, h[x], or a tags, these > classes are all "stripped" from the body content as the document is saved. > So, in this view: > > <p class="red">red</p> > > becomes: > > <p>red</p> > > After the document has been saved and re-opened for editing. > > I've looked around found this page in the docs > (http://www.daisycms.org/daisydocs-2_1/374-cd/499-cd.html) > > and it suggests that you can create a file called variables.xml containing > something like this: > <variables> > > <variableSources> > <variableDocument id="6-DSY"/> > </variableSources> > > <variablesInAttributes allAttributes="false"> > <element name="a" attributes="class, id"/> > <element name="span" attributes="class, id"/> > <element name="p" attributes="class, id"/> > <element name="h3" attributes="class, id"/> > </variablesInAttributes> > > </variables> > > Although this still seems to strip out the class attributes once the doc (in > this case "6-DSY") is saved. > > So my 2 questions are: 1. is the variables.xml approach the way to do this? > Or is there another way (from reading the docs, is sounded more like > variables.xml was supposed to resolve specific values, not allow the use of > extra attributes). > > 2. If this is the right approach, what else might I need to do if I want to > ensure class attributes aren't being deleted on save? > > Also, is there any way to apply rules for all documents in the wiki? The > example seemed to suggest that you need to apply those rules to specific > documents (e.g. 6-DSY). Would there be a way to Extend the SimpleDocument > editor to allow someone to write some rich text, then go to the markup view > and add some class attributes in and save them knowing they will be > preserved? > > Thanks in advance for any info/advice. > > A > -- > View this message in context: http://www.nabble.com/Question-about-extending-the-SimpleDocument-to-allow-the-addition-of-class-attributes.-tp24156593p24156593.html > Sent from the Daisy - General mailing list archive at Nabble.com. > > _______________________________________________ > daisy community mailing list > Professional Daisy support: http://outerthought.org/en/services/daisy/support.html > mail to: daisy@... > list information: http://lists.cocoondev.org/mailman/listinfo/daisy > daisy community mailing list Professional Daisy support: http://outerthought.org/en/services/daisy/support.html mail to: daisy@... list information: http://lists.cocoondev.org/mailman/listinfo/daisy |
| Free embeddable forum powered by Nabble | Forum Help |