: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( spaceTop >= spaceNeeded ) {
className = ' mce-arrow-down';
top = selection.top + iframeRect.top + scrollY - toolbarHeight + iosOffsetTop;
} else if ( spaceBottom >= spaceNeeded && editorHeight / 2 > selection.bottom + iframeRect.top - blockedTop ) {
className = ' mce-arrow-up';
top = selection.bottom + iframeRect.top + scrollY - iosOffsetBottom;
if ( typeof top === 'undefined' ) {
top = scrollY + blockedTop + buffer + iosOffsetBottom;
left = selectionMiddle - toolbarWidth / 2 + iframeRect.left + scrollX;
if ( selection.left < 0 || selection.right > iframeRect.width ) {
left = iframeRect.left + scrollX + ( iframeRect.width - toolbarWidth ) / 2;
} else if ( toolbarWidth >= windowWidth ) {
className += ' mce-arrow-full';
} else if ( ( left < 0 && selection.left + toolbarWidth > windowWidth ) || ( left + toolbarWidth > windowWidth && selection.right - toolbarWidth < 0 ) ) {
left = ( windowWidth - toolbarWidth ) / 2;
} else if ( left < iframeRect.left + scrollX ) {
className += ' mce-arrow-left';
left = selection.left + iframeRect.left + scrollX;
} else if ( left + toolbarWidth > iframeRect.width + iframeRect.left + scrollX ) {
className += ' mce-arrow-right';
left = selection.right - toolbarWidth + iframeRect.left + scrollX;
// No up/down arrows on the menu over images in iOS.
if ( tinymce.Env.iOS && currentSelection.nodeName === 'IMG' ) {
className = className.replace( / ?mce-arrow-(up|down)/g, '' );
toolbar.className = toolbar.className.replace( / ?mce-arrow-[\w]+/g, '' ) + className;
DOM.setStyles( toolbar, {
toolbar.on( 'show', function() {
toolbar.on( 'keydown', function( event ) {
if ( event.keyCode === 27 ) {
editor.on( 'remove', function() {
toolbar.reposition = reposition;
toolbar.hide().renderTo( document.body );
editor.shortcuts.add( 'alt+119', '', function() {
node = activeToolbar.find( 'toolbar' )[0];
node && node.focus( true );
editor.on( 'nodechange', function( event ) {
var collapsed = editor.selection.isCollapsed();
editor.fire( 'wptoolbar', args );
currentSelection = args.selection || args.element;
if ( activeToolbar && activeToolbar !== args.toolbar ) {
activeToolbar = args.toolbar;
if ( activeToolbar.visible() ) {
activeToolbar.reposition();
editor.on( 'focus', function() {
if ( activeToolbar.tempHide || event.type === 'hide' || event.type === 'blur' ) {
event.type === 'resizewindow' ||
event.type === 'scrollwindow' ||
event.type === 'resize' ||
) && ! activeToolbar.blockHide ) {
* Showing a tooltip may trigger a `resize` event in Chromium browsers.
* That results in a flicketing inline menu; tooltips are shown on hovering over a button,
* which then hides the toolbar on `resize`, then it repeats as soon as the toolbar is shown again.
if ( event.type === 'resize' || event.type === 'resizewindow' ) {
size = win.innerHeight + win.innerWidth;
// Reset old cached size.
if ( cachedWinSize && ( new Date() ).getTime() - cachedWinSize.timestamp > 2000 ) {
if ( size && Math.abs( size - cachedWinSize.size ) < 2 ) {
// `resize` fired but the window hasn't been resized. Bail.
// First of a new series of `resize` events. Store the cached size and bail.
timestamp: ( new Date() ).getTime(),
timeout = setTimeout( function() {
if ( activeToolbar && typeof activeToolbar.show === 'function' ) {
activeToolbar.scrolling = false;
activeToolbar.scrolling = true;
editor.on( 'resizewindow', hide );
// Enable `capture` for the event.
// This will hide/reposition the toolbar on any scrolling in the document.
document.addEventListener( 'scroll', hide, true );
// Bind to the editor iframe and to the parent window.
editor.dom.bind( editor.getWin(), 'resize scroll', hide );
editor.on( 'resizewindow scrollwindow', hide );
editor.on( 'remove', function() {
document.removeEventListener( 'scroll', hide, true );
editor.off( 'resizewindow scrollwindow', hide );
editor.dom.unbind( editor.getWin(), 'resize scroll', hide );
editor.on( 'blur hide', hide );
editor.wp = editor.wp || {};
editor.wp._createToolbar = create;
// Expose some functions (back-compat).