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:
Calum H.
2026-03-09 19:32:44 +00:00
committed by GitHub
parent 5594771ad8
commit f6fcdd336f
2 changed files with 13 additions and 2 deletions

View File

@@ -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)

View File

@@ -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