File manager - Edit - /home/autoph/public_html/portal/ajs/vendors/bower_components/summernote/src/js/module/DragAndDrop.js
Back
define([ 'summernote/core/dom' ], function (dom) { var DragAndDrop = function (handler) { var $document = $(document); /** * attach Drag and Drop Events * * @param {Object} layoutInfo - layout Informations * @param {Object} options */ this.attach = function (layoutInfo, options) { if (options.airMode || options.disableDragAndDrop) { // prevent default drop event $document.on('drop', function (e) { e.preventDefault(); }); } else { this.attachDragAndDropEvent(layoutInfo, options); } }; /** * attach Drag and Drop Events * * @param {Object} layoutInfo - layout Informations * @param {Object} options */ this.attachDragAndDropEvent = function (layoutInfo, options) { var collection = $(), $editor = layoutInfo.editor(), $dropzone = layoutInfo.dropzone(), $dropzoneMessage = $dropzone.find('.note-dropzone-message'); // show dropzone on dragenter when dragging a object to document // -but only if the editor is visible, i.e. has a positive width and height $document.on('dragenter', function (e) { var isCodeview = handler.invoke('codeview.isActivated', layoutInfo); var hasEditorSize = $editor.width() > 0 && $editor.height() > 0; if (!isCodeview && !collection.length && hasEditorSize) { $editor.addClass('dragover'); $dropzone.width($editor.width()); $dropzone.height($editor.height()); $dropzoneMessage.text(options.langInfo.image.dragImageHere); } collection = collection.add(e.target); }).on('dragleave', function (e) { collection = collection.not(e.target); if (!collection.length) { $editor.removeClass('dragover'); } }).on('drop', function () { collection = $(); $editor.removeClass('dragover'); }); // change dropzone's message on hover. $dropzone.on('dragenter', function () { $dropzone.addClass('hover'); $dropzoneMessage.text(options.langInfo.image.dropImage); }).on('dragleave', function () { $dropzone.removeClass('hover'); $dropzoneMessage.text(options.langInfo.image.dragImageHere); }); // attach dropImage $dropzone.on('drop', function (event) { event.preventDefault(); var dataTransfer = event.originalEvent.dataTransfer; var html = dataTransfer.getData('text/html'); var text = dataTransfer.getData('text/plain'); var layoutInfo = dom.makeLayoutInfo(event.currentTarget || event.target); if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { layoutInfo.editable().focus(); handler.insertImages(layoutInfo, dataTransfer.files); } else if (html) { $(html).each(function () { layoutInfo.editable().focus(); handler.invoke('editor.insertNode', layoutInfo.editable(), this); }); } else if (text) { layoutInfo.editable().focus(); handler.invoke('editor.insertText', layoutInfo.editable(), text); } }).on('dragover', false); // prevent default dragover event }; }; return DragAndDrop; });
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.05 |
proxy
|
phpinfo
|
Settings