Add topic extension

This commit is contained in:
Jon Staab
2024-08-22 17:25:53 -07:00
parent dc4dcb1ea2
commit d6fa0a85bc
9 changed files with 281 additions and 192 deletions
+2 -18
View File
@@ -1,20 +1,4 @@
import type {JSONContent} from '@tiptap/core'
export * from '@lib/tiptap/util'
export {createSuggestions} from '@lib/tiptap/Suggestions'
export {TopicExtension} from '@lib/tiptap/TopicExtension'
export {LinkExtension} from '@lib/tiptap/LinkExtension'
export const findNodes = (json: JSONContent, type: string) => {
const results: JSONContent[] = []
for (const node of json.content || []) {
if (node.type === type) {
results.push(node)
}
for (const result of findNodes(node, type)) {
results.push(result)
}
}
return results
}