2
0

editor-modal-media.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <template lang='pug'>
  2. v-card.editor-modal-media.animated.fadeInLeft(flat, tile)
  3. v-container.pa-3(grid-list-lg, fluid)
  4. v-layout(row, wrap)
  5. v-flex(xs12, lg9)
  6. v-card.radius-7.animated.fadeInLeft.wait-p1s(:light='!$vuetify.dark', :dark='$vuetify.dark')
  7. v-card-text
  8. .d-flex
  9. v-toolbar.radius-7(:color='$vuetify.dark ? `teal` : `teal lighten-5`', dense, flat, height='44')
  10. .body-2(:class='$vuetify.dark ? `white--text` : `teal--text`') {{$t('editor:assets.title')}}
  11. v-spacer
  12. v-btn(flat, icon, @click='refresh')
  13. v-icon(:color='$vuetify.dark ? `white` : `teal`') refresh
  14. v-dialog(v-model='newFolderDialog', max-width='550')
  15. v-btn.ml-3.my-0.mr-0.radius-7(outline, large, color='teal', :icon='$vuetify.breakpoint.xsOnly', slot='activator')
  16. v-icon(:left='$vuetify.breakpoint.mdAndUp') add
  17. span.hidden-sm-and-down(:class='$vuetify.dark ? `teal--text text--lighten-3` : ``') {{$t('editor:assets.newFolder')}}
  18. v-card.wiki-form
  19. .dialog-header.is-short {{$t('editor:assets.newFolder')}}
  20. v-card-text
  21. v-text-field.md2(
  22. outline
  23. background-color='grey lighten-3'
  24. prepend-icon='folder'
  25. v-model='newFolderName'
  26. :label='$t(`editor:assets.folderName`)'
  27. counter='255'
  28. @keyup.enter='createFolder'
  29. @keyup.esc='newFolderDialog = false'
  30. ref='folderNameIpt'
  31. )
  32. i18next.caption.grey--text.text--darken-1.pl-5(path='editor:assets.folderNameNamingRules', tag='div')
  33. a(place='namingRules', href='https://docs-beta.requarks.io/guide/assets#naming-restrictions', target='_blank') {{$t('editor:assets.folderNameNamingRulesLink')}}
  34. v-card-chin
  35. v-spacer
  36. v-btn(flat, @click='newFolderDialog = false') {{$t('common:actions.cancel')}}
  37. v-btn(color='primary', @click='createFolder', :disabled='!isFolderNameValid', :loading='newFolderLoading') {{$t('common:actions.create')}}
  38. v-toolbar(flat, dense, :color='$vuetify.dark ? `grey darken-3` : `white`')
  39. template(v-if='folderTree.length > 0')
  40. .body-2
  41. span.mr-1 /
  42. template(v-for='folder of folderTree')
  43. span(:key='folder.id') {{folder.name}}
  44. span.mx-1 /
  45. .body-2(v-else) / #[em root]
  46. template(v-if='folders.length > 0 || currentFolderId > 0')
  47. v-btn.is-icon.mx-1(:color='$vuetify.dark ? `grey lighten-1` : `grey darken-2`', outline, :dark='currentFolderId > 0', @click='upFolder()', :disabled='currentFolderId === 0')
  48. v-icon keyboard_arrow_up
  49. v-btn.btn-normalcase.mx-1(v-for='folder of folders', :key='folder.id', depressed, color='grey darken-2', dark, @click='downFolder(folder)')
  50. v-icon(left) folder
  51. span {{ folder.name }}
  52. v-divider.mt-2
  53. v-data-table(
  54. :items='assets'
  55. :headers='headers'
  56. :pagination.sync='pagination'
  57. :rows-per-page-items='[15]'
  58. :loading='loading'
  59. must-sort,
  60. hide-actions
  61. )
  62. template(slot='items', slot-scope='props')
  63. tr.is-clickable(
  64. @click.left='currentFileId = props.item.id'
  65. @click.right.prevent=''
  66. :class='currentFileId === props.item.id ? ($vuetify.dark ? `grey darken-3-d5` : `teal lighten-5`) : ``'
  67. )
  68. td.text-xs-right(v-if='$vuetify.breakpoint.smAndUp') {{ props.item.id }}
  69. td
  70. .body-2(:class='currentFileId === props.item.id ? `teal--text` : ``') {{ props.item.filename }}
  71. .caption.grey--text {{ props.item.description }}
  72. td.text-xs-center(v-if='$vuetify.breakpoint.lgAndUp')
  73. v-chip.ma-0(small, :color='$vuetify.dark ? `grey darken-4` : `grey lighten-4`')
  74. .caption {{props.item.ext.toUpperCase().substring(1)}}
  75. td(v-if='$vuetify.breakpoint.mdAndUp') {{ props.item.fileSize | prettyBytes }}
  76. td(v-if='$vuetify.breakpoint.mdAndUp') {{ props.item.createdAt | moment('from') }}
  77. td(v-if='$vuetify.breakpoint.smAndUp')
  78. v-menu(offset-x)
  79. v-btn.ma-0(icon, slot='activator')
  80. v-icon(color='grey darken-2') more_horiz
  81. v-list.py-0(style='border-top: 5px solid #444;')
  82. v-list-tile(@click='', disabled)
  83. v-list-tile-avatar
  84. v-icon(color='teal') short_text
  85. v-list-tile-content {{$t('common:actions.properties')}}
  86. v-divider
  87. template(v-if='props.item.kind === `IMAGE`')
  88. v-list-tile(@click='previewDialog = true', disabled)
  89. v-list-tile-avatar
  90. v-icon(color='green') image_search
  91. v-list-tile-content {{$t('common:actions.preview')}}
  92. v-divider
  93. v-list-tile(@click='', disabled)
  94. v-list-tile-avatar
  95. v-icon(color='indigo') crop_rotate
  96. v-list-tile-content {{$t('common:actions.edit')}}
  97. v-divider
  98. v-list-tile(@click='', disabled)
  99. v-list-tile-avatar
  100. v-icon(color='purple') offline_bolt
  101. v-list-tile-content {{$t('common:actions.optimize')}}
  102. v-divider
  103. v-list-tile(@click='openRenameDialog')
  104. v-list-tile-avatar
  105. v-icon(color='orange') keyboard
  106. v-list-tile-content {{$t('common:actions.rename')}}
  107. v-divider
  108. v-list-tile(@click='', disabled)
  109. v-list-tile-avatar
  110. v-icon(color='blue') forward
  111. v-list-tile-content {{$t('common:actions.move')}}
  112. v-divider
  113. v-list-tile(@click='deleteDialog = true')
  114. v-list-tile-avatar
  115. v-icon(color='red') delete
  116. v-list-tile-content {{$t('common:actions.delete')}}
  117. template(slot='no-data')
  118. v-alert.mt-3.radius-7(icon='folder_open', :value='true', outline, color='teal') {{$t('editor:assets.folderEmpty')}}
  119. .text-xs-center.py-2(v-if='this.pageTotal > 1')
  120. v-pagination(v-model='pagination.page', :length='pageTotal')
  121. .d-flex.mt-3
  122. v-toolbar.radius-7(flat, :color='$vuetify.dark ? `grey darken-2` : `grey lighten-4`', dense, height='44')
  123. .body-1(:class='$vuetify.dark ? `grey--text text--lighten-1` : `grey--text text--darken-1`') {{$t('editor:assets.fileCount', { count: assets.length })}}
  124. v-btn.ml-3.mr-0.my-0.radius-7(color='teal', large, @click='insert', :disabled='!currentFileId', :dark='currentFileId !== null')
  125. v-icon(left) save_alt
  126. span {{$t('common:actions.insert')}}
  127. v-flex(xs12, lg3)
  128. v-card.radius-7.animated.fadeInRight.wait-p3s(:light='!$vuetify.dark', :dark='$vuetify.dark')
  129. v-card-text
  130. .d-flex
  131. v-toolbar.radius-7(:color='$vuetify.dark ? `teal` : `teal lighten-5`', dense, flat, height='44')
  132. v-icon.mr-3(:color='$vuetify.dark ? `white` : `teal`') cloud_upload
  133. .body-2(:class='$vuetify.dark ? `white--text` : `teal--text`') {{$t('editor:assets.uploadAssets')}}
  134. v-btn.my-0.ml-3.mr-0.radius-7(outline, large, color='teal', @click='browse', v-if='$vuetify.breakpoint.mdAndUp')
  135. v-icon(left) touch_app
  136. span(:class='$vuetify.dark ? `teal--text text--lighten-3` : ``') {{$t('common:actions.browse')}}
  137. file-pond.mt-3(
  138. name='mediaUpload'
  139. ref='pond'
  140. :label-idle='$t(`editor:assets.uploadAssetsDropZone`)'
  141. allow-multiple='true'
  142. :files='files'
  143. max-files='10'
  144. server='/u'
  145. :instant-upload='false'
  146. :allow-revert='false'
  147. @processfile='onFileProcessed'
  148. )
  149. v-divider
  150. v-card-actions.pa-3
  151. .caption.grey--text.text-darken-2 Max 10 files, 5 MB each
  152. v-spacer
  153. v-btn(color='teal', dark, @click='upload') {{$t('common:actions.upload')}}
  154. v-card.mt-3.radius-7.animated.fadeInRight.wait-p4s(:light='!$vuetify.dark', :dark='$vuetify.dark')
  155. v-card-text.pb-0
  156. v-toolbar.radius-7(:color='$vuetify.dark ? `teal` : `teal lighten-5`', dense, flat)
  157. v-icon.mr-3(:color='$vuetify.dark ? `white` : `teal`') cloud_download
  158. .body-2(:class='$vuetify.dark ? `white--text` : `teal--text`') {{$t('editor:assets.fetchImage')}}
  159. v-spacer
  160. v-chip(label, color='white', small).teal--text coming soon
  161. v-text-field.mt-3(
  162. v-model='remoteImageUrl'
  163. outline
  164. single-line
  165. background-color='grey lighten-2'
  166. placeholder='https://example.com/image.jpg'
  167. )
  168. v-divider
  169. v-card-actions.pa-3
  170. .caption.grey--text.text-darken-2 Max 5 MB
  171. v-spacer
  172. v-btn(color='teal', disabled) {{$t('common:actions.fetch')}}
  173. v-card.mt-3.radius-7.animated.fadeInRight.wait-p4s(:light='!$vuetify.dark', :dark='$vuetify.dark')
  174. v-card-text.pb-0
  175. v-toolbar.radius-7(:color='$vuetify.dark ? `teal` : `teal lighten-5`', dense, flat)
  176. v-icon.mr-3(:color='$vuetify.dark ? `white` : `teal`') format_align_left
  177. .body-2(:class='$vuetify.dark ? `white--text` : `teal--text`') {{$t('editor:assets.imageAlign')}}
  178. v-select.mt-3(
  179. v-model='imageAlignment'
  180. :items='imageAlignments'
  181. outline
  182. single-line
  183. background-color='grey lighten-2'
  184. placeholder='None'
  185. )
  186. //- RENAME DIALOG
  187. v-dialog(v-model='renameDialog', max-width='550', persistent)
  188. v-card.wiki-form
  189. .dialog-header.is-short.is-orange
  190. v-icon.mr-2(color='white') keyboard
  191. span {{$t('editor:assets.renameAsset')}}
  192. v-card-text
  193. .body-2 {{$t('editor:assets.renameAssetSubtitle')}}
  194. v-text-field(
  195. outline
  196. single-line
  197. :counter='255'
  198. v-model='renameAssetName'
  199. @keyup.enter='renameAsset'
  200. :disabled='renameAssetLoading'
  201. )
  202. v-card-chin
  203. v-spacer
  204. v-btn(flat, @click='renameDialog = false', :disabled='renameAssetLoading') {{$t('common:actions.cancel')}}
  205. v-btn(color='orange darken-3', @click='renameAsset', :loading='renameAssetLoading').white--text {{$t('common:actions.rename')}}
  206. //- DELETE DIALOG
  207. v-dialog(v-model='deleteDialog', max-width='550', persistent)
  208. v-card.wiki-form
  209. .dialog-header.is-short.is-red
  210. v-icon.mr-2(color='white') highlight_off
  211. span {{$t('editor:assets.deleteAsset')}}
  212. v-card-text
  213. .body-2 {{$t('editor:assets.deleteAssetConfirm')}}
  214. .body-2.red--text.text--darken-2 {{currentAsset.filename}}?
  215. .caption.mt-3 {{$t('editor:assets.deleteAssetWarn')}}
  216. v-card-chin
  217. v-spacer
  218. v-btn(flat, @click='deleteDialog = false', :disabled='deleteAssetLoading') {{$t('common:actions.cancel')}}
  219. v-btn(color='red darken-2', @click='deleteAsset', :loading='deleteAssetLoading').white--text {{$t('common:actions.delete')}}
  220. </template>
  221. <script>
  222. import _ from 'lodash'
  223. import { get, sync } from 'vuex-pathify'
  224. import vueFilePond from 'vue-filepond'
  225. import 'filepond/dist/filepond.min.css'
  226. import listAssetQuery from 'gql/editor/editor-media-query-list.gql'
  227. import listFolderAssetQuery from 'gql/editor/editor-media-query-folder-list.gql'
  228. import createAssetFolderMutation from 'gql/editor/editor-media-mutation-folder-create.gql'
  229. import renameAssetMutation from 'gql/editor/editor-media-mutation-asset-rename.gql'
  230. import deleteAssetMutation from 'gql/editor/editor-media-mutation-asset-delete.gql'
  231. const FilePond = vueFilePond()
  232. const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i
  233. const disallowedFolderChars = /[A-Z()=.!@#$%?&*+`~<>,;:\\/[\]¬{| ]/
  234. export default {
  235. components: {
  236. FilePond
  237. },
  238. props: {
  239. value: {
  240. type: Boolean,
  241. default: false
  242. }
  243. },
  244. data() {
  245. return {
  246. folders: [],
  247. files: [],
  248. assets: [],
  249. pagination: {},
  250. remoteImageUrl: '',
  251. imageAlignments: [
  252. { text: 'None', value: '' },
  253. { text: 'Left', value: 'left' },
  254. { text: 'Centered', value: 'center' },
  255. { text: 'Right', value: 'right' },
  256. { text: 'Absolute Top Right', value: 'abstopright' }
  257. ],
  258. imageAlignment: '',
  259. loading: false,
  260. newFolderDialog: false,
  261. newFolderName: '',
  262. newFolderLoading: false,
  263. previewDialog: false,
  264. renameDialog: false,
  265. renameAssetName: '',
  266. renameAssetLoading: false,
  267. deleteDialog: false,
  268. deleteAssetLoading: false
  269. }
  270. },
  271. computed: {
  272. isShown: {
  273. get() { return this.value },
  274. set(val) { this.$emit('input', val) }
  275. },
  276. activeModal: sync('editor/activeModal'),
  277. folderTree: get('editor/media@folderTree'),
  278. currentFolderId: sync('editor/media@currentFolderId'),
  279. currentFileId: sync('editor/media@currentFileId'),
  280. pageTotal () {
  281. if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) {
  282. return 0
  283. }
  284. return Math.ceil(this.assets.length / this.pagination.rowsPerPage)
  285. },
  286. headers() {
  287. return _.compact([
  288. this.$vuetify.breakpoint.smAndUp && { text: this.$t('editor:assets.headerId'), value: 'id', width: 50, align: 'right' },
  289. { text: this.$t('editor:assets.headerFilename'), value: 'filename' },
  290. this.$vuetify.breakpoint.lgAndUp && { text: this.$t('editor:assets.headerType'), value: 'ext', width: 50 },
  291. this.$vuetify.breakpoint.mdAndUp && { text: this.$t('editor:assets.headerFileSize'), value: 'fileSize', width: 110 },
  292. this.$vuetify.breakpoint.mdAndUp && { text: this.$t('editor:assets.headerAdded'), value: 'createdAt', width: 175 },
  293. this.$vuetify.breakpoint.smAndUp && { text: this.$t('editor:assets.headerActions'), value: '', width: 40, sortable: false, align: 'right' }
  294. ])
  295. },
  296. isFolderNameValid() {
  297. return this.newFolderName.length > 1 && !localeSegmentRegex.test(this.newFolderName) && !disallowedFolderChars.test(this.newFolderName)
  298. },
  299. currentAsset () {
  300. return _.find(this.assets, ['id', this.currentFileId]) || {}
  301. }
  302. },
  303. watch: {
  304. newFolderDialog(newValue, oldValue) {
  305. if (newValue) {
  306. this.$nextTick(() => {
  307. this.$refs.folderNameIpt.focus()
  308. })
  309. }
  310. }
  311. },
  312. filters: {
  313. prettyBytes(num) {
  314. if (typeof num !== 'number' || isNaN(num)) {
  315. throw new TypeError('Expected a number')
  316. }
  317. let exponent
  318. let unit
  319. let neg = num < 0
  320. let units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
  321. if (neg) {
  322. num = -num
  323. }
  324. if (num < 1) {
  325. return (neg ? '-' : '') + num + ' B'
  326. }
  327. exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
  328. num = (num / Math.pow(1000, exponent)).toFixed(2) * 1
  329. unit = units[exponent]
  330. return (neg ? '-' : '') + num + ' ' + unit
  331. }
  332. },
  333. methods: {
  334. async refresh() {
  335. await this.$apollo.queries.assets.refetch()
  336. this.$store.commit('showNotification', {
  337. message: this.$t('editor:assets.refreshSuccess'),
  338. style: 'success',
  339. icon: 'check'
  340. })
  341. },
  342. insert () {
  343. const asset = _.find(this.assets, ['id', this.currentFileId])
  344. const assetPath = this.folderTree.map(f => f.slug).join('/')
  345. this.$root.$emit('editorInsert', {
  346. kind: asset.kind,
  347. path: this.currentFolderId > 0 ? `/${assetPath}/${asset.filename}` : `/${asset.filename}`,
  348. text: asset.filename,
  349. align: this.imageAlignment
  350. })
  351. this.activeModal = ''
  352. },
  353. browse () {
  354. this.$refs.pond.browse()
  355. },
  356. async upload () {
  357. const files = this.$refs.pond.getFiles()
  358. if (files.length < 1) {
  359. return this.$store.commit('showNotification', {
  360. message: this.$t('editor:assets.noUploadError'),
  361. style: 'warning',
  362. icon: 'warning'
  363. })
  364. }
  365. for (let file of files) {
  366. file.setMetadata({
  367. folderId: this.currentFolderId
  368. })
  369. }
  370. await this.$refs.pond.processFiles()
  371. },
  372. async onFileProcessed (err, file) {
  373. if (err) {
  374. return this.$store.commit('showNotification', {
  375. message: this.$t('editor:assets.uploadFailed'),
  376. style: 'error',
  377. icon: 'error'
  378. })
  379. }
  380. _.delay(() => {
  381. this.$refs.pond.removeFile(file.id)
  382. }, 5000)
  383. await this.$apollo.queries.assets.refetch()
  384. },
  385. downFolder(folder) {
  386. this.$store.commit('editor/pushMediaFolderTree', folder)
  387. this.currentFolderId = folder.id
  388. this.currentFileId = null
  389. },
  390. upFolder() {
  391. this.$store.commit('editor/popMediaFolderTree')
  392. const parentFolder = _.last(this.folderTree)
  393. this.currentFolderId = parentFolder ? parentFolder.id : 0
  394. this.currentFileId = null
  395. },
  396. async createFolder() {
  397. this.$store.commit(`loadingStart`, 'editor-media-createfolder')
  398. this.newFolderLoading = true
  399. try {
  400. const resp = await this.$apollo.mutate({
  401. mutation: createAssetFolderMutation,
  402. variables: {
  403. parentFolderId: this.currentFolderId,
  404. slug: this.newFolderName
  405. }
  406. })
  407. if (_.get(resp, 'data.assets.createFolder.responseResult.succeeded', false)) {
  408. await this.$apollo.queries.folders.refetch()
  409. this.$store.commit('showNotification', {
  410. message: this.$t('editor:assets.folderCreateSuccess'),
  411. style: 'success',
  412. icon: 'check'
  413. })
  414. this.newFolderDialog = false
  415. this.newFolderName = ''
  416. } else {
  417. this.$store.commit('pushGraphError', new Error(_.get(resp, 'data.assets.createFolder.responseResult.message')))
  418. }
  419. } catch (err) {
  420. this.$store.commit('pushGraphError', err)
  421. }
  422. this.newFolderLoading = false
  423. this.$store.commit(`loadingStop`, 'editor-media-createfolder')
  424. },
  425. openRenameDialog() {
  426. this.renameAssetName = this.currentAsset.filename
  427. this.renameDialog = true
  428. },
  429. async renameAsset() {
  430. this.$store.commit(`loadingStart`, 'editor-media-renameasset')
  431. this.renameAssetLoading = true
  432. try {
  433. const resp = await this.$apollo.mutate({
  434. mutation: renameAssetMutation,
  435. variables: {
  436. id: this.currentFileId,
  437. filename: this.renameAssetName
  438. }
  439. })
  440. if (_.get(resp, 'data.assets.renameAsset.responseResult.succeeded', false)) {
  441. await this.$apollo.queries.assets.refetch()
  442. this.$store.commit('showNotification', {
  443. message: this.$t('editor:assets.renameSuccess'),
  444. style: 'success',
  445. icon: 'check'
  446. })
  447. this.renameDialog = false
  448. this.renameAssetName = ''
  449. } else {
  450. this.$store.commit('pushGraphError', new Error(_.get(resp, 'data.assets.renameAsset.responseResult.message')))
  451. }
  452. } catch (err) {
  453. this.$store.commit('pushGraphError', err)
  454. }
  455. this.renameAssetLoading = false
  456. this.$store.commit(`loadingStop`, 'editor-media-renameasset')
  457. },
  458. async deleteAsset() {
  459. this.$store.commit(`loadingStart`, 'editor-media-deleteasset')
  460. this.deleteAssetLoading = true
  461. try {
  462. const resp = await this.$apollo.mutate({
  463. mutation: deleteAssetMutation,
  464. variables: {
  465. id: this.currentFileId
  466. }
  467. })
  468. if (_.get(resp, 'data.assets.deleteAsset.responseResult.succeeded', false)) {
  469. this.currentFileId = null
  470. await this.$apollo.queries.assets.refetch()
  471. this.$store.commit('showNotification', {
  472. message: this.$t('editor:assets.deleteSuccess'),
  473. style: 'success',
  474. icon: 'check'
  475. })
  476. this.deleteDialog = false
  477. } else {
  478. this.$store.commit('pushGraphError', new Error(_.get(resp, 'data.assets.deleteAsset.responseResult.message')))
  479. }
  480. } catch (err) {
  481. this.$store.commit('pushGraphError', err)
  482. }
  483. this.deleteAssetLoading = false
  484. this.$store.commit(`loadingStop`, 'editor-media-deleteasset')
  485. }
  486. },
  487. apollo: {
  488. folders: {
  489. query: listFolderAssetQuery,
  490. variables() {
  491. return {
  492. parentFolderId: this.currentFolderId
  493. }
  494. },
  495. fetchPolicy: 'network-only',
  496. update: (data) => data.assets.folders,
  497. watchLoading (isLoading) {
  498. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-folders-list-refresh')
  499. }
  500. },
  501. assets: {
  502. query: listAssetQuery,
  503. variables() {
  504. return {
  505. folderId: this.currentFolderId,
  506. kind: 'ALL'
  507. }
  508. },
  509. throttle: 1000,
  510. fetchPolicy: 'network-only',
  511. update: (data) => data.assets.list,
  512. watchLoading (isLoading) {
  513. this.loading = isLoading
  514. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-list-refresh')
  515. }
  516. }
  517. }
  518. }
  519. </script>
  520. <style lang='scss'>
  521. .editor-modal-media {
  522. position: fixed;
  523. top: 112px;
  524. left: 64px;
  525. z-index: 10;
  526. width: calc(100vw - 64px - 17px);
  527. height: calc(100vh - 112px - 24px);
  528. background-color: rgba(darken(mc('grey', '900'), 3%), .9) !important;
  529. overflow: auto;
  530. @include until($tablet) {
  531. left: 40px;
  532. width: calc(100vw - 40px);
  533. height: calc(100vh - 112px - 24px);
  534. }
  535. .filepond--root {
  536. margin-bottom: 0;
  537. }
  538. .filepond--drop-label {
  539. cursor: pointer;
  540. > label {
  541. cursor: pointer;
  542. }
  543. }
  544. .v-btn--icon {
  545. padding: 0 20px;
  546. }
  547. }
  548. </style>