I now removed the TinyMCE fields from my production code and moved it to
a development branch. Thus it is unclear when I can give you further
feedback. Since the html I got from the tinymce editor isn't xhtml I
need to solve the problem of having html as textual data in my xml.
Right now I got tired of the problem and reverted back to pure text
instead. The text get's converted into <p>aragraphs in my xml database,
thus searching for example a string in the second paragraph is easily
done with XPath. With the html it became a nightmare :(
If anyone has good pointers for best practices on handling (non-xml)
html inside xml, I'm eager to read and learn.
Thank you very much, Alain. I will try to get back to TinyMCE, it would
help my users but now it seriously impacted and started to tear on my
XRX design.
Kristian
19.05.2015 23:14, Alain Couthures kirjutas:
Hello Kristian,
I think that I have just found a workaround for the getContent() issue
with TinyMCE4 when adding a line: I have added a test to avoid useless
setContent() call when value is actually unchanged...
Please have a look at latest revision (rev.615).
Thank you for your feedback!
--Alain
Le 19/05/2015 10:12, Kristian Kankainen a écrit :
The thing that irritate me the most with these bogus elements, is
that they seem not be valid according to my TinyMCE settings. Since I
keep getting <br> instead of <br /> I can't parse the input as XML.
My current solution is to delete (in the serialised string) the bogus
elements, convert <br> to <br/> and then parse the (hopefully valid)
xml and delete all the rest of the @data-mce* attributes.
This is very fragile and I would insist in using the API method since
that is what it is there for... What is the major issue using it in
XSLTForms? Looking at the TinyMCE4 API documentation it doesn't seem
to have changed and is still the supposed way of getting "clean"
content from the editor.
Kristian
18.05.2015 23:26, Alain Couthures kirjutas:
Hello Kristian,
This forum post seems too old to be related to TinyMCE4. With
TinyMCE3, the getContent() method worked perfectly for each event
that XSLTForms has to capture. Unfortunately, with TinyMCE4, there
is a major issue using this method as soon as a new line is entered...
That is why I had to search for an alternative solution and the
innerHTML property seems good enough except for some extra
attributes that you have noticed. Do you think that some regular
expression could remove them?
--Alain
Le 14/05/2015 23:39, Kristian Kankainen a écrit :
Hello again!
Okey, I now understood and accepted that the content has to be
serialized. But I now get un-clean input from the TinyMCE equipped
fields.
I get (serialized) <br data-mce-bogus="1"> elements saved in my
database. I understand TinyMCE uses these elements internally so
that users can put the cursor inside empty elements when clicking.
But these bogus elements should be automatically cleaned away
before the form data gets sent to the server!
Reading the whole thread about the problem, this post [1] by the
main developer says that:
Use the proper API:s tinymce.activeEditor.getContent() or save
etc. Raw HTML should never be stored or extracted. TinyMCE never
produces any internal data-mce-bogus output if you use our methods
for content extraction.
Could this be the problem in XSLTForms, that the proper API isn't
used? I'm sorry I can't look at the code myself. This is my TinyMCE
config in XSLTForms:
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.agencexml.com/xsltforms/rte">
<simpleType name="standardHTML">
<restriction base="xf:HTMLFragment"
xsltforms:rte="TinyMCE"/>
<annotation>
<appinfo>
{
element_format : "xhtml",
browser_spellcheck: true,
entity_encoding: "numeric",
cleanup: true,
plugins: [
"autolink lists link charmap",
"searchreplace code fullscreen",
"insertdatetime paste"
],
toolbar: "undo redo | bold italic underline |
alignleft aligncenter alignright alignjustify | bullist numlist
outdent indent | link | charmap",
statusbar : false
}
</appinfo>
</annotation>
</simpleType>
</schema>
I use version 4.1.9 of TinyMCE and I think the XSLTForms code is
version 614.
Can I send some more information for reproducing this?
Thank you in advance
Kristian K
[1] http://www.tinymce.com/forum/viewtopic.php?pid=109291#p109291
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support