mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-06 01:37:42 +02:00
Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
95 lines
2.3 KiB
TypeScript
95 lines
2.3 KiB
TypeScript
//
|
|
// Copyright © 2023 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 { AnyExtension } from '@tiptap/core'
|
|
import { Level } from '@tiptap/extension-heading'
|
|
import Highlight from '@tiptap/extension-highlight'
|
|
import Link from '@tiptap/extension-link'
|
|
import Table from '@tiptap/extension-table'
|
|
import TableCell from '@tiptap/extension-table-cell'
|
|
import TableHeader from '@tiptap/extension-table-header'
|
|
import TableRow from '@tiptap/extension-table-row'
|
|
import TaskItem from '@tiptap/extension-task-item'
|
|
import TaskList from '@tiptap/extension-task-list'
|
|
import Typography from '@tiptap/extension-typography'
|
|
import StarterKit from '@tiptap/starter-kit'
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const headingLevels: Level[] = [1, 2, 3, 4, 5, 6]
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const tableExtensions = [
|
|
Table.configure({
|
|
resizable: false,
|
|
HTMLAttributes: {
|
|
class: 'proseTable'
|
|
}
|
|
}),
|
|
TableRow.configure({}),
|
|
TableHeader.configure({}),
|
|
TableCell.configure({})
|
|
]
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const taskListExtensions = [
|
|
TaskList,
|
|
TaskItem.configure({
|
|
nested: true,
|
|
HTMLAttributes: {
|
|
class: 'flex flex-grow gap-1 checkbox_style'
|
|
}
|
|
})
|
|
]
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const defaultExtensions: AnyExtension[] = [
|
|
StarterKit.configure({
|
|
code: {
|
|
HTMLAttributes: {
|
|
class: 'proseCode'
|
|
}
|
|
},
|
|
codeBlock: {
|
|
languageClassPrefix: 'language-',
|
|
exitOnArrowDown: true,
|
|
exitOnTripleEnter: true,
|
|
HTMLAttributes: {
|
|
class: 'proseCodeBlock'
|
|
}
|
|
},
|
|
heading: {
|
|
levels: headingLevels
|
|
}
|
|
}),
|
|
Highlight.configure({
|
|
multicolor: false
|
|
}),
|
|
Typography.configure({}),
|
|
Link.configure({
|
|
openOnClick: true,
|
|
HTMLAttributes: { class: 'cursor-pointer', rel: 'noopener noreferrer', target: '_blank' }
|
|
}),
|
|
...tableExtensions,
|
|
...taskListExtensions
|
|
]
|