aac51bf183
Implement schema v2 migration, outline/setting/inspiration CRUD, unified TipTap editing, reference panel with mentions, FTS global search, chapter version history, writing landmarks, word frequency analysis, light theme contrast fixes, and full unit/E2E test coverage. Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
613 B
TypeScript
28 lines
613 B
TypeScript
import { Mark, mergeAttributes } from '@tiptap/core'
|
|
|
|
export const LandmarkMark = Mark.create({
|
|
name: 'landmark',
|
|
inclusive: true,
|
|
addAttributes() {
|
|
return {
|
|
label: { default: '' },
|
|
landmarkType: { default: 'todo' }
|
|
}
|
|
},
|
|
parseHTML() {
|
|
return [{ tag: 'span[data-landmark]' }]
|
|
},
|
|
renderHTML({ HTMLAttributes }) {
|
|
const label = HTMLAttributes.label ?? ''
|
|
return [
|
|
'span',
|
|
mergeAttributes(HTMLAttributes, {
|
|
'data-landmark': 'true',
|
|
class: 'landmark-mark',
|
|
'data-testid': 'landmark-mark'
|
|
}),
|
|
`[TODO: ${label}]`
|
|
]
|
|
}
|
|
})
|