Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highlightedLines input is missing in 3.0.0-v3-studio.9 #24

Open
ilyagru opened this issue Sep 22, 2022 · 0 comments
Open

highlightedLines input is missing in 3.0.0-v3-studio.9 #24

ilyagru opened this issue Sep 22, 2022 · 0 comments

Comments

@ilyagru
Copy link

ilyagru commented Sep 22, 2022

Hello!

Unfortunately, I can't see the highlightedLines field in the input component in studio but I assume it should be there by default?

Screenshot 2022-09-22 at 15 53 56

Screenshot 2022-09-22 at 15 53 43

    "@portabletext/react": "^1.0.6",
    "@sanity/client": "^3.4.1",
    "@sanity/code-input": "^3.0.0-v3-studio.9",
    "@sanity/dashboard": "^3.0.0-v3-studio.3",
    "@sanity/image-url": "^1.0.1",
    "@sanity/vision": "^3.0.0-dev-preview.17",
    "next": "12.3.1",
    "next-pwa": "^5.6.0",
    "next-sanity": "^0.8.4",
    "next-themes": "^0.2.1",
    "prismjs": "^1.29.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "sanity": "^3.0.0-dev-preview.17",
    "sharp": "^0.31.0",
    "slugify": "^1.6.5",
    "styled-components": "^5.3.5"

Usage

import dynamic from 'next/dynamic'
import { CodeSchemaType } from '@sanity/code-input'

// @sanity/code-input dependencies
dynamic(() => import('ace-builds/src-noconflict/ace'), {
  ssr: false
})
dynamic(() => import('ace-builds/src-noconflict/mode-swift'), {
  ssr: false
})
dynamic(() => import('ace-builds/src-noconflict/mode-graphqlschema'), {
  ssr: false
})

const CodeBlock: CodeSchemaType = {
  name: 'codeBlock',
  title: 'Code Block',
  type: 'code',
  options: {
    theme: 'tomorrow',
    darkTheme: 'monokai',
    withFilename: true,
    language: 'typescript',
    languageAlternatives: [
      { title: 'Batch file', value: 'batchfile' },
      { title: 'C#', value: 'csharp' },
      { title: 'CSS', value: 'css' },
      { title: 'Go', value: 'golang' },
      { title: 'GROQ', value: 'groq' },
      { title: 'HTML', value: 'html' },
      { title: 'Java', value: 'java' },
      { title: 'JavaScript', value: 'javascript' },
      { title: 'JSON', value: 'json' },
      { title: 'JSX', value: 'jsx' },
      { title: 'Markdown', value: 'markdown' },
      { title: 'MySQL', value: 'mysql' },
      { title: 'PHP', value: 'php' },
      { title: 'Plain text', value: 'text' },
      { title: 'Python', value: 'python' },
      { title: 'Ruby', value: 'ruby' },
      { title: 'SASS', value: 'sass' },
      { title: 'SCSS', value: 'scss' },
      { title: 'sh', value: 'sh' },
      { title: 'TSX', value: 'tsx' },
      { title: 'TypeScript', value: 'typescript' },
      { title: 'XML', value: 'xml' },
      { title: 'YAML', value: 'yaml' },
      { title: 'GraphQL', value: 'graphql', mode: 'graphqlschema' },
      { title: 'Swift', value: 'swift', mode: 'swift' }
    ]
  }
}

export default CodeBlock

PS. How to type the field definition correctly? CodeSchemaType seems wrong there because TS complains about type: 'code',

@ilyagru ilyagru changed the title highlightedLines input seems broken in 3.0.0-v3-studio.9 highlightedLines input is missing in 3.0.0-v3-studio.9 Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant