F
Filament5mo ago
V01D

RichEditor put tags

I am using the richeditor component, it works fine, it saves the content in the database but it adds the content inside tags like these: <p> <p/> whats happening?
17 Replies
sudiplun
sudiplun5mo ago
same problem if you find solution. alert me
awcodes
awcodes5mo ago
That’s how all rich editors work. Content has to be at least in a p tag to make it valid and accessible markup.
Nico_Laravel
Nico_Laravel5mo ago
It' because rich text editor's content field uses html tags to show style document. for example if you use bold font style for your name it's content chages like<bold>yourname</bold>
sudiplun
sudiplun5mo ago
but tags show on the table. Is there any way to show styles instead of tags
awcodes
awcodes5mo ago
to my knowledge Trix doesn't support inline styles
Nico_Laravel
Nico_Laravel5mo ago
What tags are shown?
sudiplun
sudiplun5mo ago
No description
No description
Tieme
Tieme4mo ago
Try ->description(fn($record) => new HtmlString($record->field))
awcodes
awcodes4mo ago
Can you share the actual code of your column? Would make this easier.
sudiplun
sudiplun4mo ago
public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\ImageColumn::make('thumbnail')->size(80), Tables\Columns\TextColumn::make('title') ->searchable(), Tables\Columns\TextColumn::make('slug') ->toggleable(), TextColumn::make('body') ->description(fn (Blog $blog): string => $blog->body, position: 'below') ->markdown() ->searchable(), Tables\Columns\IconColumn::make('active') ->boolean(), Tables\Columns\TextColumn::make('published_at') ->label('Availability') ->dateTime() ->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('updated_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } Result
No description
awcodes
awcodes4mo ago
Try ->html() instead of ->markdown()
sudiplun
sudiplun4mo ago
tried not working is there any thing else..!
Tieme
Tieme4mo ago
for your code to work you need. 1) For a column
TextColumn::make('body')
->html()
->searchable(),
TextColumn::make('body')
->html()
->searchable(),
2) For a column description
TextColumn::make('body')
->description(fn (Blog $blog): string => new HtmlString($blog->body), position: 'below')
->searchable(),
TextColumn::make('body')
->description(fn (Blog $blog): string => new HtmlString($blog->body), position: 'below')
->searchable(),
sudiplun
sudiplun4mo ago
sorry mate couldn't work
No description
sudiplun
sudiplun4mo ago
here a file if it matters....!