Make image inserts use full root URL

This commit is contained in:
Kailash Nadh 2018-11-02 23:57:44 +05:30
parent de4e848e6d
commit 5d099ab10c
3 changed files with 8 additions and 5 deletions

View File

@ -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"`
} }

View File

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

View File

@ -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);
} }