我这儿用的是 ‘overtrue/laravel-ueditor’;可以在GitHub 获取百度直接可以找到 laravel 安装就好了。安装就跳过。我这儿直接使用
//引入css
@include('vendor.ueditor.assets')
<script id="container" name="material_details" type="text/plain" style="height: 260px" ></script>
//引入简洁版
<script type="text/javascript">
var ue = UE.getEditor('container', {
wordCount: true, //开启字数统计
elementPathEnabled: false,//是否启用元素路径,默认是显示
maximumWords: 10000, //允许的最大字符数
initialContent: '', //初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
autoClearinitialContent: true, //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
pasteplain: true, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
imageUrlPrefix: "http://localhost:4176", /* 图片访问路径前缀 */
imagePathFormat: "/UploadFiles/{yyyy}{mm}{dd}/{time}{rand:6}",/* 上传保存路径,可以自定义保存路径和文件名格式 */
urlTarget: "Email",
autoHeightEnabled: false, //关闭高度自适应
toolbars: [
[
'undo', //撤销
'redo', //重做
'bold', //加粗
'indent', //首行缩进
'italic', //斜体
'underline', //下划线
'strikethrough', //删除线
'subscript', //下标
'fontborder', //字符边框
'superscript', //上标
'formatmatch', //格式刷
'pasteplain', //纯文本粘贴模式
'selectall', //全选
'preview', //预览
'horizontal', //分隔线
'removeformat', //清除格式
'time', //时间
'date', //日期
'inserttitle', //插入标题
'cleardoc', //清空文档
'simpleupload', //单图上传
'fontfamily', //字体
'fontsize', //字号
'paragraph', //段落格式
'link', //超链接
'emotion', //表情
'spechars', //特殊字符
'searchreplace', //查询替换
'justifyleft', //居左对齐
'justifyright', //居右对齐
'justifycenter', //居中对齐
'justifyjustify', //两端对齐
'forecolor', //字体颜色
'backcolor', //背景色
'insertorderedlist', //有序列表
'insertunorderedlist', //无序列表
'fullscreen', //全屏
'directionalityltr', //从左向右输入
'directionalityrtl', //从右向左输入
'rowspacingtop', //段前距
'rowspacingbottom', //段后距
'imagenone', //默认
'imageleft', //左浮动
'imageright', //右浮动
'imagecenter', //居中
'lineheight', //行间距
'edittip ', //编辑提示
'customstyle', //自定义标题
'autotypeset', //自动排版
'drafts' // 从草稿箱加载
]
]
});
// var ue = UE.getEditor('container');
var mat_details1=$("#mat_details1").val();
ue.ready(function() {
ue.setContent(mat_details1); //赋值给UEditor
ue.execCommand('serverparam', '_token', '{{ csrf_token() }}'); // 设置 CSRF token.
});
</script>