feat: implement image uploading for mdeditor in modrt. checklist (#5361)
* feat: implement image uploading for markdowneditor in checklist * fix: lint
This commit is contained in:
@@ -148,6 +148,7 @@
|
||||
placeholder="No message generated."
|
||||
:disabled="false"
|
||||
:heading-buttons="false"
|
||||
:on-image-upload="onUploadHandler"
|
||||
/>
|
||||
<StyledInput
|
||||
v-else
|
||||
@@ -288,6 +289,7 @@
|
||||
:max-height="300"
|
||||
:disabled="false"
|
||||
:heading-buttons="false"
|
||||
:on-image-upload="onUploadHandler"
|
||||
@input="persistState"
|
||||
/>
|
||||
</template>
|
||||
@@ -482,6 +484,7 @@ import {
|
||||
import { computedAsync, useDebounceFn, useLocalStorage } from '@vueuse/core'
|
||||
|
||||
import { useGeneratedState } from '~/composables/generated'
|
||||
import { useImageUpload } from '~/composables/image-upload.ts'
|
||||
import { getProjectTypeForUrlShorthand } from '~/helpers/projects.js'
|
||||
import { useModerationStore } from '~/store/moderation.ts'
|
||||
|
||||
@@ -675,6 +678,14 @@ const isModpackPermissionsStage = computed(() => {
|
||||
return currentStageObj.value.id === 'modpack-permissions'
|
||||
})
|
||||
|
||||
async function onUploadHandler(file: File) {
|
||||
const response = await useImageUpload(file, {
|
||||
context: 'thread_message',
|
||||
projectID: projectV2.value.id,
|
||||
})
|
||||
return response.url
|
||||
}
|
||||
|
||||
const useSimpleEditor = ref(false)
|
||||
const message = ref('')
|
||||
const generatedMessage = ref(false)
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
import type { FunctionalComponent, SVGAttributes } from 'vue'
|
||||
|
||||
export type IconComponent = FunctionalComponent<SVGAttributes>
|
||||
|
||||
import _AffiliateIcon from './icons/affiliate.svg?component'
|
||||
import _AlignLeftIcon from './icons/align-left.svg?component'
|
||||
import _ArchiveIcon from './icons/archive.svg?component'
|
||||
@@ -380,6 +378,8 @@ import _XCircleIcon from './icons/x-circle.svg?component'
|
||||
import _ZoomInIcon from './icons/zoom-in.svg?component'
|
||||
import _ZoomOutIcon from './icons/zoom-out.svg?component'
|
||||
|
||||
export type IconComponent = FunctionalComponent<SVGAttributes>
|
||||
|
||||
export const AffiliateIcon = _AffiliateIcon
|
||||
export const AlignLeftIcon = _AlignLeftIcon
|
||||
export const ArchiveIcon = _ArchiveIcon
|
||||
|
||||
Reference in New Issue
Block a user