]> BookStack Code Mirror - bookstack/blobdiff - resources/assets/js/pages/page-form.js
Revamped image system to use driver-agnotstic storage and be more efficent
[bookstack] / resources / assets / js / pages / page-form.js
index e926a24fbd01fdb446ad520a9fd6e503526c2745..2bf7221965965932cc9f2d457c943efb0bbb85ab 100644 (file)
@@ -14,7 +14,7 @@ module.exports = {
     extended_valid_elements: 'pre[*]',
     automatic_uploads: false,
     valid_children: "-div[p|pre|h1|h2|h3|h4|h5|h6|blockquote]",
-    plugins: "image table textcolor paste link fullscreen imagetools code hr",
+    plugins: "image table textcolor paste link fullscreen imagetools code hr autosave",
     imagetools_toolbar: 'imageoptions',
     toolbar: "undo redo | styleselect | bold italic underline strikethrough superscript subscript | forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image-insert link hr | removeformat code fullscreen",
     content_style: "body {padding-left: 15px !important; padding-right: 15px !important; margin:0!important; margin-left:auto!important;margin-right:auto!important;}",
@@ -99,10 +99,9 @@ module.exports = {
             tooltip: 'Insert an image',
             onclick: function() {
                 ImageManager.show(function(image) {
-                    var html = '<p><a href="'+image.url+'" target="_blank">';
-                    html += '<img src="'+image.display+'" alt="'+image.name+'">';
-                    html += '</a></p>';
-                    console.log(image);
+                    var html = '<a href="'+image.url+'" target="_blank">';
+                    html += '<img src="'+image.thumbs.display+'" alt="'+image.name+'">';
+                    html += '</a>';
                     editor.execCommand('mceInsertContent', false, html);
                 });
             }
@@ -138,10 +137,7 @@ module.exports = {
                             xhr.onload = function() {
                                 if (xhr.status === 200 || xhr.status === 201) {
                                     var result = JSON.parse(xhr.responseText);
-                                    //var newImage =  editor.getDoc().getElementById(id);
-                                    //newImage.setAttribute('src', result.url);
                                     editor.dom.setAttrib(id, 'src', result.url);
-                                    console.log(result);
                                 } else {
                                     console.log('An error occured uploading the image');
                                     console.log(xhr.responseText);