contao-community-alliance / composer-client

This is the Contao Composer Client
http://de.contaowiki.org/Composer
27 stars 18 forks source link

Contao 3.2.21: ACE editor for composer.json does not work #283

Closed fritzmg closed 8 years ago

fritzmg commented 8 years ago

Unter Contao 3.2.21 the composer.json editor will not work. The JavaScript console will show

ReferenceError: ace is not defined

for this line

var editor = ace.edit("composer_client_editor");

This is because ACE is integrated like so:

<script>window.ace || document.write('<script src="assets/ace//ace.js" charset="utf-8">\x3C/script>')</script>

i.e. the folder is incorrect, it should be

assets/ace/1.1.6/ace.js

This is because composer-client 0.16.3 uses

<script>window.ace || document.write('<script src="<?php echo TL_ASSETS_URL; ?>assets/ace/<?php echo $GLOBALS['TL_ASSETS']['ACE']; ?>/ace.js" charset="utf-8">\x3C/script>')</script>

(https://github.com/contao-community-alliance/composer-client/blob/0.16.3/src/system/modules/!composer/templates/be_composer_client_editor.html5#L27) but the variable

$GLOBALS['TL_ASSETS']['ACE']

is not available in Contao 3.2.*, it was introduced in Contao 3.3.0: https://github.com/contao/core/blob/3.3.0/system/modules/core/config/config.php#L448

Prior to composer-client 0.16.2 the resource was loaded from cloudfront:

<script src="//d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>

So for Contao 3.2.* it either needs to be the old cloudfront solution or

<script>window.ace || document.write('<script src="<?php echo TL_ASSETS_URL; ?>assets/ace/<?php echo ACE; ?>/ace.js" charset="utf-8">\x3C/script>')</script>

i.e. using the ACE constant instead of $GLOBALS['TL_ASSETS']['ACE'].

discordier commented 8 years ago

Was introduced with ce646bcf34da58da9169dd650911aae201405f99 to fix issue #248

discordier commented 8 years ago

Should be fixed with 63043660766a8d81a0a291cad7eb7722d8be1bee. @fritzmg please test

fritzmg commented 8 years ago

Yep, works fine.