diff --git a/README.md b/README.md
index 3fa79cb8..a577765b 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Yank Note Markdown 编辑器
-> 一款面向程序员的 Markdown 编辑器
+> 一款面向程序员的 Markdown 编辑器
[toc]{level: [2]}
@@ -147,7 +147,7 @@ yarn run start
## 更新日志
[最新发布](https://github.com/purocean/yn/releases)
-### [v2.0.0-beta8.3](https://github.com/purocean/yn/releases/tag/v2.0.0-beta8.3) 2019-08-28
+### [v2.0.0-beta8.4](https://github.com/purocean/yn/releases/tag/v2.0.0-beta8.4) 2019-08-28
1. 增加 2.0 计划
1. Electron 打包
1. 增加 HTML 小工具渲染
diff --git a/frontend/src/components/Preview.vue b/frontend/src/components/Preview.vue
index 9bb21fd7..6f958e4a 100644
--- a/frontend/src/components/Preview.vue
+++ b/frontend/src/components/Preview.vue
@@ -33,7 +33,7 @@
TOP
-
+
@@ -180,7 +180,7 @@ export default {
if (this.fileRepo === '__help__') {
return md.replace(/\[([^\]]*)\]\((\.\/[^)]*)\)/g, `[$1](api/help/file?path=$2)`)
- .replace(/
]*)src=["']?([^\s'"]*)["']?/ig, `
]*)src=["']?(\.\/[^\s'"]*)["']?/ig, `
{
+ if (link.tagName === 'A' && link.classList.contains('open')) {
+ fetch(link.href.replace('api/attachment', 'api/open'))
+ e.preventDefault()
+ e.stopPropagation()
return
}
- env.openAlwaysOnTopWindow(img.src)
+ if (env.isElectron && link.tagName === 'A' && /^(http:|https:|ftp:)\/\//i.test(link.getAttribute('href') || '')) {
+ env.require && env.require('opn')(link.href)
+ e.preventDefault()
+ e.stopPropagation()
+ return
+ }
+ }
+
+ if (target.tagName === 'A') {
+ handleLink(target)
+ }
+
+ if (target.tagName === 'IMG') {
+ const img = target
+ if (e.ctrlKey && e.shiftKey) { // 转换外链图片到本地
+ this.transformImgOutLink(img)
+ } else if (img.parentElement.tagName === 'A') {
+ handleLink(img.parentElement)
+ } else {
+ env.openAlwaysOnTopWindow(img.src)
+ }
+
+ e.stopPropagation()
return
}
- if (e.target.tagName === 'INPUT' && e.target.parentElement.classList.contains('source-line')) {
- this.switchTodo(parseInt(e.target.parentElement.dataset['sourceLine']), e.target.checked)
+ if (target.tagName === 'INPUT' && target.parentElement.classList.contains('source-line')) {
+ this.switchTodo(parseInt(target.parentElement.dataset['sourceLine']), target.checked)
+ e.preventDefault()
+ e.stopPropagation()
return
}
- if (e.target.classList.contains('source-line') && window.getSelection().toString().length < 1) {
- this.syncScroll(parseInt(e.target.dataset['sourceLine']))
+ if (target.classList.contains('source-line') && window.getSelection().toString().length < 1) {
+ this.syncScroll(parseInt(target.dataset['sourceLine']))
+ e.stopPropagation()
e.preventDefault()
}
},
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 0d893a51..c72d5e4d 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -3282,7 +3282,7 @@ follow-redirects@^1.0.0:
for-in@^1.0.2:
version "1.0.2"
- resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
+ resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
forever-agent@~0.6.1:
version "0.6.1"
@@ -4000,7 +4000,7 @@ is-extendable@^0.1.0, is-extendable@^0.1.1:
is-extendable@^1.0.1:
version "1.0.1"
- resolved "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4"
+ resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4"
dependencies:
is-plain-object "^2.0.4"
@@ -4062,7 +4062,7 @@ is-plain-obj@^1.0.0:
is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4:
version "2.0.4"
- resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677"
+ resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677"
dependencies:
isobject "^3.0.1"
@@ -4134,7 +4134,7 @@ isobject@^2.0.0:
isobject@^3.0.0, isobject@^3.0.1:
version "3.0.1"
- resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
+ resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df"
isstream@~0.1.2:
version "0.1.2"
@@ -4774,8 +4774,8 @@ mississippi@^3.0.0:
through2 "^2.0.0"
mixin-deep@^1.2.0:
- version "1.3.1"
- resolved "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe"
+ version "1.3.2"
+ resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566"
dependencies:
for-in "^1.0.2"
is-extendable "^1.0.1"
diff --git a/package.json b/package.json
index 77460640..0d052c63 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "yank.note.yang",
- "version": "2.0.0-beta8.3",
+ "version": "2.0.0-beta8.4",
"description": "Yank-Note",
"main": "dist/app.js",
"license": "Apache-2.0",