承接 weave-php/blocknote-filament 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

weave-php/blocknote-filament

Composer 安装命令:

composer require weave-php/blocknote-filament

包简介

Weave BlockNote rich-text editor as a Filament form field for Laravel.

README 文档

README

Latest Version on Packagist Total Downloads License

BlockNote × Filament

This package embeds the BlockNote rich-text editor in Filament forms, using a bundled React UI (BlockNote + Mantine), and persists document state as a JSON string of BlockNote blocks.

Composer package: weave-php/blocknote-filament · PHP namespace: Weave\BlockNote\... (unchanged on purpose so imports stay stable).

Requirements

  • PHP ^8.3
  • Laravel 11+ (as required by your Filament version)
  • Filament ^3.0 || ^4.0 || ^5.0 (via filament/filament)

Installation

composer require weave-php/blocknote-filament

Laravel auto-discovers Weave\BlockNote\BlockNoteServiceProvider.

Register the plugin on any panel (optional but recommended for consistency with Filament’s plugin API):

use Filament\Panel;
use Weave\BlockNote\Filament\BlockNotePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->default()
        ->id('admin')
        ->path('admin')
        ->plugin(BlockNotePlugin::make());
}

Assets are registered globally by the service provider; the plugin is mainly an explicit hook for panel configuration.

Filament plugin list — thumbnail (16:9)

Publish Filament assets

After install or upgrade, publish JS/CSS to public/:

php artisan filament:assets

Files are published under public/js/weave-php/blocknote-filament/ and public/css/weave-php/blocknote-filament/.

The editor loads Inter from Filament’s font bundle (public/fonts/filament/filament/inter/). Run filament:assets or filament:install so that path exists.

Configuration

Publish the config file if you want to customize uploads and the upload route:

php artisan vendor:publish --tag=weave-blocknote-config

Default configuration:

<?php

return [

    'uploads' => [
        'enabled' => env('WEAVE_BLOCKNOTE_UPLOADS_ENABLED', true),

        'disk' => env('WEAVE_BLOCKNOTE_UPLOADS_DISK', 'public'),

        'directory' => env('WEAVE_BLOCKNOTE_UPLOADS_DIRECTORY', 'blocknote'),

        'visibility' => env('WEAVE_BLOCKNOTE_UPLOADS_VISIBILITY', 'public'),

        'max_size_kb' => (int) env('WEAVE_BLOCKNOTE_UPLOADS_MAX_KB', 12_288),

        'middleware' => ['web', 'auth'],

        'throttle' => env('WEAVE_BLOCKNOTE_UPLOADS_THROTTLE', '60,1'),

        'authorize' => null,

        'response_url_key' => 'url',

        'input_name' => 'file',
    ],

];

Configuration options:

Key Description
uploads.enabled When false, the package upload route returns 404 and the field should not expose the default upload URL.
uploads.disk Filesystem disk (default public). Use public so URLs work under /storage/... after php artisan storage:link.
uploads.directory Directory on the disk where files are stored.
uploads.visibility public or private (e.g. S3).
uploads.max_size_kb Max upload size for Laravel’s max validation rule (kilobytes).
uploads.middleware Route middleware stack (default web, auth). Adjust for auth:sanctum or your guard.
uploads.throttle Laravel throttle string (e.g. 60,1). Env: WEAVE_BLOCKNOTE_UPLOADS_THROTTLE. Set to an empty string to disable throttling on this route.
uploads.authorize Optional callable (\Illuminate\Http\Request $request): bool. Set at runtime, e.g. config()->set('weave-blocknote.uploads.authorize', fn ($r) => ...) in a service provider.
uploads.response_url_key JSON key for the file URL in the upload response (must match uploadResponseUrlKey() on the field if changed).
uploads.input_name Form field name for the file (must match uploadFieldName() on the field if changed).

Usage

Add BlockNoteEditor to a form schema. State is a JSON string (BlockNote document).

