Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/paste images #4329

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion common/clipboard_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@
}
else
{
function _html_has_image(document) {
return "" === document.body.innerText.trim() && !!document.querySelector("img")
};
function _is_html_outputting_single_mage(htmlStr) {
var document = (new DOMParser).parseFromString(htmlStr, "text/html");
return _html_has_image(document)
};
var _clipboard = (e && e.clipboardData) ? e.clipboardData : window.clipboardData;
if (!_clipboard || !_clipboard.getData)
return false;
Expand All @@ -264,7 +271,7 @@
}

var _html_format = isDisableRawPaste ? "" : this.ClosureParams.getData("text/html");
if (_html_format && _html_format != "")
if (_html_format && _html_format != "" && !_is_html_outputting_single_mage(_html_format))
{
var nIndex = _html_format.indexOf("</html>");
if (-1 != nIndex)
Expand Down
Loading