export function removePluginElement ( ) { const spellcheckContainer = getPluginElement ( ) ; if ( spellcheckContainer !== null ) { spellcheckContainer . parentElement ?. removeChild ( spellcheckContainer ) ; } } export function getPluginElement ( ) { return document . getElementById ( 'spellcheck' ) ; } export function getSpellCheckTextElement ( ) { return document . getElementById ( 'spellcheck-text' ) as HTMLTextAreaElement ; } export function createPluginElement ( ) { const pdfdoc = document . querySelector ( "div.full-size.pdf" ) ; if ( getPluginElement ( ) === null ) { pdfdoc ?. append ( makeNewPluginElement ( ) ) ; } } export function getConsoleElement ( ) { return document . getElementById ( 'spellcheck-console' ) ; } function makeNewPluginElement ( ) { const element = document . createElement ( 'div' ) ; element . id = 'spellcheck' ; element . style . position = 'absolute' ; element . style . width = '100%' ; element . style . height = '100%' ; element . style . display = 'flex' ; element . style . flexFlow = 'column' ; element . style . backgroundColor = 'Red' ; const textarea = document . createElement ( 'textarea' ) ; textarea . id = 'spellcheck-text' ; textarea . style . width = '100%' ; textarea . style . height = 'calc(100% - 30px)' ; textarea . style . resize = 'none' ; element . append ( textarea ) ; const userConsole = document . createElement ( 'div' ) ; userConsole . id = 'spellcheck-console' ; userConsole . style . marginTop = '6px' ; userConsole . style . marginBottom = '50px' ; userConsole . style . width = '100%' ; userConsole . style . height = '100px' ; userConsole . style . backgroundColor = 'rgb(249,249,249)' ; userConsole . style . overflowY = 'Scroll' ; userConsole . style . fontFamily = 'Courier New' ; userConsole . style . fontSize = '12px' ; userConsole . style . display = 'none' ; element . append ( userConsole ) ; return element ; }