use App\Elearning\QuizCompiler\Credits;
use App\Elearning\QuizCompiler\L10N;
use App\Fields\FluidbookFont;
-use App\Fields\HorizontalAlign;
-use App\Fields\ThemeBackgroundSize;
-use App\Fields\VerticalAlign;
use App\Jobs\Base;
use App\Models\Quiz;
use App\Models\QuizTheme;
-use App\Models\Signature;
use App\Models\Traits\QuizBranches;
use Cubist\Scorm\Manifest;
use Cubist\Scorm\Version;
use Cubist\Util\Files\VirtualDirectory;
use Cubist\Util\Graphics\Color;
use Cubist\Util\Text;
+use GrahamCampbell\Markdown\Facades\Markdown;
use RyanChandler\Blade\Blade;
class QuizCompiler extends Base
$l10n = $this->data->l10n;
$blade = new Blade($this->_resourcesPath() . '/views', $this->_resourcesPath() . '/cache/' . md5(rand(100000, 10000000)) . '/');
- $html = $blade->make('index', ['data' => $this->data, 'quiz' => $this->quiz, 'theme' => $this->theme, '__' => function ($str, $replace = [], $locale = null) use ($l10n) {
- $str = $l10n[$str] ?? '~' . $str;
- if (!$replace) {
- return $str;
- }
- return Text::l10nReplacements($str, $replace);
- }])->render();
+
+ $bladeData = [
+ 'data' => $this->data,
+ 'quiz' => $this->quiz,
+ 'theme' => $this->theme,
+ '__' => function ($str, $replace = [], $locale = null) use ($l10n) {
+ $str = $l10n[$str] ?? '~' . $str;
+ if (!$replace) {
+ return $str;
+ }
+ return Text::l10nReplacements($str, $replace);
+ },
+ 'markdownToHTML' => function ($markdown) {
+ return Markdown::convert($markdown)->getContent();
+ },
+ ];
+
+
+ $html = $blade->make('index', $bladeData)->render();
$vdir->file_put_contents('index.html', $html);
use Cubist\Backpack\Magic\Fields\FormSeparator;
use Cubist\Backpack\Magic\Fields\FormSuperSection;
use Cubist\Backpack\Magic\Fields\Hidden;
+use Cubist\Backpack\Magic\Fields\MarkdownBasic;
use Cubist\Backpack\Magic\Fields\SelectFromArray;
use Cubist\Backpack\Magic\Fields\Text;
-use Cubist\Backpack\Magic\Fields\Textarea;
use Spatie\Image\Manipulations;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
$this->addField('section_intro', FormSection::class, __('Introduction'));
$this->addField('intro_enable', Checkbox::class, __('Activer l\'écran d\'introduction'), ['default' => 1]);
$this->addField('intro_title', Text::class, __('Titre d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
- $this->addField('intro_text', Textarea::class, __('Texte d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
+ $this->addField('intro_text', MarkdownBasic::class, __('Texte d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
$this->addField('intro_button', Text::class, __('Texte du bouton d\'introduction'), ['when' => ['intro_enable' => ['1']]]);
$this->addField('', FormSeparator::class);
$this->addField('intro_custom_mobile', Checkbox::class, __('Personnaliser les textes sur Mobile'), ['when' => ['intro_enable' => ['1']]]);
$this->addField('intro_title_mobile', Text::class, __('Titre d\'introduction'), ['when' => ['intro_enable' => ['1'], 'intro_custom_mobile' => ['1']]]);
- $this->addField('intro_text_mobile', Textarea::class, __('Titre d\'introduction'), ['when' => ['intro_enable' => ['1'], 'intro_custom_mobile' => ['1']]]);
+ $this->addField('intro_text_mobile', MarkdownBasic::class, __('Titre d\'introduction'), ['when' => ['intro_enable' => ['1'], 'intro_custom_mobile' => ['1']]]);
$this->addField('intro_button_mobile', Text::class, __('Texte du bouton d\'introduction'), ['when' => ['intro_enable' => ['1'], 'intro_custom_mobile' => ['1']]]);
$this->addField('section_score', FormSection::class, __('Fin du quiz'));