use Filament\Schemas\Schema;
use Weave\BlockNote\Forms\Components\BlockNoteEditor;

public static function form(Schema $schema): Schema
{
    return $schema->components([
        BlockNoteEditor::make('contents')
            ->label('Content')
            ->default('[]')
            ->minHeight(480)
            ->fullscreenButton()
            ->columnSpanFull(),
    ]);
}

Persist as longText or json in your migration.

Field API

Method Description
minHeight(int|string $height) Min height (480480px, or any CSS length). Default 320px.
fullscreenButton(bool $enabled = true) Fullscreen toggle. Off until you call fullscreenButton().
blockNoteLocale(?string $locale) BlockNote UI language (fr, en, zh-tw, …). Falls back to app()->getLocale().
locale(?string $locale) Alias of blockNoteLocale(). Prefer blockNoteLocale().
disableUpload() Disables uploads in the editor.
uploadUrl(?string $url) Custom upload endpoint (default: POST weave-blocknote.upload).
uploadFieldName / uploadResponseUrlKey Must stay in sync with config if you change field / response shape.
blocks / withoutBlocks Whitelist or blacklist BlockNote block types (BlockNoteEditor::BLOCK_TYPES).

Standard Filament field methods (label(), required(), rules(), columnSpanFull(), …) apply.

Uploads & custom storage

Default route: POST /weave-blocknote/upload (weave-blocknote.upload). Implement Weave\BlockNote\Contracts\StoresBlockNoteUploads and bind it in a service provider to use S3 or another backend; return a public URL string.

The bundled script sends Accept: application/json, credentials: 'same-origin', and CSRF headers when available.

Block types, localization, validation

  • Restrict blocks with ->withoutBlocks([...]) or ->blocks([...]).
  • Locale: ->blockNoteLocale('fr') or rely on app()->getLocale() (BlockNote locales).
  • Validation: Weave\BlockNote\Rules\BlockNoteDocumentRule — messages use weave-blocknote::validation.blocknote_document.* (override under lang/vendor/weave-blocknote/{locale}/validation.php).

Tables & infolist

Plain-text preview helpers:

use Weave\BlockNote\Tables\Columns\BlockNoteColumn;
use Weave\BlockNote\Infolists\Components\BlockNoteEntry;

BlockNoteColumn::make('contents');
BlockNoteEntry::make('contents');

Weave\BlockNote\Support\BlockNoteDocument::toPlainText() extracts preview text from JSON.

Livewire & theming

The editor mount uses wire:ignore. Avoid replacing the field’s DOM subtree blindly. With Filament SPA / wire:navigate, full page loads may be more reliable if the editor fails to mount after navigation.

BlockNote uses Mantine inside the bundle; it does not automatically match Filament theme tokens or dark mode. Target .weave-blocknote-shell for custom CSS if needed.

Translations

Namespace: weave-blocknote (e.g. weave-blocknote::editor.enter_fullscreen, weave-blocknote::validation.blocknote_document.must_be_string). Override via lang/vendor/weave-blocknote/{locale}/ in your app.

Development (this package)

cd vendor/weave-php/blocknote-filament   # or clone
npm install
npm run build

Outputs dist/blocknote-editor.js and dist/blocknote-editor.css (esbuild). Commit dist/ if you ship prebuilt assets, then run php artisan filament:assets in consuming apps.

Stack: React 19, @blocknote/mantine, esbuild.

Credits

Weave PHP

License

MIT. See LICENSE.md.

weave-php/blocknote-filament 适用场景与选型建议

weave-php/blocknote-filament 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 490 次下载、GitHub Stars 达 10, 最近一次更新时间为 2026 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「editor」 「laravel」 「weave」 「filament」 「blocknote」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 weave-php/blocknote-filament 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 weave-php/blocknote-filament 我们能提供哪些服务?
定制开发 / 二次开发

基于 weave-php/blocknote-filament 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 490
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 26
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-26