From bab17d47e085bfcecda7cc2af8dd0a8b4712ce82 Mon Sep 17 00:00:00 2001 From: DrMint Date: Thu, 17 Feb 2022 23:36:24 +0100 Subject: [PATCH] Fixed ESLINT error --- src/graphql/operation.graphql | 1 + src/graphql/operations-types.ts | 1 + src/pages/editor.tsx | 6 ++++-- src/queries/helpers.ts | 5 ++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/graphql/operation.graphql b/src/graphql/operation.graphql index 5866cb8..b6c830b 100644 --- a/src/graphql/operation.graphql +++ b/src/graphql/operation.graphql @@ -335,6 +335,7 @@ query getLibraryItem($slug: String, $language_code: String) { subtype { data { attributes { + slug titles( filters: { language: { code: { eq: $language_code } } } ) { diff --git a/src/graphql/operations-types.ts b/src/graphql/operations-types.ts index be45c72..3ab1c72 100644 --- a/src/graphql/operations-types.ts +++ b/src/graphql/operations-types.ts @@ -486,6 +486,7 @@ export type GetLibraryItemQuery = { __typename: "VideoSubtypeEntity"; attributes: { __typename: "VideoSubtype"; + slug: string; titles: Array<{ __typename: "ComponentTranslationsSimpleTitle"; title: string; diff --git a/src/pages/editor.tsx b/src/pages/editor.tsx index 919e214..37930df 100644 --- a/src/pages/editor.tsx +++ b/src/pages/editor.tsx @@ -65,8 +65,10 @@ export default function Editor(props: EditorProps): JSX.Element { paste = paste.replace(/<\!--.*?-->/g, ""); paste = turndownService.turndown(paste); paste = paste.replace(/<\!--.*?-->/g, ""); - event.target.value = paste; - event.target.select(); + + const target = event.target as HTMLTextAreaElement; + target.value = paste; + target.select(); event.preventDefault(); }} className="bg-mid rounded-xl p-8 w-full font-monospace" diff --git a/src/queries/helpers.ts b/src/queries/helpers.ts index 4c308bd..4dc1a66 100644 --- a/src/queries/helpers.ts +++ b/src/queries/helpers.ts @@ -1,4 +1,5 @@ import { + GetLibraryItemQuery, GetLibraryItemsPreviewQuery, GetWebsiteInterfaceQuery, } from "graphql/operations-types"; @@ -49,7 +50,9 @@ export function prettyinlineTitle( } export function prettyItemType( - metadata: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["metadata"][number], + metadata: { + __typename: GetLibraryItemsPreviewQuery["libraryItems"]["data"][number]["attributes"]["metadata"][number]["__typename"] + }, langui: GetWebsiteInterfaceQuery["websiteInterfaces"]["data"][number]["attributes"] ): string { const type = metadata.__typename;