vue+ckEditor5
1.安装依赖
"@ckeditor/ckeditor5-build-balloon": "^10.1.0",
"@ckeditor/ckeditor5-build-classic": "^10.1.0",
"@ckeditor/ckeditor5-build-inline": "^10.1.0",
"vue-ckeditor5": "^0.1.5",
2.html
<div id="ckEditor">
<vue-ckeditor type="balloon" v-model="content" :editors="editors1" :config='config' ></vue-ckeditor>
</div>
3.引入文件
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
import BalloonEditor from '@ckeditor/ckeditor5-build-balloon'
import InlineEditor from '@ckeditor/ckeditor5-build-inline'
import VueCkeditor from 'vue-ckeditor5'
4.js
data(){
return {
content: '',
editors1: {
// classic: ClassicEditor,
balloon: BalloonEditor
},
config:{
language:'en',
ckfinder: {
uploadUrl: $.getCookie('prefixUrl') +'/file/uploads'
},
image:{
toolbar: [ 'imageTextAlternative', '|', 'imageStyle:alignLeft', 'imageStyle:full', 'imageStyle:alignRight' ],
styles: [
// This option is equal to a situation where no style is applied.
'full',
// This represents an image aligned to the left.
'alignLeft',
// This represents an image aligned to the right.
'alignRight'
]
},
fontSize: {
options: [
'tiny',
'small',
'big',
'huge'
]
},
fontFamily: {
options: [
'default',
'Ubuntu, Arial, sans-serif',
'Ubuntu Mono, Courier New, Courier, monospace'
]
},
toolbar: [
'heading',
'|',
'alignment',// <--- ADDED
'bold',
'italic',
'link',
'fontFamily',
'fontSize',
// 'bulletedList',
// 'numberedList',
'imageUpload',
// 'blockQuote',
'undo',
'redo'
]
}
}
},
5.处理数据
ctbrife(str){
// str = str.replace(/\<c:if\b[^>]*>([\s\S]*?)</c:if>/g,'')
str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
//str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
str=str.replace(/ /ig,'');//去掉
return str.substring(0,40);
}
vue+ckEditor5的更多相关文章
- ckeditor5富文本编辑器在vue中的使用
安装依赖: npm install --save @ckeditor/ckeditor5-vue @ckeditor/ckeditor5-build-classic 要创建编辑器实例,必须首先将编辑器 ...
- CKEditor5 + vue2.0 自定义图片上传、highlight、字体等用法
因业务需求,要在 vue2.0 的项目里使用富文本编辑器,经过调研多个编辑器,CKEditor5 支持 vue,遂采用.因 CKEditor5 文档比较少,此处记录下引用和一些基本用法. CKEdit ...
- CKEditor5 输入文字时拼音和汉字同时输入问题
在使用 CKEditor5 + vue 时,出现输入文字时,拼音和文字一起输入到编辑器到问题.与之前项目中使用 ckeditor 的区别是,这次项目是在 python 架构下局部引入 ckeditor ...
- vue集成ckeditor富文本框,怎么获取CKEditor实例?
CKEDITOR 版本5 ,vue集成形式 vue集成ckeditor富文本框,由于不是通过js创建的富文本对象,所以,无法取得实例对象,官方说明 官方在builds-->Getting and ...
- vue集成CKEditor构建框架的使用,遇到富文本框不出现工具栏等操作
官方关于Vue集成CKEditor富文本框的文档:https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/framew ...
- Vue.js 和 MVVM 小细节
MVVM 是Model-View-ViewModel 的缩写,它是一种基于前端开发的架构模式,其核心是提供对View 和 ViewModel 的双向数据绑定,这使得ViewModel 的状态改变可以自 ...
- wepack+sass+vue 入门教程(三)
十一.安装sass文件转换为css需要的相关依赖包 npm install --save-dev sass-loader style-loader css-loader loader的作用是辅助web ...
- wepack+sass+vue 入门教程(二)
六.新建webpack配置文件 webpack.config.js 文件整体框架内容如下,后续会详细说明每个配置项的配置 webpack.config.js直接放在项目demo目录下 module.e ...
- wepack+sass+vue 入门教程(一)
一.安装node.js node.js是基础,必须先安装.而且最新版的node.js,已经集成了npm. 下载地址 node安装,一路按默认即可. 二.全局安装webpack npm install ...
随机推荐
- 启动eclipse导致Tomcat的配置文件重置
转: 启动eclipse导致Tomcat的配置文件重置 导入一个项目,需要在Tomcat的配置文件中配置JNDI数据源,需要修改Tomcat下的server.xml文件.但是当我们修改完后重启Tomc ...
- 计算机组成原理 — FPGA 现场可编程门阵列
目录 文章目录 目录 FPGA FPGA 的应用场景 FPGA 的技术难点 FPGA 的工作原理 FPGA 的体系结构 FPGA 的开发 FPGA 的使用 FPGA 的优缺点 参考文档 FPGA FP ...
- 更改mysql 数据库 utf8
mysql> alter database 数据库名 character set utf8;
- python同时执行两个函数
使用两个线程同时执行两个函数, def fun1(): while True: time.sleep(2) print("fun1") def fun2(): while True ...
- Jenkins——增加应用编译部署
新建Item: 源码配置: 构建环境配置: #!/usr/bin/bash source /etc/profile tomcat_home="/home/mppay/apache-tomca ...
- springboot-自定义异常处理器
@Order(-1000) public class LocalExceptionResolver implements HandlerExceptionResolver { @Override pu ...
- git配置过程中fatal:拒绝合并无关的历史
首先将远程仓库和本地仓库关联起来: git branch --set-upstream-to=origin/master master 然后使用git pull整合远程仓库和本地仓库, git pul ...
- javaweb期末项目-stage1-part2-UML设计
UML设计.rar-下载 说明:解压密码为袁老师全名拼音(小写) 相关链接: 项目结构:https://www.cnblogs.com/formyfish/p/10828672.html 需求分析:h ...
- 【Python】【基础知识】【异常】【Python的异常】报错、警告
Python的异常 异常的层次结构: BaseException [所有异常的基类] +-- SystemExit [解释器请求退出] +-- KeyboardInterrupt [用户中断执行(通常 ...
- 【深入浅出-JVM】(1):Java 虚拟机
Java 虚拟机地位 种类 BEA的JRockit Solaris的Exact VM IBM的J9 感谢您的耐心阅读,如果您发现文章中有一些没表述清楚的,或者是不对的地方,请给我留言,您的鼓励是作者写 ...