Redactor ccmi18n_issue

Permalink 1 user found helpful
So I have a dashboard Single Page with a form and a textarea on it:
<textarea id="text_content" name="text_content" style="display: none"></textarea>

Before that I'm calling:
<script type="text/javascript">
    var CCM_EDITOR_SECURITY_TOKEN = "<?php echo Loader::helper('validation/token')->generate('editor')?>";
    $(function() {
        $('#text_content').redactor({
            minHeight: '300',
            'concrete5': {
                filemanager: <?php echo $fp->canAccessFileManager()?>,
                sitemap: <?php echo $tp->canAccessSitemap()?>,
                lightbox: true
            },
            'plugins': [
                'fontcolor', 'concrete5inline', 'concrete5', 'underline'
            ]
        });
    });

And again before:
<?php
$al = \Concrete\Core\Asset\AssetList::getInstance();
$al->register('javascript', 'redactor_locale', 'js/redactor_locale.js');
?>


That gives me a JS error saying:
Uncaught ReferenceError: ccmi18n_redactor is not defined


The system language is english US. Any suggestions?

daenu
 
daenu replied on at Permalink Reply
daenu
After adding:
$this->requireAsset('redactor');
on the Single Page and removing the plugins 'concrete5inline', 'concrete5', 'underline' it works. The toolbar was there but not visible, don't ask me why.
edward replied on at Permalink Reply
I had this same issue. It turned out to be because I upgraded to the latest version from Github on an existing site, and I somehow borked that process – the new versions of Concrete's javascript files had not been copied.

What I had to do to get it running was to run 'grunt js' on the command line in the 'build' directory of my Concrete5.7.4.2 development project. I guess you could also just do a fresh install of the latest Concrete5.7 and then just copy over everything from the 'concrete/' directory. If you're using the development/github version, don't forget to do a 'composer install' in the 'concrete/' directory first! Anyhow, after I had that sorted, it all worked again. Hope this helps prevent someone going on a (fun! with cursing!) 3 hour debugging quest.
eldios replied on at Permalink Reply
He edward,

do you have any ideas?
I happens at your case, when you updated, and here it is the same failure.
What do you mean that the js-Files is were not copied?
eldios replied on at Permalink Reply
I have the same issue:
ReferenceError: ccmi18n_redactor is not defined
after Updating to 5.7.5.1

Do you have any ideas?

Thanks and Cheers George
daenu replied on at Permalink Best Answer Reply
daenu
I finally called the redactor with PHP:
$this->requireAsset('redactor');
// call plugins like so:
$editor = Core::make('editor');
$editor->getPluginManager()->select('plugin_handle');
// call it like so:
print $editor->outputStandardEditor('header_text', $header_text);

To register plugins you have to do the following in the on_start() method of the controller:
$plugin = new Plugin();
        $plugin->setKey('plugin_handle');
        $plugin->setName('plugin Name');
        $plugin->requireAsset('plugin_handle');
        \Core::make('editor')->getPluginManager()->register($plugin);

Hope this helps.
eldios replied on at Permalink Reply
Hi,

thank you for your answer.

I do not use any plugin or addon.
The site worked well, but after the update I got this error in js.
It is about a normal Textblock on the website!

Do you have any ideas?

Cheers
daenu replied on at Permalink Reply
daenu
What version do you use?
How did you update the site?
What was the former version?
Did you empty/disable cache befoore upgrading?
eldios replied on at Permalink Reply
Hi
I use version: 5.7.5.1
I click in the Dashboard "Systems and Settings" -> Update Concrete5 and Installed it.
The further version was 5.7.4.2
Cache was disabled! I have not empty the Cache before!
daenu replied on at Permalink Reply
daenu
Everything seems correct... Sry no clue
eldios replied on at Permalink Reply
ok, thank you anyway!
andrew replied on at Permalink Reply
andrew
This is the correct way to include Redactor in your custom interfaces now. I was going to mention this. Basically, we include dynamic translations with our build of redactor (which is the javascript variable ccmi18n_redactor). These get loaded in automatically when you use the Core::make('editor') class. We changed the location of these translations in 5.7.5. All blocks that ship with the core and all those that properly load redactor should have no issue – but custom instances of redactor that relied on these translations being in a certain place will have to update their code to stay working.
eldios replied on at Permalink Reply
Hi,
I got the error!
Thanks and sorry!
I had an own redactor.js file in application/js because I removed the Subheadlines.
I copied the updated version in it and it works!

Thank you