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. Redis4.0.11在linux上面安装时候编译的输出

    root@iZ2zedo02x7n4nuc3lb4ueZ:/opt/redis-4.0.11/src# make install CC Makefile.deprm -rf redis-server ...

  2. SQL中group by后面的having中不能使用别名

    如下图中,SQL中需要对group by的结果使用having进行过滤,不能使用select中定义的别名,需要使用查询字段的原始名.否则会报错,列明未定义. 下图未错误演示: 修改后,正确的SQL语句 ...

  3. 基于request的爬虫练习

    引言 概述 概念:基于网络请求的模块 作用:用来模拟浏览器发请求,从而实现爬虫 通用爬虫 步骤: 指定url 请求发送:get返回的是一个响应对象 获取响应数据: text返回的是字符串形式的响应数据 ...

  4. Java数据结构之TreeMap

    一.源码注释 /** * TreeMap基于NavigableMap 的一个红黑树的实现.TreeMap会根据比较器comparator对键值对的key进行比较进行排序,如果没有比较器就是用key的自 ...

  5. 在java中异常中的题目---重要的一点

    public classTest { public static void main(String[] args) { System.out.println(newTest().test()); } ...

  6. Protel99SE推荐使用英文版

    Protel99SE的汉化版功能并不全,最好还是用英文原版,功能是最齐全的.用英文版的软件其实也不难,有限的几个词,习惯就好了.

  7. 【网易微专业】图表绘制工具Matplotlib

    01 与图片的交互方式设置 这一小节简要介绍一下Matplotlib的交互方式 import pandas as pd import numpy as np import matplotlib.pyp ...

  8. Leetcode刷题6—不同路径

    一.要求 二.知识点 这道题属于动态规划,主要思路就是将大问题不断分解成小问题进行求解 三.解题思路 1.利用数学思路找规律 将m和n组合成一个m*n的矩阵,而且是一个对称阵 [[0],[1],[1] ...

  9. Angular5 自定义scrollbar样式之 ngx-perfect-scollbar

    版本 angular 5.0 ngx-perfect-scrollbar ^5.3.5 为什么不用 ngx-perfect-scrollbar 最新的版本 v7 呢? 因为它报错啊!!! 每次init ...

  10. redis分布式映射算法

    redis分布式映射算法 一致性Hash算法的原理和实现 为了解决分布式系统中的负载均衡的问题 背景问题 有N台服务器提供缓存服务,需要对服务器进行负载均衡,将请求平均发到每台服务器上,每台服务器负载 ...