Last active
July 4, 2025 09:31
-
-
Save felixranesberger/70981602a594940e53e5da0d42dba132 to your computer and use it in GitHub Desktop.
TipTap Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { defineTipTapPlugin } from '@typo3/tiptap'; | |
| defineTipTapPlugin({ | |
| styleSheets: [ | |
| `path-to-css-file.css` | |
| ], | |
| styles: [ | |
| { | |
| name: 'Red Button', | |
| allowedTags: ['button', 'a'], | |
| attributes: { | |
| 'class': 'btn btn-danger', | |
| 'data-example-attribute': 'exampleValue', | |
| }, | |
| }, | |
| ], | |
| commands: [ | |
| { | |
| id: 'openCookieModal', | |
| label: 'Insert Cookie Modal Button', | |
| iconIdentifier: 'icon-backend-cookie', // defined with TYPO3 icons API | |
| sortAfter: 'insertLink', | |
| // This is the action that will be executed when the command button is triggered | |
| action: ({ editor }) => { | |
| const buttonHtml = ` | |
| <button | |
| class="btn btn-danger" | |
| data-example-attribute="exampleValue" | |
| > | |
| Open Cookie Modal | |
| </button> | |
| `; | |
| editor.chain().focus().insertContent(buttonHtml).run(); | |
| }, | |
| }, | |
| ], | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment