import { StateEffectType, Transaction } from '@codemirror/state' import { ViewUpdate } from '@codemirror/view' export const hasEffect = (effectType: StateEffectType) => (tr: Transaction) => tr.effects.some(effect => effect.is(effectType)) export const updateHasEffect = (effectType: StateEffectType) => (update: ViewUpdate) => update.transactions.some(tr => tr.effects.some(effect => effect.is(effectType)) ) export const findEffect = (effectType: StateEffectType) => (tr: Transaction) => tr.effects.find(effect => effect.is(effectType))