Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] Select image/audio/video/document file from Media Manager #34634

Merged
merged 58 commits into from
Jul 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e2fb982
Select audio,video,document
dgrammatiko Jun 30, 2021
5b4d9ee
meh
dgrammatiko Jun 26, 2021
5b94b1c
Remove test files
dgrammatiko Jun 26, 2021
627e3ed
Fix inconsistencies
dgrammatiko Jun 26, 2021
3eae775
install sqls
dgrammatiko Jun 26, 2021
1bf3a3c
update
dgrammatiko Jun 27, 2021
18430de
Reverse the strings
dgrammatiko Jun 27, 2021
942c808
Fix console err on ellipsis click
dgrammatiko Jun 27, 2021
c544cbb
oops
dgrammatiko Jun 27, 2021
fc90aa4
Fix previews
dgrammatiko Jun 27, 2021
65432a2
meh
dgrammatiko Jun 27, 2021
f7a3557
meh
dgrammatiko Jun 27, 2021
72e8f1e
update some dependencies
dgrammatiko Jun 30, 2021
1c2544d
meh
dgrammatiko Jun 27, 2021
0d8e875
erm
dgrammatiko Jun 27, 2021
f0ed672
undo this
dgrammatiko Jun 27, 2021
3243c8a
Implement a show-on
dgrammatiko Jun 27, 2021
22491df
nope
dgrammatiko Jun 27, 2021
f66f552
For the media field display only images
dgrammatiko Jun 27, 2021
e1fd446
Fix/add mime types, extensions
dgrammatiko Jun 28, 2021
0e427ca
Add also webm
dgrammatiko Jun 28, 2021
f246b24
Checkbox to radio
dgrammatiko Jun 28, 2021
d6a3f55
remove console
dgrammatiko Jun 28, 2021
1cb4718
Update plg_editors-xtd_image.ini
brianteeman Jun 27, 2021
9b69c02
Update plg_editors-xtd_image.sys.ini
brianteeman Jun 27, 2021
146cee5
pfff CS
dgrammatiko Jun 28, 2021
50ba878
Sync the default values
dgrammatiko Jun 28, 2021
3f6d49d
Reposition the details element
dgrammatiko Jun 28, 2021
9b9d2aa
Change the order of the radios
dgrammatiko Jun 28, 2021
42d28ef
Update administrator/components/com_media/config.xml
dgrammatiko Jun 28, 2021
fda166b
Remove listeners on disconected
dgrammatiko Jun 28, 2021
0500409
Sync more default values
dgrammatiko Jun 28, 2021
8f00331
oops
dgrammatiko Jun 28, 2021
af45060
fix controls checkbox
dgrammatiko Jun 28, 2021
9d11863
icon + typo
dgrammatiko Jun 28, 2021
d4db246
Remove the controls opt, tags always get controls
dgrammatiko Jun 28, 2021
6c0a410
Allow media field to use any media type
dgrammatiko Jun 29, 2021
4bd44af
Update administrator/language/en-GB/com_media.ini
dgrammatiko Jun 28, 2021
35c9068
CS
dgrammatiko Jun 29, 2021
309632a
Add title to object tag
dgrammatiko Jun 29, 2021
cc1395b
CS
dgrammatiko Jun 29, 2021
64f3467
Really now?
dgrammatiko Jun 29, 2021
18b4852
oops
dgrammatiko Jun 29, 2021
c53ecd5
few more fixes
dgrammatiko Jun 29, 2021
99e218b
stop failing
dgrammatiko Jun 29, 2021
977c424
center the preview modal
dgrammatiko Jun 29, 2021
2f2dc06
Better defaults
dgrammatiko Jun 29, 2021
fcebc62
Nice try…
dgrammatiko Jun 29, 2021
9c8106e
sync +
dgrammatiko Jun 30, 2021
66ddb1b
Support all media types on Media Field
dgrammatiko Jun 30, 2021
88fc3d4
The cs is hiddeous
dgrammatiko Jun 30, 2021
efa4ba3
grrr
dgrammatiko Jun 30, 2021
e7fa728
lol
dgrammatiko Jun 30, 2021
b538fff
Fix the close button on previews
dgrammatiko Jun 30, 2021
65e49e5
Clinking on the left tree should close the
dgrammatiko Jun 30, 2021
f3d1a20
Select all checkbox should also close
dgrammatiko Jun 30, 2021
08db7f1
Breadcrumb should also close
dgrammatiko Jun 30, 2021
5d4a1b7
CS
dgrammatiko Jun 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions administrator/components/com_media/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
<fieldset
name="component"
label="COM_MEDIA_FIELDSET_OPTIONS_LABEL">
<field
name="upload_extensions"
type="text"
label="COM_MEDIA_FIELD_LEGAL_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_LEGAL_EXTENSIONS_DESC"
size="50"
default="bmp,csv,doc,gif,ico,jpg,jpeg,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,BMP,CSV,DOC,GIF,ICO,JPG,JPEG,ODG,ODP,ODS,ODT,PDF,PNG,PPT,TXT,XCF,XLS"
/>

