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'
]
}
}
},
    components:{
      'vue-ckeditor': VueCkeditor.component
    }
 

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的更多相关文章

  1. ckeditor5富文本编辑器在vue中的使用

    安装依赖: npm install --save @ckeditor/ckeditor5-vue @ckeditor/ckeditor5-build-classic 要创建编辑器实例,必须首先将编辑器 ...

  2. CKEditor5 + vue2.0 自定义图片上传、highlight、字体等用法

    因业务需求,要在 vue2.0 的项目里使用富文本编辑器,经过调研多个编辑器,CKEditor5 支持 vue,遂采用.因 CKEditor5 文档比较少,此处记录下引用和一些基本用法. CKEdit ...

  3. CKEditor5 输入文字时拼音和汉字同时输入问题

    在使用 CKEditor5 + vue 时,出现输入文字时,拼音和文字一起输入到编辑器到问题.与之前项目中使用 ckeditor 的区别是,这次项目是在 python 架构下局部引入 ckeditor ...

  4. vue集成ckeditor富文本框,怎么获取CKEditor实例?

    CKEDITOR 版本5 ,vue集成形式 vue集成ckeditor富文本框,由于不是通过js创建的富文本对象,所以,无法取得实例对象,官方说明 官方在builds-->Getting and ...

  5. vue集成CKEditor构建框架的使用,遇到富文本框不出现工具栏等操作

    官方关于Vue集成CKEditor富文本框的文档:https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/framew ...

  6. Vue.js 和 MVVM 小细节

    MVVM 是Model-View-ViewModel 的缩写,它是一种基于前端开发的架构模式,其核心是提供对View 和 ViewModel 的双向数据绑定,这使得ViewModel 的状态改变可以自 ...

  7. wepack+sass+vue 入门教程(三)

    十一.安装sass文件转换为css需要的相关依赖包 npm install --save-dev sass-loader style-loader css-loader loader的作用是辅助web ...

  8. wepack+sass+vue 入门教程(二)

    六.新建webpack配置文件 webpack.config.js 文件整体框架内容如下,后续会详细说明每个配置项的配置 webpack.config.js直接放在项目demo目录下 module.e ...

  9. wepack+sass+vue 入门教程(一)

    一.安装node.js node.js是基础,必须先安装.而且最新版的node.js,已经集成了npm. 下载地址 node安装,一路按默认即可. 二.全局安装webpack npm install ...

随机推荐

  1. CACTI批量添加linux主机sh脚本

    关于批量添加就三个文件:add_hosts.sh,ips.txt,thold_test.php,关于如何使用,更是简单 ./add_hosts.sh --add #执行批量工作./add_hosts. ...

  2. java数据结构之CopyOnWriteArrayList和CopyOnWriteArraySet

    一.什么是CopyOnWrite CopyOnWrite(写时复制)简称COW,这是一种利用读写分离的思想来实现线程安全的程序设计思路.顾名思义该思想就是在写的时候将原数据复制一份,然后在新的数据中进 ...

  3. 安装最新docker-ce失败解决

    报错 下载 检查本地是否已经安装 rpm -qa |grep containerd.io 如果有低版本的,卸载即可. 安装新版的containerd.io软件包 wget https://downlo ...

  4. vue新增属性是否会响应式更新?

    原文地址 在开发过程中,我们时常会遇到这样一种情况:当vue的data里边声明或者已经赋值过的对象或者数组(数组里边的值是对象)时,向对象中添加新的属性,如果更新此属性的值,是不会更新视图的. 根据官 ...

  5. 一篇文章搞懂android存储目录结构

    前言 前两天因为开发一个app更新的功能,我将从服务器下载的apk文件放在了内部存储目录(测试手机为小米,路径为:data/user/0/packagename/files)下面,然后安装的时候一直安 ...

  6. SecureCRT 8.3注册码下载

    SecureCRT注册码是一款针对“SecureCRT 8.3”软件而制作的激活破解工具,可以完美激活“SecureCRT”软件,从而达到免费使用的目的.而SecureCRT则是一款非常优秀的且支持s ...

  7. cisco上配置 pppoe拨号

    r1(config)#vpdnenable                      开启虚拟拨号VPDN r1(config)#vpdn-groupoffice                定义组 ...

  8. MySQL知识篇-SQL3

    视图 1 提高重用性: 2 可用于数据库重构: 3 可用于不同用户,提高安全性: 定义视图: create view 视图name as select语句: 查看视图: show tables: 使用 ...

  9. web安全问题总结

    主要问题 SQL注入:即通过把SQL命令插入到Web表单递交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令,从而获取不该获取的数据 跨站脚本攻击(也称为XSS):指利用网站漏 ...

  10. day17 包与相对路径

    """ 今日内容: 1.导入模块的细节 2.包的概念及使用 3.包的相对导入 """ """ 1.导入模块的细 ...