ckeditor在创建帖子时工作正常,但在编辑帖子时丢失

时间:2019-02-18 10:02:15

标签: php laravel ckeditor

app.blade.php 文件中,我添加了:

<script src="../vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<script>
        CKEDITOR.replace( 'article-ckeditor' );
</script>

然后在 create.blade.php 文件中:

{{Form::textarea('body','',['id'=>'article-ckeditor',
                            'class'=>'form-control',
                            'placeholder'=>'Body Text'])
}}

edit.blade.php 文件中:

{{Form::textarea('body', $post->body,['id'=> 'article-ckeditor',
                                      'class'=>'form-control',
                                      'placeholder'=>'Body Text'])
}}

CKeditor在创建页面上显示,但在编辑页面上丢失。

我的问题是,我还必须在Laravel中写下什么,使CKeditor在编辑页面上可见?

1 个答案:

答案 0 :(得分:0)

遇到相同的问题,以防万一您仍然遇到问题,请查看:

https://artisansweb.net/install-use-ckeditor-laravel/

还要确保{{asset}}中带有字符串插值app.blade.php的脚本指向正确的路径。我的不得不跳出文件夹到供应商(../vendor)。您的可能会有所不同。

请注意,下一个脚本具有CKEDITOR.replace( 'summary-ckeditor' );没有 CKEDITOR.replace( article-ckeditor' );最重要的是确保您在idedit.blade.php中都使用create.blade.php指向summary-ckeditor而不是article-ckeditor

相关问题