summaryrefslogtreecommitdiff
path: root/static/js/wiki.js
blob: 3f614562148428c03e5446bc5a80c9672ea62691 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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);
    });
});