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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
5ab6ced7
Commit
5ab6ced7
authored
Aug 03, 2021
by
Jérome Perrin
Committed by
Cédric Le Ninivin
Mar 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monaco_editor: support editing JSON with an optional json schema
parent
0fed3d91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
...ortal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
+20
-0
No files found.
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
View file @
5ab6ced7
...
@@ -110,6 +110,9 @@
...
@@ -110,6 +110,9 @@
options
.
portal_type
===
'
Module Component
'
options
.
portal_type
===
'
Module Component
'
)
{
)
{
model_language
=
'
python
'
;
model_language
=
'
python
'
;
}
else
if
(
options
.
content_type
===
'
application/json
'
)
{
model_language
=
'
json
'
;
state_dict
.
json_schema_url
=
options
.
json_schema_url
;
}
}
state_dict
.
model_language
=
model_language
;
state_dict
.
model_language
=
model_language
;
state_dict
.
value
=
options
.
value
||
''
;
state_dict
.
value
=
options
.
value
||
''
;
...
@@ -304,6 +307,23 @@
...
@@ -304,6 +307,23 @@
);
);
}
}
if
(
this
.
state
.
model_language
===
'
json
'
)
{
let
schemas
=
[]
if
(
this
.
state
.
json_schema_url
)
{
schemas
.
push
(
{
uri
:
this
.
state
.
json_schema_url
,
fileMatch
:
"
*
"
}
)
}
monaco
.
languages
.
json
.
jsonDefaults
.
setDiagnosticsOptions
({
validate
:
true
,
allowComments
:
false
,
schemas
:
schemas
,
enableSchemaRequest
:
true
,
});
}
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
this
.
editor
.
updateOptions
({
readOnly
:
!
this
.
state
.
editable
});
this
.
editor
.
updateOptions
({
readOnly
:
!
this
.
state
.
editable
});
}
}
...
...
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