mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 12:32:14 +09:00
Fix #2363 treat pasted HTML as image if a single <img> tag is the only content
This commit is contained in:
parent
bdf4873a31
commit
2b1e4495e2
1 changed files with 2 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ CKEDITOR.plugins.add('rx_paste', {
|
||||||
const dataValue = event.data.dataValue;
|
const dataValue = event.data.dataValue;
|
||||||
const dataTransfer = event.data.dataTransfer;
|
const dataTransfer = event.data.dataTransfer;
|
||||||
const filesCount = dataTransfer.getFilesCount();
|
const filesCount = dataTransfer.getFilesCount();
|
||||||
|
const isFileTransfer = dataTransfer.isFileTransfer() || String(dataValue).match(/^<img\s[^>]+>$/);
|
||||||
|
|
||||||
// Replace iframe code in pasted text.
|
// Replace iframe code in pasted text.
|
||||||
if (method === 'paste' && dataValue && dataValue.replace) {
|
if (method === 'paste' && dataValue && dataValue.replace) {
|
||||||
|
|
@ -33,7 +34,7 @@ CKEDITOR.plugins.add('rx_paste', {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the pasted data contains any files.
|
// Check if the pasted data contains any files.
|
||||||
if (filesCount && dataTransfer.isFileTransfer()) {
|
if (filesCount && isFileTransfer) {
|
||||||
event.stop();
|
event.stop();
|
||||||
for (let i = 0; i < filesCount; i++) {
|
for (let i = 0; i < filesCount; i++) {
|
||||||
uploadFile(dataTransfer.getFile(i));
|
uploadFile(dataTransfer.getFile(i));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue