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
Leo Le Bouter
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 */
/*jslint nomen: true, indent: 2 */
/*global window, rJS, monaco, JSLINT */
/*global window, rJS, monaco, JSLINT */
(
function
(
window
,
rJS
,
monaco
)
{
(
function
(
window
,
rJS
,
monaco
)
{
'
use strict
'
;
'
use strict
'
;
// globals
// globals
...
@@ -10,16 +10,16 @@
...
@@ -10,16 +10,16 @@
rJS
(
window
)
rJS
(
window
)
.
declareAcquiredMethod
(
'
notifySubmit
'
,
'
notifySubmit
'
)
.
declareAcquiredMethod
(
'
notifySubmit
'
,
'
notifySubmit
'
)
.
declareJob
(
'
deferNotifySubmit
'
,
function
()
{
.
declareJob
(
'
deferNotifySubmit
'
,
function
()
{
// Ensure error will be correctly handled
// Ensure error will be correctly handled
return
this
.
notifySubmit
();
return
this
.
notifySubmit
();
})
})
.
declareAcquiredMethod
(
'
notifyChange
'
,
'
notifyChange
'
)
.
declareAcquiredMethod
(
'
notifyChange
'
,
'
notifyChange
'
)
.
declareJob
(
'
deferNotifyChange
'
,
function
()
{
.
declareJob
(
'
deferNotifyChange
'
,
function
()
{
// Ensure error will be correctly handled
// Ensure error will be correctly handled
return
this
.
notifyChange
();
return
this
.
notifyChange
();
})
})
.
ready
(
function
(
context
)
{
.
ready
(
function
(
context
)
{
let
editor
;
let
editor
;
function
deferNotifyChange
()
{
function
deferNotifyChange
()
{
if
(
!
context
.
state
.
ignoredChangeDuringInitialization
)
{
if
(
!
context
.
state
.
ignoredChangeDuringInitialization
)
{
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
/* because Alt+Click is LeftClick on ChromeOS */
/* because Alt+Click is LeftClick on ChromeOS */
multiCursorModifier
:
'
ctrlCmd
'
,
multiCursorModifier
:
'
ctrlCmd
'
,
automaticLayout
:
true
,
automaticLayout
:
true
,
autoIndent
:
true
autoIndent
:
true
,
}
}
);
);
editor
.
addAction
({
editor
.
addAction
({
...
@@ -43,12 +43,12 @@
...
@@ -43,12 +43,12 @@
keybindingContext
:
null
,
keybindingContext
:
null
,
contextMenuGroupId
:
'
navigation
'
,
contextMenuGroupId
:
'
navigation
'
,
contextMenuOrder
:
1.5
,
contextMenuOrder
:
1.5
,
run
:
context
.
deferNotifySubmit
.
bind
(
context
)
run
:
context
.
deferNotifySubmit
.
bind
(
context
)
,
});
});
editor
.
getModel
().
updateOptions
({
editor
.
getModel
().
updateOptions
({
tabSize
:
2
,
tabSize
:
2
,
insertSpaces
:
true
insertSpaces
:
true
,
});
});
editor
.
getModel
().
onDidChangeContent
(
deferNotifyChange
);
editor
.
getModel
().
onDidChangeContent
(
deferNotifyChange
);
})
})
...
@@ -56,7 +56,9 @@
...
@@ -56,7 +56,9 @@
.
declareJob
(
'
runJsLint
'
,
function
()
{
.
declareJob
(
'
runJsLint
'
,
function
()
{
var
context
=
this
;
var
context
=
this
;
return
new
RSVP
.
Queue
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
delay
(
500
);
})
.
push
(
function
()
{
return
RSVP
.
delay
(
500
);
})
.
push
(
function
()
{
.
push
(
function
()
{
if
(
context
.
state
.
model_language
===
'
javascript
'
)
{
if
(
context
.
state
.
model_language
===
'
javascript
'
)
{
JSLINT
(
context
.
editor
.
getValue
(),
{});
JSLINT
(
context
.
editor
.
getValue
(),
{});
...
@@ -65,24 +67,27 @@
...
@@ -65,24 +67,27 @@
'
jslint
'
,
'
jslint
'
,
JSLINT
.
data
()
JSLINT
.
data
()
.
errors
.
filter
(
Boolean
)
.
errors
.
filter
(
Boolean
)
.
map
(
err
=>
({
.
map
(
(
err
)
=>
({
startLineNumber
:
err
.
line
,
startLineNumber
:
err
.
line
,
startColumn
:
err
.
character
,
startColumn
:
err
.
character
,
message
:
err
.
reason
,
message
:
err
.
reason
,
severity
:
monaco
.
MarkerSeverity
.
Error
,
severity
:
monaco
.
MarkerSeverity
.
Error
,
source
:
'
jslint
'
source
:
'
jslint
'
,
}))
}))
);
);
}
}
});
});
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
model_language
,
var
model_language
,
state_dict
=
{
state_dict
=
{
key
:
options
.
key
,
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
'
;
model_language
=
'
html
'
;
}
else
if
(
options
.
portal_type
===
'
Web Script
'
)
{
}
else
if
(
options
.
portal_type
===
'
Web Script
'
)
{
model_language
=
'
javascript
'
;
model_language
=
'
javascript
'
;
...
@@ -105,7 +110,7 @@
...
@@ -105,7 +110,7 @@
return
this
.
changeState
(
state_dict
);
return
this
.
changeState
(
state_dict
);
})
})
.
onStateChange
(
function
(
modification_dict
)
{
.
onStateChange
(
function
(
modification_dict
)
{
var
queue
=
new
RSVP
.
Queue
();
var
queue
=
new
RSVP
.
Queue
();
if
(
modification_dict
.
hasOwnProperty
(
'
value
'
))
{
if
(
modification_dict
.
hasOwnProperty
(
'
value
'
))
{
// Do not notify the UI when initializing the value
// Do not notify the UI when initializing the value
...
@@ -135,16 +140,16 @@
...
@@ -135,16 +140,16 @@
plugins
:
[
prettierPlugins
.
babel
],
plugins
:
[
prettierPlugins
.
babel
],
// see http://json.schemastore.org/prettierrc for supported options.
// see http://json.schemastore.org/prettierrc for supported options.
singleQuote
:
true
,
singleQuote
:
true
,
tabWidth
:
2
tabWidth
:
2
,
});
});
return
[
return
[
{
{
range
:
model
.
getFullModelRange
(),
range
:
model
.
getFullModelRange
(),
text
text
,
}
}
,
];
];
}
}
,
}
}
);
);
...
@@ -155,7 +160,7 @@
...
@@ -155,7 +160,7 @@
// lint with typescript compiler
// lint with typescript compiler
monaco
.
languages
.
typescript
.
javascriptDefaults
.
setDiagnosticsOptions
({
monaco
.
languages
.
typescript
.
javascriptDefaults
.
setDiagnosticsOptions
({
noSemanticValidation
:
false
,
noSemanticValidation
:
false
,
noSyntaxValidation
:
false
noSyntaxValidation
:
false
,
});
});
monaco
.
languages
.
typescript
.
javascriptDefaults
.
setCompilerOptions
({
monaco
.
languages
.
typescript
.
javascriptDefaults
.
setCompilerOptions
({
...
@@ -163,17 +168,17 @@
...
@@ -163,17 +168,17 @@
allowNonTsExtensions
:
true
,
allowNonTsExtensions
:
true
,
checkJs
:
true
,
checkJs
:
true
,
allowJs
:
true
,
allowJs
:
true
,
module
:
monaco
.
languages
.
typescript
.
ModuleKind
.
UMD
module
:
monaco
.
languages
.
typescript
.
ModuleKind
.
UMD
,
});
});
// Type mapping for Nexedi libraries
// Type mapping for Nexedi libraries
const
addExtraLibrary
=
function
(
script_name
,
lib_name
)
{
const
addExtraLibrary
=
function
(
script_name
,
lib_name
)
{
return
()
=>
{
return
()
=>
{
return
fetch
(
script_name
)
return
fetch
(
script_name
)
.
then
(
function
(
resp
)
{
.
then
(
function
(
resp
)
{
return
resp
.
text
();
return
resp
.
text
();
})
})
.
then
(
function
(
script_code
)
{
.
then
(
function
(
script_code
)
{
monaco
.
languages
.
typescript
.
javascriptDefaults
.
addExtraLib
(
monaco
.
languages
.
typescript
.
javascriptDefaults
.
addExtraLib
(
script_code
,
script_code
,
lib_name
lib_name
...
@@ -186,14 +191,14 @@
...
@@ -186,14 +191,14 @@
.
push
(
addExtraLibrary
(
'
./monaco-renderjs.d.ts
'
,
'
renderjs
'
))
.
push
(
addExtraLibrary
(
'
./monaco-renderjs.d.ts
'
,
'
renderjs
'
))
.
push
(
addExtraLibrary
(
'
./monaco-jio.d.ts
'
,
'
jio
'
));
.
push
(
addExtraLibrary
(
'
./monaco-jio.d.ts
'
,
'
jio
'
));
}
}
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
)){
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
this
.
editor
.
updateOptions
({
readOnly
:
!
this
.
state
.
editable
});
this
.
editor
.
updateOptions
({
readOnly
:
!
this
.
state
.
editable
});
}
}
}
}
return
queue
;
return
queue
;
})
})
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
var
form_data
=
{};
var
form_data
=
{};
if
(
this
.
state
.
editable
)
{
if
(
this
.
state
.
editable
)
{
form_data
[
this
.
state
.
key
]
=
this
.
editor
.
getValue
();
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