kollapsminoriteten/wp-content/plugins/jetpack/modules/calypsoify/mods-gutenberg.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-11-15 23:26:29 +01:00
/* eslint-disable no-var */
2023-09-26 10:24:36 +02:00
/* global jQuery, wp, calypsoifyGutenberg */
2019-11-15 23:26:29 +01:00
2020-09-15 14:30:05 +02:00
jQuery( function ( $ ) {
2023-09-26 10:24:36 +02:00
// Force fullscreen mode for iframed post editor.
2019-11-15 23:26:29 +01:00
if (
wp &&
wp.data &&
2023-09-26 10:24:36 +02:00
wp.data.select( 'core/edit-post' ) &&
2019-11-15 23:26:29 +01:00
! wp.data.select( 'core/edit-post' ).isFeatureActive( 'fullscreenMode' )
) {
wp.data.dispatch( 'core/edit-post' ).toggleFeature( 'fullscreenMode' );
}
2023-09-26 10:24:36 +02:00
// Force fullscreen mode for iframed site editor.
if (
wp &&
wp.data &&
wp.data.select( 'core/edit-site' ) &&
! wp.data.select( 'core/edit-site' ).isFeatureActive( 'fullscreenMode' )
) {
wp.data.dispatch( 'core/edit-site' ).toggleFeature( 'fullscreenMode' );
}
2020-05-06 17:20:49 +02:00
2023-09-26 10:24:36 +02:00
var editPostHeaderInception = setInterval( function () {
var $closeButton = $( '.edit-post-fullscreen-mode-close__toolbar a' );
if ( $closeButton.length < 1 ) {
2019-11-15 23:26:29 +01:00
return;
}
clearInterval( editPostHeaderInception );
2023-09-26 10:24:36 +02:00
if ( calypsoifyGutenberg.closeUrl ) {
$closeButton.attr( 'href', calypsoifyGutenberg.closeUrl );
$closeButton.attr( 'target', '_parent' );
2020-05-06 17:20:49 +02:00
}
2019-11-15 23:26:29 +01:00
} );
2020-09-15 14:30:05 +02:00
$( 'body.revision-php a' ).each( function () {
2019-11-15 23:26:29 +01:00
var href = $( this ).attr( 'href' );
2023-09-26 10:24:36 +02:00
if ( href ) {
$( this ).attr( 'href', href.replace( '&classic-editor', '' ) );
}
2019-11-15 23:26:29 +01:00
} );
} );