summaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-11-20 16:17:57 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-11-20 16:17:57 +0100
commit9b1d5e260aab6f691fa3e2b39704334364a53fa3 (patch)
tree182133694cdef3eabac1d6bcb3346d44459f276d /static/js
parentbbb70dee15c88612ddc35565af6b2b9940357e8d (diff)
Make Wiki editable.
Diffstat (limited to 'static/js')
-rw-r--r--static/js/wiki.js70
1 files changed, 70 insertions, 0 deletions
diff --git a/static/js/wiki.js b/static/js/wiki.js
new file mode 100644
index 0000000..3f61456
--- /dev/null
+++ b/static/js/wiki.js
@@ -0,0 +1,70 @@
+/*
+jQuery(function ($) {
+ $('#wiki-page-content').on('blur', function() {
+ // FIXME: Save.
+ document.designMode = 'off';
+ });
+ $('#wiki-page-content').on('focus', function() {
+ document.designMode = 'on';
+ });
+});
+*/
+
+
+jQuery(function ($) {
+ if (!window.Aloha) {
+ window.Aloha = {};
+ }
+ window.Aloha.settings = {
+ logLevels: {'error': true, 'warn': true, 'info': true, 'debug': false},
+ errorhandling : false,
+ ribbon: true,
+
+ "i18n": {
+ "current": "de"
+ },
+ "repositories": {
+ },
+ "plugins": {
+ "format": {
+ config : [ 'b', 'i','sub','sup'],
+ editables : {
+ '#title' : [ ],
+ 'div' : [ 'b', 'i', 'del', 'sub', 'sup' ],
+ '.article' : [ 'b', 'i', 'p', 'title', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'removeFormat']
+ }
+ },
+ "list": {
+ },
+ "link": {
+ config : [ 'a' ],
+ },
+ "table": {
+ config : [ ],
+ },
+ "image": {
+ }
+ }
+ };
+
+ Aloha.ready(function() {
+ var $$ = Aloha.jQuery;
+ $$('#wiki-page-content').aloha();
+ var save = function() {
+ console.log('Saving changes.');
+ $.ajax({
+ url: "?save",
+ data: { content: $('#wiki-page-content').html() },
+ type: "POST",
+ success: function() {
+ console.log('Success.');
+ },
+ error: function() {
+ console.log('Error.');
+ }
+ });
+ };
+ $('#wiki-page-content').on('blur', save);
+ //$('#wiki-page-content').on('datachanged', save);
+ });
+});