Re: [Xsltforms-support] custom buttons in TinyMCE (4.3.12) with XSLTForms (638)
Brought to you by:
alain-couthures
From: Alain C. <ala...@ag...> - 2017-02-06 20:44:23
|
Customizing TinyMCE with XSLTForms is based on the definition of a data type with corresponding parameters. Please have a look at http://www.agencexml.com/xsltforms/tinymce.xml <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.agencexml.com/xsltforms/rte"> <simpleType name="standardHTML"> <restriction base="xforms:HTMLFragment" xsltforms:rte="TinyMCE"/> <annotation> <appinfo> { plugins: [ "advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste" ], toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" } </appinfo> </annotation> </simpleType> </schema> <instance id="main"> <data xmlns=""> <richtext><p>Paragraph <i>number one</i></p></richtext> </data> </instance> <bind nodeset="richtext" type="rte:standardHTML"/> As you can guess, the appinfo content is copied with the following instruction in the initInput method: eval("initinfo = " + (type.appinfo ? type.appinfo.replace(/(\r\n|\n|\r)/gm, " ") : "{}")); Is it what you are looking for? Thank you for your feedback! --Alain Le 2/6/2017 à 8:18 PM, C. M. Sperberg-McQueen a écrit : >> On Feb 6, 2017, at 9:15 AM, C. M. Sperberg-McQueen <cm...@bl...> wrote: >> >> >>> On Feb 5, 2017, at 2:38 PM, C. M. Sperberg-McQueen <cm...@bl...> wrote: >>> >>> Short description: I don't seem to be having any luck making custom >>> buttons work with TinyMCE in XSLTForms. Can anyone help? >> Perhaps I see the source of the problem. >> >> Looking at xsltforms.js this morning, I see that the function >> XsltForms_input.prototype.initInput unconditionally assigns a >> value to initinfo.setup; ... >> It might be cleaner to add a user hook to the default setup() >> function. That is, if the user supplies a property named (say) >> ‘Xsltforms_usersetup’ in the TinyMCE initialization object, then >> the default setup function calls that user-supplied function. > A preliminary test suggests that this modification will work. > > I made the following changes to xsltforms.js, all to the function > XsltForms_input.prototype.initinput. > > 1 After the line reading 'initinfo.mode = “none”;’, I inserted > > /* MSM 20170206 add initinfo.Xsltforms_usersetup property to allow user contributions to setup() */ > initinfo.Xsltforms_usersetup = (initinfo.Xsltforms_usersetup ? initinfo.Xsltforms_usersetup : function (ed) {} ); > > 2 In each of the two versions of initinfo.setup I added a call to > initinfo.xsltforms_usersetup(), so the first lines of the assignment > read > > initinfo.setup = function(ed) { > /* MSM 20170206 user exit for setup() */ > initinfo.Xsltforms_usersetup(ed); > > In addition, in the XForm itself, I changed the content of > the xsd:appinfo element for simple type ‘standardHTML’, > so that instead of supplying a setup property, it supplies > a property named Xsltforms_usersetup. > > The result can be seen at [1]. There is a great deal of room > for improvement, but the buttons are showing up, and the > functions associated with them are executing. (I have not > attempted any thorough testing.) > > [1] http://tlrr.blackmesatech.com/2017/02/tests/xsltforms.userexit.xhtml > > Alain, is it feasible to integrate this (or a better) way of allowing > user input to the TinyMCE setup() function in the production version > of XSLTForms? What do you think? > > best, > > Michael > > ******************************************** > C. M. Sperberg-McQueen > Black Mesa Technologies LLC > cm...@bl... > http://www.blackmesatech.com > ******************************************** > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support |