import { QuickSwitch } from "synthesizer" ; import { MbBookNote } from "types/MarginNote" ; import { util as autotag } from "addons/autotag" ; import { util as autolist } from "addons/autolist" ; import { util as autostyle } from "addons/autostyle" ; import { util as autoreplace } from "addons/autoreplace" ; import { util as autocomplete } from "addons/autocomplete" ; import { util as anotherautodef } from "addons/anotherautodef" ; import { util as autostandardize } from "addons/autostandardize" ; import { util as anotherautotitle } from "addons/anotherautotitle" ; export const newTitleText = async ( text , note ) => { const { quickSwitch } = self . profile . ohmymn ; for ( const addon of quickSwitch ) { switch ( addon ) { case QuickSwitch . autostandardize : text = autostandardize . standardizeText ( text ) ; break ; case QuickSwitch . autolist : text = autolist . listText ( text ) ; break ; case QuickSwitch . autoreplace : text = autoreplace . replaceText ( text ) ; break ; } } if ( quickSwitch . includes ( QuickSwitch . autocomplete ) ) { const result = await autocomplete . getCompletedWord ( text ) ; if ( result ) return result ; } const standardizeTitle = ( title ) => autostandardize . toTitleCase ( title ) . replace ( /\*\*/g , "" ) ; if ( quickSwitch . includes ( QuickSwitch . anotherautodef ) ) { const result = anotherautodef . getDefTitle ( text ) ; if ( result ) return { title : standardizeTitle ( result . title ) , text : result . text } ; } if ( quickSwitch . includes ( QuickSwitch . anotherautotitle ) ) { const result = anotherautotitle . getTitle ( text , note ) ; if ( result ) return { title : standardizeTitle ( result . title ) , text : "" } ; } return { text , title : undefined } ; } ; export const newTag = ( text ) => { const { quickSwitch } = self . profile . ohmymn ; if ( quickSwitch . includes ( QuickSwitch . autotag ) ) return autotag . getTag ( text ) ; } ; export const newColorStyle = ( note ) => { const { quickSwitch } = self . profile . ohmymn ; if ( quickSwitch . includes ( QuickSwitch . autostyle ) ) return autostyle . getColorStyle ( note ) ; } ;