分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 运营维护

Ueditor 的使用(这里以php+ci为例)

发布时间:2023-09-06 01:37责任编辑:苏小强关键词:暂无标签

下载:自行百度。

页面代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> ???<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> ???<script type="text/javascript" charset="utf-8" src="public/js/ueditor/ueditor.config.js"></script> ???<script type="text/javascript" charset="utf-8" src="public/js/ueditor/ueditor.all.min.js"> </script> ???<!--建议手动加在语言,避免在ie下有时因为加载语言失败导致编辑器加载失败--> ???<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型,比如你在配置项目里配置的是英文,这里加载的中文,那最后就是中文--> ???<script type="text/javascript" charset="utf-8" src="public/js/ueditor/lang/zh-cn/zh-cn.js"></script> ???????<style type="text/css"> ???????div{ width:100%; } ???</style></head><body><div> ???<script id="editor" type="text/plain" style="width:500px;height:100px;"></script></div> ???<script type="text/javascript"> ???????//实例化编辑器 ???????//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor(‘editor‘)就能拿到相关的实例 ???????var ue = UE.getEditor(‘editor‘,{ ???????????//配置工具栏菜单(这里距离个别) ???????????toolbars:[ ???????????????[‘fontsize‘,‘bold‘,‘italic‘,‘underline‘,‘insertcode‘,‘horizontal‘,‘simpleupload‘] ???????????], ???????????//是否显示路径 ???????????elementPathEnabled:false, ???????????//是否显示字数统计 ???????????wordCount:false, ???????????//是否自动本地草稿保存 ???????????autosave:false, ???????}); ???????ue.ready(function(){ ???????????//编辑器输入框内的默认文字 ???????????ue.setContent(‘写回答...‘); ???????}); ???????????</script></body></html>

配置文件修改:
这里我把ueditor插件放在了:public/js/ueditor 目录里;
配置文件路径:public/js/ueditor/php/config.json

修改上传路径:

/* 上传保存路径,可以自定义保存路径和文件名格式 */"imagePathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:99}", /* 涂鸦图片*/"scrawlPathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /*截图工具*/"snapscreenPathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",/*远程抓取*/"catcherPathFormat": "/public/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",/* 上传保存路径,可以自定义保存路径和文件名格式 */"videoPathFormat": "/public/ueditor/php/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */"filePathFormat": "/public/ueditor/php/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}", 

先写到这里,,,待续...

Ueditor 的使用(这里以php+ci为例)

原文地址:https://www.cnblogs.com/richardcastle/p/8297024.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved