function showSuggestions( target ) {
		let items = [],
			text = target.innerText || target.textContent,
			errorDescription = atdCore.findSuggestion( target );

		if ( ! errorDescription ) {
			items.push( {
				text: translate( 'No suggestions', { comment: 'Editor proofreading no suggestions' } ),
				classes: 'atd-menu-title',
				disabled: true,
			} );
		} else {
			items.push( {
				text: errorDescription.description,
				classes: 'atd-menu-title',
				disabled: true,
			} );

			if ( errorDescription.suggestions.length ) {
				items.push( { text: '-' } ); // separator

				each( errorDescription.suggestions, function( suggestion ) {
					items.push( {
						text: suggestion,
						onclick: function() {
							atdCore.applySuggestion( target, suggestion );
							checkIfFinished();
						},
					} );
				} );
			}
		}

		if ( errorDescription && errorDescription.moreinfo ) {
			items.push( { text: '-' } ); // separator

			items.push( {
				text: translate( 'Explain…', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					editor.windowManager.open( {
						title: translate( 'Explain…', { comment: 'Editor proofreading menu item' } ),
						url: errorDescription.moreinfo,
						width: 480,
						height: 380,
						inline: true,
					} );
				},
			} );
		}

		items.push.apply( items, [
			{ text: '-' }, // separator
			{
				text: translate( 'Ignore suggestion', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					ignoreWord( target, text );
				},
			},
		] );

		if ( editor.getParam( 'atd_ignore_enable' ) ) {
			items.push( {
				text: translate( 'Ignore always', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					setAlwaysIgnore( text );
					ignoreWord( target, text, true );
				},
			} );
		} else {
			items.push( {
				text: translate( 'Ignore all', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					ignoreWord( target, text, true );
				},
			} );
		}

		// Render menu
		suggestionsMenu = new SuggestionsMenu( { items, target } );
		suggestionsMenu.renderTo( document.body );
		suggestionsMenu.on( 'hide', () => {
			suggestionsMenu = null;
		} );
	}
function showSuggestions( target ) {
		let items = [],
			text = target.innerText || target.textContent,
			errorDescription = atdCore.findSuggestion( target );

		if ( ! errorDescription ) {
			items.push( {
				text: translate( 'No suggestions', { comment: 'Editor proofreading no suggestions' } ),
				classes: 'atd-menu-title',
				disabled: true,
			} );
		} else {
			items.push( {
				text: errorDescription.description,
				classes: 'atd-menu-title',
				disabled: true,
			} );

			if ( errorDescription.suggestions.length ) {
				items.push( { text: '-' } ); 

				each( errorDescription.suggestions, function( suggestion ) {
					items.push( {
						text: suggestion,
						onclick: function() {
							atdCore.applySuggestion( target, suggestion );
							checkIfFinished();
						},
					} );
				} );
			}
		}

		if ( errorDescription && errorDescription.moreinfo ) {
			items.push( { text: '-' } ); 

			items.push( {
				text: translate( 'Explain…', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					editor.windowManager.open( {
						title: translate( 'Explain…', { comment: 'Editor proofreading menu item' } ),
						url: errorDescription.moreinfo,
						width: 480,
						height: 380,
						inline: true,
					} );
				},
			} );
		}

		items.push.apply( items, [
			{ text: '-' }, 
			{
				text: translate( 'Ignore suggestion', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					ignoreWord( target, text );
				},
			},
		] );

		if ( editor.getParam( 'atd_ignore_enable' ) ) {
			items.push( {
				text: translate( 'Ignore always', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					setAlwaysIgnore( text );
					ignoreWord( target, text, true );
				},
			} );
		} else {
			items.push( {
				text: translate( 'Ignore all', { comment: 'Editor proofreading menu item' } ),
				onclick: function() {
					ignoreWord( target, text, true );
				},
			} );
		}

		
		suggestionsMenu = new SuggestionsMenu( { items, target } );
		suggestionsMenu.renderTo( document.body );
		suggestionsMenu.on( 'hide', () => {
			suggestionsMenu = null;
		} );
	}
function showSuggestions ( target ) { let items = [ ] , text = target . innerText || target . textContent , errorDescription = atdCore . findSuggestion ( target ) ; if ( ! errorDescription ) { items . push ( { text : translate ( 'No suggestions' , { comment : 'Editor proofreading no suggestions' } ) , classes : 'atd-menu-title' , disabled : true , } ) ; } else { items . push ( { text : errorDescription . description , classes : 'atd-menu-title' , disabled : true , } ) ; if ( errorDescription . suggestions . length ) { items . push ( { text : '-' } ) ; // separator each ( errorDescription . suggestions , function ( suggestion ) { items . push ( { text : suggestion , onclick : function ( ) { atdCore . applySuggestion ( target , suggestion ) ; checkIfFinished ( ) ; } , } ) ; } ) ; } } if ( errorDescription && errorDescription . moreinfo ) { items . push ( { text : '-' } ) ; // separator items . push ( { text : translate ( 'Explain…',  { c mment:  ' ditor proofreading menu item' } ) onclick : function ( ) { editor . windowManager . open ( { title : translate ( 'Explain…',  { c mment:  ' ditor proofreading menu item' } ) url : errorDescription . moreinfo , width : 480 , height : 380 , inline : true , } ) ; } , } ) ; } items . push . apply ( items , [ { text : '-' } , // separator { text : translate ( 'Ignore suggestion' , { comment : 'Editor proofreading menu item' } ) , onclick : function ( ) { ignoreWord ( target , text ) ; } , } , ] ) ; if ( editor . getParam ( 'atd_ignore_enable' ) ) { items . push ( { text : translate ( 'Ignore always' , { comment : 'Editor proofreading menu item' } ) , onclick : function ( ) { setAlwaysIgnore ( text ) ; ignoreWord ( target , text , true ) ; } , } ) ; } else { items . push ( { text : translate ( 'Ignore all' , { comment : 'Editor proofreading menu item' } ) , onclick : function ( ) { ignoreWord ( target , text , true ) ; } , } ) ; } // Render menu suggestionsMenu = new SuggestionsMenu ( { items , target } ) ; suggestionsMenu . renderTo ( document . body ) ; suggestionsMenu . on ( 'hide' , ( ) => { suggestionsMenu = null ; } ) ; }
Create the suggestions menu
Create the suggestions menu