lint: remove unused imports and variables in admin components (15 fixes)
Co-Authored-By: Justin Edmund <justin@jedmund.com>
This commit is contained in:
parent
0bdbd26deb
commit
2df4819fef
3 changed files with 6 additions and 17 deletions
|
|
@ -10,7 +10,7 @@
|
|||
import { makeDraftKey, saveDraft, loadDraft, clearDraft, timeAgo } from '$lib/admin/draftStore'
|
||||
import { createAutoSaveStore } from '$lib/admin/autoSave.svelte'
|
||||
import AutoSaveStatus from './AutoSaveStatus.svelte'
|
||||
import type { JSONContent, Editor as TipTapEditor } from '@tiptap/core'
|
||||
import type { JSONContent } from '@tiptap/core'
|
||||
import type { Post } from '@prisma/client'
|
||||
|
||||
interface Props {
|
||||
|
|
@ -29,9 +29,7 @@
|
|||
let { postId, initialData, mode }: Props = $props()
|
||||
|
||||
// State
|
||||
let isLoading = $state(false)
|
||||
let hasLoaded = $state(mode === 'create') // Create mode loads immediately
|
||||
let isSaving = $state(false)
|
||||
let activeTab = $state('metadata')
|
||||
let updatedAt = $state<string | undefined>(initialData?.updatedAt)
|
||||
|
||||
|
|
@ -179,7 +177,7 @@ $effect(() => {
|
|||
})
|
||||
|
||||
// Navigation guard: flush autosave before navigating away (only if unsaved)
|
||||
beforeNavigate(async (navigation) => {
|
||||
beforeNavigate(async () => {
|
||||
if (hasLoaded && autoSave) {
|
||||
if (autoSave.status === 'saved') {
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
<script lang="ts">
|
||||
import type { Media } from '@prisma/client'
|
||||
import Button from './Button.svelte'
|
||||
import Input from './Input.svelte'
|
||||
import SmartImage from '../SmartImage.svelte'
|
||||
import UnifiedMediaModal from './UnifiedMediaModal.svelte'
|
||||
import MediaDetailsModal from './MediaDetailsModal.svelte'
|
||||
|
|
@ -27,17 +26,13 @@
|
|||
}
|
||||
|
||||
let {
|
||||
label,
|
||||
value = $bindable([]),
|
||||
onUpload,
|
||||
onReorder,
|
||||
onRemove,
|
||||
maxItems = 20,
|
||||
allowAltText = true,
|
||||
required = false,
|
||||
error,
|
||||
placeholder = 'Drag and drop images here, or click to browse',
|
||||
helpText,
|
||||
showBrowseLibrary = false,
|
||||
maxFileSize = 10,
|
||||
disabled = false
|
||||
|
|
@ -78,7 +73,7 @@
|
|||
|
||||
// Upload multiple files to server
|
||||
async function uploadFiles(files: File[]): Promise<Media[]> {
|
||||
const uploadPromises = files.map(async (file, index) => {
|
||||
const uploadPromises = files.map(async (file) => {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { Node, mergeAttributes } from '@tiptap/core'
|
||||
import { Plugin, PluginKey } from '@tiptap/pm/state'
|
||||
import { Decoration, DecorationSet } from '@tiptap/pm/view'
|
||||
|
||||
export interface UrlEmbedOptions {
|
||||
HTMLAttributes: Record<string, unknown>
|
||||
|
|
@ -103,7 +102,7 @@ export const UrlEmbed = Node.create<UrlEmbedOptions>({
|
|||
},
|
||||
convertLinkToEmbed:
|
||||
(pos) =>
|
||||
({ state, commands, chain }) => {
|
||||
({ state, chain }) => {
|
||||
const { doc } = state
|
||||
|
||||
// Find the link mark at the given position
|
||||
|
|
@ -206,7 +205,6 @@ export const UrlEmbed = Node.create<UrlEmbedOptions>({
|
|||
// Find the link that was just inserted
|
||||
// Start from where we were before paste
|
||||
let linkStart = -1
|
||||
let linkEnd = -1
|
||||
|
||||
// Search for the link in a reasonable range
|
||||
for (
|
||||
|
|
@ -235,15 +233,13 @@ export const UrlEmbed = Node.create<UrlEmbedOptions>({
|
|||
const hasLink = $endPos
|
||||
.marks()
|
||||
.some((m) => m.type.name === 'link' && m.attrs.href === pastedUrl)
|
||||
if (hasLink) {
|
||||
linkEnd = endPos + 1
|
||||
} else {
|
||||
if (!hasLink) {
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (_e) {
|
||||
// Position might be invalid, continue
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue