feat: restore sablog browse modes and clean imported HTML
Keep the public site readable after import (nbsp, highlighter, wrapping code, compact pager) and finish the admin extras already in this tree: sticky levels, preview, page cache, and live llms.txt. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,15 +2,14 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Plugins\Neatstudio\Membership;
|
||||
|
||||
use App\Blog\Support\PluginManager;
|
||||
use App\Blog\Support\PluginServiceProvider;
|
||||
use App\Filament\Resources\Posts\Schemas\PostForm;
|
||||
use App\Models\Post;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
@@ -53,7 +52,7 @@ class ServiceProvider extends PluginServiceProvider
|
||||
}, 10);
|
||||
|
||||
// 付费文章:[paid]...[/paid] —— 无权限访客替换为 teaser;有权限替换为付费内容块(避免原始标签裸露在页面)
|
||||
$manager->addFilter('post.rendered', function (string $html, \App\Models\Post $post) {
|
||||
$manager->addFilter('post.rendered', function (string $html, Post $post) {
|
||||
$service = app(Services\MembershipService::class);
|
||||
$user = auth()->user();
|
||||
|
||||
@@ -81,25 +80,18 @@ class ServiceProvider extends PluginServiceProvider
|
||||
return $html;
|
||||
}, 10);
|
||||
|
||||
// 后台文章表单注入:付费设置(meta.price 单篇价格 + meta.members_only 会员专享)
|
||||
// 后台文章表单注入:右侧「访问设置」追加会员专享 / 价格
|
||||
$manager->addAction('filament.post_form', function (Schema $schema) {
|
||||
$schema->components([
|
||||
...$schema->getComponents(),
|
||||
Section::make('付费设置')
|
||||
->description('需启用支付插件并配置支付渠道;0 = 免费')
|
||||
->columns(3)
|
||||
->collapsible()
|
||||
->schema([
|
||||
TextInput::make('meta.price')
|
||||
->label('单篇价格(分)')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0)
|
||||
->helperText('例:9900 = ¥99;填 0 表示单篇免费'),
|
||||
Toggle::make('meta.members_only')
|
||||
->label('会员专享')
|
||||
->helperText('整篇文章仅会员可读'),
|
||||
]),
|
||||
PostForm::appendToAccessSection($schema, [
|
||||
Toggle::make('meta.members_only')
|
||||
->label('会员专享')
|
||||
->helperText('整篇文章仅会员可读'),
|
||||
TextInput::make('meta.price')
|
||||
->label('价格')
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0)
|
||||
->helperText('单位:分,例 9900 = ¥99;0 表示单篇免费'),
|
||||
]);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user