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
da6cff5e
Commit
da6cff5e
authored
Jan 09, 2024
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化行程 model=3
parent
64ba110c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
108 deletions
+2
-108
index.vue
src/views/Editor/Thumbnails/index.vue
+1
-1
BaseTextElement.vue
src/views/components/element/TextElement/BaseTextElement.vue
+1
-107
No files found.
src/views/Editor/Thumbnails/index.vue
View file @
da6cff5e
...
...
@@ -453,7 +453,7 @@ const GetTripTemplate = async () =>{
}
if
(
ConfigId
.
value
==
0
)
return
if
(
TempId
.
value
&&!
searchData
.
value
.
TempId
)
await
GetTripConfig
()
await
GetTripFiledData
()
if
(
model
.
value
!=
3
)
await
GetTripFiledData
()
}
else
{
}
...
...
src/views/components/element/TextElement/BaseTextElement.vue
View file @
da6cff5e
<
template
>
<div
style=
"pointer-events:none;"
class=
"editable-element-text"
:class=
"
{ 'lock': elementInfo.lock }"
:style="{
...
...
@@ -53,121 +54,14 @@
<
script
lang=
"ts"
setup
>
import
{
computed
,
onMounted
,
onUnmounted
,
ref
,
watch
}
from
'vue'
import
{
storeToRefs
}
from
'pinia'
import
{
debounce
}
from
'lodash'
import
{
useMainStore
,
useSlidesStore
}
from
'@/store'
import
type
{
PPTTextElement
}
from
'@/types/slides'
import
type
{
ContextmenuItem
}
from
'@/components/Contextmenu/types'
import
useElementShadow
from
'@/views/components/element/hooks/useElementShadow'
import
useHistorySnapshot
from
'@/hooks/useHistorySnapshot'
import
ElementOutline
from
'@/views/components/element/ElementOutline.vue'
import
ProsemirrorEditor
from
'@/views/components/element/ProsemirrorEditor.vue'
const
props
=
defineProps
<
{
elementInfo
:
PPTTextElement
selectElement
:
(
e
:
MouseEvent
|
TouchEvent
,
element
:
PPTTextElement
,
canMove
?:
boolean
)
=>
void
contextmenus
:
()
=>
ContextmenuItem
[]
|
null
}
>
()
const
mainStore
=
useMainStore
()
const
slidesStore
=
useSlidesStore
()
const
{
handleElementId
,
isScaling
}
=
storeToRefs
(
mainStore
)
const
{
addHistorySnapshot
}
=
useHistorySnapshot
()
const
elementRef
=
ref
<
HTMLElement
>
()
const
shadow
=
computed
(()
=>
props
.
elementInfo
.
shadow
)
const
{
shadowStyle
}
=
useElementShadow
(
shadow
)
const
handleSelectElement
=
(
e
:
MouseEvent
|
TouchEvent
,
canMove
=
true
)
=>
{
if
(
e
.
button
&&
e
.
button
==
1
)
return
if
(
props
.
elementInfo
.
lock
)
return
e
.
stopPropagation
()
props
.
selectElement
(
e
,
props
.
elementInfo
,
canMove
)
}
// 监听文本元素的尺寸变化,当高度变化时,更新高度到vuex
// 如果高度变化时正处在缩放操作中,则等待缩放操作结束后再更新
const
realHeightCache
=
ref
(
-
1
)
const
realWidthCache
=
ref
(
-
1
)
watch
(
isScaling
,
()
=>
{
if
(
handleElementId
.
value
!==
props
.
elementInfo
.
id
)
return
if
(
!
isScaling
.
value
)
{
if
(
!
props
.
elementInfo
.
vertical
&&
realHeightCache
.
value
!==
-
1
)
{
slidesStore
.
updateElement
({
id
:
props
.
elementInfo
.
id
,
props
:
{
height
:
realHeightCache
.
value
},
})
realHeightCache
.
value
=
-
1
}
if
(
props
.
elementInfo
.
vertical
&&
realWidthCache
.
value
!==
-
1
)
{
slidesStore
.
updateElement
({
id
:
props
.
elementInfo
.
id
,
props
:
{
width
:
realWidthCache
.
value
},
})
realWidthCache
.
value
=
-
1
}
}
})
const
updateTextElementHeight
=
(
entries
:
ResizeObserverEntry
[])
=>
{
const
contentRect
=
entries
[
0
].
contentRect
if
(
!
elementRef
.
value
)
return
const
realHeight
=
contentRect
.
height
+
20
const
realWidth
=
contentRect
.
width
+
20
if
(
!
props
.
elementInfo
.
vertical
&&
props
.
elementInfo
.
height
!==
realHeight
)
{
if
(
!
isScaling
.
value
)
{
slidesStore
.
updateElement
({
id
:
props
.
elementInfo
.
id
,
props
:
{
height
:
realHeight
},
})
}
else
realHeightCache
.
value
=
realHeight
}
if
(
props
.
elementInfo
.
vertical
&&
props
.
elementInfo
.
width
!==
realWidth
)
{
if
(
!
isScaling
.
value
)
{
slidesStore
.
updateElement
({
id
:
props
.
elementInfo
.
id
,
props
:
{
width
:
realWidth
},
})
}
else
realWidthCache
.
value
=
realWidth
}
}
const
resizeObserver
=
new
ResizeObserver
(
updateTextElementHeight
)
onMounted
(()
=>
{
if
(
elementRef
.
value
)
resizeObserver
.
observe
(
elementRef
.
value
)
})
onUnmounted
(()
=>
{
if
(
elementRef
.
value
)
resizeObserver
.
unobserve
(
elementRef
.
value
)
})
const
updateContent
=
(
content
:
string
)
=>
{
slidesStore
.
updateElement
({
id
:
props
.
elementInfo
.
id
,
props
:
{
content
},
})
addHistorySnapshot
()
}
const
checkEmptyText
=
debounce
(
function
()
{
const
pureText
=
props
.
elementInfo
.
content
.
replaceAll
(
/<
[^
>
]
+>/g
,
''
)
if
(
!
pureText
)
slidesStore
.
deleteElement
(
props
.
elementInfo
.
id
)
},
300
,
{
trailing
:
true
})
const
isHandleElement
=
computed
(()
=>
handleElementId
.
value
===
props
.
elementInfo
.
id
)
watch
(
isHandleElement
,
()
=>
{
if
(
!
isHandleElement
.
value
)
checkEmptyText
()
})
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
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