Skip to content

Commit

Permalink
chore: new line placeholder classname [skip e2e]
Browse files Browse the repository at this point in the history
  • Loading branch information
amanharwara committed Oct 31, 2023
1 parent 572c9b7 commit e42e2d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import TableActionMenuPlugin from './Plugins/TableCellActionMenuPlugin'
import ToolbarPlugin from './Plugins/ToolbarPlugin/ToolbarPlugin'
import { useMediaQuery, MutuallyExclusiveMediaQueryBreakpoints } from '@/Hooks/useMediaQuery'
import { CheckListPlugin } from './Plugins/List/CheckListPlugin'
import { LinePlaceholderPlugin } from './Plugins/LinePlaceholderPlugin'
import { EmptyLinePlaceholderPlugin } from './Plugins/EmptyLinePlaceholderPlugin'

type BlocksEditorProps = {
onChange?: (value: string, preview: string) => void
Expand Down Expand Up @@ -114,7 +114,7 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
<CollapsiblePlugin />
<TabIndentationPlugin />
<RemoveBrokenTablesPlugin />
<LinePlaceholderPlugin />
<EmptyLinePlaceholderPlugin />
{!readonly && floatingAnchorElem && (
<>
<DraggableBlockPlugin anchorElem={floatingAnchorElem} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useCallback, useEffect, useRef } from 'react'
import { getSelectedNode } from '../Lexical/Utils/getSelectedNode'
import { mergeRegister } from '@lexical/utils'

export const LinePlaceholderPlugin = () => {
export const EmptyLinePlaceholderPlugin = () => {
const [editor] = useLexicalComposerContext()

const placeholderElementRef = useRef<HTMLDivElement>(null)
Expand Down Expand Up @@ -82,8 +82,11 @@ export const LinePlaceholderPlugin = () => {
}, [cursorUpdate, editor])

return (
<div className="pointer-events-none fixed text-passive-1 opacity-0" ref={placeholderElementRef}>
Type <span className="rounded border border-border bg-passive-4-opacity-variant px-[3px] py-0.5">/</span> for
<div
className="super-empty-line-placeholder pointer-events-none fixed text-passive-1 opacity-0"
ref={placeholderElementRef}
>
Type <span className="rounded border border-border bg-passive-4-opacity-variant px-1 py-0.5">/</span> for
commands...
</div>
)
Expand Down

0 comments on commit e42e2d6

Please sign in to comment.