mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: add placeholder to card editor (#3870)
This commit is contained in:
parent
8116ea1dba
commit
fe23183aef
@ -116,6 +116,10 @@ class _RowEditorState extends State<RowEditor> {
|
|||||||
context: context,
|
context: context,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
),
|
),
|
||||||
|
showParagraphPlaceholder: (editorState, node) =>
|
||||||
|
editorState.document.isEmpty,
|
||||||
|
placeholderText: (node) =>
|
||||||
|
LocaleKeys.cardDetails_notesPlaceholder.tr(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -11,6 +11,8 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({
|
|||||||
required EditorStyleCustomizer styleCustomizer,
|
required EditorStyleCustomizer styleCustomizer,
|
||||||
List<SelectionMenuItem>? slashMenuItems,
|
List<SelectionMenuItem>? slashMenuItems,
|
||||||
bool editable = true,
|
bool editable = true,
|
||||||
|
ShowPlaceholder? showParagraphPlaceholder,
|
||||||
|
String Function(Node)? placeholderText,
|
||||||
}) {
|
}) {
|
||||||
final standardActions = [
|
final standardActions = [
|
||||||
OptionAction.delete,
|
OptionAction.delete,
|
||||||
@ -29,7 +31,8 @@ Map<String, BlockComponentBuilder> getEditorBuilderMap({
|
|||||||
final customBlockComponentBuilderMap = {
|
final customBlockComponentBuilderMap = {
|
||||||
PageBlockKeys.type: PageBlockComponentBuilder(),
|
PageBlockKeys.type: PageBlockComponentBuilder(),
|
||||||
ParagraphBlockKeys.type: ParagraphBlockComponentBuilder(
|
ParagraphBlockKeys.type: ParagraphBlockComponentBuilder(
|
||||||
configuration: configuration,
|
configuration: configuration.copyWith(placeholderText: placeholderText),
|
||||||
|
showPlaceholder: showParagraphPlaceholder,
|
||||||
),
|
),
|
||||||
TodoListBlockKeys.type: TodoListBlockComponentBuilder(
|
TodoListBlockKeys.type: TodoListBlockComponentBuilder(
|
||||||
configuration: configuration.copyWith(
|
configuration: configuration.copyWith(
|
||||||
|
@ -47,6 +47,8 @@ class AppFlowyEditorPage extends StatefulWidget {
|
|||||||
this.scrollController,
|
this.scrollController,
|
||||||
this.autoFocus,
|
this.autoFocus,
|
||||||
required this.styleCustomizer,
|
required this.styleCustomizer,
|
||||||
|
this.showParagraphPlaceholder,
|
||||||
|
this.placeholderText,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Widget? header;
|
final Widget? header;
|
||||||
@ -55,6 +57,8 @@ class AppFlowyEditorPage extends StatefulWidget {
|
|||||||
final bool shrinkWrap;
|
final bool shrinkWrap;
|
||||||
final bool? autoFocus;
|
final bool? autoFocus;
|
||||||
final EditorStyleCustomizer styleCustomizer;
|
final EditorStyleCustomizer styleCustomizer;
|
||||||
|
final ShowPlaceholder? showParagraphPlaceholder;
|
||||||
|
final String Function(Node)? placeholderText;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AppFlowyEditorPage> createState() => _AppFlowyEditorPageState();
|
State<AppFlowyEditorPage> createState() => _AppFlowyEditorPageState();
|
||||||
@ -112,6 +116,8 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
|
|||||||
context: context,
|
context: context,
|
||||||
editorState: widget.editorState,
|
editorState: widget.editorState,
|
||||||
styleCustomizer: widget.styleCustomizer,
|
styleCustomizer: widget.styleCustomizer,
|
||||||
|
showParagraphPlaceholder: widget.showParagraphPlaceholder,
|
||||||
|
placeholderText: widget.placeholderText,
|
||||||
);
|
);
|
||||||
|
|
||||||
List<CharacterShortcutEvent> get characterShortcutEvents => [
|
List<CharacterShortcutEvent> get characterShortcutEvents => [
|
||||||
|
@ -1040,5 +1040,8 @@
|
|||||||
"favorite": {
|
"favorite": {
|
||||||
"noFavorite": "No favorite page",
|
"noFavorite": "No favorite page",
|
||||||
"noFavoriteHintText": "Swipe the page to the left to add it to your favorites"
|
"noFavoriteHintText": "Swipe the page to the left to add it to your favorites"
|
||||||
|
},
|
||||||
|
"cardDetails": {
|
||||||
|
"notesPlaceholder": "Enter a / to insert a block, or start typing"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user