<field
name="upload_maxsize"
Expand Down Expand Up @@ -56,6 +48,16 @@
<option value="1">JYES</option>
</field>

<field
name="restrict_uploads_extensions"
type="text"
label="COM_MEDIA_FIELD_RESTRICT_UPLOADS_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_RESTRICT_UPLOADS_EXTENSIONS_DESC"
size="50"
default="bmp,gif,jpg,jpeg,png,ico,mp3,mp4,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,csv"
showon="restrict_uploads:1"
/>

<field
name="check_mime"
type="radio"
Expand All @@ -75,8 +77,34 @@
label="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_LEGAL_IMAGE_EXTENSIONS_DESC"
size="50"
default="bmp,gif,jpg,jpeg,png"
showon="restrict_uploads:1"
default="bmp,gif,jpg,jpeg,png,webp"
/>

<field
name="audio_extensions"
type="text"
label="COM_MEDIA_FIELD_LEGAL_AUDIO_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_LEGAL_AUDIO_EXTENSIONS_DESC"
size="50"
default="mp3,m4a,mp4a,ogg"
/>

<field
name="video_extensions"
type="text"
label="COM_MEDIA_FIELD_LEGAL_VIDEO_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_LEGAL_VIDEO_EXTENSIONS_DESC"
size="50"
default="mp4,mp4v,mpeg,mov,webm"
/>

<field
name="doc_extensions"
type="text"
label="COM_MEDIA_FIELD_LEGAL_DOCUMENT_EXTENSIONS_LABEL"
description="COM_MEDIA_FIELD_LEGAL_DOCUMENT_EXTENSIONS_DESC"
size="50"
default="doc,odg,odp,ods,odt,pdf,png,ppt,txt,xcf,xls,csv"
/>

