PHP code example of marshmallow / nova-tiptap
1. Go to this page and download the library: Download marshmallow/nova-tiptap library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
marshmallow / nova-tiptap example snippets
use Marshmallow\Tiptap\Tiptap;
Tiptap::make('Content')
Tiptap::make('Content')
->buttons([
'heading', 'bold', 'italic', '|', 'link', 'bulletList', 'orderedList',
// Add more buttons as needed
])
Tiptap::make('Content')
->buttons(['heading'])
->headingLevels([2, 3, 4]) // Only allow H2, H3, H4 (default: H1-H3)
Tiptap::make('Content')
->buttons(['link'])
->linkSettings([
'withFileUpload' => false, // Disable file upload option (default: true)
])
->fileSettings([
'disk' => 'public', // Storage disk to use (default: 'public')
'path' => 'links', // Path within disk (default: root folder)
])
Tiptap::make('Content')
->buttons(['image'])
->imageSettings([
'disk' => 'public', // Storage disk to use
'path' => 'uploads/images', // Path within disk
'withFileUpload' => true, // Allow file uploads (default: true)
])
Tiptap::make('Content')
->buttons(['textAlign'])
->alignments(['left', 'center', 'right', 'justify']) // Available alignments
->defaultAlignment('left') // Default text alignment
Tiptap::make('Content')
->buttons(['color'])
->colors(['#f1f1f1']) // Available colors in HEX
Tiptap::make('Content')
->buttons(['color'])
->backgroundColors(['#f1f1f1']) // Available background colors in HEX
Tiptap::make('Content')
->buttons(['rtl']) // Adds button to toggle RTL mode
Tiptap::make('Content')
->buttons(['codeBlock'])
->syntaxHighlighting()
Tiptap::make('Content')
->buttons(['editHtml'])
->htmlTheme('night') // Theme for HTML code editor (default: 'material')
Tiptap::make('Content')
->saveAsJson() // Store content as JSON instead of HTML
Tiptap::make('Content')
->sanitizeEmptyContent() // Return empty string for empty editor content
Tiptap::make('Content')
->readonly() // Make the field readonly based on your logic
Tiptap::make('Content')
->readonly(function ($request) {
return !$request->user()->isAdmin();
})