mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: unable insert a reference database (#2798)
* fix: unable insert a reference database * test: add reference database tests * feat: set min height for document inside database
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import 'package:appflowy/plugins/database_view/grid/application/row/row_document_bloc.dart';
|
||||
import 'package:appflowy/plugins/document/application/doc_bloc.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_page.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_style.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/more/cubit/document_appearance_cubit.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
||||
import 'package:flowy_infra_ui/widget/error_page.dart';
|
||||
@ -102,11 +103,18 @@ class _RowEditorState extends State<RowEditor> {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return IntrinsicHeight(
|
||||
child: AppFlowyEditorPage(
|
||||
shrinkWrap: true,
|
||||
autoFocus: false,
|
||||
editorState: editorState,
|
||||
scrollController: widget.scrollController,
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(minHeight: 300),
|
||||
child: AppFlowyEditorPage(
|
||||
shrinkWrap: true,
|
||||
autoFocus: false,
|
||||
editorState: editorState,
|
||||
scrollController: widget.scrollController,
|
||||
styleCustomizer: EditorStyleCustomizer(
|
||||
context: context,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -5,6 +5,7 @@ import 'package:appflowy/plugins/document/application/doc_bloc.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/banner.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_page.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_style.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/export_page_widget.dart';
|
||||
import 'package:appflowy/startup/startup.dart';
|
||||
import 'package:appflowy/util/base64_string.dart';
|
||||
@ -90,6 +91,10 @@ class _DocumentPageState extends State<DocumentPage> {
|
||||
Widget _buildEditorPage(BuildContext context, DocumentState state) {
|
||||
final appflowyEditorPage = AppFlowyEditorPage(
|
||||
editorState: editorState!,
|
||||
styleCustomizer: EditorStyleCustomizer(
|
||||
context: context,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
),
|
||||
header: _buildCoverAndIcon(context),
|
||||
);
|
||||
return Column(
|
||||
|
@ -17,6 +17,7 @@ class AppFlowyEditorPage extends StatefulWidget {
|
||||
this.shrinkWrap = false,
|
||||
this.scrollController,
|
||||
this.autoFocus,
|
||||
required this.styleCustomizer,
|
||||
});
|
||||
|
||||
final Widget? header;
|
||||
@ -24,6 +25,7 @@ class AppFlowyEditorPage extends StatefulWidget {
|
||||
final ScrollController? scrollController;
|
||||
final bool shrinkWrap;
|
||||
final bool? autoFocus;
|
||||
final EditorStyleCustomizer styleCustomizer;
|
||||
|
||||
@override
|
||||
State<AppFlowyEditorPage> createState() => _AppFlowyEditorPageState();
|
||||
@ -91,9 +93,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
||||
style: styleCustomizer.selectionMenuStyleBuilder(),
|
||||
).handler;
|
||||
|
||||
EditorStyleCustomizer get styleCustomizer => EditorStyleCustomizer(
|
||||
context: context,
|
||||
);
|
||||
EditorStyleCustomizer get styleCustomizer => widget.styleCustomizer;
|
||||
DocumentBloc get documentBloc => context.read<DocumentBloc>();
|
||||
|
||||
@override
|
||||
|
@ -23,11 +23,13 @@ void showLinkToPageMenu(
|
||||
final top = alignment == Alignment.bottomLeft ? offset.dy : null;
|
||||
final bottom = alignment == Alignment.topLeft ? offset.dy : null;
|
||||
|
||||
keepEditorFocusNotifier.value += 1;
|
||||
late OverlayEntry linkToPageMenuEntry;
|
||||
linkToPageMenuEntry = FullScreenOverlayEntry(
|
||||
top: top,
|
||||
bottom: bottom,
|
||||
left: offset.dx,
|
||||
dismissCallback: () => keepEditorFocusNotifier.value -= 1,
|
||||
builder: (context) => Material(
|
||||
color: Colors.transparent,
|
||||
child: LinkToPageMenu(
|
||||
|
@ -4,7 +4,6 @@ import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/cover/change_cover_popover.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/cover/emoji_popover.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_plugins/cover/emoji_icon_widget.dart';
|
||||
import 'package:appflowy/plugins/document/presentation/editor_style.dart';
|
||||
import 'package:appflowy/workspace/presentation/widgets/emoji_picker/emoji_picker.dart';
|
||||
import 'package:appflowy_editor/appflowy_editor.dart' hide FlowySvg;
|
||||
import 'package:appflowy_popover/appflowy_popover.dart';
|
||||
@ -164,8 +163,8 @@ class _AddCoverButtonState extends State<_AddCoverButton> {
|
||||
height: widget.hasIcon ? 180 : 50.0,
|
||||
alignment: Alignment.bottomLeft,
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.only(
|
||||
left: EditorStyleCustomizer.horizontalPadding + 30,
|
||||
padding: const EdgeInsets.only(
|
||||
left: 80,
|
||||
top: 20,
|
||||
bottom: 5,
|
||||
),
|
||||
@ -333,7 +332,7 @@ class _CoverImageState extends State<_CoverImage> {
|
||||
),
|
||||
hasIcon
|
||||
? Positioned(
|
||||
left: EditorStyleCustomizer.horizontalPadding + 30,
|
||||
left: 80,
|
||||
bottom: !hasCover ? 30 : 40,
|
||||
child: AppFlowyPopover(
|
||||
offset: const Offset(100, 0),
|
||||
@ -416,7 +415,7 @@ class _CoverImageState extends State<_CoverImage> {
|
||||
Widget _buildCoverOverlayButtons(BuildContext context) {
|
||||
return Positioned(
|
||||
bottom: 20,
|
||||
right: EditorStyleCustomizer.horizontalPadding,
|
||||
right: 50,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
|
@ -35,10 +35,12 @@ void showEmojiPickerMenu(
|
||||
final top = alignment == Alignment.bottomLeft ? offset.dy : null;
|
||||
final bottom = alignment == Alignment.topLeft ? offset.dy : null;
|
||||
|
||||
keepEditorFocusNotifier.value += 1;
|
||||
final emojiPickerMenuEntry = FullScreenOverlayEntry(
|
||||
top: top,
|
||||
bottom: bottom,
|
||||
left: offset.dx,
|
||||
dismissCallback: () => keepEditorFocusNotifier.value -= 1,
|
||||
builder: (context) => Material(
|
||||
child: Container(
|
||||
width: 300,
|
||||
|
@ -8,12 +8,11 @@ import 'package:google_fonts/google_fonts.dart';
|
||||
class EditorStyleCustomizer {
|
||||
EditorStyleCustomizer({
|
||||
required this.context,
|
||||
required this.padding,
|
||||
});
|
||||
|
||||
static double get horizontalPadding =>
|
||||
PlatformExtension.isDesktop ? 50.0 : 10.0;
|
||||
|
||||
final BuildContext context;
|
||||
final EdgeInsets padding;
|
||||
|
||||
EditorStyle style() {
|
||||
if (PlatformExtension.isDesktopOrWeb) {
|
||||
@ -28,7 +27,7 @@ class EditorStyleCustomizer {
|
||||
final theme = Theme.of(context);
|
||||
final fontSize = context.read<DocumentAppearanceCubit>().state.fontSize;
|
||||
return EditorStyle.desktop(
|
||||
padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
|
||||
padding: padding,
|
||||
backgroundColor: theme.colorScheme.surface,
|
||||
cursorColor: theme.colorScheme.primary,
|
||||
textStyleConfiguration: TextStyleConfiguration(
|
||||
@ -65,7 +64,7 @@ class EditorStyleCustomizer {
|
||||
final theme = Theme.of(context);
|
||||
final fontSize = context.read<DocumentAppearanceCubit>().state.fontSize;
|
||||
return EditorStyle.desktop(
|
||||
padding: EdgeInsets.symmetric(horizontal: horizontalPadding),
|
||||
padding: padding,
|
||||
backgroundColor: theme.colorScheme.surface,
|
||||
cursorColor: theme.colorScheme.primary,
|
||||
textStyleConfiguration: TextStyleConfiguration(
|
||||
|
Reference in New Issue
Block a user