Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
Project
Project
Details
Activity
Releases
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
viitto
pptist
Commits
e391c61e
Commit
e391c61e
authored
Feb 26, 2024
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增文本框双击事件,双击选中当前文本
parent
3a65d394
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
ProsemirrorEditor.vue
src/views/components/element/ProsemirrorEditor.vue
+2
-1
index.vue
src/views/components/element/TextElement/index.vue
+9
-2
No files found.
src/views/components/element/ProsemirrorEditor.vue
View file @
e391c61e
...
...
@@ -95,7 +95,8 @@ watch(() => props.editable, () => {
// 暴露 focus 方法
const
focus
=
()
=>
editorView
.
focus
()
defineExpose
({
focus
})
const
selectAll
=
()
=>
autoSelectAll
(
editorView
)
defineExpose
({
focus
,
selectAll
})
// 执行富文本命令(可以是一个或多个)
// 部分命令在执行前先判断当前选区是否为空,如果选区为空先进行全选操作
...
...
src/views/components/element/TextElement/index.vue
View file @
e391c61e
...
...
@@ -52,11 +52,12 @@
}"
@update="value => updateContent(value)"
@mousedown="$event => handleSelectElement($event, false)"
ref="editorRef"
/>
<!-- 当字号过大且行高较小时,会出现文字高度溢出的情况,导致拖拽区域无法被选中,因此添加了以下节点避免该情况 -->
<div
class=
"drag-handler top"
></div>
<div
class=
"drag-handler bottom"
></div>
<div
class=
"drag-handler top"
@
dblclick=
"setEditorHandler"
></div>
<div
class=
"drag-handler bottom"
@
dblclick=
"setEditorHandler"
></div>
</div>
</div>
</div>
...
...
@@ -88,6 +89,7 @@ const { handleElementId, isScaling } = storeToRefs(mainStore)
const
{
addHistorySnapshot
}
=
useHistorySnapshot
()
const
elementRef
=
ref
<
HTMLElement
>
()
const
editorRef
=
ref
()
const
shadow
=
computed
(()
=>
props
.
elementInfo
.
shadow
)
const
{
shadowStyle
}
=
useElementShadow
(
shadow
)
...
...
@@ -170,6 +172,11 @@ const updateContent = (content: string) => {
addHistorySnapshot
()
}
const
setEditorHandler
=
()
=>
{
editorRef
.
value
?.
focus
()
editorRef
.
value
?.
selectAll
()
}
const
checkEmptyText
=
debounce
(
function
()
{
const
pureText
=
props
.
elementInfo
.
content
.
replaceAll
(
/<
[^
>
]
+>/g
,
''
)
if
(
!
pureText
)
slidesStore
.
deleteElement
(
props
.
elementInfo
.
id
)
...
...
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