Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
cf865453
Commit
cf865453
authored
May 30, 2025
by
tyyin lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(首页富文本): 写作模式热键开启&模板复制样式丢失
parent
cfbdd1fb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
19 deletions
+29
-19
template-input-prompt.ts
...ents/rich-text-input-box/formats/template-input-prompt.ts
+10
-10
index.vue
src/views/home/components/rich-text-input-box/index.vue
+19
-0
quill-opstions.ts
...ews/home/components/rich-text-input-box/quill-opstions.ts
+0
-9
No files found.
src/views/home/components/rich-text-input-box/formats/template-input-prompt.ts
View file @
cf865453
...
...
@@ -9,12 +9,14 @@ class TemplateInputPromptBlot extends Embed {
static
create
(
config
:
{
placeholder
:
string
;
index
:
string
})
{
const
root
=
super
.
create
()
as
HTMLElement
root
.
dataset
.
placeholder
=
`
${
config
.
placeholder
}
`
root
.
dataset
.
index
=
`
${
config
.
index
}
`
root
.
classList
.
add
(
`prompt-index-
${
config
.
index
}
`
)
// root.classList.add('prompt-blank', 'relative')
const
outerEl
=
document
.
createElement
(
'span'
)
outerEl
.
dataset
.
placeholder
=
`[
${
config
.
placeholder
}
]`
// outerEl.classList.add('prompt-blank', 'relative', 'inline-block', 'min-w-fit')
outerEl
.
classList
.
add
(
'relative'
,
...
...
@@ -25,10 +27,7 @@ class TemplateInputPromptBlot extends Embed {
'mx-[2px]'
,
'rounded-[4px]'
,
)
outerEl
.
style
.
backgroundColor
=
'rgba(0,87,255,0.06)'
// outerEl.style.color = '#b5caff'
outerEl
.
style
.
color
=
'#9ea3ff'
outerEl
.
style
.
lineHeight
=
'24px'
outerEl
.
style
.
cssText
=
'background-color: rgba(0,87,255,0.06); color: #b5caff; line-height: 24px;'
const
placeholderEl
=
document
.
createElement
(
'span'
)
placeholderEl
.
textContent
=
`[
${
config
.
placeholder
}
]`
...
...
@@ -51,11 +50,12 @@ class TemplateInputPromptBlot extends Embed {
'break-all'
,
// 'outline-none',
)
inputContainerEl
.
style
.
left
=
'0'
inputContainerEl
.
style
.
right
=
'0'
inputContainerEl
.
style
.
color
=
'#000dff'
inputContainerEl
.
style
.
outlineStyle
=
'none'
inputContainerEl
.
style
.
cssText
=
`
left: 0;
right: 0;
color: #000dff;
outline-style: none;
`
inputContainerEl
.
textContent
=
''
...
...
src/views/home/components/rich-text-input-box/index.vue
View file @
cf865453
...
...
@@ -118,8 +118,27 @@ watchEffect(() => {
quillInst
.
value
.
on
(
'composition-end'
,
()
=>
{
if
(
quillInst
.
value
)
{
quillInst
.
value
.
root
.
dataset
.
placeholder
=
quillInst
.
value
.
options
.
placeholder
const
text
=
quillInst
.
value
.
getText
().
trim
()
if
(
text
===
'@'
)
{
quillInst
.
value
.
deleteText
(
0
,
text
.
length
+
1
)
showSceneList
.
value
=
true
quillInst
.
value
.
blur
()
}
}
})
quillInst
.
value
.
clipboard
.
addMatcher
(
'span.template-input-prompt-container'
,
(
node
)
=>
{
const
spanEl
=
node
as
HTMLSpanElement
return
new
Delta
().
insert
({
'template-input-prompt'
:
{
placeholder
:
spanEl
.
dataset
.
placeholder
,
index
:
spanEl
.
dataset
.
index
,
},
})
})
}
})
...
...
src/views/home/components/rich-text-input-box/quill-opstions.ts
View file @
cf865453
...
...
@@ -23,15 +23,6 @@ export function getQuillOptions(config: ConfigInterface): QuillOptions {
}
},
},
process
:
{
key
:
'Process'
,
shiftKey
:
true
,
handler
:
function
(
range
:
any
,
context
:
any
)
{
if
(
config
.
keyboardCallback
.
at
)
{
config
.
keyboardCallback
.
at
((
this
as
any
).
quill
as
Quill
,
range
,
context
)
}
},
},
'@'
:
{
key
:
'@'
,
shiftKey
:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment