Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
trust Tomorrow
Awesome-Markdown-Editor
提交
340cfd4b
Awesome-Markdown-Editor
项目概览
trust Tomorrow
/
Awesome-Markdown-Editor
与 Fork 源项目一致
Fork自
gitcode_dev / Awesome-Markdown-Editor
通知
2
Star
1
Fork
1
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
340cfd4b
编写于
8月 20, 2021
作者:
璃白.
🌻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:修复url识别不准确问题
上级
6b2cdc97
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
122 addition
and
50 deletion
+122
-50
dist/.DS_Store
dist/.DS_Store
+0
-0
dist/index.html
dist/index.html
+3
-4
dist/markdown-editor.js
dist/markdown-editor.js
+1
-1
dist/md.zip
dist/md.zip
+0
-0
package.json
package.json
+1
-1
src/App.vue
src/App.vue
+1
-0
src/components/content/mixins/render-mixins.js
src/components/content/mixins/render-mixins.js
+33
-22
src/components/header/components/tool-button.vue
src/components/header/components/tool-button.vue
+27
-1
src/components/header/components/video-select.vue
src/components/header/components/video-select.vue
+50
-0
src/main.js
src/main.js
+6
-21
未找到文件。
dist/.DS_Store
浏览文件 @
340cfd4b
无法预览此类型文件
dist/index.html
浏览文件 @
340cfd4b
...
...
@@ -85,9 +85,9 @@
value
:
"
## edswgdfgdfgdfg
\n
**dfgdfgdfg**
\n
_ergdfgdfg_
\n
> ergergdfg
\n
```
\n
wefgdfsfdgdf
\n
```
\n
- efwefsdfsdf
\n\n\n
sdgfdfgdfgdfg
\n\n\n
edrfgdfgdfg
\n\n\n\n
ergergergergerg
\n
ergergergerg
\n\n\n
edrfgdfgdfg
\n\n\n\n
ergergergergerg
\n
ergergergerg
\n\n\n
edrfgdfgdfg
\n\n\n\n
ergergergergerg
\n
ergergergerg
"
,
value
:
"
![img
](https://img2.baidu.com/it/u=3681880960,455182084&fm=26&fmt=auto&gp=0.jpg)
"
,
"
[link
](https://img2.baidu.com/it/u=3681880960,455182084&fm=26&fmt=auto&gp=0.jpg)
"
,
// value: "当前问题已结题,不再开放新的回答。",
//
value: "(http://www.baidu.com)\n(http://www.baidu.com)",
value
:
"
(http://www.baidu.com)
\n
(http://www.baidu.com)
"
,
disabled
:
false
,
themeOptions
:
{
dark
:
false
,
...
...
@@ -144,12 +144,11 @@
console
.
log
(
res
);
},
onUpload
:
function
(
file
,
type
,
callback
)
{
console
.
log
(
type
);
if
(
type
===
"
video
"
)
{
callback
(
"
http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4
"
);
return
;
}
new
Promise
((
res
,
rej
)
=>
{
setTimeout
(()
=>
{
res
(
file
);
...
...
dist/markdown-editor.js
浏览文件 @
340cfd4b
此差异已折叠。
点击以展开。
dist/md.zip
浏览文件 @
340cfd4b
无法预览此类型文件
package.json
浏览文件 @
340cfd4b
{
"name"
:
"markdown-editor"
,
"description"
:
" A open source markdown editor of csdn codechina team contributed"
,
"version"
:
"0.7.
4
"
,
"version"
:
"0.7.
5
"
,
"publisher"
:
"guoweijia"
,
"scripts"
:
{
"start"
:
"webpack serve --mode=development"
,
...
...
src/App.vue
浏览文件 @
340cfd4b
...
...
@@ -398,6 +398,7 @@ export default {
},
upload
(
e
)
{
this
.
fileList
=
Array
.
from
(
e
.
target
.
files
);
this
.
$refs
.
mdUploadFile
.
value
=
""
;
},
submit
()
{
this
.
$emit
(
"
submit
"
,
{
...
...
src/components/content/mixins/render-mixins.js
浏览文件 @
340cfd4b
...
...
@@ -72,15 +72,15 @@ 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
// preload="auto"
// data-setup='{}'>
// <source src="${href}" type="video/mp4"></source>
// </video>`;
// }
// ![img](...)渲染图片
let
out
=
'
<img src="
'
+
href
+
'
" alt="
'
+
text
+
'
"
'
;
if
(
title
)
{
...
...
@@ -89,22 +89,33 @@ export default {
out
+=
"
/>
"
;
return
out
;
},
//
link(href, title, text) {
//
console.log(href, title, text);
link
(
href
,
title
,
text
)
{
console
.
log
(
href
,
title
,
text
);
// if (href === null) {
// return text;
// }
if
(
href
===
null
)
{
return
text
;
}
let
invalidText
=
""
;
if
(
href
===
text
)
{
const
invalidRule
=
/
[
)】}
\]]
*$/
;
if
(
href
.
match
(
invalidRule
))
{
invalidText
=
href
.
match
(
invalidRule
)[
0
];
href
=
href
.
replace
(
invalidRule
,
""
);
text
=
href
;
}
}
// let out = '<a href="' + href + '"';
// if (title) {
// out += ' title="' + title + '"';
// }
// out += ">" + text + "</a>";
// return out;
// },
let
out
=
'
<a href="
'
+
href
+
'
"
'
;
if
(
title
)
{
out
+=
'
title="
'
+
title
+
'
"
'
;
}
out
+=
"
>
"
+
text
+
"
</a>
"
;
if
(
invalidText
)
{
out
+=
invalidText
;
}
return
out
;
},
text
(
text
)
{
const
newText
=
text
.
replace
(
/
(\@\S
+
\s{0,1})
/g
,
function
(
val
)
{
const
user
=
_this
.
getUserByName
(
val
.
slice
(
1
).
trim
());
return
`<a type="user" download data-user="
${
user
&&
...
...
src/components/header/components/tool-button.vue
浏览文件 @
340cfd4b
...
...
@@ -18,6 +18,14 @@
>
<span
:class=
"['icon iconfont', `icon-$
{info.icon}`]">
</span>
</div>
<div
v-else-if=
"info.name === 'video'"
@
click=
"handleTool(info.name, info.startStr, info.endStr)"
v-tip.bottom=
"videoOptions"
class=
"tool_button"
>
<span
:class=
"['icon iconfont', `icon-$
{info.icon}`]">
</span>
</div>
<div
v-else
v-tip.bottom=
"options"
...
...
@@ -31,10 +39,11 @@
<
script
>
import
{
checkBoswer
}
from
"
@/assets/js/utils
"
;
import
codeSelect
from
"
./code-select
"
;
import
videoSelect
from
"
./video-select
"
;
import
tableSelect
from
"
./table-select
"
;
import
markdownDoc
from
"
./markdown-doc
"
;
export
default
{
components
:
{
codeSelect
,
tableSelect
},
components
:
{
codeSelect
,
tableSelect
,
videoSelect
},
props
:
{
info
:
{
type
:
Object
,
...
...
@@ -104,6 +113,23 @@ export default {
theme
:
this
.
darkMode
?
"
dark
"
:
"
light
"
};
},
videoOptions
()
{
return
{
// content: this.info.tip,
customComponent
:
videoSelect
,
customClass
:
"
videoSelectDialog
"
,
width
:
80
,
customListeners
:
{
select
:
val
=>
{
this
.
closeTips
();
const
lang
=
val
.
toLowerCase
().
replace
(
/-/
,
""
);
this
.
handleTool
(
"
code
"
,
"
\n
```
"
+
lang
+
"
\n
"
,
"
\n\n\n
```
"
);
}
},
zIndex
:
parseInt
(
this
.
zIndex
)
+
1
,
theme
:
this
.
darkMode
?
"
dark
"
:
"
light
"
};
},
tableOptions
()
{
return
{
content
:
this
.
info
.
tip
,
...
...
src/components/header/components/video-select.vue
0 → 100644
浏览文件 @
340cfd4b
<
template
>
<div
class=
"video_select_container"
>
<ul>
<li>
上传视频
</li>
<li>
插入视频
</li>
</ul>
</div>
</
template
>
<
script
>
export
default
{
data
()
{
return
{};
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.video_select_container {
position: relative;
}
ul {
max-height: 142px;
overflow-y: auto;
margin-top: 2px;
margin-bottom: 4px;
padding-top: 4px;
box-sizing: border-box;
scrollbar-color: transparent transparent;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
&::-webkit-scrollbar-thumb {
border-radius: 1em;
background-color: rgba(50, 50, 50, 0.3);
}
&::-webkit-scrollbar-track {
border-radius: 1em;
background-color: rgba(50, 50, 50, 0);
}
li {
cursor: pointer;
height: 24px;
line-height: 24px;
&:hover {
color: var(--md-editor-border-color-active);
}
}
}
</
style
>
src/main.js
浏览文件 @
340cfd4b
...
...
@@ -2,12 +2,7 @@ import Vue from "vue";
import
App
from
"
./App
"
;
import
Vtip
from
"
vtip
"
;
import
"
vtip/lib/index.min.css
"
;
import
{
initStyle
,
setzIndex
,
isNotEmpty
,
getParameterName
}
from
"
@/assets/js/utils
"
;
import
{
initStyle
,
setzIndex
,
isNotEmpty
}
from
"
@/assets/js/utils
"
;
import
"
@/assets/style/global.less
"
;
Vue
.
use
(
Vtip
.
directive
);
...
...
@@ -111,22 +106,12 @@ function initMdEditor(obj) {
onSubmit
(
val
);
},
upload
({
val
,
type
,
callback
})
{
const
params
=
getParameterName
(
onUpload
);
if
(
!
params
.
includes
(
"
type
"
))
{
onUpload
(
val
,
function
(
res
)
{
callback
({
url
:
res
,
file
:
val
});
onUpload
(
val
,
type
,
function
(
res
)
{
callback
({
url
:
res
,
file
:
val
});
}
else
{
onUpload
(
val
,
type
,
function
(
res
)
{
callback
({
url
:
res
,
file
:
val
});
});
}
});
},
renderLinks
({
links
,
callback
})
{
if
(
!
renderLinks
)
return
callback
(
links
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录