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
Binh
erp5
Commits
704fac1c
Commit
704fac1c
authored
Sep 08, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monaco_editor: RenderJS gadget version
parent
0c768086
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
196 additions
and
0 deletions
+196
-0
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html
...l_skins/erp5_monaco_editor/monaco-editor.gadget.html.html
+27
-0
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.xml
...al_skins/erp5_monaco_editor/monaco-editor.gadget.html.xml
+32
-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
+105
-0
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.xml
...rtal_skins/erp5_monaco_editor/monaco-editor.gadget.js.xml
+32
-0
No files found.
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.html
0 → 100644
View file @
704fac1c
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Monaco Editor
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script>
/*
This is understood by our build of monaco-editor
https://lab.nexedi.com/jerome/monaco-editor-erp5/blob/master/public-path.js
*/
window
.
monacoEditorWebPackResourceBaseUrl
=
"
monaco-editor/
"
;
</script>
<script
src=
"monaco-editor/app.bundle.min.js"
></script>
<script
src=
"monaco-editor.gadget.js"
></script>
</head>
<body>
<div
class=
"monaco-container"
style=
"width:100%;height:800px;border:1px solid grey;"
></div>
</body>
</html>
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.html.xml
0 → 100644
View file @
704fac1c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
monaco-editor.gadget.html
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.js
0 → 100644
View file @
704fac1c
/*jslint nomen: true, indent: 2 */
/*global window, rJS, monaco*/
(
function
(
window
,
rJS
,
monaco
)
{
'
use strict
'
;
rJS
(
window
)
.
declareAcquiredMethod
(
'
notifySubmit
'
,
'
notifySubmit
'
)
.
declareJob
(
'
deferNotifySubmit
'
,
function
()
{
// Ensure error will be correctly handled
return
this
.
notifySubmit
();
})
.
declareAcquiredMethod
(
'
notifyChange
'
,
'
notifyChange
'
)
.
declareJob
(
'
deferNotifyChange
'
,
function
()
{
// Ensure error will be correctly handled
return
this
.
notifyChange
();
})
.
ready
(
function
()
{
var
context
=
this
,
editor
;
function
deferNotifyChange
()
{
if
(
!
context
.
state
.
ignoredChangeDuringInitialization
)
{
return
context
.
deferNotifyChange
();
}
}
this
.
editor
=
editor
=
monaco
.
editor
.
create
(
this
.
element
.
querySelector
(
'
.monaco-container
'
),
{
/* because Alt+Click is LeftClick on ChromeOS */
multiCursorModifier
:
'
ctrlCmd
'
,
automaticLayout
:
true
,
autoIndent
:
true
}
);
editor
.
addAction
({
id
:
'
save
'
,
label
:
'
Save
'
,
keybindings
:
[
monaco
.
KeyMod
.
CtrlCmd
|
monaco
.
KeyCode
.
KEY_S
],
precondition
:
null
,
keybindingContext
:
null
,
contextMenuGroupId
:
'
navigation
'
,
contextMenuOrder
:
1.5
,
run
:
context
.
deferNotifySubmit
.
bind
(
context
)
});
editor
.
getModel
().
updateOptions
({
tabSize
:
2
,
insertSpaces
:
true
});
editor
.
getModel
().
onDidChangeContent
(
deferNotifyChange
);
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
model_language
,
state_dict
=
{
key
:
options
.
key
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
};
if
(
options
.
portal_type
===
'
Web Page
'
)
{
model_language
=
'
html
'
;
}
else
if
(
options
.
portal_type
===
'
Web Script
'
)
{
model_language
=
'
javascript
'
;
}
else
if
(
options
.
portal_type
===
'
Web Style
'
)
{
model_language
=
'
css
'
;
}
else
if
(
options
.
portal_type
===
'
Python Script
'
)
{
model_language
=
'
python
'
;
}
state_dict
.
model_language
=
model_language
;
state_dict
.
value
=
options
.
value
||
''
;
return
this
.
changeState
(
state_dict
);
})
.
onStateChange
(
function
(
modification_dict
)
{
if
(
modification_dict
.
hasOwnProperty
(
'
value
'
))
{
// Do not notify the UI when initializing the value
this
.
state
.
ignoredChangeDuringInitialization
=
true
;
this
.
editor
.
setValue
(
this
.
state
.
value
);
this
.
state
.
ignoredChangeDuringInitialization
=
false
;
}
if
(
modification_dict
.
hasOwnProperty
(
'
model_language
'
))
{
monaco
.
editor
.
setModelLanguage
(
this
.
editor
.
getModel
(),
this
.
state
.
model_language
);
if
(
this
.
state
.
model_language
===
'
html
'
)
{
// XXX why do we need this while it set on model already ? is it bug in monaco ?
monaco
.
languages
.
html
.
htmlDefaults
.
options
.
format
.
tabSize
=
2
;
monaco
.
languages
.
html
.
htmlDefaults
.
options
.
format
.
insertSpaces
=
true
;
}
}
})
.
declareMethod
(
'
getContent
'
,
function
()
{
var
form_data
=
{};
if
(
this
.
state
.
editable
)
{
form_data
[
this
.
state
.
key
]
=
this
.
editor
.
getValue
();
// Change the value state in place
// This will prevent the gadget to be changed if
// its parent call render with the same value
// (as ERP5 does in case of formulator error)
this
.
state
.
value
=
form_data
[
this
.
state
.
key
];
}
return
form_data
;
});
})(
window
,
rJS
,
monaco
);
bt5/erp5_monaco_editor/SkinTemplateItem/portal_skins/erp5_monaco_editor/monaco-editor.gadget.js.xml
0 → 100644
View file @
704fac1c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
monaco-editor.gadget.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/javascript
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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