mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore: show line numbers to skill editor
This commit is contained in:
@ -34,7 +34,6 @@ import {
|
||||
UPDATE_DATASETS_EVENT_EMITTER,
|
||||
UPDATE_HISTORY_EVENT_EMITTER,
|
||||
} from './constants'
|
||||
import styles from './line-numbers.module.css'
|
||||
import ComponentPickerBlock from './plugins/component-picker-block'
|
||||
import {
|
||||
ContextBlock,
|
||||
@ -89,7 +88,6 @@ export type PromptEditorProps = {
|
||||
className?: string
|
||||
placeholder?: string | React.ReactNode
|
||||
placeholderClassName?: string
|
||||
showLineNumbers?: boolean
|
||||
style?: React.CSSProperties
|
||||
value?: string
|
||||
editable?: boolean
|
||||
@ -115,7 +113,6 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
||||
className,
|
||||
placeholder,
|
||||
placeholderClassName,
|
||||
showLineNumbers,
|
||||
style,
|
||||
value,
|
||||
editable = true,
|
||||
@ -181,14 +178,13 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
||||
|
||||
return (
|
||||
<LexicalComposer initialConfig={{ ...initialConfig, editable }}>
|
||||
<div className={cn('relative', showLineNumbers && styles.lineNumbersScope, wrapperClassName)}>
|
||||
<div className={cn('relative', wrapperClassName)}>
|
||||
<RichTextPlugin
|
||||
contentEditable={(
|
||||
<ContentEditable
|
||||
className={cn(
|
||||
'text-text-secondary outline-none',
|
||||
compact ? 'text-[13px] leading-5' : 'text-sm leading-6',
|
||||
showLineNumbers && styles.lineNumbers,
|
||||
className,
|
||||
)}
|
||||
style={style || {}}
|
||||
@ -197,11 +193,7 @@ const PromptEditor: FC<PromptEditorProps> = ({
|
||||
placeholder={(
|
||||
<Placeholder
|
||||
value={placeholder}
|
||||
className={cn(
|
||||
'truncate',
|
||||
showLineNumbers && styles.lineNumbersPlaceholder,
|
||||
placeholderClassName,
|
||||
)}
|
||||
className={cn('truncate', placeholderClassName)}
|
||||
compact={compact}
|
||||
/>
|
||||
)}
|
||||
|
||||
@ -14,13 +14,13 @@ import {
|
||||
TextNode,
|
||||
} from 'lexical'
|
||||
import * as React from 'react'
|
||||
import styles from '@/app/components/base/prompt-editor/line-numbers.module.css'
|
||||
import { CustomTextNode } from '@/app/components/base/prompt-editor/plugins/custom-text/node'
|
||||
import OnBlurBlock from '@/app/components/base/prompt-editor/plugins/on-blur-or-focus-block'
|
||||
import Placeholder from '@/app/components/base/prompt-editor/plugins/placeholder'
|
||||
import UpdateBlock from '@/app/components/base/prompt-editor/plugins/update-block'
|
||||
import { textToEditorState } from '@/app/components/base/prompt-editor/utils'
|
||||
import { cn } from '@/utils/classnames'
|
||||
import styles from './line-numbers.module.css'
|
||||
import {
|
||||
ToolBlock,
|
||||
ToolBlockNode,
|
||||
|
||||
Reference in New Issue
Block a user