v1.18.x
barisusakli 10 years ago
parent f81e3ad358
commit 5f2271e4e0

@ -37,7 +37,7 @@ define('composer', [
if (confirm) { if (confirm) {
discard(composer.active); discard(composer.active);
} else { } else {
history.pushState({}, '', '#compose'); history.pushState({}, '');
} }
}); });
}); });
@ -48,8 +48,16 @@ define('composer', [
localStorage.removeItem('category:' + data.data.cid + ':bookmark'); localStorage.removeItem('category:' + data.data.cid + ':bookmark');
localStorage.removeItem('category:' + data.data.cid + ':bookmark:clicked'); localStorage.removeItem('category:' + data.data.cid + ':bookmark:clicked');
ajaxify.go('topic/' + data.data.slug); ajaxify.go('topic/' + data.data.slug);
removeComposerHistory();
}); });
function removeComposerHistory() {
var env = utils.findBootstrapEnvironment();
if (env === 'xs' || env ==='sm') {
history.back();
}
}
// Query server for formatting options // Query server for formatting options
socket.emit('modules.composer.getFormattingOptions', function(err, options) { socket.emit('modules.composer.getFormattingOptions', function(err, options) {
composer.formatting = options; composer.formatting = options;
@ -118,7 +126,7 @@ define('composer', [
var env = utils.findBootstrapEnvironment(); var env = utils.findBootstrapEnvironment();
if (env === 'xs' || env ==='sm') { if (env === 'xs' || env ==='sm') {
history.pushState({}, '', '#compose'); history.pushState({}, '');
} }
} }
@ -354,6 +362,7 @@ define('composer', [
postContainer.find('.composer-discard').on('click', function() { postContainer.find('.composer-discard').on('click', function() {
if (!composer.posts[post_uuid].modified) { if (!composer.posts[post_uuid].modified) {
removeComposerHistory();
discard(post_uuid); discard(post_uuid);
return; return;
} }
@ -361,6 +370,7 @@ define('composer', [
translator.translate('[[modules:composer.discard]]', function(translated) { translator.translate('[[modules:composer.discard]]', function(translated) {
bootbox.confirm(translated, function(confirm) { bootbox.confirm(translated, function(confirm) {
if (confirm) { if (confirm) {
removeComposerHistory();
discard(post_uuid); discard(post_uuid);
} }
btn.prop('disabled', false); btn.prop('disabled', false);
@ -559,6 +569,7 @@ define('composer', [
$('html').removeClass('composing mobile'); $('html').removeClass('composing mobile');
} }
} }

Loading…
Cancel
Save