Added tinymce de-focus toolbar hack for drawing editor load
The tinymce event system would not pick up the focus within the loaded draw.io instance, after the drawing toolbar button was clicked, hence the toolbar would hang around. This adds a hack to dispatch a mousedown event on the body to get the toolbar to hide. For #3597
This commit is contained in:
		
							parent
							
								
									050ae01f94
								
							
						
					
					
						commit
						fee3022ad8
					
				| 
						 | 
				
			
			@ -165,7 +165,6 @@ function register(editor, url) {
 | 
			
		|||
            showPopup(editor, textContent, '', (newCode, newLang) => {
 | 
			
		||||
                const pre = doc.createElement('pre');
 | 
			
		||||
                const code = doc.createElement('code');
 | 
			
		||||
                console.log(newCode);
 | 
			
		||||
                code.classList.add(`language-${newLang}`);
 | 
			
		||||
                code.innerText = newCode;
 | 
			
		||||
                pre.append(code);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,6 +106,8 @@ export function getPlugin(providedOptions) {
 | 
			
		|||
            icon: 'diagram',
 | 
			
		||||
            onAction() {
 | 
			
		||||
                editor.execCommand('drawio');
 | 
			
		||||
                // Hack to de-focus the tinymce editor toolbar
 | 
			
		||||
                window.document.body.dispatchEvent(new Event('mousedown', {bubbles: true}));
 | 
			
		||||
            },
 | 
			
		||||
            fetch(callback) {
 | 
			
		||||
                callback([
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue