New site setting to enable or disable rich text pasting

This commit is contained in:
Vinoth Kannan 2017-12-08 14:09:39 +05:30
parent 0a47642003
commit b9c0488687
4 changed files with 11 additions and 2 deletions

View File

@ -434,9 +434,14 @@ export default Ember.Component.extend({
});
$element.on('fileuploadpaste', (e) => {
const { types } = clipboardData(e);
this._pasted = true;
if (!this.siteSettings.enable_rich_text_paste || !$(".d-editor-input").is(":focus")) {
return;
}
const { types } = clipboardData(e);
if (types.includes("text/plain") || types.includes("text/html")) {
e.preventDefault();
}

View File

@ -640,7 +640,7 @@ export default Ember.Component.extend({
},
paste(e) {
if (!$(".d-editor-input").is(":focus")) {
if (!this.siteSettings.enable_rich_text_paste || !$(".d-editor-input").is(":focus")) {
return;
}

View File

@ -1088,6 +1088,7 @@ en:
top_page_default_timeframe: "Default timeframe for the top view page."
show_email_on_profile: "Show a user's email on their profile (only visible to themselves and staff)"
prioritize_username_in_ux: "Show username first on user page, user card and posts (when disabled name is shown first)"
enable_rich_text_paste: "Enable automatic HTML to Markdown conversion"
email_token_valid_hours: "Forgot password / activate account tokens are valid for (n) hours."

View File

@ -525,6 +525,9 @@ posting:
enable_markdown_typographer:
client: true
default: true
enable_rich_text_paste:
client: true
default: false
suppress_reply_directly_below:
client: true
default: true