mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-08 21:27:45 +03:00
EZQMS-470: Add server side tiptap extension for node uuid (#4358)
Signed-off-by: Anna No <anna.no@xored.com>
This commit is contained in:
parent
31b0d98d90
commit
9def3b2213
@ -14,6 +14,7 @@
|
||||
//
|
||||
|
||||
import { Extension } from '@tiptap/core'
|
||||
import { Level } from '@tiptap/extension-heading'
|
||||
import Table from '@tiptap/extension-table'
|
||||
import TableCell from '@tiptap/extension-table-cell'
|
||||
import TableHeader from '@tiptap/extension-table-header'
|
||||
@ -21,12 +22,12 @@ import TableRow from '@tiptap/extension-table-row'
|
||||
import TaskItem from '@tiptap/extension-task-item'
|
||||
import TaskList from '@tiptap/extension-task-list'
|
||||
|
||||
import { NodeUuid } from '../marks/nodeUuid'
|
||||
import { ImageNode, ImageOptions } from '../nodes/image'
|
||||
import { ReferenceNode } from '../nodes/reference'
|
||||
import { TodoItemNode, TodoListNode } from '../nodes/todo'
|
||||
|
||||
import { DefaultKit, DefaultKitOptions } from './default-kit'
|
||||
import { Level } from '@tiptap/extension-heading'
|
||||
|
||||
const headingLevels: Level[] = [1, 2, 3, 4, 5, 6]
|
||||
|
||||
@ -72,7 +73,8 @@ export const ServerKit = Extension.create<ServerKitOptions>({
|
||||
ImageNode.configure(this.options.image),
|
||||
TodoItemNode,
|
||||
TodoListNode,
|
||||
ReferenceNode
|
||||
ReferenceNode,
|
||||
NodeUuid
|
||||
]
|
||||
}
|
||||
})
|
||||
|
23
packages/text/src/marks/nodeUuid.ts
Normal file
23
packages/text/src/marks/nodeUuid.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { Mark } from '@tiptap/core'
|
||||
|
||||
const NAME = 'node-uuid'
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const NodeUuid = Mark.create({
|
||||
name: NAME,
|
||||
inline: true,
|
||||
|
||||
parseHTML () {
|
||||
return [
|
||||
{
|
||||
tag: `span[${NAME}]`
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
renderHTML ({ HTMLAttributes }) {
|
||||
return ['span', HTMLAttributes, 0]
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue
Block a user