Problem with tapestry5-jquery and SUPPRESS_PROTOTYPE

335 views
Skip to first unread message

Thomas Noirez

unread,
Oct 8, 2013, 11:34:17 AM10/8/13
to tapestry...@googlegroups.com
Hi,

I have a strange problem, I'am using
  • Tapestry 5.3.6
  • tapestry5-jquery 3.3.7
  • tapestry-ckeditor which use Prototype

When I configure with this value :

        configuration.add(SymbolConstants.PRODUCTION_MODE, false);
        configuration.add(JQuerySymbolConstants.SUPPRESS_PROTOTYPE, false);
        configuration.add(JQuerySymbolConstants.JQUERY_ALIAS, "jq");

OK, no problem it works

But when I'm using PRODUCTION_MODE = true, problem ckeditor does not appear and when I look the code there is no proptoype.js

Did I miss something ?

Thanks Thomas



Emmanuel DEMEY

unread,
Oct 8, 2013, 12:19:48 PM10/8/13
to tapestry...@googlegroups.com
That's normal. You should have a core.js 'I think), containig all the core javascript files, including Prototype. 
But your component should work. Do you have any JS Errors ? 

Thomas Noirez

unread,
Oct 8, 2013, 1:14:37 PM10/8/13
to tapestry...@googlegroups.com

Emmanuel DEMEY

unread,
Oct 8, 2013, 2:56:28 PM10/8/13
to tapestry...@googlegroups.com
How to you initialize your CKEditor component ? 


2013/10/8 Thomas Noirez <thomas...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "tapestry5-jquery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tapestry5-jque...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.e...@gmail.com

Twitter : @EmmanuelDemey

Thomas Noirez

unread,
Oct 8, 2013, 3:08:17 PM10/8/13
to tapestry...@googlegroups.com
I'm using tapestry-ckeditor from : http://tynamo.org/tapestry-ckeditor+guide


My component

<t:beaneditform t:id="webInfo" object="currentInfo" submitlabel="Mise à jour" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"
    include="idInfoWeb, utilisateur, local, infoWebType, menu, titre, contenu,  ordre, role, isActif, groupement">
    <p:menu>
        <label>Menu pére</label>
        <t:select value="currentInfo.menu" model="model" />
    </p:menu>

    <p:idInfoWeb>
        <label>Id</label>
        <t:if test="newInformation" negate="true">
            <t:hidden value="currentInfo.idInfoWeb" />
        </t:if>
        <strong>[${currentInfo.idInfoWeb}]</strong>
    </p:idInfoWeb>
    <p:utilisateur>
        <label>Utilisateur</label>
        <strong>${currentInfo.utilisateur}</strong>
    </p:utilisateur>
    <p:contenu>
        <t:textarea t:value="currentInfo.contenu" t:mixins="tynamo/ckeditor" parameters="{'toolbar': 'Full'}" />
    </p:contenu>
</t:beaneditform>


init-ckeditor.js from the jar

Tapestry.ckeditor = {
    formEventHandlers : {}
};

/**
 * Tapestry initialization for tapestry-ckeditor.
 */
Tapestry.Initializer.initCKEditor = function(textareaId, ckeditorInitJSON) {

    /*
     * If the textarea with id=ckeditorId cannot be found (probably because if
     * tapestry zone update), than destroy it's corresponding ckeditor instance.
     */
    for (ckeditorId in CKEDITOR.instances)
        if ($(ckeditorId) == undefined)
            // destroy the ckeditor instance without updating the textarea
            CKEDITOR.instances[ckeditorId].destroy(true);

    // init CKEditor for the given textarea
    CKEDITOR.replace(textareaId, ckeditorInitJSON);

    var updateTextArea = function() {
        /*
         * if the ckeditor instance with id=textareaId cannot be found, than it
         * has been destroyed so remove the corresponding eventHandler listening
         * on FORM_PREPARE_FOR_SUBMIT_EVENT,
         *
         * else update the textarea with the ckeditor contentnts before the form
         * is submitted so that the corresponding server side property is
         * updated.
         */
        var ckeditorInstance = CKEDITOR.instances[textareaId];
        if (ckeditorInstance == undefined)
            document.stopObserving(Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT,
                    Tapestry.ckeditor.formEventHandlers[textareaId]);
        else
            ckeditorInstance.updateElement(); // update the textarea
    };

    Tapestry.ckeditor.formEventHandlers[textareaId] = updateTextArea;
    document.observe(Tapestry.FORM_PREPARE_FOR_SUBMIT_EVENT, updateTextArea);
};

Emmanuel DEMEY

unread,
Oct 9, 2013, 4:58:45 AM10/9/13
to tapestry...@googlegroups.com
If you type Tapestry in your javascript console, do you have something, or do you have "undefined". I think the problem come from this variable. 
Can you share the begining of the downloaded tapestry.js file ? I think this file is compressed, and the variable Tapestry has been renamed. 


2013/10/8 Thomas Noirez <thomas...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "tapestry5-jquery" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tapestry5-jque...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thomas Noirez

unread,
Oct 9, 2013, 4:24:50 PM10/9/13
to tapestry...@googlegroups.com
Hello

When I type tapestry in the console :
>>> Tapestry
undefined

There is no tapestry.js in my page, but core.js (558 Ko !!!!)
In core.js, I found JQuery, and many other things
core.js

Emmanuel DEMEY

unread,
Oct 10, 2013, 4:58:55 AM10/10/13
to tapestry...@googlegroups.com
i can reproduce the problem. Very very strange. 
I will try to find the solution today. 
Manu


2013/10/9 Thomas Noirez <thomas...@gmail.com>

Emmanuel DEMEY

unread,
Oct 10, 2013, 10:28:12 AM10/10/13
to tapestry...@googlegroups.com
I think it is the same problem as explained here : http://stackoverflow.com/questions/4504026/prototype-and-jquery-concatenation-failure

But I do not have a solution right now. keeping searching. 

Manu


2013/10/10 Emmanuel DEMEY <demey.e...@gmail.com>

Emmanuel DEMEY

unread,
Oct 11, 2013, 4:56:35 AM10/11/13
to tapestry...@googlegroups.com
So I think There is no magical solution. It is not a error sur to Tapestry, but to the JavaScript technos. 

What I can propose, is to create 2 différents Tapestry JavaScript Stack : one containing jQuery and another containg Prototype. It works in my app. 

I have created 3 gists to help you : https://gist.github.com/Gillespie59/6931714

The package of the JQueryJavaScriptStack class should be the same ! (we override the stack coming from Tapestry5-jQuery). 

Let me know if it works for you. And if it the case, I will commit the solution on the trunk. 

Manu

Thomas Noirez

unread,
Oct 11, 2013, 5:10:40 AM10/11/13
to tapestry...@googlegroups.com
OK, thanks, I will try this evening

Thomas Noirez

unread,
Oct 12, 2013, 7:05:33 AM10/12/13
to tapestry...@googlegroups.com
It's not working !

So I decided to create a new component ckeditor with jQuery and remove prototype.

It's seems to work !!!!

Thnaks for everything
Reply all
Reply to author
Forward
0 new messages