Commit a261c388 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_officejs] Reuse code mirror gadget

parent b4e5cb0e
......@@ -105,27 +105,45 @@
<item>
<key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n
# generated on Fri, 09 Jun 2016 11:45:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
# generated on Fri, 13 Oct 2017 16:00:00 +0000\n
CACHE:\n
renderjs.js\n
rsvp.js\n
jiodev.js\n
gadget_officejs_codemirror.js\n
codemirror/lib/codemirror.js\n
codemirror/lib/codemirror.css\n
codemirror/addon/cm_edit/matchbrackets.js\n
codemirror/addon/cm_edit/trailingspace.js\n
codemirror/addon/dialog/dialog.css\n
codemirror/addon/search/matchesonscrollbar.css\n
codemirror/mode/css/css.js\n
codemirror/mode/xml/xml.js\n
codemirror/mode/htmlmixed/htmlmixed.js\n
codemirror/mode/javascript/javascript.js\n
codemirror/addon/dialog/dialog.js\n
codemirror/addon/display/fullscreen.css\n
codemirror/addon/display/fullscreen.js\n
codemirror/addon/display/rulers.js\n
codemirror/addon/search/searchcursor.js\n
codemirror/addon/search/search.js\n
codemirror/addon/scroll/annotatescrollbar.js\n
codemirror/addon/search/matchesonscrollbar.js\n
codemirror/addon/search/jump-to-line.js\n
codemirror/addon/selection/active-line.js\n
codemirror/addon/hint/show-hint.css\n
codemirror/addon/hint/show-hint.js\n
codemirror/addon/hint/anyword-hint.js\n
codemirror/addon/fold/foldgutter.css\n
codemirror/addon/fold/foldcode.js\n
codemirror/addon/fold/foldgutter.js\n
codemirror/addon/fold/indent-fold.js\n
codemirror/addon/fold/comment-fold.js\n
codemirror/addon/merge/merge.css\n
diff_match_patch/javascript/diff_match_patch_uncompressed.js\n
codemirror/addon/merge/merge.js\n
codemirror/addon/lint/lint.css\n
codemirror/addon/lint/lint.js\n
jshint.js\n
codemirror/addon/lint/javascript-lint.js\n
csslint.js\n
codemirror/addon/lint/css-lint.js\n
codemirror/mode/xml/xml.js\n
codemirror/mode/javascript/javascript.js\n
codemirror/mode/css/css.js\n
codemirror/mode/htmlmixed/htmlmixed.js\n
codemirror.gadget.js\n
NETWORK:\n
*</string> </value>
</item>
......@@ -268,7 +286,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>958.44217.46814.8652</string> </value>
<value> <string>962.48895.14326.63948</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -286,7 +304,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1495033658.39</float>
<float>1507908439.82</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -3,29 +3,79 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Codemirror Gadget</title>
<title>Codemirror</title>
<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">
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="codemirror/lib/codemirror.js"></script>
<script src="codemirror/mode/css/css.js"></script>
<script src="codemirror/mode/xml/xml.js"></script>
<script src="codemirror/mode/javascript/javascript.js"></script>
<script src="codemirror/mode/htmlmixed/htmlmixed.js"></script>
<link rel="stylesheet" href="codemirror/lib/codemirror.css" />
<!--script src="codemirror/mode/&dtml-mode;/&dtml-mode;.js"></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;
}
body {
padding: 0;
margin: 0;
}
</style>
<!-- Rulers -->
<script src="codemirror/addon/display/rulers.js"></script>
<!-- Search addons -->
<link rel="stylesheet" href="codemirror/addon/dialog/dialog.css">
<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/scroll/annotatescrollbar.js"></script>
<script src="codemirror/addon/search/matchesonscrollbar.js"></script>
<script src="gadget_officejs_codemirror.js" type="text/javascript"></script>
<script src="codemirror/addon/search/jump-to-line.js"></script>
<script src="codemirror/addon/selection/active-line.js"></script>
<!-- Python autocomplete (Ctrl-Space, see below)
TODO-arnau: Add ERP5 autocompletion?
-->
<link rel="stylesheet" href="codemirror/addon/hint/show-hint.css" />
<script src="codemirror/addon/hint/show-hint.js"></script>
<script src="codemirror/addon/hint/anyword-hint.js"></script>
<!-- Code folding -->
<link rel="stylesheet" href="codemirror/addon/fold/foldgutter.css" />
<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 -->
<link rel="stylesheet" href="codemirror/addon/merge/merge.css" />
<script src="diff_match_patch/javascript/diff_match_patch_uncompressed.js"></script>
<script src="codemirror/addon/merge/merge.js"></script>
<!-- Linter -->
<link rel="stylesheet" href="codemirror/addon/lint/lint.css" />
<script src="codemirror/addon/lint/lint.js"></script>
<script type="text/javascript" src="jshint.js"></script>
<script type="text/javascript" src="codemirror/addon/lint/javascript-lint.js"></script>
<script type="text/javascript" src="csslint.js"></script>
<script type="text/javascript" src="codemirror/addon/lint/css-lint.js"></script>
<script type="text/javascript" src="codemirror/mode/xml/xml.js"></script>
<script type="text/javascript" src="codemirror/mode/javascript/javascript.js"></script>
<script type="text/javascript" src="codemirror/mode/css/css.js"></script>
<script type="text/javascript" src="codemirror/mode/htmlmixed/htmlmixed.js"></script>
<link rel="stylesheet" href="codemirror/addon/display/fullscreen.css" />
<script src="codemirror/addon/display/fullscreen.js"></script>
<script src="codemirror.gadget.js"></script>
</head>
<body>
<div class="codemirror_gadget"><textarea name="code"></textarea></div>
<textarea></textarea>
</body>
</html>
......@@ -274,7 +274,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>957.30669.28687.29849</string> </value>
<value> <string>962.24071.53498.34082</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -292,7 +292,7 @@
</tuple>
<state>
<tuple>
<float>1487777231.91</float>
<float>1507908370.86</float>
<string>UTC</string>
</tuple>
</state>
......
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS, CodeMirror, RSVP */
(function (window, rJS, CodeMirror, RSVP) {
"use strict";
rJS(window)
.declareAcquiredMethod("saveContent", "triggerSubmit")
.declareMethod('render', function (options) {
this.props.key = options.key || {};
this.props.editor.setOption("mode", options.mode || "htmlmixed");
this.props.editor.setValue(options.value || "");
})
.declareMethod('getContent', function () {
var result = {};
result[this.props.key || "text_content"] = this.props.editor.getValue();
return result;
})
.declareService(function () {
this.props.editor.refresh();
this.props.editor.focus();
})
.ready(function (g) {
g.props = {};
return g.getElement()
.push(function (element) {
g.props.element = element;
CodeMirror.commands.save = function () {
return new RSVP.Queue()
.push(function () {
return g.saveContent();
});
};
g.props.editor = CodeMirror.fromTextArea(g.props.element.querySelector("textarea"), {
lineNumbers: true,
mode: "text/html",
matchBrackets: true,
showCursorWhenSelecting: true,
extraKeys: {"Alt-F": "findPersistent"}
});
// XXX custom styling for CribJS, should be put somewhere else-
g.props.element.querySelector('.CodeMirror').setAttribute('style', 'min-height: 800px;');
});
});
}(window, rJS, CodeMirror, RSVP));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Script" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Change_local_roles_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Anonymous</string>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_officejs_codemirror.js</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_officejs_codemirror_js</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Script</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>OfficeJS CodeMirror Gadget JS</string> </value>
</item>
<item>
<key> <string>url_string</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>document_publication_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>processing_status_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>publish</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1486738092.34</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>published</string> </value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>957.15091.17078.39594</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1486737802.08</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>detect_converted_file</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_processing_state</string> </key>
<value> <string>converted</string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1486737749.93</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
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