feat: support click to create content inside empty toggle list (#6854)

* feat: support click to create content inside empty toggle list

* test: support click to create content inside empty toggle list

* fix: toggle list rtl issue

* chore: optimize cover title request node logic
This commit is contained in:
Lucas 2024-11-25 10:39:23 +08:00 committed by GitHub
parent 2ad2a79bd0
commit bde1457524
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 135 additions and 34 deletions

View file

@ -163,7 +163,11 @@ class _DocumentPageState extends State<DocumentPage>
return Provider(
create: (_) {
final context = SharedEditorContext();
if (widget.view.name.isEmpty) {
final children = editorState.document.root.children;
final firstDelta = children.firstOrNull?.delta;
final isEmptyDocument =
children.length == 1 && (firstDelta == null || firstDelta.isEmpty);
if (widget.view.name.isEmpty && isEmptyDocument) {
context.requestCoverTitleFocus = true;
}
return context;