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
Nikola Balog
erp5
Commits
117e8487
Commit
117e8487
authored
Jun 01, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monaco_editor: re-format with new prettier
parent
8c53dfaf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
26 deletions
+31
-26
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
+31
-26
No files found.
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
View file @
117e8487
/*jslint nomen: true, indent: 2 */
/*global window, rJS, monaco, JSLINT */
(
function
(
window
,
rJS
,
monaco
)
{
(
function
(
window
,
rJS
,
monaco
)
{
'
use strict
'
;
// globals
...
...
@@ -10,16 +10,16 @@
rJS
(
window
)
.
declareAcquiredMethod
(
'
notifySubmit
'
,
'
notifySubmit
'
)
.
declareJob
(
'
deferNotifySubmit
'
,
function
()
{
.
declareJob
(
'
deferNotifySubmit
'
,
function
()
{
// Ensure error will be correctly handled
return
this
.
notifySubmit
();
})
.
declareAcquiredMethod
(
'
notifyChange
'
,
'
notifyChange
'
)
.
declareJob
(
'
deferNotifyChange
'
,
function
()
{
.
declareJob
(
'
deferNotifyChange
'
,
function
()
{
// Ensure error will be correctly handled
return
this
.
notifyChange
();
})
.
ready
(
function
(
context
)
{
.
ready
(
function
(
context
)
{
let
editor
;
function
deferNotifyChange
()
{
if
(
!
context
.
state
.
ignoredChangeDuringInitialization
)
{
...
...
@@ -32,7 +32,7 @@
/* because Alt+Click is LeftClick on ChromeOS */
multiCursorModifier
:
'
ctrlCmd
'
,
automaticLayout
:
true
,
autoIndent
:
true
autoIndent
:
true
,
}
);
editor
.
addAction
({
...
...
@@ -43,12 +43,12 @@
keybindingContext
:
null
,
contextMenuGroupId
:
'
navigation
'
,
contextMenuOrder
:
1.5
,
run
:
context
.
deferNotifySubmit
.
bind
(
context
)
run
:
context
.
deferNotifySubmit
.
bind
(
context
)
,
});
editor
.
getModel
().
updateOptions
({
tabSize
:
2
,
insertSpaces
:
true
insertSpaces
:
true
,
});
editor
.
getModel
().
onDidChangeContent
(
deferNotifyChange
);
})
...
...
@@ -56,7 +56,9 @@
.
declareJob
(
'
runJsLint
'
,
function
()
{
var
context
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
delay
(
500
);
})
.
push
(
function
()
{
return
RSVP
.
delay
(
500
);
})
.
push
(
function
()
{
if
(
context
.
state
.
model_language
===
'
javascript
'
)
{
JSLINT
(
context
.
editor
.
getValue
(),
{});
...
...
@@ -65,24 +67,27 @@
'
jslint
'
,
JSLINT
.
data
()
.
errors
.
filter
(
Boolean
)
.
map
(
err
=>
({
.
map
(
(
err
)
=>
({
startLineNumber
:
err
.
line
,
startColumn
:
err
.
character
,
message
:
err
.
reason
,
severity
:
monaco
.
MarkerSeverity
.
Error
,
source
:
'
jslint
'
source
:
'
jslint
'
,
}))
);
}
});
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
model_language
,
state_dict
=
{
key
:
options
.
key
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
,
};
if
(
options
.
portal_type
===
'
Web Page
'
||
options
.
content_type
==
'
text/html
'
)
{
if
(
options
.
portal_type
===
'
Web Page
'
||
options
.
content_type
==
'
text/html
'
)
{
model_language
=
'
html
'
;
}
else
if
(
options
.
portal_type
===
'
Web Script
'
)
{
model_language
=
'
javascript
'
;
...
...
@@ -105,7 +110,7 @@
return
this
.
changeState
(
state_dict
);
})
.
onStateChange
(
function
(
modification_dict
)
{
.
onStateChange
(
function
(
modification_dict
)
{
var
queue
=
new
RSVP
.
Queue
();
if
(
modification_dict
.
hasOwnProperty
(
'
value
'
))
{
// Do not notify the UI when initializing the value
...
...
@@ -135,16 +140,16 @@
plugins
:
[
prettierPlugins
.
babel
],
// see http://json.schemastore.org/prettierrc for supported options.
singleQuote
:
true
,
tabWidth
:
2
tabWidth
:
2
,
});
return
[
{
range
:
model
.
getFullModelRange
(),
text
}
text
,
}
,
];
}
}
,
}
);
...
...
@@ -155,7 +160,7 @@
// lint with typescript compiler
monaco
.
languages
.
typescript
.
javascriptDefaults
.
setDiagnosticsOptions
({
noSemanticValidation
:
false
,
noSyntaxValidation
:
false
noSyntaxValidation
:
false
,
});
monaco
.
languages
.
typescript
.
javascriptDefaults
.
setCompilerOptions
({
...
...
@@ -163,17 +168,17 @@
allowNonTsExtensions
:
true
,
checkJs
:
true
,
allowJs
:
true
,
module
:
monaco
.
languages
.
typescript
.
ModuleKind
.
UMD
module
:
monaco
.
languages
.
typescript
.
ModuleKind
.
UMD
,
});
// Type mapping for Nexedi libraries
const
addExtraLibrary
=
function
(
script_name
,
lib_name
)
{
const
addExtraLibrary
=
function
(
script_name
,
lib_name
)
{
return
()
=>
{
return
fetch
(
script_name
)
.
then
(
function
(
resp
)
{
.
then
(
function
(
resp
)
{
return
resp
.
text
();
})
.
then
(
function
(
script_code
)
{
.
then
(
function
(
script_code
)
{
monaco
.
languages
.
typescript
.
javascriptDefaults
.
addExtraLib
(
script_code
,
lib_name
...
...
@@ -186,14 +191,14 @@
.
push
(
addExtraLibrary
(
'
./monaco-renderjs.d.ts
'
,
'
renderjs
'
))
.
push
(
addExtraLibrary
(
'
./monaco-jio.d.ts
'
,
'
jio
'
));
}
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
)){
this
.
editor
.
updateOptions
({
readOnly
:
!
this
.
state
.
editable
});
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
this
.
editor
.
updateOptions
({
readOnly
:
!
this
.
state
.
editable
});
}
}
return
queue
;
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
var
form_data
=
{};
if
(
this
.
state
.
editable
)
{
form_data
[
this
.
state
.
key
]
=
this
.
editor
.
getValue
();
...
...
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