platform icon indicating copy to clipboard operation
platform copied to clipboard

[13.0] Allow `html` messages in notifications

Open tabuna opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe.

Right now, to display an HTML notification with bold text, for example, you need to use Alert with your own Blade view:

use Orchid\Support\Facades\Alert;
use Orchid\Support\Color;

Alert::view('alert', Color::INFO(), [
    'name' => 'Alexandr'
]);

Which requires the mandatory creation of a view. What makes additional difficulties when there is a translation of sentences and in this translation the boldness in various places.

Describe the solution you'd like

I suggest a clear solution to this, disable text sanitize before sending the message:

Toast::withoutEscaping()->warning('Hello <strong>Alexandr</strong>');
Alert::withoutEscaping()->warning('Hello <strong>Alexandr</strong>');

It should be a conscious decision to disable it and should therefore be called before passing the string itself.

Additional context

Most likely, this will not affect the previously written user code in any way. The exception will be a change in the template, which we cannot take into account in any way.

tabuna avatar Jun 29 '22 20:06 tabuna