Merge pull request #170 from witzig/editor-fixes
Editor fixes/improvements
This commit is contained in:
commit
bec976e061
4 changed files with 25 additions and 29 deletions
|
@ -135,8 +135,8 @@ processes=1
|
||||||
[mosaico]
|
[mosaico]
|
||||||
# Installed templates
|
# Installed templates
|
||||||
templates=[["versafix-1", "Versafix One"]]
|
templates=[["versafix-1", "Versafix One"]]
|
||||||
# Inject custom scripts from public/mosaico/custom/
|
# Inject custom scripts
|
||||||
# customscripts=["some-lib.js", "my-mosaico-plugin.js"]
|
# customscripts=["/mosaico/custom/my-mosaico-plugin.js"]
|
||||||
|
|
||||||
[grapejs]
|
[grapejs]
|
||||||
# Installed templates
|
# Installed templates
|
||||||
|
|
|
@ -417,37 +417,32 @@ let parseGrapejsMultipartTestForm = (req, res, next) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
router.post('/test', parseGrapejsMultipartTestForm, passport.csrfProtection, (req, res) => {
|
router.post('/test', parseGrapejsMultipartTestForm, passport.csrfProtection, (req, res) => {
|
||||||
|
let sendError = err => {
|
||||||
|
if (req.query.editor === 'grapejs') {
|
||||||
|
res.status(500).json({
|
||||||
|
errors: err.message || err
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
res.status(500).send(err.message || err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
prepareHtml({
|
prepareHtml({
|
||||||
editorName: req.query.editor,
|
editorName: req.query.editor,
|
||||||
html: req.body.html
|
html: req.body.html
|
||||||
}, (err, html) => {
|
}, (err, html) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
req.query.editor === 'grapejs' ?
|
return sendError(err);
|
||||||
res.status(500).json({
|
|
||||||
errors: err.message || err
|
|
||||||
}) :
|
|
||||||
res.status(500).send(err.message || err);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.list(['defaultAddress', 'defaultFrom'], (err, configItems) => {
|
settings.list(['defaultAddress', 'defaultFrom'], (err, configItems) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
req.query.editor === 'grapejs' ?
|
return sendError(err);
|
||||||
res.status(500).json({
|
|
||||||
errors: err.message || err
|
|
||||||
}) :
|
|
||||||
res.status(500).send(err.message || err);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mailer.getMailer((err, transport) => {
|
mailer.getMailer((err, transport) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
req.query.editor === 'grapejs' ?
|
return sendError(err);
|
||||||
res.status(500).json({
|
|
||||||
errors: err.message || err
|
|
||||||
}) :
|
|
||||||
res.status(500).send(err.message || err);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let opts = {
|
let opts = {
|
||||||
|
@ -465,12 +460,7 @@ router.post('/test', parseGrapejsMultipartTestForm, passport.csrfProtection, (re
|
||||||
|
|
||||||
transport.sendMail(opts, (err, info) => {
|
transport.sendMail(opts, (err, info) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
req.query.editor === 'grapejs' ?
|
return sendError(err);
|
||||||
res.status(500).json({
|
|
||||||
errors: err.message || err
|
|
||||||
}) :
|
|
||||||
res.status(500).send(err.message || err);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
req.query.editor === 'grapejs' ?
|
req.query.editor === 'grapejs' ?
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#toast-container {
|
#toast-container {
|
||||||
|
top: auto !important;
|
||||||
|
bottom: 5px;
|
||||||
|
right: 325px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: lighter;
|
font-weight: lighter;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +180,7 @@
|
||||||
var encodedSrc = (s && s[1]) || encodeURIComponent(src);
|
var encodedSrc = (s && s[1]) || encodeURIComponent(src);
|
||||||
var dynamicSrc = '/editorapi/img?src=' + encodedSrc + '&method=resize¶ms=' + $(this).width() + '%2C' + $(this).height();
|
var dynamicSrc = '/editorapi/img?src=' + encodedSrc + '&method=resize¶ms=' + $(this).width() + '%2C' + $(this).height();
|
||||||
imgs.push({
|
imgs.push({
|
||||||
cls: $(this).attr('class'),
|
cls: $(this).attr('class').split(' ')[0],
|
||||||
dynamicSrc: dynamicSrc,
|
dynamicSrc: dynamicSrc,
|
||||||
src: src,
|
src: src,
|
||||||
});
|
});
|
||||||
|
@ -245,10 +248,12 @@
|
||||||
statusFormElC.style.opacity = '0';
|
statusFormElC.style.opacity = '0';
|
||||||
statusFormEl.removeAttribute('data-tooltip');
|
statusFormEl.removeAttribute('data-tooltip');
|
||||||
md.close();
|
md.close();
|
||||||
|
toastr.success('Testmail sent');
|
||||||
} else if (res.errors) {
|
} else if (res.errors) {
|
||||||
statusFormEl.className = 'fa fa-exclamation-circle';
|
statusFormEl.className = 'fa fa-exclamation-circle';
|
||||||
statusFormEl.setAttribute('data-tooltip', res.errors);
|
statusFormEl.setAttribute('data-tooltip', res.errors);
|
||||||
statusFormElC.className = 'form-status text-danger';
|
statusFormElC.className = 'form-status text-danger';
|
||||||
|
toastr.error(res.errors);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -357,9 +362,10 @@
|
||||||
}, null, 'html')
|
}, null, 'html')
|
||||||
.success(function() {
|
.success(function() {
|
||||||
window.bridge.lastSavedHtml = html;
|
window.bridge.lastSavedHtml = html;
|
||||||
|
toastr.success('Sucessfully saved');
|
||||||
})
|
})
|
||||||
.fail(function(data) {
|
.fail(function(data) {
|
||||||
alert(data.responseText || 'An error occured while saving the document');
|
toastr.error(data.responseText || 'An error occured while saving the document');
|
||||||
})
|
})
|
||||||
.always(function() {
|
.always(function() {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
{{#if editorConfig.customscripts}}
|
{{#if editorConfig.customscripts}}
|
||||||
{{#each editorConfig.customscripts}}
|
{{#each editorConfig.customscripts}}
|
||||||
<script src="custom/{{this}}"></script>
|
<script src="{{this}}"></script>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue