@sy-common/wang-editor 1.0.0-beta.13 → 1.0.0-beta.15
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 +1 -1
- package/src/index.vue +26 -10
package/package.json
CHANGED
package/src/index.vue
CHANGED
|
@@ -117,10 +117,10 @@ export default {
|
|
|
117
117
|
{
|
|
118
118
|
name: "宋体",
|
|
119
119
|
value: "宋体"
|
|
120
|
-
}, "隶书","方正小标宋简体", "思源宋体", "微软雅黑", "Arial", "Tahoma", "Verdana", "Times New Roman", "Courier New"]
|
|
120
|
+
}, "隶书", "方正小标宋简体", "思源宋体", "微软雅黑", "Arial", "Tahoma", "Verdana", "Times New Roman", "Courier New"]
|
|
121
121
|
},
|
|
122
|
-
color:{
|
|
123
|
-
colors:[
|
|
122
|
+
color: {
|
|
123
|
+
colors: [
|
|
124
124
|
"rgb(0, 0, 0)",
|
|
125
125
|
"rgb(38, 38, 38)",
|
|
126
126
|
"rgb(89, 89, 89)",
|
|
@@ -244,13 +244,29 @@ export default {
|
|
|
244
244
|
onChange(editor) {
|
|
245
245
|
let self = this;
|
|
246
246
|
let html = this.editor.getHtml()
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
247
|
+
// 创建一个临时的 div 容器来解析 HTML
|
|
248
|
+
const tempDiv = document.createElement('div');
|
|
249
|
+
tempDiv.innerHTML = html;
|
|
250
|
+
|
|
251
|
+
// 处理 table 元素
|
|
252
|
+
const tables = tempDiv.querySelectorAll('table');
|
|
253
|
+
tables.forEach(table => {
|
|
254
|
+
const currentStyle = table.getAttribute('style') || '';
|
|
255
|
+
const newStyle = `${currentStyle}; border-collapse: collapse;`.trim();
|
|
256
|
+
table.setAttribute('class', 'wangeditor-styled-table');
|
|
257
|
+
table.setAttribute('style', newStyle);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// 处理 hr 元素
|
|
261
|
+
const hrs = tempDiv.querySelectorAll('hr');
|
|
262
|
+
hrs.forEach(hr => {
|
|
263
|
+
const currentStyle = hr.getAttribute('style') || '';
|
|
264
|
+
const newStyle = `${currentStyle}; border: 1px solid rgb(250, 64, 6);`.trim();
|
|
265
|
+
hr.setAttribute('style', newStyle);
|
|
266
|
+
});
|
|
267
|
+
// 更新处理后的 HTML
|
|
268
|
+
html = tempDiv.innerHTML;
|
|
269
|
+
console.log("this.editor.getMenuConfig('color')", this.editor.getMenuConfig('color'))
|
|
254
270
|
this.$emit('input', self.valueType === 'html' ? html : editor.getText())
|
|
255
271
|
this.$emit('on-change', html, editor.getText())
|
|
256
272
|
},
|