Re: [Xsltforms-support] TinyMCE
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2015-05-19 20:14:25
|
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 >>> >> > |