Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress 5.4 builder extension issue #30

Open
provineet opened this issue Apr 3, 2020 · 0 comments
Open

WordPress 5.4 builder extension issue #30

provineet opened this issue Apr 3, 2020 · 0 comments

Comments

@provineet
Copy link

provineet commented Apr 3, 2020

With WordPress 5.4 updates there is an issue with the Unyson Builder button on edit page. Gutenberg editor doesn't hide while using Unyson builder.

I have edited these two functions inside editor_integration.js to fix the issue.

`
showBuilder: function () {
this.elements.$useWpEditorBtn.show();
this.elements.$wpPostBodyContent.addClass( 'page-builder-visible' );
this.elements.$wpPostDivRich.addClass( 'fw-disable-editor' );
this.elements.$builderBox.show().removeClass( 'closed' );

		if ( this.isGutenberg() ) {

			if ( ! wp.data.select( 'core/editor' ).getEditedPostAttribute( 'title' ) ) {
				wp.data.dispatch( 'core/editor' ).editPost( {title: 'Post #' + $( '#post_ID' ).val()} );
			}

			this.gutenbergContainer.find( '.edit-post-header-toolbar' ).children().hide();
			this.elements.$useWpEditorBtn.show();
			this.elements.$useBuilderBtn.hide();
			this.gutenbergContainer.find(".block-editor-block-list__layout").hide();
    		this.gutenbergContainer.find(".block-editor-writing-flow__click-redirect").hide();
		}

		// set the hidden to store that the builder is active
		this.elements.$builderActiveHidden.val( 'true' );

		this.events.trigger( 'show' );
	},
	hideBuilder: function () {
		this.elements.$wpPostBodyContent.removeClass( 'page-builder-visible' );
		this.elements.$useWpEditorBtn.hide();
		this.elements.$builderBox.hide();
		this.elements.$wpPostDivRich.removeClass( 'fw-disable-editor' );
		this.elements.$wpPostDivRich.trigger( 'resize' );
		// set the hidden to store that the builder is inactive
		this.elements.$builderActiveHidden.val( 'false' );
		//tinyMCE.get( gui.editorId ).execCommand("mceRepaint");

		if ( this.isGutenberg() ) {
			this.gutenbergContainer.find( '.edit-post-header-toolbar' ).children().show();
			this.elements.$useWpEditorBtn.hide();
			this.elements.$useBuilderBtn.show();
			this.gutenbergContainer.find(".block-editor-block-list__layout").show();
			this.gutenbergContainer.find(".block-editor-writing-flow__click-redirect").show();
		}

		this.events.trigger( 'hide' );
	},`

Please take a look and roll out an update for the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant