5 return function(sandbox) {
\r
7 var doc = sandbox.getBootstrappedData().document;
\r
8 var document_id = sandbox.getBootstrappedData().document_id;
\r
13 xmlns="http://nowoczesnapolska.org.pl/sst#"\n\
\r
14 xmlns:xlink="http://www.w3.org/1999/xlink"\n\
\r
15 xmlns:dc="http://purl.org/dc/elements/1.1/"\n\
\r
16 xmlns:dcterms="http://purl.org/dc/terms/"\n\
\r
20 <div class="p"></div>\n\
\r
25 function readCookie(name) {
\r
26 var nameEQ = escape(name) + "=";
\r
27 var ca = document.cookie.split(';');
\r
28 for (var i = 0; i < ca.length; i++) {
\r
30 while (c.charAt(0) == ' ') c = c.substring(1, c.length);
\r
31 if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length, c.length));
\r
38 beforeSend: function(xhr, settings) {
\r
39 if (!(/^(GET|HEAD|OPTIONS|TRACE)$/.test(settings.type))) {
\r
40 xhr.setRequestHeader("X-CSRFToken", readCookie('csrftoken'));
\r
47 sandbox.publish('ready');
\r
49 getDocument: function() {
\r
52 commitDocument: function(newDocument, reason) {
\r
54 sandbox.publish('documentChanged', doc, reason);
\r
56 saveDocument: function() {
\r
57 sandbox.publish('savingStarted');
\r
60 url: '/' + gettext('editor') + '/' + document_id,
\r
61 data: JSON.stringify({document:doc}),
\r
62 success: function() {sandbox.publish('savingEnded', 'success');},
\r
63 error: function() {sandbox.publish('savingEnded', 'error');}
\r