Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-pay
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 b79e5d0e
authored
Dec 23, 2021
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改
1 parent
54654b73
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
src/views/customerTransform/components/tag-textarea.vue
src/views/customerTransform/components/tag-textarea.vue
View file @
b79e5d0
...
...
@@ -6,8 +6,8 @@
ref=
"wTextareaContent"
:id=
"contentId"
@
click=
"inputClick($event)"
@
focus=
"
isLocked = true
"
@
blur=
"
isLocked = false
"
@
focus=
"
onFocus
"
@
blur=
"
onBlur
"
@
keydown
.
delete=
"handleDelete($event)"
@
input=
"handleInput($event.target)"
></div>
...
...
@@ -41,6 +41,7 @@ export default {
contentId
:
`content
${
this
.
getGuid
()}
`
,
// 输入的时候锁定,禁止更新innerHTML
isLocked
:
false
,
isInsert
:
false
,
// 记录当前选中tag的ID
currentTagId
:
null
,
// 当前光标位置
...
...
@@ -189,12 +190,34 @@ export default {
node
.
src
=
url
this
.
insertNode
(
node
)
},
onFocus
()
{
this
.
isLocked
=
true
this
.
isInsert
=
true
},
onBlur
()
{
this
.
isLocked
=
false
},
insertNode
(
node
)
{
// 在内容中插入标签
// 删掉选中的内容(如有)
if
(
this
.
savedRange
.
startContainer
)
{
this
.
insertNodeFirst
(
node
)
}
else
{
document
.
querySelector
(
'.w-textarea_input'
).
focus
()
setTimeout
(()
=>
{
this
.
insertNodeFirst
(
node
)
},
100
)
}
},
insertNodeFirst
(
node
)
{
this
.
savedRange
.
deleteContents
()
// 插入链接
this
.
savedRange
.
insertNode
(
node
)
if
(
this
.
isInsert
)
{
this
.
savedRange
.
insertNode
(
node
)
}
else
{
document
.
querySelector
(
'.w-textarea_input'
).
appendChild
(
node
)
}
this
.
isInsert
=
false
// 更新双向绑定数据
let
target
=
this
.
$refs
.
wTextareaContent
if
(
navigator
.
userAgent
.
indexOf
(
'Firefox'
)
>
0
||
navigator
.
userAgent
.
indexOf
(
'QQBrowser'
)
>
0
)
{
...
...
@@ -458,7 +481,6 @@ export default {
let
Textnode
=
document
.
createElement
(
'div'
)
Textnode
.
innerHTML
=
replaceImg
this
.
currentText
=
Textnode
.
innerText
console
.
log
(
this
.
currentText
,
11111111
)
this
.
$emit
(
'updateText'
,
this
.
currentText
)
},
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