medienbaecker / kirby-tiptap
Kirby Tiptap
Fund package maintenance!
medienbaecker
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Language:Vue
Type:kirby-plugin
Requires
- getkirby/composer-installer: ^1.1
- ueberdosis/tiptap-php: ^1.4
README
A powerful, user-friendly Tiptap field for Kirby.
Features
- ๐ Best of both worlds: Uses (and highlights) KirbyTags for images/links while providing WYSIWYG formatting
- ๐ฆ Supports all standard Kirby field features like
required
,default
,placeholder
,counter
,disabled
,help
,size
,spellcheck
andminlength
/maxlength
- ๐ค Smart text handling with intuitive soft hyphen
(-)
and non-breaking space(_)
replacements, and visible special characters - ๐ง Configurable buttons with customizable heading levels and a content sanitizer that automatically removes formatting you don't want
- ๐ผ Inline mode for paragraph-free content with buttons being disabled automatically
- ๐ง One method to rule them all with
tiptapText()
handling UUID resolution, smartypants, automatic inline mode and more - โจ Intuitive drag & drop support for pages and files with intelligent spacing
- ๐ Custom field preview showing formatted text in structure fields
- ๐ Improved link handling with a dialog that allows custom link types and custom fields, automatically picks the right KirbyTag (
(link: )
,(email: )
,(file: )
or(tel: )
) and pre-fills the link and link text fields according to the selected text - ๐ Custom highlights via a regular expression config option, making it possible to e.g. highlight long words
- ๐ Abstracted JSON structure for easy content manipulation with features like
offsetHeadings
Usage
Blueprints
Available buttons
tiptap: buttons: # Default buttons: - headings: - 1 - 2 - 3 - bold - italic - link - image - bulletList - orderedList # Additional buttons: - strike - code - codeBlock - removeFormatting # Divider: - "|"
Available options
tiptap: inline: true # remove block elements like paragraphs counter: false # disable character counter size: small # small, medium, large, huge or the default auto spellcheck: false # disable spellcheck pretty: true # pretty-print JSON in content file links: # Set link types in the link dialog options: - page - url # Add fields to the link dialog fields: class: label: Classes type: checkboxes options: border: Border shadow: Shadow rounded: Rounded required: true placeholder: My placeholder default: My default content disabled: true help: My help maxlength: 10 minlength: 10
Template
// Basic usage echo $page->text()->tiptapText(); // With heading level offset echo $page->text()->tiptapText([ 'offsetHeadings' => 1 ]);
Configuration
// site/config/config.php return [ // Supports https://getkirby.com/docs/reference/system/options/smartypants 'smartypants' => true, // Custom highlights via regex (can be styled via panel CSS) 'medienbaecker.tiptap.highlights' => [ [ 'pattern' => '\\b[a-zA-Zรครถรผรรรร\\w]{20,}\\b', 'class' => 'long-word' ] ] ];
Ideas for future improvements
- Localisation of formatting button titles
- Custom buttons
- Kirbytag button? (Fetch all Kirbytags except
link
,image
andfile
?) - Image/file uploads? (I don't necessarily like how the core textarea handles this with a
link
button allowing to select files and a separate file button with upload functionality) - Table button
- Replacement for Writer/Textarea blocks?
- Snapshot Compare?
- Blocks replacement?
- Forced content structure?
- Real-time collaboration?