@sy-common/wang-editor 1.0.0-beta.4 → 1.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.vue +27 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sy-common/wang-editor",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "lambo",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@lambo-design/core": "^4.7.1-beta.140"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"release
|
|
20
|
+
"release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
|
|
21
21
|
"release-major": "standard-version --release-as major",
|
|
22
22
|
"release-minor": "standard-version --release-as minor",
|
|
23
23
|
"release-patch": "standard-version --release-as patch",
|
package/src/index.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div>
|
|
3
3
|
<!-- 工具栏 -->
|
|
4
4
|
<Toolbar
|
|
5
5
|
:editor="editor"
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
<script>
|
|
20
20
|
import '@wangeditor-next/editor/dist/css/style.css'
|
|
21
21
|
import {oneOf} from '@lambo-design/shared/utils/platform';
|
|
22
|
-
import {
|
|
22
|
+
import {Editor, Toolbar} from '@wangeditor-next/editor-for-vue2'
|
|
23
23
|
|
|
24
24
|
export default {
|
|
25
25
|
name: 'WangEditor',
|
|
26
|
-
components: {
|
|
26
|
+
components: {Editor, Toolbar},
|
|
27
27
|
props: {
|
|
28
28
|
value: {
|
|
29
29
|
type: String,
|
|
@@ -101,20 +101,37 @@ export default {
|
|
|
101
101
|
editorConfig: {
|
|
102
102
|
placeholder: '请输入内容...',
|
|
103
103
|
MENU_CONF: {
|
|
104
|
-
|
|
104
|
+
fontFamily: {
|
|
105
|
+
fontFamilyList: [
|
|
106
|
+
"黑体",
|
|
107
|
+
{
|
|
108
|
+
name: "仿宋",
|
|
109
|
+
value: "仿宋"
|
|
110
|
+
},
|
|
111
|
+
"仿宋_GB2312",
|
|
112
|
+
"楷体",
|
|
113
|
+
"楷体_GB2312",
|
|
114
|
+
"标楷体",
|
|
115
|
+
"华文仿宋",
|
|
116
|
+
"华文楷体",
|
|
117
|
+
{
|
|
118
|
+
name: "宋体",
|
|
119
|
+
value: "宋体"
|
|
120
|
+
}, "隶书", "思源宋体", "微软雅黑", "Arial", "Tahoma", "Verdana", "Times New Roman", "Courier New"]
|
|
121
|
+
},
|
|
105
122
|
uploadImage: {
|
|
106
123
|
//上传图片配置
|
|
107
|
-
server: this.ossServerContext+this.ossFilePutUrl, //上传接口地址
|
|
124
|
+
server: this.ossServerContext + this.ossFilePutUrl, //上传接口地址
|
|
108
125
|
fieldName: 'file', //上传文件名
|
|
109
126
|
methods: 'post',
|
|
110
127
|
metaWithUrl: true, // 参数拼接到 url 上
|
|
111
128
|
//自定义插入图片
|
|
112
|
-
customInsert:(res, insertFn)=>{
|
|
129
|
+
customInsert: (res, insertFn) => {
|
|
113
130
|
let self = this;
|
|
114
131
|
const imgInfo = res.data[0] || {}
|
|
115
|
-
const {
|
|
132
|
+
const {fileId, fileName, contentType} = imgInfo
|
|
116
133
|
insertFn(self.ossServerContext + self.ossFileGetImgUrl + fileId, fileName, self.ossServerContext + self.ossFileGetImgUrl + fileId)
|
|
117
|
-
}
|
|
134
|
+
},
|
|
118
135
|
|
|
119
136
|
},
|
|
120
137
|
}
|
|
@@ -151,8 +168,8 @@ export default {
|
|
|
151
168
|
onChange(editor) {
|
|
152
169
|
let self = this;
|
|
153
170
|
let html = this.editor.getHtml()
|
|
154
|
-
if (html.includes('table')){
|
|
155
|
-
html = html.replace(/<table /g,'<table class="wangeditor-styled-table" style= "border-collapse: collapse;"'); // 添加边框)
|
|
171
|
+
if (html.includes('table')) {
|
|
172
|
+
html = html.replace(/<table /g, '<table class="wangeditor-styled-table" style= "border-collapse: collapse;"'); // 添加边框)
|
|
156
173
|
}
|
|
157
174
|
console.log(html)
|
|
158
175
|
this.$emit('input', self.valueType === 'html' ? html : editor.getText())
|