diff --git a/src/editor/index.js b/src/editor/index.js
index 045a68a..66345ec 100644
--- a/src/editor/index.js
+++ b/src/editor/index.js
@@ -511,6 +511,10 @@ class Editor extends Component {
let txt = ev.clipboardData.getData('text/plain')
let items = ev.clipboardData.items
+ if (this.readOnly || this.disabled) {
+ return
+ }
+
// 先文件判断, 避免右键单击复制图片时, 当成html处理
if (items && items.length) {
let blob = null
diff --git a/src/markd/core.js b/src/markd/core.js
index f70bdc3..4cb4b42 100644
--- a/src/markd/core.js
+++ b/src/markd/core.js
@@ -594,7 +594,7 @@ class Tool {
// 引用结束
if (isBlockquote) {
- if (emptyLineLength > 1) {
+ if (emptyLineLength > 0) {
isBlockquote = false
emptyLineLength = 0
while (blockquoteLevel > 0) {
diff --git a/src/markd/index.js b/src/markd/index.js
index cbe5930..74c7fc5 100644
--- a/src/markd/index.js
+++ b/src/markd/index.js
@@ -10,6 +10,8 @@ import md2html from './core.js'
import '../code/index.js'
import '../form/checkbox.js'
+export default md2html
+
class Markd extends Component {
static props = {
code: { type: String, default: '', attribute: false }
diff --git a/src/meditor/addon.js b/src/meditor/addon.js
index b9b89d7..babfe65 100644
--- a/src/meditor/addon.js
+++ b/src/meditor/addon.js
@@ -124,18 +124,15 @@ export default {
},
fullscreen(elem) {
- //
- this.props.fullscreen = !this.props.fullscreen
- if (this.props.fullscreen) {
- this.setAttribute('fullscreen', '')
- } else {
- this.removeAttribute('fullscreen')
- }
- elem.classList.toggle('active', this.props.fullscreen)
+ this.classList.toggle('fullscreen')
+ elem.classList.toggle('active')
},
preview(elem) {
- this.state.preview = !this.state.preview
- this.__VIEW__.classList.toggle('active', this.state.preview)
- elem.classList.toggle('active', this.state.preview)
+ this.previewEnabled = !this.previewEnabled
+ this.$refs.view.classList.toggle('active')
+ elem.classList.toggle('active')
+ if (this.previewEnabled) {
+ this.$refs.view.code = this.value
+ }
}
}
diff --git a/src/meditor/helper.js b/src/meditor/helper.js
index b2c33c7..d133522 100644
--- a/src/meditor/helper.js
+++ b/src/meditor/helper.js
@@ -16,17 +16,17 @@ const ELEMS = {
href = (href && href[1]) || null
title = (title && title[1]) || null
- tar = (tar && tar[1]) || '_self'
+ tar = tar && tar[1]
if (!href) {
return inner || href
}
- href = href.replace('viod(0)', '')
- attrs = `target=${tar}`
+ href = href.replace('viod(0)', '').replaceAll('&', '&')
+ attrs = tar ? `target=${tar}` : ''
attrs += title ? `;title=${title}` : ''
- return `[${inner || href}](${href} "${attrs}")`
+ return `[${inner || href}](${href}${attrs ? ` "${attrs}"` : ''})`
},
em: function (str, attr, inner) {
return (inner && '_' + inner + '_') || ''
@@ -134,10 +134,10 @@ export function renderToolbar(list = [], dict = {}, showText = false) {
let title = showText ? '' : dict[it]
let text = showText ? dict[it] || '' : ''
- return html``
+ `
})
}
@@ -151,11 +151,19 @@ export function html2md(str) {
str = str
.replace(/\t/g, ' ')
- .replace(/]*>/, '')
+ .replace(/<\/?(meta|link|script)[^>]*?>/g, '')
+ .replace(//g, '')
+ .replace(/]*?>[\w\W]*?<\/xml>/g, '')
+ .replace(/