Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
verona-modules-aspect
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IQB
verona-modules-aspect
Commits
b3e870b5
Commit
b3e870b5
authored
2 years ago
by
rhenck
Browse files
Options
Downloads
Patches
Plain Diff
Fix radio-button-group sanitization
Transform string array to Textlabel array. #338
parent
c18fb2ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/common/services/sanitization.service.ts
+19
-3
19 additions, 3 deletions
projects/common/services/sanitization.service.ts
with
19 additions
and
3 deletions
projects/common/services/sanitization.service.ts
+
19
−
3
View file @
b3e870b5
...
@@ -8,7 +8,7 @@ import { Unit } from 'common/models/unit';
...
@@ -8,7 +8,7 @@ import { Unit } from 'common/models/unit';
import
{
import
{
BasicStyles
,
DragNDropValueObject
,
ExtendedStyles
,
BasicStyles
,
DragNDropValueObject
,
ExtendedStyles
,
InputElement
,
PlayerProperties
,
InputElement
,
PlayerProperties
,
PositionedUIElement
,
PositionProperties
,
TextImageLabel
,
PositionedUIElement
,
PositionProperties
,
TextImageLabel
,
TextLabel
,
UIElement
,
UIElementValue
UIElement
,
UIElementValue
}
from
'
common/models/elements/element
'
;
}
from
'
common/models/elements/element
'
;
import
{
LikertElement
}
from
'
common/models/elements/compound-elements/likert/likert
'
;
import
{
LikertElement
}
from
'
common/models/elements/compound-elements/likert/likert
'
;
...
@@ -27,6 +27,7 @@ import { Section } from 'common/models/section';
...
@@ -27,6 +27,7 @@ import { Section } from 'common/models/section';
import
{
IDManager
}
from
'
common/util/id-manager
'
;
import
{
IDManager
}
from
'
common/util/id-manager
'
;
import
{
RadioButtonGroupComplexElement
}
from
'
common/models/elements/input-elements/radio-button-group-complex
'
;
import
{
RadioButtonGroupComplexElement
}
from
'
common/models/elements/input-elements/radio-button-group-complex
'
;
import
packageJSON
from
'
../../../package.json
'
;
import
packageJSON
from
'
../../../package.json
'
;
import
{
RadioButtonGroupElement
}
from
'
common/models/elements/input-elements/radio-button-group
'
;
@
Injectable
({
@
Injectable
({
providedIn
:
'
root
'
providedIn
:
'
root
'
...
@@ -116,6 +117,9 @@ export class SanitizationService {
...
@@ -116,6 +117,9 @@ export class SanitizationService {
.
includes
(
newElement
.
type
as
string
))
{
.
includes
(
newElement
.
type
as
string
))
{
newElement
=
SanitizationService
.
handlePlusOne
(
newElement
as
InputElement
);
newElement
=
SanitizationService
.
handlePlusOne
(
newElement
as
InputElement
);
}
}
if
([
'
radio
'
].
includes
(
newElement
.
type
as
string
))
{
newElement
=
SanitizationService
.
handleRadioGroup
(
newElement
as
RadioButtonGroupElement
);
}
if
([
'
radio-group-images
'
].
includes
(
newElement
.
type
as
string
))
{
if
([
'
radio-group-images
'
].
includes
(
newElement
.
type
as
string
))
{
newElement
=
SanitizationService
.
fixImageLabel
(
newElement
as
RadioButtonGroupComplexElement
);
newElement
=
SanitizationService
.
fixImageLabel
(
newElement
as
RadioButtonGroupComplexElement
);
}
}
...
@@ -419,7 +423,7 @@ export class SanitizationService {
...
@@ -419,7 +423,7 @@ export class SanitizationService {
return
element
as
ToggleButtonElement
;
return
element
as
ToggleButtonElement
;
}
}
private
static
fixImageLabel
(
element
:
Partial
<
RadioButtonGroupComplexElement
>
)
{
private
static
fixImageLabel
(
element
:
Partial
<
RadioButtonGroupComplexElement
>
)
:
RadioButtonGroupComplexElement
{
return
{
return
{
...
element
,
...
element
,
options
:
element
.
options
?
options
:
element
.
options
?
...
@@ -428,6 +432,18 @@ export class SanitizationService {
...
@@ -428,6 +432,18 @@ export class SanitizationService {
.
map
((
column
:
TextImageLabel
)
=>
({
.
map
((
column
:
TextImageLabel
)
=>
({
...
column
,
imgPosition
:
column
.
imgPosition
||
(
column
as
any
).
position
||
'
above
'
...
column
,
imgPosition
:
column
.
imgPosition
||
(
column
as
any
).
position
||
'
above
'
}))
}))
};
}
as
RadioButtonGroupComplexElement
;
}
private
static
handleRadioGroup
(
element
:
Partial
<
RadioButtonGroupElement
>
):
RadioButtonGroupElement
{
return
{
...
element
,
options
:
element
.
options
?
element
.
options
:
(
element
.
richTextOptions
as
string
[])
.
map
((
option
:
string
)
=>
({
text
:
option
}))
}
as
RadioButtonGroupElement
;
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment