Commit 541dcd12e382d0f95c15c04d6f1f31bf1a1e5e4a

Add Plugin type in the editor
  • Diff rendering mode:
  • inline
  • side by side

mouchak/static/js/editor.js

9 'click .pagename .disp': 'showPage',9 'click .pagename .disp': 'showPage',
10 'click #addPage': 'addPage',10 'click #addPage': 'addPage',
11 'click .pagename .remove': 'removePage',11 'click .pagename .remove': 'removePage',
12 'click #menu-config': 'showMenu'
12 'click #menu-config': 'showMenu',
13 'click #footer-config': 'footerConfig'
13 },14 },
14 initialize: function() {15 initialize: function() {
15 _.bindAll(this);16 _.bindAll(this);
25 //console.log(menu);25 //console.log(menu);
26 this.menuconfig = new M.types.model.menu(menu);26 this.menuconfig = new M.types.model.menu(menu);
27 this.menuconfigview = new MenuConfigView({model: this.menuconfig});27 this.menuconfigview = new MenuConfigView({model: this.menuconfig});
28 this.footerconfigview = new FooterConfigView();
28 },29 },
29 render: function() {30 render: function() {
30 // append the page list31 // append the page list
69 },69 },
70 showMenu: function(event) {70 showMenu: function(event) {
71 this.menuconfigview.render();71 this.menuconfigview.render();
72 },
73 footerConfig: function(event) {
74 this.footerconfigview.render();
72 }75 }
73 });76 });
7477
263 // init the wysiwig editor263 // init the wysiwig editor
264 M.editor.wysiwig('#edit');264 M.editor.wysiwig('#edit');
265 }265 }
266 else if(type === 'image' || type === 'video' || type === 'audio') {
266 else if(type === 'image' || type === 'video' ||
267 type === 'audio' || type === 'plugin') {
267 var template = _.template($('#media-template').html());268 var template = _.template($('#media-template').html());
269
268 $('#specific-content').html(template({270 $('#specific-content').html(template({
269 src: this.model.get('src')271 src: this.model.get('src')
270 }));272 }));
313 done: function() {313 done: function() {
314 this.update();314 this.update();
315 this.cleanUp();315 this.cleanUp();
316 }
317 });
318
319 /* view to configure footer */
320 var FooterConfigView = Backbone.View.extend({
321 tagName: 'div',
322 id: 'page',
323 events: {
324 'click #saveFooter': 'saveFooter'
325 },
326 initialize: function() {
327 _.bindAll(this);
328 this.template = _.template($('#footer-config-template').html());
329 },
330 render: function() {
331 $('#page').remove();
332 $('#content-container').append(this.$el);
333 this.$el.html(this.template());
334 M.editor.wysiwig('#footer-input');
335 },
336 saveFooter: function() {
337 tinymce.triggerSave(false, true);
338 var data = $('#footer-input').html();
339 console.log(data);
316 }340 }
317 });341 });
318342