Replaced document events by plugin events in chatstates