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

Hide WordPress logo animation for preview #12216

Closed
ducngyn opened this issue Nov 22, 2018 · 6 comments
Closed

Hide WordPress logo animation for preview #12216

ducngyn opened this issue Nov 22, 2018 · 6 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@ducngyn
Copy link

ducngyn commented Nov 22, 2018

Since the update to 4.1.0 #11022 there is now a WordPress logo animation appearing after hitting the preview button.

Is there any way to hide/change/remove this animation?
Maybe you could provide a filter to alter the animation.

I tried to access the CSS properties from within my own plugin, but to no avail.

@swissspidy swissspidy added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Nov 22, 2018
@swissspidy
Copy link
Member

The interstitial animation is defined here: https://github.com/WordPress/gutenberg/blob/f090e84828b18f2b1a21bebf68a9a1bdd85324de/packages/editor/src/components/post-preview-button/index.js. It's pretty much hardcoded.

Why do you want to remove the animation though?

Personally I like this little UX addition.

@ducngyn
Copy link
Author

ducngyn commented Nov 22, 2018

Because it is a Wordpress brand logo and I would like to put in my own logo, if that's possible.

@greatislander
Copy link
Contributor

It may also be worth considering a reduced-motion alternative to respond to https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion

@noisysocks
Copy link
Member

I've written a proposal for a filter which would let one customise this UI in #12238.

@ducngyn
Copy link
Author

ducngyn commented Nov 23, 2018

Thanks a lot!
But is there a way to work around this before the filter is released?
I can't access the .editor-post-preview-button__interstitial-message class from any css-file and !important is also not working.

@noisysocks
Copy link
Member

noisysocks commented Nov 25, 2018

I'm not sure that there's a way to do this because the Preview button opens a new window with HTML that's built entirely from within the Preview button component.

A very very hacky approach might be to override window.open() with a function that injects your custom CSS:

var _open = window.open;
window.open = function() {
	var previewWindow = _open.apply( this, arguments );
	if ( /^wp-preview/.test( previewWndow.name ) ) {
		var style = document.createElement( 'style' );
		style.type = 'text/css';
		style.innerText = 'body { background: #222; } /*... more css ..*/';
		previewWindow.document.head.appendChild( style );
	}
	return previewWindow;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

4 participants