Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_38536878
Awesome-Markdown-Editor
提交
96e5d5c2
Awesome-Markdown-Editor
项目概览
qq_38536878
/
Awesome-Markdown-Editor
与 Fork 源项目一致
Fork自
gitcode_dev / Awesome-Markdown-Editor
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Awesome-Markdown-Editor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
96e5d5c2
编写于
8月 23, 2021
作者:
璃白.
🌻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:修复link
上级
340cfd4b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
49 addition
and
26 deletion
+49
-26
src/App.vue
src/App.vue
+1
-1
src/assets/js/utils.js
src/assets/js/utils.js
+16
-2
src/assets/style/markdown.less
src/assets/style/markdown.less
+3
-1
src/components/content/mixins/render-mixins.js
src/components/content/mixins/render-mixins.js
+7
-9
src/components/header/components/tool-button.vue
src/components/header/components/tool-button.vue
+12
-4
src/components/header/components/video-select.vue
src/components/header/components/video-select.vue
+3
-2
src/components/header/md-header.vue
src/components/header/md-header.vue
+7
-7
未找到文件。
src/App.vue
浏览文件 @
96e5d5c2
...
...
@@ -245,7 +245,7 @@ export default {
const
newText
=
formatText
(
originalText
,
selectionInfo
,
"
\n
![video](
"
,
"
![video](
"
,
`
${
url
}
'
${
name
}
')\n`
);
_this
.
text
=
newText
;
...
...
src/assets/js/utils.js
浏览文件 @
96e5d5c2
...
...
@@ -385,12 +385,26 @@ export function getLinkTitle(linkEl, item) {
const
originTitle
=
linkEl
.
innerText
;
const
titleEl
=
Array
.
from
(
linkEl
.
getElementsByClassName
(
"
md_link_title
"
));
if
(
titleEl
.
length
)
return
item
.
title
||
titleEl
[
0
].
innerText
;
return
/^http/
.
test
(
originTitle
)
?
""
:
originTitle
;
return
/^
(
http|www
)
/
.
test
(
originTitle
)
?
""
:
originTitle
;
}
export
function
removeLinkHeadAndEnd
(
link
)
{
if
(
!
link
)
return
""
;
return
link
.
replace
(
/^https
?
:
\/\/
/
,
""
).
replace
(
/
\/
$/
,
""
);
}
export
function
renderLinkCard
(
title
,
item
)
{
console
.
log
(
item
.
title
);
console
.
log
(
item
.
url
);
return
`
<span class="md_link_title">
${
title
||
item
.
title
||
""
}
</span>
${
removeLinkHeadAndEnd
(
item
.
title
)
===
removeLinkHeadAndEnd
(
item
.
url
)
?
""
:
`
<span class="md_link_title">
${
title
||
item
.
title
||
""
}
</span>
`
}
${
`<span class="md_link_desc" style="
${
item
.
description
?
""
:
"
margin: 0px 0 2px
"
}
">
${
item
.
description
||
""
}
</span>`
}
...
...
src/assets/style/markdown.less
浏览文件 @
96e5d5c2
...
...
@@ -10,7 +10,9 @@
.md_preview {
font-family: -apple-system, SF UI Text, Arial, PingFang SC, Hiragino Sans GB,
Microsoft YaHei, WenQuanYi Micro Hei, sans-serif, SimHei, SimSun;
video {
display: block;
}
img {
max-width: 100%;
height: auto;
...
...
src/components/content/mixins/render-mixins.js
浏览文件 @
96e5d5c2
...
...
@@ -72,15 +72,13 @@ export default {
</div>
</div>`
;
}
// if (text === "video") {
// return `<video
// class="video-js"
// controls
// preload="auto"
// data-setup='{}'>
// <source src="${href}" type="video/mp4"></source>
// </video>`;
// }
if
(
text
===
"
video
"
)
{
return
`<video
class="video-js"
controls
src="
${
href
}
"
/>`
;
}
// ![img](...)渲染图片
let
out
=
'
<img src="
'
+
href
+
'
" alt="
'
+
text
+
'
"
'
;
if
(
title
)
{
...
...
src/components/header/components/tool-button.vue
浏览文件 @
96e5d5c2
...
...
@@ -118,12 +118,20 @@ export default {
// content: this.info.tip,
customComponent
:
videoSelect
,
customClass
:
"
videoSelectDialog
"
,
width
:
80
,
width
:
72
,
customListeners
:
{
select
:
val
=>
{
addVideo
:
val
=>
{
this
.
closeTips
();
const
lang
=
val
.
toLowerCase
().
replace
(
/-/
,
""
);
this
.
handleTool
(
"
code
"
,
"
\n
```
"
+
lang
+
"
\n
"
,
"
\n\n\n
```
"
);
switch
(
val
)
{
case
"
link
"
:
this
.
handleTool
(
"
code
"
,
"
![video](
"
,
"
)
\n
"
);
break
;
case
"
upload
"
:
this
.
$emit
(
"
upload
"
,
"
video
"
);
break
;
default
:
break
;
}
}
},
zIndex
:
parseInt
(
this
.
zIndex
)
+
1
,
...
...
src/components/header/components/video-select.vue
浏览文件 @
96e5d5c2
<
template
>
<div
class=
"video_select_container"
>
<ul>
<li>
上传视频
</li>
<li>
插入视频
</li>
<li
@
click=
"$emit('addVideo', 'upload')"
>
上传视频
</li>
<li
@
click=
"$emit('addVideo', 'link')"
>
插入视频
</li>
</ul>
</div>
</
template
>
...
...
@@ -42,6 +42,7 @@ ul {
cursor: pointer;
height: 24px;
line-height: 24px;
text-align: center;
&:hover {
color: var(--md-editor-border-color-active);
}
...
...
src/components/header/md-header.vue
浏览文件 @
96e5d5c2
...
...
@@ -237,13 +237,13 @@ export default {
startStr
:
""
,
endStr
:
""
},
//
{
//
name: "video",
//
icon: "shipin",
//
tip: "上传视频",
//
startStr: "",
//
endStr: ""
//
},
{
name
:
"
video
"
,
icon
:
"
shipin
"
,
tip
:
"
上传视频
"
,
startStr
:
""
,
endStr
:
""
},
{
name
:
"
task
"
,
icon
:
"
renwu
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录