jqhph / dcat-admin

🔥 基于 Laravel 的后台系统构建工具 (Laravel Admin),使用很少的代码快速构建一个功能完善的高颜值后台系统,内置丰富的后台常用组件,开箱即用,让开发者告别冗杂的HTML代码
http://www.dcatadmin.com
MIT License
3.9k stars 713 forks source link

Markdown Editor set language and options globally or locally has no effect, it's not working #1237

Open jay2success opened 3 years ago

jay2success commented 3 years ago

Description:

Markdown can't change language and options. Language set to English and still showing Chinese. Set Options has no effect, either globally (via bootstrap) or locally (via controller)

Steps To Reproduce:

Via controller: $form->markdown('html_template') ->languageUrl(admin_asset('@admin/dcat/plugins/editor-md/languages/en.js')) ->options([ 'language' => 'en', 'height' => 800, 'codeFold' => true, 'saveHTMLToTextarea' => true, 'searchReplace' => true, 'emoji' => false, 'taskList' => false, 'tocm' => false, 'tex' => false, 'flowChart' => false, 'sequenceDiagram' => false, 'imageUpload' => true, 'autoFocus' => true, ]) ->required();

Global Via bootstrap.php: Markdown::resolving(function (Markdown $markdown) { $markdown->options([ 'language' => 'en', 'height' => 800, 'codeFold' => true, 'saveHTMLToTextarea' => true, 'searchReplace' => true, 'emoji' => false, 'taskList' => false, 'tocm' => false, 'tex' => false, 'flowChart' => false, 'sequenceDiagram' => false, 'imageUpload' => true, 'autoFocus' => true, ]); });

jay2success commented 3 years ago

After further test, the options not working only if it's inside the form Multi line layout (row). The language still not working though, it's always showing Chinese language.

$form->row(function (Form\Row $row) use ($form) { $row->markdown('html_template') ->languageUrl(admin_asset('@admin/dcat/plugins/editor-md/languages/en.js')) ->options([ 'language' => 'en', 'height' => 800, 'codeFold' => true, 'saveHTMLToTextarea' => true, 'searchReplace' => true, 'emoji' => false, 'taskList' => false, 'tocm' => false, 'tex' => false, 'flowChart' => false, 'sequenceDiagram' => false, 'imageUpload' => true, 'autoFocus' => true, ]) ->required(); });