Re: [Xsltforms-support] custom buttons in TinyMCE (4.3.12) with XSLTForms (638)
Brought to you by:
alain-couthures
|
From: C. M. Sperberg-M. <cm...@bl...> - 2017-02-06 19:18:17
|
> 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
********************************************
|