[FIX] website_blog: fix the share content popover widget
Bug
===
We can not share a text with the "share content popover" widget
if the text contains a single quote (').
Task-2223641
closes odoo/odoo#49515
X-original-commit: 58cba0f3139d8ac8fe561aac88af2a79a2703d50
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -28,10 +28,11 @@
|
||||
// Shorten the selected text to match the tweet max length
|
||||
// Note: all (non-localhost) urls in a tweet have 23 characters https://support.twitter.com/articles/78124
|
||||
var selectedText = this.getSelection('string').substring(0, option.maxLength - baseLength - 23);
|
||||
var text = encodeURIComponent(_.str.sprintf(tweet, selectedText, window.location.href));
|
||||
var $btn_t = $('<a class="px-2 btn btn-link" onclick="window.open(\''+option.shareLink+text+'\',\'_'+option.target+'\',\'location=yes,height=570,width=520,scrollbars=yes,status=yes\')" href="#"/>');
|
||||
$btn_t.append($('<i class="fa fa-lg fa-twitter"/>'));
|
||||
$popover_content.append($btn_t);
|
||||
|
||||
var text = btoa(encodeURIComponent(_.str.sprintf(tweet, selectedText, window.location.href)));
|
||||
$popover_content.append(_.str.sprintf(
|
||||
"<a onclick=\"window.open('%s' + atob('%s'), '_%s','location=yes,height=570,width=520,scrollbars=yes,status=yes')\"><i class=\"ml4 mr4 fa fa-twitter fa-lg\"/></a>",
|
||||
option.shareLink, text, option.target));
|
||||
}
|
||||
return $popover_content;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user