@portabletext/editor
Version:
Portable Text Editor made in React
13 lines (10 loc) • 411 B
text/typescript
import type {EditorSnapshot} from '../editor/editor-snapshot'
import {getMarkState} from './selector.get-mark-state'
export function getActiveAnnotationsMarks(snapshot: EditorSnapshot) {
const schema = snapshot.context.schema
const markState = getMarkState(snapshot)
return (markState?.marks ?? []).filter(
(mark) =>
!schema.decorators.map((decorator) => decorator.name).includes(mark),
)
}