Merge branch 'main' of github.com:ueberdosis/tiptap-next into main
This commit is contained in:
32
packages/extension-underline/index.ts
Normal file
32
packages/extension-underline/index.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { Mark } from '@tiptap/core'
|
||||||
|
|
||||||
|
declare module '@tiptap/core/src/Editor' {
|
||||||
|
interface Editor {
|
||||||
|
underline(): Editor,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new Mark()
|
||||||
|
.name('underline')
|
||||||
|
.schema(() => ({
|
||||||
|
parseDOM: [
|
||||||
|
{
|
||||||
|
tag: 'u',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
style: 'text-decoration',
|
||||||
|
getAttrs: node => node === 'underline' ? {} : false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
toDOM: () => ['u', 0],
|
||||||
|
}))
|
||||||
|
.commands(({ editor, name }) => ({
|
||||||
|
underline: next => () => {
|
||||||
|
editor.toggleMark(name)
|
||||||
|
next()
|
||||||
|
},
|
||||||
|
}))
|
||||||
|
.keys(({ editor }) => ({
|
||||||
|
'Mod-u': () => editor.underline()
|
||||||
|
}))
|
||||||
|
.create()
|
||||||
17
packages/extension-underline/package.json
Normal file
17
packages/extension-underline/package.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "@tiptap/extension-underline",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"source": "index.ts",
|
||||||
|
"main": "dist/tiptap-extension-underline.js",
|
||||||
|
"umd:main": "dist/tiptap-extension-underline.umd.js",
|
||||||
|
"module": "dist/tiptap-extension-underline.mjs",
|
||||||
|
"unpkg": "dist/tiptap-extension-underline.js",
|
||||||
|
"jsdelivr": "dist/tiptap-extension-underline.js",
|
||||||
|
"files": [
|
||||||
|
"src",
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"peerDependencies": {
|
||||||
|
"@tiptap/core": "2.x"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user