Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
feba703c
Commit
feba703c
authored
Mar 14, 2024
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_editor: make jslint happy
parent
5c252784
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
23 deletions
+27
-23
bt5/erp5_json_editor/SkinTemplateItem/portal_skins/erp5_json_editor/json-editor.gadget.js.js
...em/portal_skins/erp5_json_editor/json-editor.gadget.js.js
+27
-23
No files found.
bt5/erp5_json_editor/SkinTemplateItem/portal_skins/erp5_json_editor/json-editor.gadget.js.js
View file @
feba703c
...
@@ -45,38 +45,42 @@
...
@@ -45,38 +45,42 @@
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
setValue
=
function
(
value
,
initial
)
{
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
setValue
=
function
(
value
,
initial
)
{
/* Sanitize value before setting it */
/* Sanitize value before setting it */
let
sanitized
=
this
.
typecast
(
value
)
var
sanitized
=
this
.
typecast
(
value
),
const
inEnum
=
(
this
.
enum_options
.
length
>
0
&&
this
.
enum_values
.
includes
(
sanitized
))
inEnum
=
(
this
.
enum_options
.
length
>
0
&&
this
.
enum_values
.
includes
(
sanitized
)),
haveToUseDefaultValue
=
(
!!
this
.
jsoneditor
.
options
.
use_default_values
||
this
.
schema
.
default
===
undefined
);
const
haveToUseDefaultValue
=
!!
this
.
jsoneditor
.
options
.
use_default_values
||
typeof
this
.
schema
.
default
!==
'
undefined
'
if
(
!
this
.
hasPlaceholderOption
&&
(
!
inEnum
||
(
initial
&&
!
this
.
isRequired
()
&&
!
haveToUseDefaultValue
)))
{
if
(
!
this
.
hasPlaceholderOption
&&
(
!
inEnum
||
(
initial
&&
!
this
.
isRequired
()
&&
!
haveToUseDefaultValue
)))
{
/* NXD: We forcefuly include the value even */
/* NXD: We forcefuly include the value even */
this
.
theme
.
setSelectOptions
(
this
.
input
,
this
.
enum_options
.
concat
([
value
]),
this
.
enum_display
.
concat
([
value
]),
this
.
hasPlaceholderOption
,
this
.
placeholderOptionText
)
this
.
theme
.
setSelectOptions
(
this
.
input
,
this
.
enum_options
.
concat
([
value
]),
this
.
enum_display
.
concat
([
value
]),
this
.
hasPlaceholderOption
,
this
.
placeholderOptionText
);
}
}
if
(
this
.
value
===
sanitized
)
return
if
(
this
.
value
===
sanitized
)
{
return
;
}
/* NXD: !this.hasPlaceholderOption seems to be a bug on upstream introduces by:
/* NXD: !this.hasPlaceholderOption seems to be a bug on upstream introduces by:
https://github.com/json-editor/json-editor/pull/1499/commits/2f9b1b3a30e64383b92dc4cd7494f55ba089ae66 */
https://github.com/json-editor/json-editor/pull/1499/commits/2f9b1b3a30e64383b92dc4cd7494f55ba089ae66 */
if
(
inEnum
&&
!
this
.
hasPlaceholderOption
)
{
if
(
inEnum
&&
!
this
.
hasPlaceholderOption
)
{
this
.
input
.
value
=
this
.
enum_options
[
this
.
enum_values
.
indexOf
(
sanitized
)]
this
.
input
.
value
=
this
.
enum_options
[
this
.
enum_values
.
indexOf
(
sanitized
)]
;
}
else
if
(
!
inEnum
&&
!
this
.
hasPlaceholderOption
)
{
}
else
if
(
!
inEnum
&&
!
this
.
hasPlaceholderOption
)
{
this
.
input
.
value
=
sanitized
this
.
input
.
value
=
sanitized
;
}
else
{
}
else
{
this
.
input
.
value
=
'
_placeholder_
'
this
.
input
.
value
=
'
_placeholder_
'
;
}
}
this
.
value
=
sanitized
this
.
value
=
sanitized
;
if
(
!
initial
)
{
if
(
!
initial
)
{
this
.
is_dirty
=
true
this
.
is_dirty
=
true
;
}
this
.
onChange
()
this
.
change
()
}
}
this
.
onChange
();
this
.
change
();
};
if
(
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
original_preBuild
===
undefined
)
{
if
(
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
original_preBuild
===
undefined
)
{
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
original_preBuild
=
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
preBuild
;
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
original_preBuild
=
JSONEditor
.
defaults
.
editors
.
select
.
prototype
.
preBuild
;
...
@@ -120,7 +124,7 @@
...
@@ -120,7 +124,7 @@
if
(
this
.
schema
.
type
===
'
boolean
'
&&
(
value
===
'
undefined
'
||
value
===
undefined
))
{
if
(
this
.
schema
.
type
===
'
boolean
'
&&
(
value
===
'
undefined
'
||
value
===
undefined
))
{
return
undefined
;
return
undefined
;
}
}
if
(
this
.
schema
.
type
===
'
boolean
'
&&
(
typeof
value
==
"
boolean
"
))
{
if
(
this
.
schema
.
type
===
'
boolean
'
&&
(
typeof
value
==
=
"
boolean
"
))
{
return
value
;
return
value
;
}
}
if
(
this
.
schema
.
type
===
'
boolean
'
&&
(
value
===
"
true
"
||
value
===
"
1
"
))
{
if
(
this
.
schema
.
type
===
'
boolean
'
&&
(
value
===
"
true
"
||
value
===
"
1
"
))
{
...
@@ -140,7 +144,7 @@
...
@@ -140,7 +144,7 @@
}
}
if
(
this
.
schema
.
type
===
'
integer
'
)
{
if
(
this
.
schema
.
type
===
'
integer
'
)
{
if
(
parseFloat
(
value
))
{
if
(
parseFloat
(
value
))
{
return
Math
.
floor
(
parseFloat
(
value
))
return
Math
.
floor
(
parseFloat
(
value
))
;
}
}
}
}
if
(
this
.
schema
.
enum
&&
value
===
undefined
)
{
if
(
this
.
schema
.
enum
&&
value
===
undefined
)
{
...
@@ -295,8 +299,8 @@
...
@@ -295,8 +299,8 @@
// editor relies on async load function, so we must return the promise
// editor relies on async load function, so we must return the promise
// to finish before continue, otherwise rendering errors wont throw Errors
// to finish before continue, otherwise rendering errors wont throw Errors
// in the same stack as expected.
// in the same stack as expected.
return
editor
.
promise
return
editor
.
promise
;
})
})
;
})
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
var
form_data
=
{};
var
form_data
=
{};
...
...
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