Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
风云海OL
Awesome-Markdown-Editor
提交
8c56ab19
Awesome-Markdown-Editor
项目概览
风云海OL
/
Awesome-Markdown-Editor
与 Fork 源项目一致
Fork自
gitcode_dev / Awesome-Markdown-Editor
通知
1
Star
1
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,体验更适合开发者的 AI 搜索 >>
提交
8c56ab19
编写于
8月 05, 2021
作者:
璃白.
🌻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:修复打包报错问题
上级
2c7b2f8c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
69 addition
and
23 deletion
+69
-23
src/App.vue
src/App.vue
+2
-0
src/assets/js/utils.js
src/assets/js/utils.js
+20
-5
src/assets/style/variable.less
src/assets/style/variable.less
+1
-0
src/components/content/components/user-select.vue
src/components/content/components/user-select.vue
+15
-4
src/components/content/md-textarea.vue
src/components/content/md-textarea.vue
+5
-3
src/components/content/mixins/select-user-mixins.js
src/components/content/mixins/select-user-mixins.js
+26
-11
未找到文件。
src/App.vue
浏览文件 @
8c56ab19
...
...
@@ -324,6 +324,8 @@ export default {
}
if
(
this
.
callUserList
.
length
)
{
emitContent
.
callUserList
=
this
.
callUserList
;
}
else
{
emitContent
.
callUserList
=
[];
}
emitContent
.
filteredTags
=
this
.
filteredTags
;
...
...
src/assets/js/utils.js
浏览文件 @
8c56ab19
...
...
@@ -76,7 +76,8 @@ export function initStyle({
contentBgColor
,
codeBgColor
,
codeTheme
,
helpdocColor
helpdocColor
,
itemActiveBgColor
})
{
// 夜晚模式
if
(
dark
)
{
...
...
@@ -89,6 +90,7 @@ export function initStyle({
codeBgColor
=
"
#777888
"
;
contentBgColor
=
"
#222226
"
;
helpdocColor
=
"
#CCCCD8
"
;
itemActiveBgColor
=
"
#777888
"
;
}
if
(
frameBgColor
)
{
document
.
documentElement
.
style
.
setProperty
(
...
...
@@ -96,6 +98,12 @@ export function initStyle({
frameBgColor
);
}
if
(
itemActiveBgColor
)
{
document
.
documentElement
.
style
.
setProperty
(
"
--md-editor-item-active-bg-color
"
,
itemActiveBgColor
);
}
if
(
contentBgColor
)
{
document
.
documentElement
.
style
.
setProperty
(
"
--md-editor-content-bg-color
"
,
...
...
@@ -143,19 +151,19 @@ export function initStyle({
if
(
codeTheme
)
{
switch
(
codeTheme
)
{
case
"
dark
"
:
import
(
"
@/assets/style/code/dark.
c
ss
"
);
import
(
"
@/assets/style/code/dark.
le
ss
"
);
break
;
case
"
light
"
:
import
(
"
@/assets/style/code/lightfair.
c
ss
"
);
import
(
"
@/assets/style/code/lightfair.
le
ss
"
);
break
;
case
"
atom-one-dark
"
:
import
(
"
@/assets/style/code/atom-one-dark.
c
ss
"
);
import
(
"
@/assets/style/code/atom-one-dark.
le
ss
"
);
break
;
default
:
break
;
}
}
else
{
import
(
"
@/assets/style/code/lightfair.
c
ss
"
);
import
(
"
@/assets/style/code/lightfair.
le
ss
"
);
}
}
...
...
@@ -183,6 +191,13 @@ export function checkBoswer() {
);
return
agent
!==
null
;
}
export
function
isAndroid
()
{
const
agent
=
navigator
.
userAgent
.
match
(
/
(
Android
)
/i
);
return
agent
!==
null
;
}
// 去除头部空格行
export
function
removeBlankLine
(
val
)
{
if
(
!
val
)
return
""
;
...
...
src/assets/style/variable.less
浏览文件 @
8c56ab19
...
...
@@ -7,6 +7,7 @@
--md-editor-content-bg-color: #fff;
--md-editor-frame-bg-color-disabled: #f5f7fa;
--md-editor-content-bg-color-disabled: #f5f7fa;
--md-editor-item-active-bg-color: #f5f7fa;
--md-editor-helpdoc-color: #666666;
--md-editor-code-bg-color: #f3f4f5;
--md-editor-fullScrren-zIndex: 2000;
...
...
src/components/content/components/user-select.vue
浏览文件 @
8c56ab19
...
...
@@ -25,6 +25,7 @@
</div>
</
template
>
<
script
>
import
{
throttle
as
throttleFn
}
from
"
@/assets/js/utils
"
;
export
default
{
props
:
{
position
:
{
...
...
@@ -48,6 +49,8 @@ export default {
computed
:
{
list
()
{
const
list
=
this
.
userList
;
console
.
log
(
"
list
"
,
list
);
if
(
!
list
.
length
)
return
[];
return
list
.
map
((
item
,
index
)
=>
{
if
(
index
===
0
)
{
...
...
@@ -57,6 +60,9 @@ export default {
}
return
item
;
});
},
throttle
()
{
return
throttleFn
();
}
},
watch
:
{
...
...
@@ -76,7 +82,12 @@ export default {
},
methods
:
{
selectUser
(
user
)
{
this
.
$emit
(
"
selectUser
"
,
user
);
console
.
log
(
this
.
throttle
);
this
.
throttle
(()
=>
{
console
.
log
(
111
);
this
.
$emit
(
"
selectUser
"
,
user
);
},
1000
);
},
isActive
(
index
)
{
return
index
===
this
.
activeUserIndex
;
...
...
@@ -90,7 +101,7 @@ export default {
<
style
lang=
"less"
scoped
>
.md_select_container {
position: absolute;
background:
#fff
;
background:
var(--md-editor-content-bg-color)
;
box-shadow: 0 1px 6px rgb(0 0 0 / 10%);
border: 1px solid var(--md-editor-border-color);
border-radius: 4px;
...
...
@@ -139,11 +150,11 @@ export default {
cursor: pointer;
@media (any-hover: hover) {
&:hover {
background:
#f5f7fa
;
background:
var(--md-editor-item-active-bg-color)
;
}
}
&.active {
background:
#f5f7fa
;
background:
var(--md-editor-item-active-bg-color)
;
}
// & + li {
// margin-top: 10px;
...
...
src/components/content/md-textarea.vue
浏览文件 @
8c56ab19
...
...
@@ -5,6 +5,8 @@
:id=
"id"
@
change=
"$emit('update:text', textContent)"
@
input=
"input"
@
keydown.stop.50=
"handleCallUser"
@
keydown.stop.229=
"handleCallUser"
@
focus=
"setFocus(true)"
@
blur=
"setFocus(false)"
@
paste=
"pasteFile"
...
...
@@ -53,7 +55,7 @@
import
{
getSelectionInfo
,
getPosition
,
preventDefault
,
isAndroid
,
throttle
as
throttleFn
}
from
"
@/assets/js/utils
"
;
import
selectUser
from
"
./components/user-select
"
;
...
...
@@ -288,8 +290,8 @@ export default {
};
},
input
(
e
)
{
if
(
e
.
data
===
"
@
"
)
{
this
.
createSelectUserDialog
();
if
(
isAndroid
()
&&
e
.
data
===
"
@
"
)
{
this
.
createSelectUserDialog
(
"
android
"
);
}
if
(
this
.
showSelectUser
)
this
.
handleQueryUser
(
e
);
this
.
$emit
(
"
update:textLength
"
,
this
.
textContent
.
length
);
...
...
src/components/content/mixins/select-user-mixins.js
浏览文件 @
8c56ab19
...
...
@@ -5,6 +5,21 @@ export default {
allUserList
:
[]
};
},
mounted
()
{
setTimeout
(()
=>
{
const
text
=
this
.
text
;
if
(
/
(\@\S
+
\s{0,1})
/g
.
test
(
text
))
{
this
.
$emit
(
"
queryUserList
"
,
""
);
this
.
$nextTick
(()
=>
{
const
userList
=
this
.
userList
;
this
.
allUserList
=
userList
;
this
.
$nextTick
(()
=>
{
this
.
transferMarkdown
(
text
);
});
});
}
},
0
);
},
methods
:
{
handleSelectUser
(
user
)
{
const
originalText
=
this
.
textContent
;
...
...
@@ -42,16 +57,12 @@ export default {
this
.
queryInfo
.
keyWord
=
keyWord
;
this
.
$emit
(
"
queryUserList
"
,
keyWord
);
},
// handleCallUser(e) {
// // console.log('aaa');
// // console.log(e);
// // alert(e.key)
// if (e.key === "@" || (e.key === "Process" && e.code === "Digit2")) {
// this.createSelectUserDialog();
// }
// },
createSelectUserDialog
()
{
handleCallUser
(
e
)
{
if
(
e
.
key
===
"
@
"
||
(
e
.
key
===
"
Process
"
&&
e
.
code
===
"
Digit2
"
))
{
this
.
createSelectUserDialog
();
}
},
createSelectUserDialog
(
type
)
{
const
textEl
=
document
.
getElementById
(
this
.
id
);
if
(
!
textEl
)
return
;
const
height
=
getComputedStyle
(
textEl
).
getPropertyValue
(
"
height
"
);
...
...
@@ -95,6 +106,10 @@ export default {
textEl
.
parentNode
.
removeChild
(
hideEl
);
this
.
queryInfo
.
startPosition
=
getPosition
(
this
.
id
)
+
1
;
this
.
queryInfo
.
endPosition
=
getPosition
(
this
.
id
)
+
1
;
if
(
type
===
"
android
"
)
{
this
.
queryInfo
.
startPosition
--
;
this
.
queryInfo
.
endPosition
--
;
}
this
.
$emit
(
"
queryUserList
"
,
this
.
queryInfo
.
keyWord
);
this
.
$nextTick
(()
=>
{
const
userList
=
this
.
userList
;
...
...
@@ -116,7 +131,7 @@ export default {
getUserByName
(
name
)
{
const
userList
=
this
.
allUserList
;
if
(
!
userList
.
length
)
return
""
;
return
userList
.
find
(
(
item
)
=>
item
.
nickname
===
name
);
return
userList
.
find
(
item
=>
item
.
nickname
===
name
);
}
}
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录