mirror of
https://github.com/discourse/discourse.git
synced 2025-02-17 16:55:08 +00:00
FIX: Inline head tag html pasting
This commit is contained in:
parent
77fbb2306d
commit
5c3ef7875f
@ -639,6 +639,17 @@ export default Ember.Component.extend({
|
||||
return null;
|
||||
},
|
||||
|
||||
_pasteMarkdown(text) {
|
||||
const lineVal = this._getSelected(null, {lineVal: true}).lineVal;
|
||||
|
||||
if(lineVal) { // inline pasting
|
||||
text = text.replace(/^#+/, "").trim();
|
||||
text = (lineVal.search(/\s$/) === lineVal.length - 1) ? text : ` ${text}`;
|
||||
}
|
||||
|
||||
this.appEvents.trigger('composer:insert-text', text);
|
||||
},
|
||||
|
||||
paste(e) {
|
||||
if (!$(".d-editor-input").is(":focus")) {
|
||||
return;
|
||||
@ -664,7 +675,7 @@ export default Ember.Component.extend({
|
||||
const markdown = toMarkdown(html);
|
||||
|
||||
if (!plainText || plainText.length < markdown.length) {
|
||||
this.appEvents.trigger('composer:insert-text', markdown);
|
||||
this._pasteMarkdown(markdown);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user