You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

629 lines
25 KiB

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