mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-26 11:34:58 +02:00
fix: add mermaid plugin to server kit (#7671)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
@@ -186,6 +186,8 @@
|
||||
{/each}
|
||||
{/if}
|
||||
</th>
|
||||
{:else if node.type === MarkupNodeType.mermaid}
|
||||
<!-- TODO -->
|
||||
{:else if node.type === MarkupNodeType.comment}
|
||||
<!-- Ignore -->
|
||||
{:else}
|
||||
|
||||
@@ -33,6 +33,7 @@ import { DefaultKit, DefaultKitOptions } from './default-kit'
|
||||
import { CodeExtension, codeOptions } from '../marks/code'
|
||||
import { NoteBaseExtension } from '../marks/noteBase'
|
||||
import { CommentNode } from '../nodes/comment'
|
||||
import { MermaidExtension, mermaidOptions } from '../nodes/mermaid'
|
||||
import TextAlign from '@tiptap/extension-text-align'
|
||||
import TextStyle from '@tiptap/extension-text-style'
|
||||
import { BackgroundColor, TextColor } from '../marks/colors'
|
||||
@@ -85,6 +86,7 @@ export const ServerKit = Extension.create<ServerKitOptions>({
|
||||
}),
|
||||
CodeBlockExtension.configure(codeBlockOptions),
|
||||
CodeExtension.configure(codeOptions),
|
||||
MermaidExtension.configure(mermaidOptions),
|
||||
...tableExtensions,
|
||||
...taskListExtensions,
|
||||
...fileExtensions,
|
||||
|
||||
@@ -38,6 +38,7 @@ export enum MarkupNodeType {
|
||||
table_row = 'tableRow',
|
||||
table_cell = 'tableCell',
|
||||
table_header = 'tableHeader',
|
||||
mermaid = 'mermaid',
|
||||
comment = 'comment'
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Copyright © 2024 Hardcore Engineering Inc.
|
||||
//
|
||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License. You may
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
|
||||
import { codeBlockOptions } from './codeblock'
|
||||
|
||||
export const mermaidOptions: CodeBlockOptions = {
|
||||
...codeBlockOptions,
|
||||
defaultLanguage: 'mermaid'
|
||||
}
|
||||
|
||||
export const MermaidExtension = CodeBlock.extend({
|
||||
name: 'mermaid',
|
||||
group: 'block',
|
||||
|
||||
parseHTML () {
|
||||
return [
|
||||
{
|
||||
tag: 'div.mermaid-diagram',
|
||||
preserveWhitespace: 'full'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
addAttributes () {
|
||||
return {
|
||||
language: {
|
||||
default: 'mermaid'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user