Welcome to the Support forum for the Advanced Custom Fields Plugin. Before posting, please view the To-do list to find the current development status. Thanks, Elliot.
TinyMCE button labels and localization broken
  • Hi Elliott,

    I'm testing version 3 beta 2 and I'm having some problems with WYSIWYG -editor. See the attachment.

    WYSIWYG -editor's labels are not loaded as they should. When I activated the plugin, all labels went to something like {#advanced_dlg.code_title}. At that time I had my admin language finnish. When I changed back to english, they started working again, except certain editor plugins, like tables. Those are generated by TinyMCE advanced -plugin.

    So, english is working fine with default editor, finnish is not. Both are "broken" when viewing TinyMCE advanced -fields.

    It seems that this is a hopefully simple javascript problem, that gets fixed easily. Thanks in advance.
    Attachments
    Näyttökuva 2011-10-18 kohteessa 16.05.42.png 48K
  • 49 Comments sorted by
  • Hi Elliott, hi folks

    i have the same bug. I think it is in acf.php, line 314: wp_tiny_mce(). When I replace this with "add_action('admin_head', 'wp_tiny_mce');" everything is allright. But I don't know, if this is a good solution. What do you think?

    Thanks.
  • This fix worked for me. Change line 23 in core/fields/wysiwyg.php

    from -> add_action('admin_head', 'wp_tiny_mce');
    to -> if (function_exists('wp_tiny_mce')) wp_tiny_mce();
  • Ok, so the above code fixed the labels in pages and posts, but broke the labels in Options -page.

    To fix it in both posts and pages as well as in options page, I made a quick fix like this:

    if (function_exists('wp_tiny_mce')) wp_tiny_mce();

    global $pagenow;
    if($pagenow == 'admin.php'){
    add_action('admin_head', 'wp_tiny_mce');
    }
  • I can confirm this, it happens to me too. I'm using WordPress 3.2.1 (finnish) and ACF 3.0.2 breaks my TinyMCE. It happens because in the editors JavaScript there's twice the line "tinyMCE.init(tinyMCEPreInit.mceInit);" and it breaks TinyMCE.

    WordPress localizations add a piece of JavaScript that translates the buttons and some other stuff in the editor: http://pastebin.com/FqZSjQdz

    I commented out line 23 in advanced-custom-fields/core/fields/wysiwyg.php, which was a line in the constructor, add_action('admin_head', 'wp_tiny_mce');. This probably means I don't get any WYSIWYG for ACF but I don't care, I don't use the WYSIWYG in ACF.

    EDIT: Oh, these messages seem not to be sorted by date but rather by score. That's why I got confused. I'll try the new fix by JuTy83, see if it works, and report here.

    EDIT2: Here I am, as promised. The fix by JuTy83 works for me but I haven't tested any WYSIWYG options ACF has to offer because as I said, I don't need the WYSIWYG myself.
  • I'd like to second that. When using TinyMCE Advanced, the CSS dialog box, for example, looks like the attached image. e.g. #style_dlg.text_lineheight

    Attachments
    Picture 2.png 89K
  • ditto... using a fresh install of WP 3.2.1 with no other plugins turned on besides ACF 3.0.0 beta 3 and TinyMCE Advanced 3.4.2.1.

    also with TinyMCE Advanced turned off... the default WP link dialog box is broken... there's a drop down area to select pages... it doesn't toggle open and closed when ACF 3.0.0 beta is active.

    same thing happened a while back with ACF 2.0.4 and Elliott fixed it, see this past post:

    http://www.advancedcustomfields.com/support/discussion/375/acf-and-tinymce-advanced-plugin-issues#Item_3

    those example images no longer work but looked like JuTu83's image above
  • just updated v3.0.0 from beta to stable release on two different sites and this bug still exists... it still breaks TinyMCE Advanced and also breaks WordPress' toggle function in the link dialog box of the text editor.

    no PHP errors reported... Elliott, is there anything we can change in the meantime until there's a fix?

    thanks!
  • wp-tinymce.php:24Uncaught TypeError: Cannot call method 'getLang' of null

    This is the error that I am getting. I am using TinyMCE Advanced. Disabling ACF 3 gets TinyMCE running fine again. All labels are messed up on the advanced image and linking windows.

    image
    Attachments
    Screen shot 2011-11-07 at 1.15.21 PM.png 40K
  • Have similar bug
  • Hmmm.. not sure what's going wrong guys. I can't replicate the problem here and the wysiwyg code hasn't changed much since the last versions.

    I'll look into it but I'm not sure what the problem is.

    Is it a problem with translation / other plugins?
  • Hi. I'm using WP 3.2.1 (Japanese) / ACF 3.0.0, and also have the same bug.
    Turning off the other plugins, but nothing has resolved.
  • Same problem here. Using Slovak localization.
    I don't know what is source of problem.

    In acf.php on line 314 just comment this:

    wp_tiny_mce();

    TinyMCE will work well...
  • I can confirm Radovan's solution. After commenting out line 314, labels start to work again.
  • Elliott, i have a clean install of WP 3.2.1 and only ACF 3.0.0 activated and no other plugins... when i highlight a piece of text in the text editor, click on the link icon, and get the WP pop-up link dialog box, ACF breaks the toggle down function to reach other pages within the site... then when i activate TinyMCE Advanced, i see the bug showing {advlink.dig_url}.

    again, no PHP errors reported... hope that helps.
  • I tried as Radovan did, then TinyMCE works fine. thanx!
  • Radovan’s solution worked for me, too.

    Hope the fix doesn’t break anything else. But by now everything looks fine.
  • OK, there is just one snag, when you use Radovan’s solution:

    When setting up additional Wysiwyg editor fields for a page and have the main Content editor field hidden, image and file upload/insert funcionality is broken.

    I tried Philip’s solution and replaced "wp_tiny_mce()" with "add_action('admin_head', 'wp_tiny_mce');". Now everything works fine: Loaclisation and image/file upload/insert.
  • Fantastic - great fix! Kudos to Radovan and MichaelvanLaar. Hopefully we'll see a ACF 3.0.1 release that incorporates this.
  • Thanks to Radovan and MichaelvanLaar... Philip's fix is working great for me so far.
  • I am seeing this bug as well, but with a different result. The bug is causing the full-screen editor to not function. No editing of content can happen in the full screen editor.

    Going into acf.php and commenting out the line:
    wp_tiny_mce();
    does fix it.

    What I'm seeing when that line is not commented out is that Firefox throws this error:
    Error: a is null
    Source File: http://example.com/wordpress/wp-includes/js/tinymce/wp-tinymce.php?c=1&ver=342-20110630200
    Line: 24

    The editor on the regular screen functions fine, but clicking the full-screen button pulls up the regular full-screen editor, but any typing happens behind the content in black - original content is in grey.

    My guess is that it's somehow doubling the call for tinymce for the editor and it's confusing it. See my attached screenshot for what this bug looks like.

    Note: this bug happens even if I remove any Advanced Custom Fields from the post screens - so I would guess it is calling tinymce globally.

    Hope this helps. Glad to dig harder on this if you can give me some guidance how.

    thanks,
    Scott
    Attachments
    full screen editor bug.png 30K
  • Hi all,

    I can confirm the above solution. I have the same bug as described here. I commented out the: wp_tiny_mce();. And the errors gone. Thanks for the help! And thank you Elliot for your hard work!
  • Hey guys

    I've fixed it in v3.0.2 (should be out soon)
  • Hi!
    Running WordPress 3.2.1. with Swedish translation and the latest ACF 3.0.2, still got the error, see attached image. And this time I can't seem to apply the quickfix by MichaelvanLaar because the row with wp_tiny_mce() seem to be re/moved?

    image
    Attachments
    advanced-error.jpg 32K
  • Hello Elliott,

    same problem here. All lables are broken with german language pack (in ACF 3.0, 3.0.1 and 3.0.2).
  • Thanks for reporting back guys

    I just don't know what the problem is...
    It's working for some people but not for others. Are you running any translation plugins that could effect the wp editor?
  • Have you changed much of the WYSIWYG -code in 3.0.2 Elliott? In 3.0.0 both of these hacks, fixed the problem:

    1. Comment out line 314 in afc.php
    2. add wp_tiny_mce(); in a function and do add_action ->

    // create tyn mce instance for wysiwyg
    function add_tiny_mce(){
    wp_tiny_mce();
    }
    add_action('admin_head', 'add_tiny_mce');

    Now neither works. Hopefully this helps a little bit to find the problem.
  • Hello Elliott,

    thanks for your reply. Yes, I use two things, that modify the editor:

    1) An own function to add own allowed html tags:
    function pn_tinymce_customize($in){ $in['extended_valid_elements']='hr[class|width|size|noshade],iframe[width,height,src,frameborder,allowfullscreen]';

    return $in;
    }
    add_filter('tiny_mce_before_init', 'pn_tinymce_customize' );

    2) The multipage toolit plugin (http://wordpress.org/extend/plugins/multi-page-toolkit/). This plugin add two own buttons to the editor.

    I hope, I can help you.

    Regards, Kristian
  • still broken in ACF 3.0.2 for me with WP 3.2.1... no language packs installed... applied JuTu83's second fix and it seems to working great... thanks JuTu83.
  • Same problem here... using french localization. If ACF 3.0.2 is enabled, it breaks tinyMCE.
    JuTu83 fix is working!
  • Same here, unfortunately since update to ACF 3.0.2, the TinyMCE is broken and the previous fixes no longer work either!! :(

    i'm using an italian localization; plus a bunch of plugins (but none of them really related to language)

    on top of that, now the problem is worse than before; before the TinyMCE had all those weird labels, now a lot of buttons disappeared! I only have B, I, text formatting, links, lists... everything else disappeared, including whole kitchen sink, plugin buttons and so on...
  • thanks @JuTu83

    I'll add that to the next version
  • In 3.02 edit core/fields/wysiwyg.php and comment out line 23:
    add_action('admin_head', 'wp_tiny_mce');

    The issue seems to be that it is not coping with multiple instances of TinyMCE in the one screen. It also manifests itself by the spell check not working if you spell check in ACF wysiwyg the spell check drop down appears in the main wysiwyg. In fact, without the above fix applied spell checking doesn't work at all in the ACF wysiwyg.
  • I am having the same problem described in this thread using latest version of WordPress 3.2.1 and TinyMCE Advanced.
  • Humm i don't want edit core, any solutions? or where use the JuTu83's fix?
    same problem with latest version of wordpress and acf

    Thanks
  • My mistake: JuTu83 fix is only working randomly...

    - Sometimes, the Edit area in Posts or Pages is displayed twice, with duplicated TinyMCE bars (and neither of these two are working...). See attached screenshot.
    - Sometimes, TinyMCE in Posts edit page is in "Basic mode", as if it was created with ACF (wich is not the case here).

    This issue is blocking the editing of the content in website. The only "solution" to get TinyMCE back is to disable ACF. But in this case my website is not working anymore because front page uses a lot ACF.

    Kind of a dead end here. Any help would be appreciated.
    Attachments
    ACF-Bug.jpg 271K
  • Hi Guys

    I really want to fix this bug! Can someone write the steps I need to take to set up my own localized version of wordpress? Do I need any plugins / settings / etc ?

    I'll set one up and have a play this weekend and find the solution.

    Thanks for your patience. Any help with this one will be greatly appreciated.

    Cheers
  • Hi Elliott,

    You can easily set up localized version of wordpress by downloading a language file from http://codex.wordpress.org/WordPress_in_Your_Language. Then add this language file to wp-content/languages folder.

    After that you have to set up wordpress to use that language in wp-config.
    Look for the code (line 72): define ('WPLANG', ''); and change it to define('WPLANG', 'language_code_here'); for example if you have downloaded a French language file then you change the code to -> define('WPLANG', 'fr_FR');

    I suggest that you also install TinyMCE advanced plugin. It's really popular plugin, so would be great that ACF would work with it.

    I hope you can replicate this bug and are able to find a fix for it :)

    ps. For me, the fix I've used is working just fine in every possible scenario. With or without TinyMCE advanced and with multiple acf WYSIWYG -fields and in Options pages.
  • @slightlydifferent , unfortunately your fix didn't work for me (running WP in it_IT l18n and ACF 3.02)

    @admin , to localize an installation of wordpress is rather easy, just follow @JuTu83 link; I'm also running TinyMCE advanced as him and many others in this thread

    fixes until 3.01 were fine, but since 3.02 no longer apply
  • Hi guys

    I think I've fixed it!

    Please edit the /core/fields/wysiwyg.php file and replace the constructor (on line 6 - 25) with this:
    /*--------------------------------------------------------------------------------------
    *
    * Constructor
    *
    * @author Elliot Condon
    * @since 1.0.0
    * @updated 2.2.0
    *
    *-------------------------------------------------------------------------------------*/

     
    function __construct($parent)
    {
    parent::__construct($parent);
     
    $this->name = 'wysiwyg';
    $this->title = __("Wysiwyg Editor",'acf');
     
    add_action('admin_head', array($this, 'add_tiny_mce'));
     
    }
     
    function add_tiny_mce()
    {
    global $post;
     
    if($post && post_type_supports($post->post_type, 'editor'))
    {
    // do nothing, wysiwyg will render correctly!
    }
    else
    {
    wp_tiny_mce();
    }
     
    }


    Can you please test this with pages / posts / options page and a custom post type that doesn't support the editor?

    Thanks
  • Hi Elliott,

    Great work! Seems to work. I've tested it in two different sites. All works in Options -page and in posts, pages and in custom posts that doesn't support the editor. Multiple WYSIWYG -fields works also.

    Hopefully this also works for everyone else :)
  • Vote Up0Vote Down janjan December 2011
    Many thanks Elliot, I tested your code and it works fine for me. I am using WP 3.2.1 with a German language pack. I wrote a page with a ACF WYSIWYG textfield with the standard WP content editor turned off. And everything runs smoothly: All labels as they should be. Thanks!
  • It doesn't fix completely the admin area: if I edit an existing page/post, TinyMCE is loading fine (with localized strings). This is en improvement.
    BUT if I add a new post/page, the edit area is displayed twice and none of them is working properly. You can see it in the attached screenshot. After reloading the edit page, TinyMCE area is working fine again... Not really convenient for my clients.
    Attachments
    Bug_ACF_2.png 113K
  • Your fix from Dec 5 fixed the bug I was seeing in the full-screen mode. Thanks for that!
  • That fix didn't work at all. Kitchen sink is gone and doesn't show up anymore. TinyMCE Advanced plugin (meant to extend the TinyMCE) doesn't work anymore. Half of the people here are using that plugin, it's rather stable, so I think there's still something in ACF causing trouble.
  • This is what I mean - here's a custom post type edit page... as you can see I don't have a kitchen sink and the whole appearance of the TinyMCE is changed... shouldn't be like this, there's also no kitchen sink. Then also the TinyMCE advanced extension are missing, despite the TinyMCE Advanced plugin was activated (and reactivated once more just to be sure). Deactivating ACF brings the old TinyMCE back and everything returns to normal. The fix described by Admin on Dec 5 didn't bring a solution to the issue.
    Attachments
    acf_tinymce_issue.png 27K
  • I have the same issue as above (as per Netactions screenshot) but only in Chrome (v15 mac) even after I have implemented the fix given above.

    I find that if I refresh the cache it works fine the first time the edit page is loaded. However the second time the page is loaded the WYSIWYG editor breaks as mentioned.

    So far Firefox and Safari don't seem to have any issues (not sure about IE).

    Are any of the above users using Chrome?

    Hope this helps shed some light on the problem.
  • Hi, I'm using Chrome on Mac as well (version 16). I didn't try with FF
  • issue is still present in Opera... Chrome is fine (WIndows7)
  • I'm still having the duplicate editor issue with v3.0.6 using WP 3.3.1 on Mac 10.6.8 using Safari 5.1.2, even with all code from functions.php removed and all plugins disabled except ACF. I am using a very standard installation.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion

Tagged