This is a good workaround, thanks.

This won't work when the textarea with TinyMCE is loaded from an Ajax
request, though. Nevertheless, the problem shouldn't arise when the script
is loaded from an Ajax request, so in case the request is an Ajax request,
you can include it with RenderSupport as usual and if it is not, then use
the form you just described. Thanks, Josh, that should do the trick.

However, I think the ticket should still be considered. Including a script
that doens't work when combined with others is not a very "rare case", so
built-in support without recurring to workarounds would be really helpful.

Regards.


Josh Canfield wrote:
> 
> Here is a workaround that I used in my tinymce mixin.
> 
> void afterRender(MarkupWriter writer) {
>         // inject script in a non-combinable way
>         final String scriptelementid = "tinymce-script";
>         final Element src =
> writer.getDocument().getElementById(scriptelementid);
>         if (src == null) {
>             final String path =
> _symbolSource.valueForSymbol("tinymce") + "/tiny_mce.js";
>             final Asset asset =
> _assetSource.getAsset(_resources.getBaseResource(), path,
> _resources.getLocale());
>             Element dest = writer.getDocument().find("html/head");
>             if (dest != null) {
>                 dest.element("script", "src", asset.toClientURL(),
> "id", scriptelementid);
>             }
>         }
> }
> 
> Josh
> 
> On Mon, Nov 23, 2009 at 1:13 PM, raulmt <rau...@gmail.com> wrote:
>>
>> Hello,
>>
>> Combining Javascripts feature in T5.1 is great, but sadly I had to
>> disable
>> it. I use TinyMCE and this library uses its own path (where tiny_mce.js
>> "lives") to load other files that are needed (themes, languages, etc.).
>> The
>> problem arises when tiny_mce.js is in the combined virtual asset because
>> it
>> doesn't find any script tag with itself as the src so TinyMCE can't
>> figure
>> out the path to load the other assets.
>>
>> I think there should be a way to specify that some scripts should not be
>> combined because sometimes (like in this case) is a must have... "all or
>> nothing" isn't optimal. I looked into the Tapestry code and doesn't seem
>> to
>> be possible currently... is there a way? should I post a ticket in jira
>> about per-script combining configuration?
>>
>> Regards.
>> --
>> View this message in context:
>> http://n2.nabble.com/Combining-Javascript-doesn-t-work-with-libraries-like-TinyMCE-tp4054005p4054005.html
>> Sent from the Tapestry Users mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Combining-Javascript-doesn-t-work-with-libraries-like-TinyMCE-tp4054005p4058340.html
Sent from the Tapestry Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to