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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
4a67d957
Commit
4a67d957
authored
Aug 03, 2021
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monaco_editor: support editing JSON with an optional json schema
parent
64bb960d
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 @
4a67d957
...
...
@@ -110,6 +110,9 @@
options
.
portal_type
===
'
Module Component
'
)
{
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
.
value
=
options
.
value
||
''
;
...
...
@@ -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
'
))
{
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