From 648be73b7207ca593d75c5ae2d36ce6cef75cc9a Mon Sep 17 00:00:00 2001 From: "Michael P. Pfeiffer" Date: Wed, 4 Dec 2019 15:06:22 +0100 Subject: [PATCH] move hack to edit post index --- .../src/components/block-mobile-toolbar/index.js | 16 ---------------- packages/edit-post/src/index.js | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/block-editor/src/components/block-mobile-toolbar/index.js b/packages/block-editor/src/components/block-mobile-toolbar/index.js index d5a0c9e6c488c..2e1b9a13fc2bc 100644 --- a/packages/block-editor/src/components/block-mobile-toolbar/index.js +++ b/packages/block-editor/src/components/block-mobile-toolbar/index.js @@ -8,22 +8,6 @@ import { ifViewportMatches } from '@wordpress/viewport'; */ import BlockMover from '../block-mover'; -// This is a temporary fix for a couple of issues specific to Webkit on iOS. -// Without this fix the browser scrolls the mobile toolbar off-screen. -// Once supported in Safari we can replace this in favor of preventScroll. -// For details see issue #18632 and PR #18686 -// Specifically, we scroll `edit-post-editor-regions__body` to enable a fixed top toolbar. -// But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar. - -const isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1; -if ( isIphone ) { - document.addEventListener( 'focusin', function( ) { - setTimeout( () => { - window.scrollTo( 0, 0 ); - }, 150 ); - } ); -} - function BlockMobileToolbar( { clientId, moverDirection } ) { return (
diff --git a/packages/edit-post/src/index.js b/packages/edit-post/src/index.js index 531f8e1c0267e..83999f7bf8004 100644 --- a/packages/edit-post/src/index.js +++ b/packages/edit-post/src/index.js @@ -77,6 +77,22 @@ export function initializeEditor( id, postType, postId, settings, initialEdits ) console.warn( "Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening . Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins." ); } + // This is a temporary fix for a couple of issues specific to Webkit on iOS. + // Without this hack the browser scrolls the mobile toolbar off-screen. + // Once supported in Safari we can replace this in favor of preventScroll. + // For details see issue #18632 and PR #18686 + // Specifically, we scroll `edit-post-editor-regions__body` to enable a fixed top toolbar. + // But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar. + + const isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1; + if ( isIphone ) { + document.addEventListener( 'focusin', function( ) { + setTimeout( () => { + window.scrollTo( 0, 0 ); + }, 150 ); + } ); + } + render(