advanced-custom-blocks icon indicating copy to clipboard operation
advanced-custom-blocks copied to clipboard

Javascript error when switching to the visual editor

Open signaturesteve opened this issue 6 years ago • 5 comments

I have a custom block just containing a title (Text) field and a content (WYSIWYG) field. The WYSIWYG has 2 tabs, visual and text. on clicking visual I get the following in the console and it fails to switch.

Uncaught TypeError: Cannot read property 'onpageload' of undefined at wp-tinymce.php?c=1&ver=4800-20180716:3 at e (wp-tinymce.php?c=1&ver=4800-20180716:3) at je.b.bind (wp-tinymce.php?c=1&ver=4800-20180716:3) at Object.F [as bind] (wp-tinymce.php?c=1&ver=4800-20180716:3) at Object.init (wp-tinymce.php?c=1&ver=4800-20180716:3) at e (editor.min.js?ver=4.9.8:1) at HTMLDocument. (editor.min.js?ver=4.9.8:1) at C (wp-tinymce.php?c=1&ver=4800-20180716:3) at HTMLDocument.d (wp-tinymce.php?c=1&ver=4800-20180716:3)

signaturesteve avatar Oct 09 '18 08:10 signaturesteve

also happens on another block I created that uses a repeater

signaturesteve avatar Oct 09 '18 15:10 signaturesteve

What ACF version are you using?

rchipka avatar Oct 09 '18 15:10 rchipka

Hi its ACF Pro 5.7.0 . (latest is 5.7.7 - dont expect that to fix it though)

I also get this:

Uncaught TypeError: Cannot read property 'buttons' of undefined at Object.buildQuicktags (acf-input.min.js?ver=5.7.0:3) at Object.initializeQuicktags (acf-input.min.js?ver=5.7.0:3) at Object.initialize (acf-input.min.js?ver=5.7.0:3) at initializeEditor (acf-input.min.js?ver=5.7.0:3) at initialize (acf-input.min.js?ver=5.7.0:3) at i.t (acf-input.min.js?ver=5.7.0:1) at i.acf.Model (acf-input.min.js?ver=5.7.0:1) at i [as constructor] (acf-input.min.js?ver=5.7.0:1) at new i (acf-input.min.js?ver=5.7.0:1) at Object.acf.newField (acf-input.min.js?ver=5.7.0:1)

signaturesteve avatar Oct 09 '18 16:10 signaturesteve

Probably a similar/related issue here with WYSIWYG-type field. (ACF 5.7.7 + ACB 2.1.5)

In addition to the 'onpageload' error described above, I am getting this error on TinyMCE initialization (regardless of whether delayed or not).

acf-input.min.js?ver=5.7.7:4 Uncaught TypeError: Cannot read property 'buttons' of undefined
    at Object.buildQuicktags (acf-input.min.js?ver=5.7.7:4)
    at Object.initializeQuicktags (acf-input.min.js?ver=5.7.7:4)
    at Object.initialize (acf-input.min.js?ver=5.7.7:3)
    at initializeEditor (acf-input.min.js?ver=5.7.7:3)
    at i.onMousedown (acf-input.min.js?ver=5.7.7:3)
    at i.<anonymous> (acf-input.min.js?ver=5.7.7:1)
    at HTMLDivElement.d (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.8:2)
    at HTMLDivElement.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.8:3)
    at HTMLDivElement.r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,moxiejs,plupload&ver=4.9.8:3)

While we are on the issue of WYSIWYG / HTML edits, could you please confirm my understanding that this to-do item

Create a "Block" field type so that we can have inner blocks as fields

is to allow to rendering/saving/editing the (HTML) value of such fields with Gutenberg blocks? (A sort of a reverse-direction functionality of what this plugin does now?) This would be huge.

Could you share any estimates on how laborious / time-consuming this would be / any developments so far? Would try to get into this & contribute.

Thanks a lot for the great plugin.

definiteIymaybe avatar Oct 19 '18 00:10 definiteIymaybe

My solution for this is to go to function.php then add this code:

wp_enqueue_editor();

got the solution from here: https://wordpress.stackexchange.com/questions/317361/multiple-tinymce-wp-editor-in-wordpress-4-8

hermanomark avatar Jun 28 '20 02:06 hermanomark