Commit 06eb9e4c authored by Boris Kocherov's avatar Boris Kocherov

erp5_officejs: enable tasty features in codemirror

parent 8360833f
......@@ -238,7 +238,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>956.9824.23798.17493</string> </value>
<value> <string>956.25809.26818.60245</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1482489673.45</float>
<float>1485527180.58</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -8,9 +8,12 @@
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<link rel="stylesheet" href="codemirror/lib/codemirror.css">
<link rel="stylesheet" href="codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" href="codemirror/addon/search/matchesonscrollbar.css">
<link rel="stylesheet" type= "text/css" href="codemirror/lib/codemirror.css">
<link rel="stylesheet" type= "text/css" href="codemirror/addon/dialog/dialog.css">
<link rel="stylesheet" type= "text/css" href="codemirror/addon/search/matchesonscrollbar.css">
<link rel="stylesheet" type= "text/css" href="codemirror/addon/fold/foldgutter.css">
<link rel="stylesheet" type= "text/css" href="codemirror/addon/merge/merge.css">
<link rel="stylesheet" type= "text/css" href="codemirror/addon/lint/lint.css">
<script src="codemirror/lib/codemirror.js"></script>
<script src="codemirror/mode/css/css.js"></script>
......@@ -20,10 +23,38 @@
<script src="codemirror/addon/dialog/dialog.js"></script>
<script src="codemirror/addon/search/searchcursor.js"></script>
<script src="codemirror/addon/search/search.js"></script>
<script src="codemirror/addon/comment/comment.js"></script>
<script src="codemirror/addon/comment/continuecomment.js"></script>
<script src="codemirror/addon/scroll/annotatescrollbar.js"></script>
<script src="codemirror/addon/search/matchesonscrollbar.js"></script>
<script src="gadget_code_mirror_editor.js" type="text/javascript"></script>
<script src="codemirror/addon/cm_edit/matchbrackets.js"></script>
<!-- Trailing spaces -->
<script src="codemirror/addon/cm_edit/trailingspace.js"></script>
<style type="text/css">
.cm-trailingspace {
background-color: gray;
}
</style>
<!-- Code folding -->
<script src="codemirror/addon/fold/foldcode.js"></script>
<script src="codemirror/addon/fold/foldgutter.js"></script>
<script src="codemirror/addon/fold/indent-fold.js"></script>
<script src="codemirror/addon/fold/comment-fold.js"></script>
<!-- Merge -->
<script src="diff_match_patch/javascript/diff_match_patch_uncompressed.js"></script>
<script src="codemirror/addon/merge/merge.js"></script>
<!-- Linter -->
<script src="codemirror/addon/lint/lint.js"></script>
<script src="jshint.js"></script>
<script src="codemirror/addon/lint/javascript-lint.js"></script>
</head>
<body>
<div class="codemirror_gadget"><textarea name="code"></textarea></div>
......
......@@ -73,14 +73,30 @@
<key> <string>default_reference</string> </key>
<value> <string>gadget_code_mirror_editor.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>codemirror_gadget_code_mirror_editor_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>revision</string> </key>
<value> <string>27</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Code Mirror Editor Gadget</string> </value>
......@@ -218,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.55456.978.40106</string> </value>
<value> <string>956.63666.51974.1638</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -236,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1481295361.6</float>
<float>1485722098.08</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -36,10 +36,38 @@
g.props.editor = CodeMirror.fromTextArea(g.props.element.querySelector("textarea"), {
lineNumbers: true,
mode: "text/html",
styleActiveLine: true,
showTrailingSpace: true,
mode: "text/html",
matchBrackets: true,
tabSize: 2,
indentWithTabs: false,
showCursorWhenSelecting: true,
extraKeys: {"Alt-F": "findPersistent"}
continueComments: true,
foldGutter: true,
lineWrapping: true,
gutters: ["CodeMirror-lint-markers",
"CodeMirror-linenumbers",
"CodeMirror-foldgutter"],
lint: true,
extraKeys: {
"Ctrl-Space": "autocomplete",
"Alt-Space": "autocomplete",
"Ctrl-Q": function (cm) {cm.foldCode(cm.getCursor()); },
"Tab": function (cm) {
// We want to insert spaces, not tab, and we also want to keep the behaviour of indenting selection.
if (cm.getSelection()) {
return cm.execCommand("defaultTab");
}
var spaces = new Array(cm.getOption("indentUnit") + 1).join(" ");
cm.replaceSelection(spaces);
},
"Ctrl-I": "indentAuto",
"Shift-Tab": "indentLess",
'Alt-F': 'findPersistent',
'Cmd-/': 'toggleComment',
'Ctrl-/': 'toggleComment'
}
});
// XXX custom styling for CribJS, should be put somewhere else-
g.props.element.querySelector('.CodeMirror').setAttribute('style', 'min-height: 800px;');
......
......@@ -93,6 +93,10 @@
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>revision</string> </key>
<value> <string>31</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Code Mirror Editor Gadget JS</string> </value>
......@@ -230,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>955.55531.65356.52462</string> </value>
<value> <string>956.63666.53306.36966</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1481330224.45</float>
<float>1485722100.13</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment