diff --git a/src/neditor/index.wc b/src/neditor/index.wc
index 7323d19..611e1a6 100644
--- a/src/neditor/index.wc
+++ b/src/neditor/index.wc
@@ -39,6 +39,26 @@
border-radius: 4px;
}
+table {
+ border-spacing: 0;
+ border-collapse: collapse;
+
+ tr {
+ background: #fff;
+ }
+ thead tr {
+ background: nth($cp, 1);
+ }
+ th,
+ td {
+ padding: 6px 12px;
+ border: 1px solid nth($cp, 3);
+ }
+ th {
+ font-weight: bold;
+ }
+}
+
.neditor {
position: relative;
flex: 1;
@@ -268,7 +288,13 @@ export default class Neditor {
}
get value() {
- return this.__EDITOR__.innerHTML
+ var html = this.__EDITOR__.innerHTML
+ if (~html.indexOf('
')) {
+ html =
+ '' +
+ html
+ }
+ return html
}
set value(val) {
@@ -461,9 +487,27 @@ export default class Neditor {
this.__pasteFn = bind(this.__EDITOR__, 'paste', ev => {
ev.preventDefault()
+ var html = ev.clipboardData.getData('text/html')
var txt = ev.clipboardData.getData('text/plain')
var items = ev.clipboardData.items
+ if (html) {
+ html = html
+ .replace(/\t/g, ' ')
+ .replace(/]*>/, '')
+ .replace(
+ /]*? href\s?=\s?["']?([^"']*)["']?[^>]*?>/g,
+ ''
+ )
+ .replace(
+ /]*? href\s?=\s?["']?([^"']*)["']?[^>]*?>/g,
+ ''
+ )
+ .replace(/<(?!a|img)([\w\-]+)[^>]*>/g, '<$1>')
+
+ return this.exec('insertHtml', html)
+ }
+
if (txt) {
return this.exec('insertText', txt)
}