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
sudiplun10mo ago
same problem if you find solution. alert me
awcodes
awcodes10mo 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_Laravel10mo 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
sudiplun10mo ago
but tags show on the table. Is there any way to show styles instead of tags
awcodes
awcodes10mo ago
to my knowledge Trix doesn't support inline styles
Nico_Laravel
Nico_Laravel10mo ago
What tags are shown?
sudiplun
sudiplun10mo ago
No description
No description
Tieme
Tieme10mo ago
Try ->description(fn($record) => new HtmlString($record->field))
awcodes
awcodes10mo ago
Can you share the actual code of your column? Would make this easier.
sudiplun
sudiplun10mo 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
awcodes10mo ago
Try ->html() instead of ->markdown()
sudiplun
sudiplun10mo ago
tried not working is there any thing else..!
Tieme
Tieme10mo 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
sudiplun10mo ago
sorry mate couldn't work
No description
sudiplun
sudiplun10mo ago
here a file if it matters....!
Want results from more Discord servers?
Add your server