зеркало из https://github.com/nextcloud/text.git
♻️ (#2463): remove duplicated code
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
This commit is contained in:
Родитель
5abdf58b48
Коммит
f2c95d14cb
|
@ -43,6 +43,7 @@
|
|||
<script>
|
||||
import { getCurrentUser } from '@nextcloud/auth'
|
||||
import { showError } from '@nextcloud/dialogs'
|
||||
import { mimetypesImages as IMAGE_MIMES } from '../helpers/mime.js'
|
||||
|
||||
import {
|
||||
useEditorMixin,
|
||||
|
@ -56,18 +57,6 @@ import {
|
|||
STATE_UPLOADING,
|
||||
} from './EditorMediaHandler.provider.js'
|
||||
|
||||
const IMAGE_MIMES = [
|
||||
'image/png',
|
||||
'image/jpeg',
|
||||
'image/jpg',
|
||||
'image/gif',
|
||||
'image/x-xbitmap',
|
||||
'image/x-ms-bmp',
|
||||
'image/bmp',
|
||||
'image/svg+xml',
|
||||
'image/webp',
|
||||
]
|
||||
|
||||
export default {
|
||||
name: 'EditorMediaHandler',
|
||||
mixins: [useEditorMixin, useFileMixin, useSyncServiceMixin],
|
||||
|
|
|
@ -20,6 +20,18 @@
|
|||
*
|
||||
*/
|
||||
|
||||
const mimetypesImages = [
|
||||
'image/png',
|
||||
'image/jpeg',
|
||||
'image/jpg',
|
||||
'image/gif',
|
||||
'image/x-xbitmap',
|
||||
'image/x-ms-bmp',
|
||||
'image/bmp',
|
||||
'image/svg+xml',
|
||||
'image/webp',
|
||||
]
|
||||
|
||||
const openMimetypesMarkdown = [
|
||||
'text/markdown',
|
||||
]
|
||||
|
@ -55,6 +67,7 @@ if (!window.oc_appswebroots?.richdocuments && !window.oc_appswebroots?.onlyoffic
|
|||
const openMimetypes = [...openMimetypesMarkdown, ...openMimetypesPlainText]
|
||||
|
||||
export {
|
||||
mimetypesImages,
|
||||
openMimetypes,
|
||||
openMimetypesMarkdown,
|
||||
openMimetypesPlainText,
|
||||
|
|
|
@ -87,22 +87,11 @@
|
|||
import { generateUrl } from '@nextcloud/router'
|
||||
import { NodeViewWrapper } from '@tiptap/vue-2'
|
||||
import ClickOutside from 'vue-click-outside'
|
||||
// import TrashCanIcon from 'vue-material-design-icons/TrashCan.vue'
|
||||
import { Image as ImageIcon, TrashCan } from '../components/icons.js'
|
||||
import store from './../mixins/store.js'
|
||||
import { useImageResolver } from './../components/EditorWrapper.provider.js'
|
||||
|
||||
const imageMimes = [
|
||||
'image/png',
|
||||
'image/jpeg',
|
||||
'image/jpg',
|
||||
'image/gif',
|
||||
'image/x-xbitmap',
|
||||
'image/x-ms-bmp',
|
||||
'image/bmp',
|
||||
'image/svg+xml',
|
||||
'image/webp',
|
||||
]
|
||||
import { mimetypesImages as IMAGE_MIMES } from '../helpers/mime.js'
|
||||
|
||||
const getQueryVariable = (src, variable) => {
|
||||
const query = src.split('?')[1]
|
||||
|
@ -172,9 +161,8 @@ export default {
|
|||
return getQueryVariable(this.src, 'fileId')
|
||||
},
|
||||
isSupportedImage() {
|
||||
const mime = getQueryVariable(this.src, 'mimetype')
|
||||
return typeof mime === 'undefined'
|
||||
|| imageMimes.indexOf(mime) !== -1
|
||||
return typeof this.mime === 'undefined'
|
||||
|| IMAGE_MIMES.indexOf(this.mime) !== -1
|
||||
},
|
||||
internalLinkOrImage() {
|
||||
if (this.imageFileId) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче