Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
npm
/
glsx-components
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit dfd6837a
authored
Aug 17, 2022
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
67da8cc3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
30 deletions
src/packages/Editor/src/tag-textarea.vue
src/packages/Editor/src/tag-textarea.vue
View file @
dfd6837
...
...
@@ -151,8 +151,8 @@ export default {
// IE < 9
document
.
selection
.
createRange
().
pasteHTML
(
html
)
}
this
.
currentText
=
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
this
.
$emit
(
'updateText'
,
this
.
currentText
)
const
htm
=
document
.
querySelector
(
'.w-textarea_input'
).
innerHTML
this
.
subText
(
htm
)
},
addTag
(
text
)
{
// 创建模版标签
...
...
@@ -246,6 +246,21 @@ export default {
},
100
)
}
},
subText
(
htm
)
{
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
.
replace
(
/<img src="https:
\/\/
img01.glsx.com.cn
\/
weapp
\/
resource
\/
saas
\/
scrm
\/
emoji
\/
/g
,
''
)
.
replace
(
/<wise.+
?(?:
<
\/
wise>
)
/g
,
'@昵称'
)
.
replace
(
/<br>/g
,
'\n'
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
})
let
Textnode
=
document
.
createElement
(
'div'
)
Textnode
.
innerHTML
=
replaceImg
this
.
currentText
=
replaceImg
.
substring
(
0
,
600
)
this
.
$emit
(
'updateText'
,
this
.
currentText
)
},
insertNodeFirst
(
node
)
{
this
.
savedRange
.
deleteContents
()
// 插入链接
...
...
@@ -263,20 +278,7 @@ export default {
this
.
updateData
(
target
.
innerHTML
)
}
let
htm
=
target
.
innerHTML
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
.
replace
(
/<img src="https:
\/\/
img01.glsx.com.cn
\/
weapp
\/
resource
\/
saas
\/
scrm
\/
emoji
\/
/g
,
''
)
.
replace
(
/<wise.+
?(?:
<
\/
wise>
)
/g
,
'@昵称'
)
.
replace
(
/<br>/g
,
'\n'
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
})
let
Textnode
=
document
.
createElement
(
'div'
)
Textnode
.
innerHTML
=
replaceImg
this
.
currentText
=
replaceImg
.
substring
(
0
,
600
)
console
.
log
(
this
.
currentText
)
this
.
$emit
(
'updateText'
,
this
.
currentText
)
this
.
subText
(
htm
)
},
placeCaretAtEnd
(
el
)
{
//传入光标要去的jq节点对象
...
...
@@ -299,20 +301,7 @@ export default {
// 即时更新数据
this
.
updateData
(
target
.
innerHTML
)
let
htm
=
target
.
innerHTML
console
.
log
(
htm
)
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
htm
.
replace
(
/<img src="https:
\/\/
img01.glsx.com.cn
\/
weapp
\/
resource
\/
saas
\/
scrm
\/
emoji
\/
/g
,
''
)
.
replace
(
/<wise.+
?(?:
<
\/
wise>
)
/g
,
'@昵称'
)
.
replace
(
/<br>/g
,
'\n'
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
})
let
Textnode
=
document
.
createElement
(
'div'
)
Textnode
.
innerHTML
=
replaceImg
this
.
currentText
=
Textnode
.
innerText
.
substring
(
0
,
600
)
this
.
$emit
(
'updateText'
,
this
.
currentText
)
this
.
subText
(
htm
)
},
handleDelete
(
e
)
{
// 监听“删除”事件
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment