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
57b380a1
Commit
57b380a1
authored
Jun 04, 2024
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决文字消失的问题
parent
58870d58
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
2 deletions
+80
-2
htmlutil.ts
src/utils/htmlutil.ts
+53
-0
text.ts
src/utils/psdParser/text.ts
+3
-1
index.vue
src/views/Editor/Thumbnails/index.vue
+24
-1
No files found.
src/utils/htmlutil.ts
0 → 100644
View file @
57b380a1
export
default
class
HtmlUtil
{
// 1.用浏览器内部转换器实现html编码
static
htmlEncode
=
(
html
:
string
)
=>
{
// 创建一个元素容器
var
tempDiv
=
document
.
createElement
(
'div'
);
// 把需要编码的字符串赋值给该元素的innerText(ie支持)或者textContent(火狐、谷歌等)
(
tempDiv
.
textContent
!=
undefined
)
?
(
tempDiv
.
textContent
=
html
)
:
(
tempDiv
.
innerText
=
html
);
var
output
=
tempDiv
.
innerHTML
;
tempDiv
.
remove
();
return
output
;
}
// 2.用浏览器内部转换器实现html解码
static
htmlDecode
=
(
text
:
string
)
=>
{
// 创建一个元素容器
var
tempDiv
=
document
.
createElement
(
'div'
);
// 把解码字符串赋值给元素innerHTML
tempDiv
.
innerHTML
=
text
;
// 最后返回这个元素的innerText(ie支持)或者textContent(火狐、谷歌等支持)
var
output
=
tempDiv
.
innerText
||
tempDiv
.
textContent
;
tempDiv
.
remove
;
return
output
;
}
// 3.使用正则实现html编码
static
htmlEncodeByRegExp
=
(
str
:
string
)
=>
{
var
s
=
''
;
if
(
str
.
length
===
0
)
{
return
''
;
}
s
=
str
.
replace
(
/&/g
,
'&'
);
s
=
s
.
replace
(
/</g
,
'<'
);
s
=
s
.
replace
(
/>/g
,
'>'
);
s
=
s
.
replace
(
/ /g
,
' '
);
s
=
s
.
replace
(
/
\'
/g
,
'''
);
s
=
s
.
replace
(
/
\"
/g
,
'"'
);
return
s
;
}
// 4.使用正则实现html解码
static
htmlDecodeByRegExp
=
(
str
:
string
)
=>
{
var
s
=
''
;
if
(
str
.
length
===
0
)
{
return
''
;
}
s
=
str
.
replace
(
/&/g
,
'&'
);
s
=
s
.
replace
(
/</g
,
'<'
);
s
=
s
.
replace
(
/>/g
,
'>'
);
s
=
s
.
replace
(
/ /g
,
' '
);
s
=
s
.
replace
(
/'/g
,
'
\'
'
);
s
=
s
.
replace
(
/"/g
,
'
\
"'
);
return
s
;
}
}
\ No newline at end of file
src/utils/psdParser/text.ts
View file @
57b380a1
import
{
PPTElementShadow
,
PPTTextElement
}
from
'@/types/slides'
;
import
{
PPTElementShadow
,
PPTTextElement
}
from
'@/types/slides'
;
import
HtmlUtil
from
'../htmlutil'
;
export
const
ResolveText
=
(
item
:
any
,
index
:
number
,
offsetLeft
:
number
,
offsetTop
:
number
,
groupId
:
string
=
''
):
PPTTextElement
=>
{
export
const
ResolveText
=
(
item
:
any
,
index
:
number
,
offsetLeft
:
number
,
offsetTop
:
number
,
groupId
:
string
=
''
):
PPTTextElement
=>
{
...
@@ -69,7 +70,8 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
...
@@ -69,7 +70,8 @@ export const ResolveText = (item: any, index: number,offsetLeft:number,offsetTop
if
(
objectEFFFects
&&
objectEFFFects
.
data
?.
FrFX
?.
enab
){
if
(
objectEFFFects
&&
objectEFFFects
.
data
?.
FrFX
?.
enab
){
stroke
=
getStrokeHandler
(
objectEFFFects
)
stroke
=
getStrokeHandler
(
objectEFFFects
)
}
}
let
content
=
`<p><span style="
${
style
}
">
${
value
}
</span></p>`
let
content
=
`<p><span style="
${
style
}
">
${
HtmlUtil
.
htmlEncodeByRegExp
(
value
)}
</span></p>`
const
isVertical
=
item
.
layer
.
adjustments
.
typeTool
.
obj
.
textData
.
Ornt
.
value
!=
'Hrzn'
const
isVertical
=
item
.
layer
.
adjustments
.
typeTool
.
obj
.
textData
.
Ornt
.
value
!=
'Hrzn'
if
(
isVertical
)
{
if
(
isVertical
)
{
...
...
src/views/Editor/Thumbnails/index.vue
View file @
57b380a1
...
@@ -82,6 +82,7 @@ import { Slide } from '@/types/slides'
...
@@ -82,6 +82,7 @@ import { Slide } from '@/types/slides'
import
{
uniqueId
}
from
'lodash'
import
{
uniqueId
}
from
'lodash'
import
{
useUserStore
}
from
"@/store"
;
import
{
useUserStore
}
from
"@/store"
;
import
themeColor
from
'@/utils/colorExtraction'
;
import
themeColor
from
'@/utils/colorExtraction'
;
import
HtmlUtil
from
'@/utils/htmlutil'
const
mainStore
=
useMainStore
()
const
mainStore
=
useMainStore
()
const
slidesStore
=
useSlidesStore
()
const
slidesStore
=
useSlidesStore
()
...
@@ -464,6 +465,17 @@ const GetTripTemplate = async () =>{
...
@@ -464,6 +465,17 @@ const GetTripTemplate = async () =>{
}
}
newSlides
.
push
(
obj
)
newSlides
.
push
(
obj
)
}
else
if
(
SlidesData
.
length
>
0
){
}
else
if
(
SlidesData
.
length
>
0
){
SlidesData
.
forEach
((
x
:
any
)
=>
{
x
.
elements
.
forEach
((
y
:
any
)
=>
{
if
(
y
.
contentStr
&&
y
.
content
.
includes
(
y
.
contentStr
)){
let
temp
=
HtmlUtil
.
htmlEncodeByRegExp
(
y
.
contentStr
)
if
(
temp
!=
y
.
contentStr
)
{
console
.
log
(
'diff'
,
y
.
contentStr
,
temp
)
y
.
content
=
y
.
content
.
replace
(
y
.
contentStr
,
temp
)
}
}
})
})
newSlides
=
SlidesData
newSlides
=
SlidesData
}
}
let
IDs
=
[]
let
IDs
=
[]
...
@@ -699,6 +711,15 @@ const sellGetTripTemplate = async () =>{
...
@@ -699,6 +711,15 @@ const sellGetTripTemplate = async () =>{
let
SlidesData
=
JSON
.
parse
(
dataObj
.
TempData
)
let
SlidesData
=
JSON
.
parse
(
dataObj
.
TempData
)
let
newSlides
=
[]
let
newSlides
=
[]
await
SlidesData
.
forEach
((
x
,
i
)
=>
{
await
SlidesData
.
forEach
((
x
,
i
)
=>
{
x
.
elements
.
forEach
((
y
:
any
)
=>
{
if
(
y
.
contentStr
&&
y
.
content
.
includes
(
y
.
contentStr
)){
let
temp
=
HtmlUtil
.
htmlEncodeByRegExp
(
y
.
contentStr
)
if
(
temp
!=
y
.
contentStr
)
{
console
.
log
(
'diff'
,
y
.
contentStr
,
temp
)
y
.
content
=
y
.
content
.
replace
(
y
.
contentStr
,
temp
)
}
}
})
newSlides
.
push
(
x
)
newSlides
.
push
(
x
)
})
})
slidesStore
.
setSlides
(
newSlides
)
slidesStore
.
setSlides
(
newSlides
)
...
@@ -979,7 +1000,9 @@ if(!query().ViewSlideshow) GetTripTemplate()
...
@@ -979,7 +1000,9 @@ if(!query().ViewSlideshow) GetTripTemplate()
}
}
&
.selected
{
&
.selected
{
.thumbnail
{
.thumbnail
{
outline-color
:
$themeColor
;
// outline-color: $themeColor;
outline-color
:
#0B40FE
;
box-shadow
:
0px
0px
15px
0px
rgba
(
11
,
64
,
254
,
0
.8
);
}
}
}
}
}
}
...
...
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