Skip to content

Commit

Permalink
fixed uploading image after inserting it with link dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
iskaktoltay committed Dec 17, 2024
1 parent eac7feb commit c3baadd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {HMBlockSchema} from '@/editor/schema'
import {youtubeParser} from '@/editor/utils'
import {
StateStream,
UnpackedHypermediaId,
createHMUrl,
isHypermediaScheme,
isPublicGatewayLink,
normalizeHmId,
StateStream,
UnpackedHypermediaId,
} from '@shm/shared'
import {
File as FileIcon,
Expand Down Expand Up @@ -243,7 +243,7 @@ export function getLinkMenuItems({
const {state, schema} = editor._tiptapEditor
const {selection} = state
if (!selection.empty) return
let embedUrl = link ? link : sourceUrl ? sourceUrl : ''
let embedUrl = ''
if (media === 'video') {
let videoUrl = link ? link : sourceUrl ? sourceUrl : ''
if (videoUrl.includes('youtu.be') || videoUrl.includes('youtube')) {
Expand All @@ -261,11 +261,12 @@ export function getLinkMenuItems({
}
embedUrl = videoUrl
}

const node =
media !== 'twitter'
? schema.nodes[media].create({
url: embedUrl ? embedUrl : '',
src: embedUrl ? '' : link,
src: embedUrl ? '' : link ? link : sourceUrl ? sourceUrl : '',
name: fileName ? fileName : '',
})
: schema.nodes['web-embed'].create({
Expand Down
3 changes: 3 additions & 0 deletions frontend/apps/desktop/src/editor/image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export const ImageBlock = createReactBlockSpec({
url: {
default: '',
},
src: {
default: '',
},
alt: {
default: '',
},
Expand Down

0 comments on commit c3baadd

Please sign in to comment.