This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

优化neditor的选中

old
宇天 2019-11-01 20:01:41 +08:00
parent d2a2c74bbb
commit 1caabb0be6
1 changed files with 4 additions and 6 deletions

View File

@ -477,10 +477,7 @@ export default class Neditor {
}) })
//监听鼠标事件的,以缓存选中状态 //监听鼠标事件的,以缓存选中状态
this.__mouseFn = bind(this.__EDITOR__, 'mouseup', ev => { this.__mouseFn = bind(this.__EDITOR__, 'mouseleave', ev => {
this.__FONT__.classList.remove('fadein')
this.__COLOR__.classList.remove('fadein')
this.__LINK__.classList.remove('fadein')
this.saveSelection() this.saveSelection()
}) })
@ -501,7 +498,8 @@ export default class Neditor {
if (html) { if (html) {
html = html html = html
.replace(/\t/g, ' ') .replace(/\t/g, ' ')
.replace(/<meta [^>]*>/, '') .replace(/<\/?(meta|link|script)[^>]*?>/g, '')
.replace(/<!--[\w\W]*?-->/g, '')
.replace( .replace(
/<a[^>]*? href\s?=\s?["']?([^"']*)["']?[^>]*?>/g, /<a[^>]*? href\s?=\s?["']?([^"']*)["']?[^>]*?>/g,
'<a href="$1">' '<a href="$1">'
@ -550,7 +548,7 @@ export default class Neditor {
unbind(this.__FONT__, 'click', this.__fontFn) unbind(this.__FONT__, 'click', this.__fontFn)
unbind(this.__COLOR__, 'click', this.__colorFn) unbind(this.__COLOR__, 'click', this.__colorFn)
unbind(this.__LINK_BTN__, 'click', this.__linkFn) unbind(this.__LINK_BTN__, 'click', this.__linkFn)
unbind(this.__EDITOR__, 'mouseup', this.__mouseFn) unbind(this.__EDITOR__, 'mouseleave', this.__mouseFn)
unbind(this.__EDITOR__, 'paste', this.__pasteFn) unbind(this.__EDITOR__, 'paste', this.__pasteFn)
this.__observer.disconnect() this.__observer.disconnect()
} }