Skip to content

Commit bb5551b

Browse files
committed
Merge branch 'master' into feat/fast-create-form
2 parents 3d9a2a0 + b1bbaed commit bb5551b

File tree

8 files changed

+16
-51
lines changed

8 files changed

+16
-51
lines changed

config/app_local.example.php

+2-36
Original file line numberDiff line numberDiff line change
@@ -670,54 +670,20 @@
670670

671671
/**
672672
* Upload configurations.
673+
*
674+
* 'files' and 'media' accept all mimes, so no configuration needed.
673675
*/
674676
// 'uploadAccepted' => [
675677
// 'audio' => [
676678
// 'audio/*',
677679
// ],
678-
// 'files' => [
679-
// 'application/msword', // .doc, .dot
680-
// 'application/pdf', // .pdf
681-
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // .docx
682-
// 'application/vnd.ms-excel', // .xls, .xlt, .xla
683-
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx
684-
// 'application/vnd.ms-powerpoint', // .ppt, .pot, .pps, .ppa
685-
// 'application/vnd.openxmlformats-officedocument.presentationml.presentation', // .pptx
686-
// 'application/x-mpegURL',
687-
// 'audio/*',
688-
// 'text/csv',
689-
// 'text/html',
690-
// 'text/plain',
691-
// 'text/rtf',
692-
// 'text/xml',
693-
// 'image/*',
694-
// 'video/*',
695-
// ],
696680
// 'images' => [
697681
// 'image/*',
698682
// ],
699683
// 'videos' => [
700684
// 'application/x-mpegURL',
701685
// 'video/*',
702686
// ],
703-
// 'media' => [
704-
// 'application/msword', // .doc, .dot
705-
// 'application/pdf', // .pdf
706-
// 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', // .docx
707-
// 'application/vnd.ms-excel', // .xls, .xlt, .xla
708-
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', // .xlsx
709-
// 'application/vnd.ms-powerpoint', // .ppt, .pot, .pps, .ppa
710-
// 'application/vnd.openxmlformats-officedocument.presentationml.presentation', // .pptx
711-
// 'application/x-mpegURL',
712-
// 'audio/*',
713-
// 'image/*',
714-
// 'text/csv',
715-
// 'text/html',
716-
// 'text/plain',
717-
// 'text/rtf',
718-
// 'text/xml',
719-
// 'video/*',
720-
// ],
721687
// ],
722688
// 'uploadForbidden' => [
723689
// 'mimetypes' => [

config/version.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[Manager]
2-
version=5.3.2
2+
version=5.3.3

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bedita-manager",
3-
"version": "5.3.2",
3+
"version": "5.3.3",
44
"description": "BEdita Manager",
55
"keywords": [
66
"BEdita",

resources/js/app/helpers/view.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export default {
167167
},
168168

169169
acceptMimeTypes(type) {
170-
if (!BEDITA.uploadConfig?.accepted?.[type]) {
170+
if (['files', 'media'].includes(type) || !BEDITA.uploadConfig?.accepted?.[type]) {
171171
return '';
172172
}
173173

@@ -198,8 +198,9 @@ export default {
198198

199199
/** accepted mime types check */
200200
const mimes = BEDITA.uploadConfig?.accepted;
201-
if (mimes?.[objectType] && !this.checkAcceptedMime(mimes[objectType], fileType)) {
202-
const msg = t`File type not accepted` + `: "${fileType}". ` + t`Accepted types` + `: "${mimes[objectType].join('", "')}".`;
201+
const ot = objectType === 'media' ? this.getObjectTypeFromMime(fileType) : objectType;
202+
if (ot !== 'files' && mimes?.[ot] && !this.checkAcceptedMime(mimes[ot], fileType)) {
203+
const msg = t`File type not accepted` + `: "${fileType}". ` + t`Accepted types` + `: "${mimes[ot].join('", "')}".`;
203204
BEDITA.warning(msg);
204205

205206
return false;

src/View/Helper/SystemHelper.php

-6
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ class SystemHelper extends Helper
5252
'application/x-mpegURL',
5353
'video/*',
5454
],
55-
'media' => [
56-
'application/x-mpegURL',
57-
'audio/*',
58-
'image/*',
59-
'video/*',
60-
],
6155
];
6256

6357
/**

templates/Element/Form/dropupload.twig

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{# :accepted-drop="[`.from-relation-${relationName}`,isRelationWithMedia && 'from-files']"> #}
2+
{% set ot = objectTypes|length == 1 ? objectTypes[0] : 'media' %}
23
<drop-upload
4+
:object-type="{{ ot|json_encode }}"
35
placeholder="{{ __('Click or drop new files here') }}"
46
@new-relations="appendRelations"
57
v-if="isRelationWithMedia"

templates/Element/Form/relation.twig

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@
139139
</div>
140140
<div class="mt-5">
141141
{% if uploadableNum %}
142-
{{ element(Element.dropupload(relationsSchema[relationName]['right'])) }}
142+
{{ element(Element.dropupload(relationsSchema[relationName]['right']), {
143+
'objectTypes': relationsSchema[relationName]['right']
144+
}) }}
143145
{% endif %}
144146
<div>
145147
<button v-if="isPanelOpen({{object.id|json_encode}})" @click.prevent.stop="closePanel()">

yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -3666,9 +3666,9 @@ koa-router@^9.1.0:
36663666
path-to-regexp "^6.1.0"
36673667

36683668
koa@^2.13.0:
3669-
version "2.15.3"
3670-
resolved "https://registry.npmjs.org/koa/-/koa-2.15.3.tgz#062809266ee75ce0c75f6510a005b0e38f8c519a"
3671-
integrity sha512-j/8tY9j5t+GVMLeioLaxweJiKUayFhlGqNTzf2ZGwL0ZCQijd2RLHK0SLW5Tsko8YyyqCZC2cojIb0/s62qTAg==
3669+
version "2.15.4"
3670+
resolved "https://registry.yarnpkg.com/koa/-/koa-2.15.4.tgz#7000b3d8354558671adb1ba1b1c09bedb5f8da75"
3671+
integrity sha512-7fNBIdrU2PEgLljXoPWoyY4r1e+ToWCmzS/wwMPbUNs7X+5MMET1ObhJBlUkF5uZG9B6QhM2zS1TsH6adegkiQ==
36723672
dependencies:
36733673
accepts "^1.3.5"
36743674
cache-content-type "^1.0.0"

0 commit comments

Comments
 (0)