mirror of
https://github.com/processwire/processwire.git
synced 2025-08-11 17:24:46 +02:00
Add @Toutouwai processwire/processwire-requests#242 to support automatic open of collapsed Inputfield when file dragged into file/image or CKEditor field that supports it
This commit is contained in:
@@ -291,7 +291,11 @@ class InputfieldCKEditor extends InputfieldTextarea {
|
||||
|
||||
$extraPlugins = $this->extraPlugins;
|
||||
$imagesField = $this->getImagesFieldName($assetPage);
|
||||
if($imagesField) $extraPlugins[] = 'uploadimage';
|
||||
|
||||
if($imagesField) {
|
||||
$extraPlugins[] = 'uploadimage';
|
||||
$this->addClass('InputfieldHasUpload', 'wrapClass');
|
||||
}
|
||||
|
||||
$settings = array(
|
||||
'baseHref' => $config->urls->root,
|
||||
|
@@ -594,6 +594,7 @@ class InputfieldFile extends Inputfield implements InputfieldItemList, Inputfiel
|
||||
|
||||
public function renderReady(Inputfield $parent = null, $renderValueMode = false) {
|
||||
$this->addClass('InputfieldNoFocus', 'wrapClass');
|
||||
if(!$renderValueMode) $this->addClass('InputfieldHasUpload', 'wrapClass');
|
||||
|
||||
if($this->useTags) {
|
||||
$this->wire('modules')->get('JqueryUI')->use('selectize');
|
||||
|
@@ -1319,6 +1319,14 @@ function InputfieldStates($target) {
|
||||
$(document).on('submit', '.InputfieldFormConfirm', function() {
|
||||
$(this).addClass('InputfieldFormSubmitted');
|
||||
});
|
||||
|
||||
// open Inputfields supporting uploads when file dragged in, per @Toutouwai #242
|
||||
$(document).on('dragenter', '.InputfieldHasUpload.InputfieldStateCollapsed', function(e) {
|
||||
var dt = e.originalEvent.dataTransfer;
|
||||
if(dt.types && (dt.types.indexOf ? dt.types.indexOf('Files') !== -1 : dt.types.contains('Files'))) {
|
||||
InputfieldOpen($(this));
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("beforeunload", InputfieldFormBeforeUnloadEvent);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user