Commit 53a4b813 authored by iv's avatar iv

OfficeJS drive: Add codemirror editor (version: 5.10.0).

Sources: https://github.com/codemirror/CodeMirror/tree/8a3e59cb49b05da385639c350858c2a2a07e60c1
parent d8e6e6a4
......@@ -130,6 +130,34 @@ jquerymobile.css\n
jquerymobile.js\n
renderjs.js\n
rsvp.js\n
gadget_officejs_drive_page_edit.html\n
gadget_officejs_drive_page_edit.js\n
gadget_officejs_drive_page_browse_storage.html\n
gadget_officejs_drive_page_browse.js\n
gadget_officejs_drive_panel.html\n
gadget_officejs_drive_jio.js\n
gadget_officejs_drive_jio.html\n
gadget_officejs_drive_header.js\n
gadget_officejs_drive.appcache\n
gadget_officejs_drive_panel.js\n
gadget_officejs_drive_header.html\n
gadget_officejs_drive_router.html\n
gadget_officejs_drive_router.js\n
gadget_codemirror.js\n
gadget_codemirror.html\n
gadget_codemirror.css\n
codemirror_theme_zenburn.css\n
codemirror_mode_javascript.js\n
codemirror_mode_clike.js\n
codemirror_keymap_vim.js\n
codemirror.js\n
codemirror.css\n
codemirror_addon_searchcursor.js\n
codemirror_addon_edit_matchbrackets.js\n
codemirror_addon_display_fullscreen.js\n
codemirror_addon_display_fullscreen.css\n
codemirror_addon_dialog.js\n
codemirror_addon_dialog.css\n
NETWORK:\n
*
......@@ -268,7 +296,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.8659.41277.10359</string> </value>
<value> <string>948.27240.55520.50022</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -286,7 +314,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1451480890.17</float>
<float>1452596017.77</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -150,7 +150,7 @@
jio_options = {\n
type: "dav",\n
// XXX Hardcoded\n
url: "https://localhost:5000/webdav/media/removable",\n
url: "https://localhost:5000/webdav",\n
with_credentials: true\n
};\n
}\n
......@@ -324,7 +324,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.20342.16883.65058</string> </value>
<value> <string>948.36185.35957.25497</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -342,7 +342,7 @@
</tuple>
<state>
<tuple>
<float>1452181839.01</float>
<float>1453132424.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -111,9 +111,9 @@
<key> <string>text_content</string> </key>
<value> <string encoding="cdata"><![CDATA[
/*globals window, rJS, document */\n
/*globals window, rJS, RSVP, loopEventListener, document */\n
/*jslint indent: 2, nomen: true, maxlen: 80*/\n
(function (window, rJS, document) {\n
(function (window, rJS, RSVP, loopEventListener, document) {\n
"use strict";\n
\n
var gadget_klass = rJS(window);\n
......@@ -128,11 +128,28 @@
})\n
\n
.declareAcquiredMethod("jio_allAttachments", "jio_allAttachments")\n
.declareAcquiredMethod("redirect", "redirect")\n
\n
\n
.declareMethod("render", function (options) {\n
var gadget = this,\n
ul = gadget.props.element.querySelector(\'ul\'),\n
position = options.position || \'/key/notes/\';\n
position = options.position || \'/\';\n
\n
if (!position.startsWith(\'/\')) {\n
position = \'/\' + position;\n
}\n
if (!position.endsWith(\'/\')) {\n
position += \'/\';\n
}\n
\n
gadget.props.element.querySelector(\'input\').value = position;\n
\n
// clean previous ul children\n
while (ul.hasChildNodes()) {\n
ul.removeChild(ul.firstChild);\n
}\n
\n
return gadget.jio_allAttachments(position)\n
.push(function (all) {\n
var key,\n
......@@ -150,9 +167,27 @@
}\n
}\n
});\n
})\n
\n
.declareService(function () {\n
var gadget = this;\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return loopEventListener(\n
gadget.props.element.querySelector(\'form\'),\n
\'submit\',\n
true,\n
function () {\n
gadget.redirect(\n
{position: gadget.props.element.querySelector(\'input\').value}\n
);\n
}\n
);\n
});\n
});\n
\n
}(window, rJS, document));
}(window, rJS, RSVP, loopEventListener, document));
]]></string> </value>
</item>
......@@ -291,7 +326,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.20330.12482.53299</string> </value>
<value> <string>948.30407.28943.54340</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -309,7 +344,7 @@
</tuple>
<state>
<tuple>
<float>1452181116.02</float>
<float>1453118514.19</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -133,6 +133,9 @@
\n
<body>\n
<h1>Super OfficeJS Drive</h1>\n
<form>\n
position: <input type="text" name="position">\n
</form>\n
<ul>\n
</ul>\n
</body>\n
......@@ -276,7 +279,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.20216.15255.7833</string> </value>
<value> <string>948.27123.59534.19558</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -294,7 +297,7 @@
</tuple>
<state>
<tuple>
<float>1452176160.33</float>
<float>1452589359.42</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -118,11 +118,13 @@
\n
</head>\n
<body>\n
<div id=message></div>\n
<noscript>Javascript needed.</noscript>\n
\n
<p class=message></p>\n
<form class="view-web-page-form">\n
<textarea id="content"></textarea>\n
<button type="submit" class="ui-btn ui-btn-b ui-btn-inline ui-icon-edit ui-btn-icon-right ui-screen-hidden">Save</button>\n
</form>\n
<div data-gadget-url="gadget_codemirror.html" data-gadget-scope="codemirror"></div>\n
</body>\n
</html>
......@@ -261,7 +263,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.20288.34344.32136</string> </value>
<value> <string>948.35794.23372.40226</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -279,7 +281,7 @@
</tuple>
<state>
<tuple>
<float>1452183396.51</float>
<float>1453109726.99</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -98,9 +98,9 @@
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>/*globals window, rJS, RSVP, loopEventListener, document*/\n
<value> <string>/*globals window, rJS, RSVP, loopEventListener*/\n
/*jslint indent: 2, nomen: true, maxlen: 80*/\n
(function (window, RSVP, rJS, loopEventListener, document) {\n
(function (window, RSVP, rJS, loopEventListener) {\n
"use strict";\n
\n
var gadget_klass = rJS(window);\n
......@@ -115,43 +115,60 @@
// g.props.deferred = RSVP.defer();\n
});\n
})\n
\n
// allow external use of triggerData, so that editor gadget can save\n
// with its own shortcuts/buttons/whatever.\n
.allowPublicAcquisition(\'triggerData\', function () {\n
this.props.element.querySelector(\'button\').click();\n
})\n
\n
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")\n
.declareAcquiredMethod("jio_putAttachment", "jio_putAttachment")\n
.declareAcquiredMethod("updateHeader", "updateHeader")\n
\n
.declareMethod(\'triggerSubmit\', function () {\n
this.props.element.querySelector(\'button\').click();\n
})\n
\n
.declareMethod(\'render\', function (options) {\n
var gadget = this,\n
format = \'text\';\n
gadget.props.position = options.position || \'/key/notes/\';\n
gadget.props.currentResourceName = options.resource;\n
if (gadget.props.currentResourceName.endsWith(\'.txt\')) {\n
gadget.props.position = options.position || \'/\';\n
gadget.props.resourceName = options.resource;\n
if (gadget.props.resourceName.endsWith(\'.txt\') ||\n
gadget.props.resourceName.endsWith(\'.html\')) {\n
return gadget.jio_getAttachment(gadget.props.position,\n
gadget.props.currentResourceName,\n
gadget.props.resourceName,\n
{format: format})\n
.push(function (data) {\n
gadget.props.element.querySelector(\'textarea\').value = data;\n
// XXX: declare gadget here instead?\n
return gadget.getDeclaredGadget(\'codemirror\')\n
.push(function (editorGadget) {\n
gadget.props.editorGadget = editorGadget;\n
return editorGadget.render({\n
data: data,\n
resource: gadget.props.resourceName\n
});\n
});\n
})\n
\n
.push(function () {\n
return gadget.updateHeader({\n
title: \'Editing \' + gadget.props.currentResourceName,\n
title: \'Editing \' + gadget.props.resourceName +\n
\' at \' + gadget.props.position,\n
save_action: true\n
});\n
});\n
}\n
// XXX: if document not ending with \'.txt\': unsupported\n
gadget.props.element.querySelector(\'div\').appendChild(\n
document.createTextNode(\'Format not supported (yet).\')\n
);\n
gadget.props.element.querySelector(\'textarea\').setAttribute(\n
\'class\',\n
\'ui-screen-hidden\'\n
);\n
})\n
\n
.declareMethod(\'triggerSubmit\', function () {\n
this.props.element.querySelector(\'button\').click();\n
// otherwise: unsupported format\n
return gadget.getDeclaredGadget(\'codemirror\')\n
.push(function (editorGadget) {\n
gadget.props.element.querySelector(\'.message\').textContent =\n
\'Format not supported (yet?).\';\n
// hide device if not considered editable\n
editorGadget.props.element.className = \'ui-screen-hidden\';\n
});\n
})\n
\n
/////////////////////////////////////////\n
......@@ -167,17 +184,20 @@
\'submit\',\n
true,\n
function () {\n
return gadget.jio_putAttachment(\n
gadget.props.position,\n
gadget.props.currentResourceName,\n
gadget.props.element.querySelector(\'textarea\').value\n
);\n
return gadget.props.editorGadget.getData()\n
.push(function (data) {\n
return gadget.jio_putAttachment(\n
gadget.props.position,\n
gadget.props.resourceName,\n
data\n
);\n
});\n
}\n
);\n
});\n
});\n
\n
}(window, RSVP, rJS, loopEventListener, document));</string> </value>
}(window, RSVP, rJS, loopEventListener));</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -314,7 +334,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>948.20334.31824.8072</string> </value>
<value> <string>948.35950.62357.43776</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -332,7 +352,7 @@
</tuple>
<state>
<tuple>
<float>1452183421.53</float>
<float>1453137582.16</float>
<string>UTC</string>
</tuple>
</state>
......
web_page_module/gadget_officejs_drive_*
web_page_module/codemirror_*
web_site_module/officejs_drive
web_site_module/officejs_drive/**
\ No newline at end of file
web_page_module/gadget_officejs_drive_*
web_page_module/codemirror_*
web_site_module/officejs_drive
web_site_module/officejs_drive/**
\ No newline at end of file
web_page_module/codemirror_*
web_page_module/gadget_officejs_drive_*
web_site_module/officejs_drive
web_site_module/officejs_drive/**
\ No newline at end of file
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