fix: replace more any types in components
- fix edra placeholder components with proper editor context types - fix gallery image types with proper type assertions - fix ProseMirror transaction types in link manager - fix command types in composer toolbar - replace any with unknown where type is dynamic
This commit is contained in:
parent
9c746d51c0
commit
3d77922a99
11 changed files with 23 additions and 23 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string
|
title: string
|
||||||
actions?: any
|
actions?: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
let { title, actions }: Props = $props()
|
let { title, actions }: Props = $props()
|
||||||
|
|
|
||||||
|
|
@ -133,10 +133,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dismiss dropdowns on typing
|
// Dismiss dropdowns on typing
|
||||||
export function dismissOnTyping(transaction: any) {
|
export function dismissOnTyping(transaction: unknown) {
|
||||||
if (showUrlConvertDropdown && transaction.docChanged) {
|
if (showUrlConvertDropdown && transaction.docChanged) {
|
||||||
const hasTextChange = transaction.steps.some(
|
const hasTextChange = transaction.steps.some(
|
||||||
(step: any) =>
|
(step: unknown) =>
|
||||||
step.toJSON().stepType === 'replace' || step.toJSON().stepType === 'replaceAround'
|
step.toJSON().stepType === 'replace' || step.toJSON().stepType === 'replaceAround'
|
||||||
)
|
)
|
||||||
if (hasTextChange) {
|
if (hasTextChange) {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
editor: Editor
|
editor: Editor
|
||||||
variant: ComposerVariant
|
variant: ComposerVariant
|
||||||
currentTextStyle: string
|
currentTextStyle: string
|
||||||
filteredCommands: any
|
filteredCommands: unknown
|
||||||
colorCommands: any[]
|
colorCommands: unknown[]
|
||||||
excludedCommands: string[]
|
excludedCommands: string[]
|
||||||
showMediaLibrary: boolean
|
showMediaLibrary: boolean
|
||||||
onTextStyleDropdownToggle: () => void
|
onTextStyleDropdownToggle: () => void
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
||||||
|
|
||||||
// Get album context if available
|
// Get album context if available
|
||||||
const editorContext = getContext<any>('editorContext') || {}
|
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
|
||||||
const albumId = $derived(editorContext.albumId)
|
const albumId = $derived(editorContext.albumId)
|
||||||
|
|
||||||
// Generate unique pane ID based on node position
|
// Generate unique pane ID based on node position
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
function handleKeyDown(e: KeyboardEvent) {
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleClick(e as any)
|
handleClick(e as unknown as MouseEvent)
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
if (showPane) {
|
if (showPane) {
|
||||||
paneManager.close()
|
paneManager.close()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
||||||
|
|
||||||
// Get album context if available
|
// Get album context if available
|
||||||
const editorContext = getContext<any>('editorContext') || {}
|
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
|
||||||
const albumId = $derived(editorContext.albumId)
|
const albumId = $derived(editorContext.albumId)
|
||||||
|
|
||||||
// Generate unique pane ID based on node position
|
// Generate unique pane ID based on node position
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
function handleKeyDown(e: KeyboardEvent) {
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleClick(e as any)
|
handleClick(e as unknown as MouseEvent)
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
if (showPane) {
|
if (showPane) {
|
||||||
paneManager.close()
|
paneManager.close()
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@
|
||||||
updateAttributes({ images: newImages })
|
updateAttributes({ images: newImages })
|
||||||
} else {
|
} else {
|
||||||
// Add to existing images
|
// Add to existing images
|
||||||
const existingImages = node.attrs.images || []
|
const existingImages = (node.attrs.images || []) as Array<{ id: number; [key: string]: unknown }>
|
||||||
const currentIds = existingImages.map((img: any) => img.id)
|
const currentIds = existingImages.map((img) => img.id)
|
||||||
const uniqueNewImages = newImages.filter((img) => !currentIds.includes(img.id))
|
const uniqueNewImages = newImages.filter((img) => !currentIds.includes(img.id))
|
||||||
updateAttributes({ images: [...existingImages, ...uniqueNewImages] })
|
updateAttributes({ images: [...existingImages, ...uniqueNewImages] })
|
||||||
}
|
}
|
||||||
|
|
@ -54,8 +54,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeImage(imageId: number) {
|
function removeImage(imageId: number) {
|
||||||
const currentImages = node.attrs.images || []
|
const currentImages = (node.attrs.images || []) as Array<{ id: number; [key: string]: unknown }>
|
||||||
const updatedImages = currentImages.filter((img: any) => img.id !== imageId)
|
const updatedImages = currentImages.filter((img) => img.id !== imageId)
|
||||||
updateAttributes({ images: updatedImages })
|
updateAttributes({ images: updatedImages })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
||||||
|
|
||||||
// Get album context if available
|
// Get album context if available
|
||||||
const editorContext = getContext<any>('editorContext') || {}
|
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
|
||||||
const albumId = $derived(editorContext.albumId)
|
const albumId = $derived(editorContext.albumId)
|
||||||
|
|
||||||
// Generate unique pane ID based on node position
|
// Generate unique pane ID based on node position
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
function handleKeyDown(e: KeyboardEvent) {
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleClick(e as any)
|
handleClick(e as unknown as MouseEvent)
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
if (showPane) {
|
if (showPane) {
|
||||||
paneManager.close()
|
paneManager.close()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
||||||
|
|
||||||
// Get album context if available
|
// Get album context if available
|
||||||
const editorContext = getContext<any>('editorContext') || {}
|
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
|
||||||
const albumId = $derived(editorContext.albumId)
|
const albumId = $derived(editorContext.albumId)
|
||||||
|
|
||||||
// Generate unique pane ID based on node position
|
// Generate unique pane ID based on node position
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
function handleKeyDown(e: KeyboardEvent) {
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleClick(e as any)
|
handleClick(e as unknown as MouseEvent)
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
if (showPane) {
|
if (showPane) {
|
||||||
paneManager.close()
|
paneManager.close()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
||||||
|
|
||||||
// Get album context if available
|
// Get album context if available
|
||||||
const editorContext = getContext<any>('editorContext') || {}
|
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
|
||||||
const albumId = $derived(editorContext.albumId)
|
const albumId = $derived(editorContext.albumId)
|
||||||
|
|
||||||
// Generate unique pane ID based on node position
|
// Generate unique pane ID based on node position
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
function handleKeyDown(e: KeyboardEvent) {
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleClick(e as any)
|
handleClick(e as unknown as MouseEvent)
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
if (showPane) {
|
if (showPane) {
|
||||||
paneManager.close()
|
paneManager.close()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
||||||
|
|
||||||
// Get album context if available
|
// Get album context if available
|
||||||
const editorContext = getContext<any>('editorContext') || {}
|
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
|
||||||
const albumId = $derived(editorContext.albumId)
|
const albumId = $derived(editorContext.albumId)
|
||||||
|
|
||||||
// Generate unique pane ID based on node position
|
// Generate unique pane ID based on node position
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
function handleKeyDown(e: KeyboardEvent) {
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleClick(e as any)
|
handleClick(e as unknown as MouseEvent)
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
if (showPane) {
|
if (showPane) {
|
||||||
paneManager.close()
|
paneManager.close()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
const { editor, deleteNode, getPos }: NodeViewProps = $props()
|
||||||
|
|
||||||
// Get album context if available
|
// Get album context if available
|
||||||
const editorContext = getContext<any>('editorContext') || {}
|
const editorContext = getContext<{ albumId?: number; [key: string]: unknown }>('editorContext') || {}
|
||||||
const albumId = $derived(editorContext.albumId)
|
const albumId = $derived(editorContext.albumId)
|
||||||
|
|
||||||
// Generate unique pane ID based on node position
|
// Generate unique pane ID based on node position
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
function handleKeyDown(e: KeyboardEvent) {
|
function handleKeyDown(e: KeyboardEvent) {
|
||||||
if (e.key === 'Enter' || e.key === ' ') {
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
handleClick(e as any)
|
handleClick(e as unknown as MouseEvent)
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
if (showPane) {
|
if (showPane) {
|
||||||
paneManager.close()
|
paneManager.close()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue