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.

617 lines
24 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)
  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='/u'
  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 vueFilePond from 'vue-filepond'
  226. import 'filepond/dist/filepond.min.css'
  227. import listAssetQuery from 'gql/editor/editor-media-query-list.gql'
  228. import listFolderAssetQuery from 'gql/editor/editor-media-query-folder-list.gql'
  229. import createAssetFolderMutation from 'gql/editor/editor-media-mutation-folder-create.gql'
  230. import renameAssetMutation from 'gql/editor/editor-media-mutation-asset-rename.gql'
  231. import deleteAssetMutation from 'gql/editor/editor-media-mutation-asset-delete.gql'
  232. const FilePond = vueFilePond()
  233. const localeSegmentRegex = /^[A-Z]{2}(-[A-Z]{2})?$/i
  234. const disallowedFolderChars = /[A-Z()=.!@#$%?&*+`~<>,;:\\/[\]¬{| ]/
  235. export default {
  236. components: {
  237. FilePond
  238. },
  239. props: {
  240. value: {
  241. type: Boolean,
  242. default: false
  243. }
  244. },
  245. data() {
  246. return {
  247. folders: [],
  248. files: [],
  249. assets: [],
  250. pagination: 1,
  251. remoteImageUrl: '',
  252. imageAlignments: [
  253. { text: 'None', value: '' },
  254. { text: 'Left', value: 'left' },
  255. { text: 'Centered', value: 'center' },
  256. { text: 'Right', value: 'right' },
  257. { text: 'Absolute Top Right', value: 'abstopright' }
  258. ],
  259. imageAlignment: '',
  260. loading: false,
  261. newFolderDialog: false,
  262. newFolderName: '',
  263. newFolderLoading: false,
  264. previewDialog: false,
  265. renameDialog: false,
  266. renameAssetName: '',
  267. renameAssetLoading: false,
  268. deleteDialog: false,
  269. deleteAssetLoading: false
  270. }
  271. },
  272. computed: {
  273. isShown: {
  274. get() { return this.value },
  275. set(val) { this.$emit('input', val) }
  276. },
  277. editorKey: get('editor/editorKey'),
  278. activeModal: sync('editor/activeModal'),
  279. folderTree: get('editor/media@folderTree'),
  280. currentFolderId: sync('editor/media@currentFolderId'),
  281. currentFileId: sync('editor/media@currentFileId'),
  282. pageTotal () {
  283. if (!this.assets) {
  284. return 0
  285. }
  286. return Math.ceil(this.assets.length / 15)
  287. },
  288. headers() {
  289. return _.compact([
  290. this.$vuetify.breakpoint.smAndUp && { text: this.$t('editor:assets.headerId'), value: 'id', width: 80 },
  291. { text: this.$t('editor:assets.headerFilename'), value: 'filename' },
  292. this.$vuetify.breakpoint.lgAndUp && { text: this.$t('editor:assets.headerType'), value: 'ext', width: 90 },
  293. this.$vuetify.breakpoint.mdAndUp && { text: this.$t('editor:assets.headerFileSize'), value: 'fileSize', width: 110 },
  294. this.$vuetify.breakpoint.mdAndUp && { text: this.$t('editor:assets.headerAdded'), value: 'createdAt', width: 175 },
  295. this.$vuetify.breakpoint.smAndUp && { text: this.$t('editor:assets.headerActions'), value: '', width: 80, sortable: false, align: 'right' }
  296. ])
  297. },
  298. isFolderNameValid() {
  299. return this.newFolderName.length > 1 && !localeSegmentRegex.test(this.newFolderName) && !disallowedFolderChars.test(this.newFolderName)
  300. },
  301. currentAsset () {
  302. return _.find(this.assets, ['id', this.currentFileId]) || {}
  303. }
  304. },
  305. watch: {
  306. newFolderDialog(newValue, oldValue) {
  307. if (newValue) {
  308. this.$nextTick(() => {
  309. this.$refs.folderNameIpt.focus()
  310. })
  311. }
  312. }
  313. },
  314. filters: {
  315. prettyBytes(num) {
  316. if (typeof num !== 'number' || isNaN(num)) {
  317. throw new TypeError('Expected a number')
  318. }
  319. let exponent
  320. let unit
  321. let neg = num < 0
  322. let units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
  323. if (neg) {
  324. num = -num
  325. }
  326. if (num < 1) {
  327. return (neg ? '-' : '') + num + ' B'
  328. }
  329. exponent = Math.min(Math.floor(Math.log(num) / Math.log(1000)), units.length - 1)
  330. num = (num / Math.pow(1000, exponent)).toFixed(2) * 1
  331. unit = units[exponent]
  332. return (neg ? '-' : '') + num + ' ' + unit
  333. }
  334. },
  335. methods: {
  336. async refresh() {
  337. await this.$apollo.queries.assets.refetch()
  338. this.$store.commit('showNotification', {
  339. message: this.$t('editor:assets.refreshSuccess'),
  340. style: 'success',
  341. icon: 'check'
  342. })
  343. },
  344. insert () {
  345. const asset = _.find(this.assets, ['id', this.currentFileId])
  346. const assetPath = this.folderTree.map(f => f.slug).join('/')
  347. this.$root.$emit('editorInsert', {
  348. kind: asset.kind,
  349. path: this.currentFolderId > 0 ? `/${assetPath}/${asset.filename}` : `/${asset.filename}`,
  350. text: asset.filename,
  351. align: this.imageAlignment
  352. })
  353. this.activeModal = ''
  354. },
  355. browse () {
  356. this.$refs.pond.browse()
  357. },
  358. async upload () {
  359. const files = this.$refs.pond.getFiles()
  360. if (files.length < 1) {
  361. return this.$store.commit('showNotification', {
  362. message: this.$t('editor:assets.noUploadError'),
  363. style: 'warning',
  364. icon: 'warning'
  365. })
  366. }
  367. for (let file of files) {
  368. file.setMetadata({
  369. folderId: this.currentFolderId
  370. })
  371. }
  372. await this.$refs.pond.processFiles()
  373. },
  374. async onFileProcessed (err, file) {
  375. if (err) {
  376. return this.$store.commit('showNotification', {
  377. message: this.$t('editor:assets.uploadFailed'),
  378. style: 'error',
  379. icon: 'error'
  380. })
  381. }
  382. _.delay(() => {
  383. this.$refs.pond.removeFile(file.id)
  384. }, 5000)
  385. await this.$apollo.queries.assets.refetch()
  386. },
  387. downFolder(folder) {
  388. this.$store.commit('editor/pushMediaFolderTree', folder)
  389. this.currentFolderId = folder.id
  390. this.currentFileId = null
  391. },
  392. upFolder() {
  393. this.$store.commit('editor/popMediaFolderTree')
  394. const parentFolder = _.last(this.folderTree)
  395. this.currentFolderId = parentFolder ? parentFolder.id : 0
  396. this.currentFileId = null
  397. },
  398. async createFolder() {
  399. this.$store.commit(`loadingStart`, 'editor-media-createfolder')
  400. this.newFolderLoading = true
  401. try {
  402. const resp = await this.$apollo.mutate({
  403. mutation: createAssetFolderMutation,
  404. variables: {
  405. parentFolderId: this.currentFolderId,
  406. slug: this.newFolderName
  407. }
  408. })
  409. if (_.get(resp, 'data.assets.createFolder.responseResult.succeeded', false)) {
  410. await this.$apollo.queries.folders.refetch()
  411. this.$store.commit('showNotification', {
  412. message: this.$t('editor:assets.folderCreateSuccess'),
  413. style: 'success',
  414. icon: 'check'
  415. })
  416. this.newFolderDialog = false
  417. this.newFolderName = ''
  418. } else {
  419. this.$store.commit('pushGraphError', new Error(_.get(resp, 'data.assets.createFolder.responseResult.message')))
  420. }
  421. } catch (err) {
  422. this.$store.commit('pushGraphError', err)
  423. }
  424. this.newFolderLoading = false
  425. this.$store.commit(`loadingStop`, 'editor-media-createfolder')
  426. },
  427. openRenameDialog() {
  428. this.renameAssetName = this.currentAsset.filename
  429. this.renameDialog = true
  430. },
  431. async renameAsset() {
  432. this.$store.commit(`loadingStart`, 'editor-media-renameasset')
  433. this.renameAssetLoading = true
  434. try {
  435. const resp = await this.$apollo.mutate({
  436. mutation: renameAssetMutation,
  437. variables: {
  438. id: this.currentFileId,
  439. filename: this.renameAssetName
  440. }
  441. })
  442. if (_.get(resp, 'data.assets.renameAsset.responseResult.succeeded', false)) {
  443. await this.$apollo.queries.assets.refetch()
  444. this.$store.commit('showNotification', {
  445. message: this.$t('editor:assets.renameSuccess'),
  446. style: 'success',
  447. icon: 'check'
  448. })
  449. this.renameDialog = false
  450. this.renameAssetName = ''
  451. } else {
  452. this.$store.commit('pushGraphError', new Error(_.get(resp, 'data.assets.renameAsset.responseResult.message')))
  453. }
  454. } catch (err) {
  455. this.$store.commit('pushGraphError', err)
  456. }
  457. this.renameAssetLoading = false
  458. this.$store.commit(`loadingStop`, 'editor-media-renameasset')
  459. },
  460. async deleteAsset() {
  461. this.$store.commit(`loadingStart`, 'editor-media-deleteasset')
  462. this.deleteAssetLoading = true
  463. try {
  464. const resp = await this.$apollo.mutate({
  465. mutation: deleteAssetMutation,
  466. variables: {
  467. id: this.currentFileId
  468. }
  469. })
  470. if (_.get(resp, 'data.assets.deleteAsset.responseResult.succeeded', false)) {
  471. this.currentFileId = null
  472. await this.$apollo.queries.assets.refetch()
  473. this.$store.commit('showNotification', {
  474. message: this.$t('editor:assets.deleteSuccess'),
  475. style: 'success',
  476. icon: 'check'
  477. })
  478. this.deleteDialog = false
  479. } else {
  480. this.$store.commit('pushGraphError', new Error(_.get(resp, 'data.assets.deleteAsset.responseResult.message')))
  481. }
  482. } catch (err) {
  483. this.$store.commit('pushGraphError', err)
  484. }
  485. this.deleteAssetLoading = false
  486. this.$store.commit(`loadingStop`, 'editor-media-deleteasset')
  487. },
  488. cancel () {
  489. this.activeModal = ''
  490. }
  491. },
  492. apollo: {
  493. folders: {
  494. query: listFolderAssetQuery,
  495. variables() {
  496. return {
  497. parentFolderId: this.currentFolderId
  498. }
  499. },
  500. fetchPolicy: 'network-only',
  501. update: (data) => data.assets.folders,
  502. watchLoading (isLoading) {
  503. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-folders-list-refresh')
  504. }
  505. },
  506. assets: {
  507. query: listAssetQuery,
  508. variables() {
  509. return {
  510. folderId: this.currentFolderId,
  511. kind: 'ALL'
  512. }
  513. },
  514. throttle: 1000,
  515. fetchPolicy: 'network-only',
  516. update: (data) => data.assets.list,
  517. watchLoading (isLoading) {
  518. this.loading = isLoading
  519. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'editor-media-list-refresh')
  520. }
  521. }
  522. }
  523. }
  524. </script>
  525. <style lang='scss'>
  526. .editor-modal-media {
  527. position: fixed !important;
  528. top: 112px;
  529. left: 64px;
  530. z-index: 10;
  531. width: calc(100vw - 64px - 17px);
  532. height: calc(100vh - 112px - 24px);
  533. background-color: rgba(darken(mc('grey', '900'), 3%), .9) !important;
  534. overflow: auto;
  535. @include until($tablet) {
  536. left: 40px;
  537. width: calc(100vw - 40px);
  538. height: calc(100vh - 112px - 24px);
  539. }
  540. &.is-editor-ckeditor {
  541. top: 64px;
  542. left: 0;
  543. width: 100%;
  544. height: calc(100vh - 64px - 26px);
  545. @include until($tablet) {
  546. top: 56px;
  547. left: 0;
  548. width: 100%;
  549. height: calc(100vh - 56px - 24px);
  550. }
  551. }
  552. &.is-editor-code {
  553. top: 64px;
  554. height: calc(100vh - 64px - 26px);
  555. @include until($tablet) {
  556. top: 56px;
  557. height: calc(100vh - 56px - 24px);
  558. }
  559. }
  560. &.is-editor-common {
  561. top: 64px;
  562. left: 0;
  563. width: 100%;
  564. height: calc(100vh - 64px);
  565. @include until($tablet) {
  566. top: 56px;
  567. left: 0;
  568. width: 100%;
  569. height: calc(100vh - 56px);
  570. }
  571. }
  572. .filepond--root {
  573. margin-bottom: 0;
  574. }
  575. .filepond--drop-label {
  576. cursor: pointer;
  577. > label {
  578. cursor: pointer;
  579. }
  580. }
  581. .filepond--file-action-button.filepond--action-process-item {
  582. display: none;
  583. }
  584. .v-btn--icon {
  585. padding: 0 20px;
  586. }
  587. }
  588. </style>