import ace from 'brace' ; import { installXJsonMode } from '@kbn/ace' ; export function initializeEditor ( { el , licenseEnabled , } ) { const editor = ace . acequire ( 'ace/ace' ) . edit ( el ) ; installXJsonMode ( editor ) ; editor . $blockScrolling = Infinity ; if ( ! licenseEnabled ) { editor . setReadOnly ( true ) ; editor . container . style . pointerEvents = 'none' ; editor . container . style . opacity = '0.5' ; const textArea = editor . container . querySelector ( 'textarea' ) ; if ( textArea ) { textArea . setAttribute ( 'tabindex' , '-1' ) ; } editor . renderer . setStyle ( 'disabled' ) ; editor . blur ( ) ; } return editor ; }