<field
Expand All @@ -93,7 +121,7 @@
label="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_LABEL"
description="COM_MEDIA_FIELD_LEGAL_MIME_TYPES_DESC"
size="50"
default="image/jpeg,image/gif,image/png,image/bmp,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip"
default="image/jpeg,image/gif,image/png,image/bmp,image/webp,audio/ogg,audio/mpeg,audio/mp4,video/mp4,video/mpeg,video/quicktime,video/webm,application/msword,application/excel,application/pdf,application/powerpoint,text/plain,application/x-zip"
showon="restrict_uploads:1"
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class Api {
this._csrfToken = Joomla.getOptions('csrf.token');

this.imagesExtensions = options.imagesExtensions;
this.audioExtensions = options.audioExtensions;
this.videoExtensions = options.videoExtensions;
this.documentExtensions = options.documentExtensions;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ export default {
/* Handle the on crumb click event */
onCrumbClick(crumb) {
this.navigateTo(crumb.path);
window.parent.document.dispatchEvent(
new CustomEvent(
'onMediaFileSelected',
{
bubbles: true,
cancelable: false,
detail: {},
},
),
);
},
findDrive(adapter) {
let driveObject = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
<template>
<div
class="media-browser-audio"
@dblclick="openPreview()"
@mouseleave="hideActions()"
>
<div class="media-browser-item-preview">
<div class="file-background">
<div class="file-icon">
<span class="fas fa-file-audio" />
</div>
</div>
</div>
<div class="media-browser-item-info">
{{ item.name }} {{ item.filetype }}
</div>
<span
class="media-browser-select"
:aria-label="translate('COM_MEDIA_TOGGLE_SELECT_ITEM')"
:title="translate('COM_MEDIA_TOGGLE_SELECT_ITEM')"
/>
<div
class="media-browser-actions"
:class="{'active': showActions}"
>
<button
ref="actionToggle"
type="button"
class="action-toggle"
:aria-label="translate('COM_MEDIA_OPEN_ITEM_ACTIONS')"
:title="translate('COM_MEDIA_OPEN_ITEM_ACTIONS')"
@keyup.enter="openActions()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.space="openActions()"
@keyup.down="openActions()"
@keyup.up="openLastActions()"
>
<span
class="image-browser-action icon-ellipsis-h"
aria-hidden="true"
@click.stop="openActions()"
/>
</button>
<div
v-if="showActions"
class="media-browser-actions-list"
>
<ul>
<li>
<button
ref="actionPreview"
type="button"
class="action-preview"
:aria-label="translate('COM_MEDIA_ACTION_PREVIEW')"
:title="translate('COM_MEDIA_ACTION_PREVIEW')"
@keyup.enter="openPreview()"
@keyup.space="openPreview()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.esc="hideActions()"
@keyup.up="$refs.actionDelete.focus()"
@keyup.down="$refs.actionDownload.focus()"
>
<span
class="image-browser-action icon-search-plus"
aria-hidden="true"
@click.stop="openPreview()"
/>
</button>
</li>
<li>
<button
ref="actionDownload"
type="button"
class="action-download"
:aria-label="translate('COM_MEDIA_ACTION_DOWNLOAD')"
:title="translate('COM_MEDIA_ACTION_DOWNLOAD')"
@keyup.enter="download()"
@keyup.space="download()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.esc="hideActions()"
@keyup.up="$refs.actionPreview.focus()"
@keyup.down="$refs.actionRename.focus()"
>
<span
class="image-browser-action icon-download"
aria-hidden="true"
@click.stop="download()"
/>
</button>
</li>
<li>
<button
ref="actionRename"
type="button"
class="action-rename"
:aria-label="translate('COM_MEDIA_ACTION_RENAME')"
:title="translate('COM_MEDIA_ACTION_RENAME')"
@keyup.enter="openRenameModal()"
@keyup.space="openRenameModal()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.esc="hideActions()"
@keyup.up="$refs.actionDownload.focus()"
@keyup.down="$refs.actionShare.focus()"
>
<span
class="image-browser-action icon-text-width"
aria-hidden="true"
@click.stop="openRenameModal()"
/>
</button>
</li>
<li>
<button
ref="actionShare"
type="button"
class="action-url"
:aria-label="translate('COM_MEDIA_ACTION_SHARE')"
:title="translate('COM_MEDIA_ACTION_SHARE')"
@keyup.enter="openShareUrlModal()"
@keyup.space="openShareUrlModal()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.esc="hideActions()"
@keyup.up="$refs.actionRename.focus()"
@keyup.down="$refs.actionDelete.focus()"
>
<span
class="image-browser-action icon-link"
aria-hidden="true"
@click.stop="openShareUrlModal()"
/>
</button>
</li>
<li>
<button
ref="actionDelete"
type="button"
class="action-delete"
:aria-label="translate('COM_MEDIA_ACTION_DELETE')"
:title="translate('COM_MEDIA_ACTION_DELETE')"
@keyup.enter="openConfirmDeleteModal()"
@keyup.space="openConfirmDeleteModal()"
@focus="focused(true)"
@blur="focused(false)"
@keyup.esc="hideActions()"
@keyup.up="$refs.actionShare.focus()"
@keyup.down="$refs.actionPreview.focus()"
>
<span
class="image-browser-action icon-trash"
aria-hidden="true"
@click.stop="openConfirmDeleteModal()"
/>
</button>
</li>
</ul>
</div>
</div>
</div>
</template>

<script>
import * as types from '../../../store/mutation-types.es6';

export default {
name: 'MediaBrowserItemAudio',
// eslint-disable-next-line vue/require-prop-types
props: ['item', 'focused'],
data() {
return {
showActions: false,
};
},
methods: {
/* Preview an item */
openPreview() {
this.$store.commit(types.SHOW_PREVIEW_MODAL);
this.$store.dispatch('getFullContents', this.item);
},
/* Preview an item */
download() {
this.$store.dispatch('download', this.item);
},
/* Opening confirm delete modal */
openConfirmDeleteModal() {
this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
this.$store.commit(types.SHOW_CONFIRM_DELETE_MODAL);
},
/* Rename an item */
openRenameModal() {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
this.$store.commit(types.SHOW_RENAME_MODAL);
},
/* Open modal for share url */
openShareUrlModal() {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
this.$store.commit(types.SHOW_SHARE_MODAL);
},
/* Open actions dropdown */
openActions() {
this.showActions = true;
this.$nextTick(() => this.$refs.actionPreview.focus());
},
/* Open actions dropdown and focus on last element */
openLastActions() {
this.showActions = true;
this.$nextTick(() => this.$refs.actionDelete.focus());
},
/* Hide actions dropdown */
hideActions() {
this.showActions = false;
this.$nextTick(() => this.$refs.actionToggle.focus());
},
},
};
</script>
Loading