mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 10:45:57 +00:00
FIX: reply as new topic wasn't working in FF when the post was only composed of an image
This commit is contained in:
parent
2c9058ab00
commit
2c384aec83
@ -410,12 +410,12 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
|||||||
action: Discourse.Composer.CREATE_TOPIC,
|
action: Discourse.Composer.CREATE_TOPIC,
|
||||||
draftKey: Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY,
|
draftKey: Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY,
|
||||||
categoryId: this.get('category.id')
|
categoryId: this.get('category.id')
|
||||||
}).then(function() {
|
}).then(() => {
|
||||||
return Em.isEmpty(quotedText) ? Discourse.Post.loadQuote(post.get('id')) : quotedText;
|
return Em.isEmpty(quotedText) ? Discourse.Post.loadQuote(post.get('id')) : quotedText;
|
||||||
}).then(function(q) {
|
}).then(q => {
|
||||||
const postUrl = "" + location.protocol + "//" + location.host + post.get('url'),
|
const postUrl = `${location.protocol}//${location.host}${post.get('url')}`,
|
||||||
postLink = "[" + Handlebars.escapeExpression(self.get('model.title')) + "](" + postUrl + ")";
|
postLink = `[${Handlebars.escapeExpression(self.get('model.title'))}](${postUrl})`;
|
||||||
composerController.appendText(I18n.t("post.continue_discussion", { postLink: postLink }) + "\n\n" + q);
|
composerController.appendText(`${I18n.t("post.continue_discussion", { postLink })}\n\n${q}`);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -3,15 +3,17 @@ export default {
|
|||||||
REGEXP: /\[quote=([^\]]*)\]((?:[\s\S](?!\[quote=[^\]]*\]))*?)\[\/quote\]/im,
|
REGEXP: /\[quote=([^\]]*)\]((?:[\s\S](?!\[quote=[^\]]*\]))*?)\[\/quote\]/im,
|
||||||
|
|
||||||
// Build the BBCode quote around the selected text
|
// Build the BBCode quote around the selected text
|
||||||
build: function(post, contents, opts) {
|
build(post, contents, opts) {
|
||||||
var contents_hashed, result, sansQuotes, stripped, stripped_hashed, tmp;
|
var contents_hashed, result, sansQuotes, stripped, stripped_hashed, tmp;
|
||||||
var full = opts && opts["full"];
|
var full = opts && opts["full"];
|
||||||
var raw = opts && opts["raw"];
|
var raw = opts && opts["raw"];
|
||||||
|
|
||||||
|
if (!post) { return ""; }
|
||||||
|
|
||||||
if (!contents) contents = "";
|
if (!contents) contents = "";
|
||||||
|
|
||||||
sansQuotes = contents.replace(this.REGEXP, '').trim();
|
sansQuotes = contents.replace(this.REGEXP, '').trim();
|
||||||
if (sansQuotes.length === 0) return "";
|
if (sansQuotes.length === 0) { return ""; }
|
||||||
|
|
||||||
// Escape the content of the quote
|
// Escape the content of the quote
|
||||||
sansQuotes = sansQuotes.replace(/</g, "<")
|
sansQuotes = sansQuotes.replace(/</g, "<")
|
||||||
@ -22,7 +24,7 @@ export default {
|
|||||||
/* Strip the HTML from cooked */
|
/* Strip the HTML from cooked */
|
||||||
tmp = document.createElement('div');
|
tmp = document.createElement('div');
|
||||||
tmp.innerHTML = post.get('cooked');
|
tmp.innerHTML = post.get('cooked');
|
||||||
stripped = tmp.textContent || tmp.innerText;
|
stripped = tmp.textContent || tmp.innerText || "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Let's remove any non alphanumeric characters as a kind of hash. Yes it's
|
Let's remove any non alphanumeric characters as a kind of hash. Yes it's
|
||||||
|
@ -405,9 +405,8 @@ Post.reopenClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
loadRevision(postId, version) {
|
loadRevision(postId, version) {
|
||||||
return Discourse.ajax("/posts/" + postId + "/revisions/" + version + ".json").then(function (result) {
|
return Discourse.ajax("/posts/" + postId + "/revisions/" + version + ".json")
|
||||||
return Ember.Object.create(result);
|
.then(result => Ember.Object.create(result));
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
hideRevision(postId, version) {
|
hideRevision(postId, version) {
|
||||||
@ -419,16 +418,15 @@ Post.reopenClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
loadQuote(postId) {
|
loadQuote(postId) {
|
||||||
return Discourse.ajax("/posts/" + postId + ".json").then(function (result) {
|
return Discourse.ajax("/posts/" + postId + ".json").then(result => {
|
||||||
const post = Discourse.Post.create(result);
|
const post = Discourse.Post.create(result);
|
||||||
return Quote.build(post, post.get('raw'), {raw: true, full: true});
|
return Quote.build(post, post.get('raw'), {raw: true, full: true});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
loadRawEmail(postId) {
|
loadRawEmail(postId) {
|
||||||
return Discourse.ajax("/posts/" + postId + "/raw-email").then(function (result) {
|
return Discourse.ajax("/posts/" + postId + "/raw-email")
|
||||||
return result.raw_email;
|
.then(result => result.raw_email);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user