siakad-itm/app/Support/TextAlignAttributeSanitizer.php
Yoga Pangestu 62f8c167e8
Some checks failed
tests / ci (pull_request) Has been cancelled
feat: implement feedback system with CRUD functionality
- Add FeedbackController to handle feedback submissions and management.
- Create Feedback model and migration for feedbacks table.
- Introduce FeedbackStatus and FeedbackType enums for better type handling.
- Implement FeedbackService for business logic related to feedback.
- Create FeedbackRequest for validation of feedback data.
- Add Tiptap rich text editor for feedback message input.
- Develop frontend components for displaying and managing feedback.
- Add routes for feedback management in web.php.
- Create utility types for feedback in TypeScript.
- Update app-sidebar to include feedback navigation.
2026-08-25 14:25:50 +07:00

33 lines
906 B
PHP

<?php
namespace App\Support;
use Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig;
use Symfony\Component\HtmlSanitizer\Visitor\AttributeSanitizer\AttributeSanitizerInterface;
/**
* Allows only `style="text-align: left|center|right|justify"` (as emitted by
* Tiptap's TextAlign extension) through the sanitizer's `style` attribute.
*/
class TextAlignAttributeSanitizer implements AttributeSanitizerInterface
{
public function getSupportedElements(): ?array
{
return ['p', 'h2', 'h3'];
}
public function getSupportedAttributes(): ?array
{
return ['style'];
}
public function sanitizeAttribute(string $element, string $attribute, string $value, HtmlSanitizerConfig $config): ?string
{
if (preg_match('/^text-align:\s*(left|center|right|justify);?$/i', trim($value)) === 1) {
return $value;
}
return null;
}
}