Bläddra i källkod

Make image inserts use full root URL

Kailash Nadh 6 år sedan
förälder
incheckning
5d099ab10c
3 ändrade filer med 8 tillägg och 5 borttagningar
  1. 1 1
      admin.go
  2. 4 0
      default-template.html
  3. 3 4
      frontend/my/src/Campaign.js

+ 1 - 1
admin.go

@@ -10,7 +10,7 @@ import (
 
 
 type configScript struct {
 type configScript struct {
 	RootURL    string   `json:"rootURL"`
 	RootURL    string   `json:"rootURL"`
-	UploadURI  string   `json:"uploadURL"`
+	UploadURI  string   `json:"uploadURI"`
 	FromEmail  string   `json:"fromEmail"`
 	FromEmail  string   `json:"fromEmail"`
 	Messengers []string `json:"messengers"`
 	Messengers []string `json:"messengers"`
 }
 }

+ 4 - 0
default-template.html

@@ -36,6 +36,10 @@
                 padding: 30px;
                 padding: 30px;
             }
             }
 
 
+            img {
+                max-width: 100%;
+            }
+
             a {
             a {
                 color: #7f2aff;
                 color: #7f2aff;
             }
             }

+ 3 - 4
frontend/my/src/Campaign.js

@@ -36,11 +36,11 @@ class Editor extends React.PureComponent {
                 [{ "color": [] }, { "background": [] }, { 'size': [] }],
                 [{ "color": [] }, { "background": [] }, { 'size': [] }],
                 [{"list": "ordered"}, {"list": "bullet"}, {"indent": "-1"}, {"indent": "+1"}],
                 [{"list": "ordered"}, {"list": "bullet"}, {"indent": "-1"}, {"indent": "+1"}],
                 [{"align": ""}, { "align": "center" }, { "align": "right" }, { "align": "justify" }],
                 [{"align": ""}, { "align": "center" }, { "align": "right" }, { "align": "justify" }],
-                ["link", "gallery"],
+                ["link", "image"],
                 ["clean", "font"]
                 ["clean", "font"]
             ],
             ],
             handlers: {
             handlers: {
-                "gallery": () => {
+                "image": () => {
                     this.props.toggleMedia()
                     this.props.toggleMedia()
                 }
                 }
             }
             }
@@ -62,12 +62,11 @@ class Editor extends React.PureComponent {
     // Custom handler for inserting images from the media popup.
     // Custom handler for inserting images from the media popup.
     insertMedia = (uri) => {
     insertMedia = (uri) => {
         const quill = this.state.quill.getEditor()
         const quill = this.state.quill.getEditor()
-
         let range = quill.getSelection(true);
         let range = quill.getSelection(true);
         quill.updateContents(new Delta()
         quill.updateContents(new Delta()
           .retain(range.index)
           .retain(range.index)
           .delete(range.length)
           .delete(range.length)
-          .insert({ image: uri })
+          .insert({ image: this.props.config.rootURL + uri })
         , null);
         , null);
     }
     }