Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_76812819
Awesome-Markdown-Editor
提交
f03e7082
Awesome-Markdown-Editor
项目概览
2301_76812819
/
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,发现更多精彩内容 >>
提交
f03e7082
编写于
9月 03, 2021
作者:
璃白.
🌻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:添加链接缓存
上级
be6ea1c0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
11 deletion
+33
-11
src/App.vue
src/App.vue
+30
-7
src/assets/js/utils.js
src/assets/js/utils.js
+1
-1
src/components/content/components/link-type-select.vue
src/components/content/components/link-type-select.vue
+1
-1
src/components/content/mixins/select-link-type-mixins.js
src/components/content/mixins/select-link-type-mixins.js
+1
-2
未找到文件。
src/App.vue
浏览文件 @
f03e7082
...
...
@@ -306,6 +306,7 @@ export default {
textLength
:
""
,
userList
:
false
,
callUserList
:
[],
linkList
:
[],
selectionInfo
:
{
selectorId
:
""
,
selectionStart
:
""
,
...
...
@@ -452,13 +453,34 @@ export default {
});
},
renderLinksHtml
({
vDom
,
links
})
{
const
_this
=
this
;
console
.
log
(
links
);
// 缓存里没有的链接,就发送请求获取信息
const
emitList
=
links
.
filter
(
item
=>
!
this
.
linkList
.
find
(
link
=>
link
&&
link
.
url
===
item
.
url
)
);
console
.
log
(
"
emit
"
,
emitList
);
this
.
$emit
(
"
renderLinks
"
,
{
links
,
callback
:
function
(
list
)
{
list
.
forEach
(
item
=>
{
links
:
emitList
,
callback
:
list
=>
{
// 用原始数组做循环
links
.
forEach
(
item
=>
{
const
linkItem
=
this
.
linkList
.
find
(
link
=>
link
&&
link
.
url
===
item
.
url
);
// 如果
if
(
!
linkItem
)
{
const
returnLink
=
list
.
find
(
link
=>
link
&&
link
.
url
===
item
.
url
);
if
(
!
returnLink
)
return
;
item
.
title
=
returnLink
.
title
;
item
.
description
=
returnLink
.
description
;
item
.
icon
=
returnLink
.
icon
;
this
.
linkList
.
push
(
returnLink
);
}
else
{
item
.
title
=
linkItem
.
title
;
item
.
description
=
linkItem
.
description
;
item
.
icon
=
linkItem
.
icon
;
}
// item.csdn = true;
const
linkEl
=
vDom
.
querySelector
(
"
#
"
+
item
.
id
);
if
(
!
linkEl
)
return
;
...
...
@@ -472,7 +494,8 @@ export default {
const
title
=
getLinkTitle
(
linkEl
,
item
);
linkEl
.
innerHTML
=
renderLinkCard
(
title
,
item
);
});
_this
.
html
=
vDom
.
innerHTML
;
this
.
html
=
vDom
.
innerHTML
;
}
});
}
...
...
src/assets/js/utils.js
浏览文件 @
f03e7082
...
...
@@ -395,7 +395,7 @@ export function renderLinkCard(title, item) {
let
content
;
switch
(
linkType
)
{
case
"
1
"
:
content
=
`<span class="md_link_url">
${
item
.
title
}
</span>`
;
content
=
`<span class="md_link_url">
${
title
||
item
.
title
||
""
}
</span>`
;
break
;
case
"
2
"
:
content
=
`<span class="md_link_url">
${
item
.
url
}
</span>`
;
...
...
src/components/content/components/link-type-select.vue
浏览文件 @
f03e7082
...
...
@@ -43,7 +43,7 @@ export default {
position
:
{
immediate
:
true
,
handler
:
function
({
left
,
top
})
{
this
.
left
=
left
+
12
;
this
.
left
=
left
;
this
.
top
=
top
+
40
;
}
}
...
...
src/components/content/mixins/select-link-type-mixins.js
浏览文件 @
f03e7082
...
...
@@ -2,7 +2,6 @@ import { getPosition, formatText, linkTypeSpiltStr } from "@/assets/js/utils";
export
default
{
methods
:
{
handleSelectLinkType
(
index
)
{
console
.
log
(
index
);
const
originalText
=
this
.
textContent
;
const
queryInfo
=
this
.
queryInfo
;
const
cursorPosition
=
getPosition
(
this
.
id
);
...
...
@@ -71,7 +70,7 @@ export default {
left
:
pEl
.
offsetLeft
<
frameWidth
*
(
2
/
3
)
?
pEl
.
offsetLeft
:
pEl
.
offsetLeft
-
1
4
0
,
:
pEl
.
offsetLeft
-
1
2
0
,
top
:
pEl
.
offsetTop
-
textEl
.
scrollTop
};
textEl
.
parentNode
.
removeChild
(
hideEl
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录