facebook / facebook/lexical

Feature: Make the caption plugins independent of the ImageNode/ImagePlugin

Open
#3,172 0 comments 0 reactions 0 assignees View on GitHub
enhancement images
Dominant language
TypeScript
Stars
23.9k
Forks
2.2k
Avg merge
1d 14h
Merged PRs (30d)
55

Description

In order for the image component to be modularizable, it would be nice if the plugins used by the caption editor could be sent as children of the ImagePlugin or as a property.
In this way, people could customize the behavior of captions without having to modify their internal structure.

I'm thinking something like:

```jsx







{
isCollabActive ? (

) : (

);
}
}
placeholder={

Enter a caption...

}
/>;
{
showNestedEditorTreeView === true ? : null;
}
;
}

/>
```

Note that the new table plugin uses a similar strategy for the cell plugins.
LexicalComposer, LexicalNestedComposer, and TableContext use very similar logic. Considering that similar logic could now be useful for images and that this pattern can plausibly be repeated in almost any nested editor, I think it would be nice to find a way to make all these contexts more reusable.

For my part, I was trying for a while to adapt the TableContext, but some doubts arose.
For example, I don't understand why `` is created in App.tsx when it is just initialized in `` and I think it is not used by any other plugin. I think it could be simplified to something like
``.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.