Add drop handlers for mediatags in ckeditor
parent
c00d295466
commit
018f71df04
|
@ -290,10 +290,22 @@ define([
|
|||
onFileDrop(dropped, e);
|
||||
});
|
||||
};
|
||||
var createCkeditorDropHandler = function () {
|
||||
var editor = config.ckeditor;
|
||||
editor.document.on('drop', function (ev) {
|
||||
var dropped = ev.data.$.dataTransfer.files;
|
||||
onFileDrop(dropped, ev);
|
||||
ev.data.preventDefault(true);
|
||||
});
|
||||
};
|
||||
|
||||
var createUploader = function ($area, $hover, $body) {
|
||||
if (!config.noHandlers) {
|
||||
createAreaHandlers($area, null);
|
||||
if (config.ckeditor) {
|
||||
createCkeditorDropHandler();
|
||||
} else {
|
||||
createAreaHandlers($area, null);
|
||||
}
|
||||
}
|
||||
createTableContainer($body);
|
||||
};
|
||||
|
|
|
@ -762,6 +762,20 @@ define([
|
|||
}
|
||||
|
||||
onLocal();
|
||||
|
||||
var fmConfig = {
|
||||
ckeditor: editor,
|
||||
body: $('body'),
|
||||
onUploaded: function (ev, data) {
|
||||
var parsed = Cryptpad.parsePadUrl(data.url);
|
||||
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
|
||||
var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
|
||||
var mt = '<media-tag contenteditable="false" src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '" tabindex="1"></media-tag>';
|
||||
editor.insertElement(CKEDITOR.dom.element.createFromHtml(mt));
|
||||
}
|
||||
};
|
||||
APP.FM = common.createFileManager(fmConfig);
|
||||
|
||||
editor.focus();
|
||||
if (newPad) {
|
||||
cursor.setToEnd();
|
||||
|
@ -772,10 +786,8 @@ define([
|
|||
|
||||
realtimeOptions.onConnectionChange = function (info) {
|
||||
setEditable(info.state);
|
||||
//toolbar.failed(); TODO
|
||||
if (info.state) {
|
||||
initializing = true;
|
||||
//toolbar.reconnecting(info.myId); // TODO
|
||||
Cryptpad.findOKButton().click();
|
||||
} else {
|
||||
Cryptpad.alert(Messages.common_connectionLost, undefined, true);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
define(['/common/cryptpad-common.js'], function (Cryptpad) {
|
||||
define(['/customize/messages.js'], function (Messages) {
|
||||
// Adds a context menu entry to open the selected link in a new tab.
|
||||
// See https://github.com/xwiki-contrib/application-ckeditor/commit/755d193497bf23ed874d874b4ae92fbee887fc10
|
||||
var Messages = Cryptpad.Messages;
|
||||
return {
|
||||
addSupportForOpeningLinksInNewTab : function (Ckeditor) {
|
||||
// Returns the DOM element of the active (currently focused) link. It has also support for linked image widgets.
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
'media-tag iframe{' +
|
||||
'border: 6px solid #eee;' +
|
||||
'}' +
|
||||
'media-tag img{' +
|
||||
'vertical-align: top;' +
|
||||
'}' +
|
||||
'media-tag *{' +
|
||||
'width:100%; height:100%;' +
|
||||
'}');
|
||||
|
|
Loading…
Reference in New Issue