Commit 4f0c87d26f2c378b449954b6e02d92abffa6014c

Add callback input for JS plugin in UI

  Add callback input in the UI for JS plugins.
  • Diff rendering mode:
  • inline
  • side by side

mouchak/static/js/editor.js

326 }326 }
327 }327 }
328 else if(type === 'image' || type === 'video' ||328 else if(type === 'image' || type === 'video' ||
329 type === 'audio' || type === 'plugin') {
329 type === 'audio') {
330330
331 var template = _.template($('#media-template').html());331 var template = _.template($('#media-template').html());
332 $('#specific-content').html(template({332 $('#specific-content').html(template({
337 /*var view = new M.types.view[type]({model: this.model});337 /*var view = new M.types.view[type]({model: this.model});
338 //$('#specific-content.preview').html();338 //$('#specific-content.preview').html();
339 view.render('.preview');*/339 view.render('.preview');*/
340 }
341 else if(type === 'plugin') {
342 var template = _.template($('#plugin-template').html());
343 $('#specific-content').html(template({
344 src: this.model.get('src'),
345 callback: this.model.get('callback')
346 }));
340 }347 }
341 else if(type === 'map') {348 else if(type === 'map') {
342 var template = _.template($('#map-template').html());349 var template = _.template($('#map-template').html());

mouchak/templates/editor.html

288 </div>288 </div>
289 </script>289 </script>
290290
291 <script type="text/template" id="plugin-template">
292 <div class="data">
293 <div class="row">
294 <div class="form-group col-lg-6">
295 <div class="input-group">
296 <span class="input-group-addon"><strong>path to file</strong></span>
297 <input class="form-control" type="text" placeholder="src" value="<%= src %>"
298 m-data-target="src">
299 </div>
300 </div>
301 </div>
302 <div class="row">
303 <div class="form-group col-lg-6">
304 <div class="input-group">
305 <span class="input-group-addon"><strong>callback</strong></span>
306 <input class="form-control" type="text" placeholder=
307 "callback function for js plugin" value="<%= callback %>"
308 m-data-target="callback">
309 </div>
310 </div>
311 </div>
312 <div class="preview"></div>
313 </div>
314 </script>
315
291 <script type="text/template" id="text-template">316 <script type="text/template" id="text-template">
292 <div class="data">317 <div class="data">
293 <div class="edit-type-wrap">318 <div class="edit-type-wrap">