使用CKEditor内部刀片模板[Laravel 3.x]
我想使用这个捆绑包: 但我在视图中嵌套它时遇到了麻烦(我以前成功完成的所有安装步骤)。 如何将Form::text()与此捆绑包连接 当我加上使用CKEditor内部刀片模板[Laravel 3.x],laravel,ckeditor,laravel-3,blade,Laravel,Ckeditor,Laravel 3,Blade,我想使用这个捆绑包: 但我在视图中嵌套它时遇到了麻烦(我以前成功完成的所有安装步骤)。 如何将Form::text()与此捆绑包连接 当我加上 <?php $ckeditor = new CKEditor(); $config = array(); $config['toolbar'] = array( array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Str
<?php
$ckeditor = new CKEditor();
$config = array();
$config['toolbar'] = array(
array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
array( 'Image', 'Link', 'Unlink', 'Anchor' )
);
$events['instanceReady'] = 'function (ev) {
alert("Loaded: " + ev.editor.name);
}';
$ckeditor->editor("field1", "
Initial value.
", $config, $events);
?>
以下是一个工作TinyMCE的示例:
<!-- title field -->
<p>{{ Form::label('title', 'Tytuł') }}</p>
{{ $errors->first('title', '<div class="alert alert-error"><a class="close">×</a>:message</div>') }}
<p>{{ Form::text('title', $value = $post->title, $attributes = array(Input::old('title'))); }}</p>
<!-- body field -->
<p>{{ Form::label('body', 'Tekst') }}</p>
{{ $errors->first('body', '<div class="alert alert-error"><a class="close">×</a>:message</div>') }}
<p>{{ RTE::rich_text_box('body',$post->body,array('att'=>array('id'=>'editorID'),'selector'=>'editorSelector','mode'=>'full','setup'=>array('skin'=>'o2k7','skin_variant'=>'black'))) }}
</p>
<!-- submit button -->
<p>{{ Form::submit('Edit') }}</p>
{{Form::label('title','Tytuł'')}
{{$errors->first('title','×:message')}
{{Form::text('title',$value=$post->title,$attributes=array(Input::old('title'));}
{{Form::label('body','Tekst')}
{{$errors->first('body','×:message')}
{{RTE::富文本框('body',$post->body,数组('att'=>array('id'=>'editorID'),'selector'=>'editorSelector','mode'=>'full','setup'=>array('skin'=>'o2k7','skin\u variant'=>'black'))}
{{Form::submit('Edit')}
诀窍是使用它而不是Form::text(并更改0755的/laravel/public/bundles/*中的所有文件权限)
同样的事情也发生在Keckeditor身上。希望它能在将来帮助别人(:步骤如下:
通过运行以下命令,首先通过composer安装编辑器:
编写器需要unisharp/laravel ckeditor
将此添加到config/app.php
中的ServiceProvider到providers数组中:
'providers'=>[
Unisharp\Ckeditor\ServiceProvider::class,
再次回到命令行,发布资源:
php artisan供应商:发布--tag=ckeditor
现在将其嵌入文本区域
用id绑定
CKEDITOR.replace('your_id');
对于这些步骤,他们有自己的步骤
注意:如果您使用Laravel Collictive添加文本区域并将id
绑定到文本区域,请使用以下命令:
{{Form::textarea('desc', '', ['id' => 'your_id'])}}
和然后显示格式良好的内容,如下所示:
{!!$post->desc!!}
其中$post->desc
是从数据库返回的存储值我也尝试过,但不知道如何正确使用它:(