mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2026-06-23 04:10:17 +00:00
Image: use relative url
Embedding the full URL into the notes is a bit anoying if you want to change hostname (or e.g. hosting from a local IP). Using the relative URL should work in all(?) cases afaik. I would also like to remove that `additionalUrlText` argument, which is a bit confusing (not sure it works as intended?). It is only used in file `use-on-image-upload-from-renderer.ts` - and not sure it even is set to anything Signed-off-by: Nicolai Søborg <git@xn--sb-lka.org>
This commit is contained in:
committed by
Philip Molares
parent
7ade60aab7
commit
3c18898e47
@@ -100,6 +100,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
- If only one external login provider is configured, the sign-in button will directly link to it.
|
||||
- Links in Gist-Frames work only if explicitly opened in new tabs.
|
||||
- Changed default editor-placeholder to include the full url to the /features-page as new users might not find it otherwise.
|
||||
- Changed image path to be relative.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import type { CursorSelection } from '../tool-bar/formatters/types/cursor-select
|
||||
import type { EditorView } from '@codemirror/view'
|
||||
import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useBaseUrl } from '../../../../hooks/common/use-base-url'
|
||||
import type { ApiError } from 'next/dist/server/api-utils'
|
||||
|
||||
/**
|
||||
@@ -39,7 +38,6 @@ type handleUploadSignature = (
|
||||
export const useHandleUpload = (): handleUploadSignature => {
|
||||
const { t } = useTranslation()
|
||||
const { showErrorNotificationBuilder } = useUiNotifications()
|
||||
const baseUrl = useBaseUrl()
|
||||
|
||||
return useCallback(
|
||||
(view, file, cursorSelection, description, additionalUrlText) => {
|
||||
@@ -62,8 +60,7 @@ export const useHandleUpload = (): handleUploadSignature => {
|
||||
})
|
||||
uploadFile(noteAlias, file)
|
||||
.then((uuid) => {
|
||||
const fullUrl = `${baseUrl}media/${uuid}`
|
||||
const replacement = ``
|
||||
const replacement = ``
|
||||
changeContent(({ markdownContent }) => [
|
||||
replaceInContent(markdownContent, uploadPlaceholder, replacement),
|
||||
undefined
|
||||
@@ -81,6 +78,6 @@ export const useHandleUpload = (): handleUploadSignature => {
|
||||
])
|
||||
})
|
||||
},
|
||||
[showErrorNotificationBuilder, t, baseUrl]
|
||||
[showErrorNotificationBuilder, t]
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user