Monitors the window resize event, assigning an `.is-scrollable` class to
any toolbars for which horizontal scroll exists.
function toggleToolbarsScrollableOnResize() {
		function toggleToolbarsScrollableClass() {
			editor.$( '.mce-toolbar-grp', editor.theme.panel.getEl() ).each( ( i, toolbar ) => {
				const isScrollable = toolbar.scrollWidth > toolbar.clientWidth;
				editor.$( toolbar ).toggleClass( 'is-scrollable', isScrollable );
			} );
		}

		window.addEventListener( 'resize', throttle( toggleToolbarsScrollableClass, 200 ) );
		toggleToolbarsScrollableClass();

		// Since some toolbars are hidden by default and report inaccurate
		// dimensions when forced to be shown, we instead bind to the event
		// when it's expected that they'll be visible
		editor.on( 'wptoolbar', event => {
			// Since an event handler is expected to set the toolbar property,
			// set a timeout to wait until the toolbar has been assigned
			setTimeout( () => {
				if ( ! event.toolbar || ! event.toolbar.visible() ) {
					return;
				}

				// For inline toolbars, the scrollable panel is the first child
				// of the toolbar, so we compare its width against the parent
				const toolbar = event.toolbar.getEl();
				const isScrollable = toolbar.firstChild.scrollWidth > toolbar.clientWidth;
				editor.dom.toggleClass( toolbar, 'is-scrollable', isScrollable );
			}, 0 );
		} );
	}