@lambo-design/wang-editor 1.0.0-beta.11 → 1.0.0-beta.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/wang-editor",
3
- "version": "1.0.0-beta.11",
3
+ "version": "1.0.0-beta.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -9,12 +9,9 @@
9
9
  "access": "public",
10
10
  "registry": "https://registry.npmjs.org/"
11
11
  },
12
- "dependencies": {
13
- "wangeditor": "^3.1.1"
14
- },
15
12
  "devDependencies": {
16
- "@lambo-design/core": "^4.7.1-beta.167",
17
- "@lambo-design/shared": "^1.0.0-beta.285"
13
+ "@lambo-design/core": "^4.7.1-beta.171",
14
+ "@lambo-design/shared": "^1.0.0-beta.316"
18
15
  },
19
16
  "scripts": {
20
17
  "release": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
package/src/index.vue CHANGED
@@ -101,7 +101,7 @@ export default {
101
101
  },
102
102
  mounted() {
103
103
  let self = this;
104
- const Editor = require('wangeditor')
104
+ const Editor = require('./js/wang-editor.js')
105
105
  self.editor = new Editor(`#${this.editorId}`)
106
106
  self.editor.customConfig.onchange = (html) => {
107
107
  let text = self.editor.txt.text()
@@ -110,6 +110,18 @@ export default {
110
110
  this.$emit('on-change', html, text)
111
111
  }
112
112
 
113
+ self.editor.customConfig.linkCheck = (text, link) => {
114
+ console.log('linkCheck text', text)
115
+ console.log('linkCheck link', link)
116
+ if (!/^https?:\/\/[^\s/$.?#].[^\s]*$/.test(link)) {
117
+ return '链接格式不正确,请输入有效的HTTP/HTTPS地址';
118
+ }
119
+ if (link.includes('javascript:')) {
120
+ return '禁止使用javascript协议';
121
+ }
122
+ return true;
123
+ }
124
+
113
125
  // 根据 preservePasteStyle 属性决定是否保留粘贴样式
114
126
  self.editor.customConfig.pasteFilterStyle = this.preservePasteStyle
115
127
  // 设置触发事件间隔
@@ -159,6 +171,7 @@ export default {
159
171
  self.editor.customConfig.menus = [
160
172
  'head', // 标题
161
173
  'bold', // 粗体
174
+ 'hr', //分割线
162
175
  'fontSize', // 字号
163
176
  'fontName', // 字体
164
177
  'italic', // 斜体
@@ -189,7 +202,8 @@ export default {
189
202
  '#7b5ba1',
190
203
  '#46acc8',
191
204
  '#f9963b',
192
- '#ffffff'
205
+ '#ffffff',
206
+ '#FF0000'
193
207
  ]
194
208
  if (!this.preservePasteStyle) {
195
209
  self.editor.customConfig.pasteTextHandle = function (content) {