You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please could you make this change (add compatibility with ckeditor plugin)
Inside clipboard_image_paste.js, add the function:
// Add createObjectURL function
function createObjectURL ( file ) {
if ( window.webkitURL ) {
return window.webkitURL.createObjectURL( file );
} else if ( window.URL && window.URL.createObjectURL ) {
return window.URL.createObjectURL( file );
} else {
return null;
}
};
And use the function insdide pasteHandler:
// Handle paste events
function pasteHandler(e) {
// We need to check if event.clipboardData is supported (Chrome)
if (hasClipboard && e.clipboardData) {
// Get the items from the clipboard
var items = e.clipboardData.items;
if (!items)
alert(cbImagePaste.cbp_txt_empty_cb);
else {
// Loop through all items, looking for any kind of image
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") !== -1) {
// We need to represent the image as a file,
var blob = items[i].getAsFile();
// and use a URL or webkitURL (whichever is available to the browser)
// to create a temporary URL to the object
//***********************************************************
var source = createObjectURL(blob);
//***********************************************************
// The URL can then be used as the source of an image
createImage(source);
return;
}
}
alert(cbImagePaste.cbp_txt_no_image_cb);
}
// If we can't handle clipboard data directly (Firefox),
// we need to read what was pasted from the contenteditable element
} else {
// This is a cheap trick to make sure we read the data
// AFTER it has been inserted.
setTimeout(checkInput, 1);
}
};
This patch works with textile and ckeditor
The text was updated successfully, but these errors were encountered:
I've pasted your code but still copy-paste in CKeditor doesn't work.
When I'm editing issue then I see a pasted image but after save, image doesn't show in issue.
Please could you make this change (add compatibility with ckeditor plugin)
Inside clipboard_image_paste.js, add the function:
// Add createObjectURL function
function createObjectURL ( file ) {
if ( window.webkitURL ) {
return window.webkitURL.createObjectURL( file );
} else if ( window.URL && window.URL.createObjectURL ) {
return window.URL.createObjectURL( file );
} else {
return null;
}
};
And use the function insdide pasteHandler:
// Handle paste events
function pasteHandler(e) {
// We need to check if event.clipboardData is supported (Chrome)
if (hasClipboard && e.clipboardData) {
// Get the items from the clipboard
var items = e.clipboardData.items;
if (!items)
alert(cbImagePaste.cbp_txt_empty_cb);
else {
// Loop through all items, looking for any kind of image
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf("image") !== -1) {
// We need to represent the image as a file,
var blob = items[i].getAsFile();
// and use a URL or webkitURL (whichever is available to the browser)
// to create a temporary URL to the object
//***********************************************************
var source = createObjectURL(blob);
//***********************************************************
// The URL can then be used as the source of an image
createImage(source);
return;
}
}
alert(cbImagePaste.cbp_txt_no_image_cb);
}
// If we can't handle clipboard data directly (Firefox),
// we need to read what was pasted from the contenteditable element
} else {
// This is a cheap trick to make sure we read the data
// AFTER it has been inserted.
setTimeout(checkInput, 1);
}
};
This patch works with textile and ckeditor
The text was updated successfully, but these errors were encountered: