• I have an error with the new version of ACF 6 when in ACF edition group.

    Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
        initialize_acf_medium_editor_field https://mysite/assets/plugins/acf-medium-editor-field/assets/js/input.js?ver=2.6.0:44
        <anonymous> https://mysite/assets/plugins/acf-medium-editor-field/assets/js/input.js?ver=2.6.0:90
        jQuery 2
        <anonymous> https://mysite/assets/plugins/acf-medium-editor-field/assets/js/input.js?ver=2.6.0:88
        s https://mysite/assets/plugins/advanced-custom-fields-pro/assets/build/js/acf-input.min.js?ver=6.0.1:1
        o https://mysite/assets/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.1:1
        doAction https://mysite/assets/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.1:1
        doAction https://mysite/assets/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.1:1
        7806 https://mysite/assets/plugins/advanced-custom-fields-pro/assets/build/js/acf.min.js?ver=6.0.1:1

    In previous version of ACF, this function initialize_acf_medium_editor_field wasn’t executed in input.js in admin acf group edition, but only in edition post page

    i have a custom solution to solve my case, but the plugin need an update for this problem i think

    My change on line 89 in input.js

    if ($(this).hasClass('acf-field-medium-editor') ) {
    					initialize_acf_medium_editor_field($(this));
    				}

    Thanks a lot
    Matt

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author John Huebner

    (@hube2)

    I’m going to need more information on were you’ve added this code, can you post the entire if/else block where you made the change?

    Thread Starter karbou

    (@karbou)

    This is the previously code

    if(typeof acf.add_action !== 'undefined') {
    	acf.add_action('ready append', function( $el ){
    		acf.get_fields({ type : 'medium_editor'}, $el).each(function(){
    			initialize_acf_medium_editor_field($(this));
    		});
    	});
    } else {
    	$(document).on('acf/setup_fields', function(e, postbox){
    		$(postbox).find('.field[data-field_type="medium_editor"]').each(function(){
    			initialize_acf_medium_editor_field($(this));
    		});
    	});
    }

    And this the new :

    if(typeof acf.add_action !== 'undefined') {
        acf.add_action('ready append', function( $el ){
            acf.get_fields({ type : 'medium_editor' }, $el).each(function(){
                if ($(this).hasClass('acf-field-medium-editor') ) {
                    initialize_acf_medium_editor_field($(this));
                }
            });
        });
    } else {
        $(document).on('acf/setup_fields', function(e, postbox){
            $(postbox).find('.field[data-field_type="medium_editor"]').each(function(){
                initialize_acf_medium_editor_field($(this));
            });
        });
    }

    My goal with this modification is to use initialize_acf_medium_editor_field only in edit post page, not in acf field group edit page.

    Plugin Author John Huebner

    (@hube2)

    So the real issue here is that it is trying to initialize the field when editing field groups and not an issue when initializing when editing a post or some other place where the field is used.

    Initializing when editing a field group in ACF should not be happening at all. That is what I need to figure out.

    Plugin Author John Huebner

    (@hube2)

    Your fix does not work for all errors. I am in the process of fixing.

    Important note. I am in the process of getting this plugin to work with ACF6, however, in ACF version 6 this plugin will not support custom buttons in the editor. It will only support custom button the acf/medium-editor-field/custom-buttons filter hook in code.

    It is going to be a while before I get this fixed. If you must edit field groups containing medium editor fields then I would suggest reverting to ACF5 until this plugin is updated.

    Plugin Author John Huebner

    (@hube2)

    For now, until I can get this plugin working again you’ll need to revert to ACF 5 if you want to keep using this plugin.

    Plugin Author John Huebner

    (@hube2)

    This should be resolved

    Thread Starter karbou

    (@karbou)

    @hube2 Thanks !

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Error JS with ACF 6’ is closed to new replies.