tiptap update

This commit is contained in:
2026-01-01 08:55:58 +10:00
parent a37386565a
commit de1483d409
2 changed files with 25 additions and 12 deletions

View File

@@ -14,17 +14,17 @@
"vite": "^6.4"
},
"dependencies": {
"@tiptap/core": "^2.3.0",
"@tiptap/extension-highlight": "^2.3.0",
"@tiptap/extension-image": "^2.3.0",
"@tiptap/extension-link": "^2.3.0",
"@tiptap/extension-subscript": "^2.3.0",
"@tiptap/extension-superscript": "^2.3.0",
"@tiptap/extension-text-align": "^2.3.0",
"@tiptap/extension-typography": "^2.3.0",
"@tiptap/extension-underline": "^2.3.0",
"@tiptap/pm": "^2.3.0",
"@tiptap/starter-kit": "^2.3.0",
"@tiptap/core": "^3.10.7",
"@tiptap/extension-highlight": "^3.10.7",
"@tiptap/extension-image": "^3.10.7",
"@tiptap/extension-link": "^3.10.7",
"@tiptap/extension-subscript": "^3.10.7",
"@tiptap/extension-superscript": "^3.10.7",
"@tiptap/extension-text-align": "^3.10.7",
"@tiptap/extension-typography": "^3.10.7",
"@tiptap/extension-underline": "^3.10.7",
"@tiptap/pm": "^3.10.7",
"@tiptap/starter-kit": "^3.10.7",
"tailwindcss": "^4.1.17"
}
}

View File

@@ -1,6 +1,7 @@
import Link from "@tiptap/extension-link";
import {Editor} from "@tiptap/core";
import StarterKit from "@tiptap/starter-kit";
import Underline from "@tiptap/extension-underline";
import Highlight from "@tiptap/extension-highlight";
import TextAlign from "@tiptap/extension-text-align";
import Typography from "@tiptap/extension-typography";
@@ -49,12 +50,16 @@ document.addEventListener('alpine:init', () => {
editor = new Editor({
element: this.$refs.element,
extensions: [
StarterKit,
StarterKit.configure({
link: false,
underline: false,
}),
Highlight,
CustomLink.configure({
rel: 'noopener noreferrer',
openOnClick: 'whenNotEditable',
}),
Underline,
TextAlign.configure({
types: ['heading', 'paragraph', 'small', 'extraSmall'],
}),
@@ -65,6 +70,11 @@ document.addEventListener('alpine:init', () => {
ExtraSmall,
Box
],
editorProps: {
attributes: {
class: 'tiptap content',
},
},
content: content,
onCreate({/* editor */}) {
_this.updatedAt = Date.now()
@@ -141,6 +151,9 @@ document.addEventListener('alpine:init', () => {
unsetAllMarks() {
editor.chain().focus().unsetAllMarks().run()
},
clearNodes() {
editor.chain().focus().clearNodes().run()
},
clearNotes() {
editor.chain().focus().clearNodes().run()
},