chore: remove file upload limitation & add tooltip for search (#5944)

This commit is contained in:
Annie 2024-08-12 22:24:24 +08:00 committed by GitHub
parent 6e26dc128c
commit 4b710527c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 96 additions and 49 deletions

View File

@ -208,9 +208,11 @@ class FileBlockComponentState extends State<FileBlockComponent>
child: Row( child: Row(
children: [ children: [
const HSpace(10), const HSpace(10),
FlowySvg(FlowySvgs.slash_menu_icon_file_s, FlowySvg(
FlowySvgs.slash_menu_icon_file_s,
color: Theme.of(context).hintColor, color: Theme.of(context).hintColor,
size: const Size.square(24),), size: const Size.square(24),
),
const HSpace(10), const HSpace(10),
..._buildTrailing(context), ..._buildTrailing(context),
], ],

View File

@ -142,7 +142,7 @@ class _FileUploadLocalState extends State<_FileUploadLocal> {
borderType: BorderType.RRect, borderType: BorderType.RRect,
color: isDragging color: isDragging
? Theme.of(context).colorScheme.primary ? Theme.of(context).colorScheme.primary
: Colors.black, : Theme.of(context).hintColor,
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -153,7 +153,7 @@ class _FileUploadLocalState extends State<_FileUploadLocal> {
LocaleKeys.document_plugins_file_dropFileToUpload LocaleKeys.document_plugins_file_dropFileToUpload
.tr(), .tr(),
fontSize: 16, fontSize: 16,
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).hintColor,
), ),
const VSpace(13.5), const VSpace(13.5),
] else ...[ ] else ...[
@ -164,6 +164,7 @@ class _FileUploadLocalState extends State<_FileUploadLocal> {
maxLines: 2, maxLines: 2,
lineHeight: 1.5, lineHeight: 1.5,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Theme.of(context).hintColor,
), ),
], ],
], ],
@ -208,6 +209,7 @@ class _FileUploadNetworkState extends State<_FileUploadNetwork> {
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
children: [ children: [
const VSpace(12),
FlowyTextField( FlowyTextField(
hintText: LocaleKeys.document_plugins_file_networkHint.tr(), hintText: LocaleKeys.document_plugins_file_networkHint.tr(),
onChanged: (value) => inputText = value, onChanged: (value) => inputText = value,
@ -220,19 +222,25 @@ class _FileUploadNetworkState extends State<_FileUploadNetwork> {
color: Theme.of(context).colorScheme.error, color: Theme.of(context).colorScheme.error,
), ),
], ],
const VSpace(8), const VSpace(20),
SizedBox( SizedBox(
width: 160, height: 32,
width: 300,
child: FlowyButton( child: FlowyButton(
backgroundColor: Theme.of(context).colorScheme.primary,
hoverColor:
Theme.of(context).colorScheme.primary.withOpacity(0.9),
showDefaultBoxDecorationOnMobile: true, showDefaultBoxDecorationOnMobile: true,
margin: const EdgeInsets.all(8.0), margin: const EdgeInsets.all(5),
text: FlowyText( text: FlowyText(
LocaleKeys.document_plugins_file_networkAction.tr(), LocaleKeys.document_plugins_file_networkAction.tr(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Theme.of(context).colorScheme.onPrimary,
), ),
onTap: submit, onTap: submit,
), ),
), ),
const VSpace(8),
], ],
), ),
); );

View File

@ -121,7 +121,9 @@ class _UploadImageMenuState extends State<UploadImageMenu> {
final type = values[currentTabIndex]; final type = values[currentTabIndex];
switch (type) { switch (type) {
case UploadImageType.local: case UploadImageType.local:
return Padding( return Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -138,17 +140,18 @@ class _UploadImageMenuState extends State<UploadImageMenu> {
allowMultipleImages: widget.allowMultipleImages, allowMultipleImages: widget.allowMultipleImages,
onPickFiles: widget.onSelectedLocalImages, onPickFiles: widget.onSelectedLocalImages,
), ),
if (widget.limitMaximumImageSize) ...[
const VSpace(6.0),
FlowyText(
LocaleKeys.document_imageBlock_maximumImageSize.tr(),
fontSize: 12.0,
color: Theme.of(context).hintColor,
),
],
], ],
), ),
), ),
),
// if (widget.limitMaximumImageSize) ...[
// FlowyText(
// LocaleKeys.document_imageBlock_maximumImageSize.tr(),
// fontSize: 10.0,
// color: Theme.of(context).hintColor,
// ),
// ],
],
); );
case UploadImageType.url: case UploadImageType.url:
return Container( return Container(

View File

@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
@ -455,12 +456,28 @@ class _SidebarSearchButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FlowyButton( return FlowyTooltip(
richMessage: TextSpan(
children: [
TextSpan(
text: '${LocaleKeys.search_sidebarSearchIcon.tr()}\n',
style: context.tooltipTextStyle(),
),
TextSpan(
text: Platform.isMacOS ? '⌘+P' : 'Ctrl+P',
style: context
.tooltipTextStyle()
?.copyWith(color: Theme.of(context).hintColor),
),
],
),
child: FlowyButton(
onTap: () => CommandPalette.of(context).toggle(), onTap: () => CommandPalette.of(context).toggle(),
leftIcon: const FlowySvg(FlowySvgs.search_s), leftIcon: const FlowySvg(FlowySvgs.search_s),
iconPadding: 12.0, iconPadding: 12.0,
margin: const EdgeInsets.only(left: 8.0), margin: const EdgeInsets.only(left: 8.0),
text: FlowyText.regular(LocaleKeys.search_label.tr()), text: FlowyText.regular(LocaleKeys.search_label.tr()),
),
); );
} }
} }

View File

@ -1,4 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.12265 11.5847C5.92255 12.1165 6.88538 12.5 8.00024 12.5C10.4842 12.5 12.2135 10.596 13.0675 9.39083C13.6624 8.55146 13.6624 7.44854 13.0675 6.60917C12.7341 6.13867 12.2673 5.56168 11.6743 5.03305L10.9661 5.74127C11.4908 6.20089 11.9225 6.72296 12.2516 7.18736C12.601 7.68035 12.601 8.31965 12.2516 8.81264C11.4276 9.97552 9.9599 11.5 8.00024 11.5C7.19618 11.5 6.47495 11.2434 5.84702 10.8603L5.12265 11.5847ZM5.03441 10.2587L4.32618 10.967C3.73316 10.4383 3.26636 9.86133 2.93294 9.39083C2.33811 8.55146 2.33811 7.44854 2.93294 6.60917C3.78701 5.40397 5.51627 3.5 8.00024 3.5C9.1151 3.5 10.0779 3.88354 10.8778 4.4153L10.1535 5.13966C9.52554 4.75665 8.80431 4.5 8.00024 4.5C6.04059 4.5 4.57293 6.02448 3.74884 7.18736C3.39948 7.68035 3.39948 8.31965 3.74884 8.81264C4.07794 9.27704 4.50968 9.79911 5.03441 10.2587ZM6.99269 9.71466C7.28548 9.8954 7.62952 10 8.00036 10C9.09422 10 9.95491 9.08996 9.95491 8C9.95491 7.64165 9.86187 7.30275 9.69811 7.00924L8.93118 7.77618C8.94668 7.84779 8.95491 7.92265 8.95491 8C8.95491 8.5669 8.51315 9 8.00036 9C7.91225 9 7.82623 8.98721 7.7442 8.96316L6.99269 9.71466ZM7.06951 8.22363L6.30253 8.99061C6.13882 8.69713 6.04582 8.35829 6.04582 8C6.04582 6.91005 6.9065 6 8.00036 6C8.37114 6 8.71513 6.10456 9.00789 6.28525L8.25635 7.03679C8.17436 7.01277 8.08841 7 8.00036 7C7.48757 7 7.04582 7.4331 7.04582 8C7.04582 8.07728 7.05403 8.15208 7.06951 8.22363Z" fill="#333333"/> <path d="M6.67502 6.675C6.4908 6.84666 6.34305 7.05366 6.24057 7.28366C6.13809 7.51366 6.08298 7.76194 6.07854 8.0137C6.0741 8.26545 6.12041 8.51553 6.21471 8.749C6.30901 8.98247 6.44937 9.19455 6.62742 9.3726C6.80547 9.55065 7.01755 9.69101 7.25102 9.78531C7.48449 9.87961 7.73457 9.92592 7.98632 9.92148C8.23808 9.91704 8.48637 9.86194 8.71636 9.75946C8.94636 9.65698 9.15336 9.50922 9.32502 9.325" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.667 3.33325L3.33366 11.6666" stroke="#333333" stroke-linecap="round"/> <path d="M7.2063 3.675C7.46962 3.64219 7.73469 3.6255 8.00005 3.625C12.375 3.625 14.25 8 14.25 8C13.9706 8.5982 13.6202 9.16058 13.2063 9.675" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M4.63125 4.63125C3.38828 5.47789 2.39367 6.64079 1.75 8C1.75 8 3.625 12.375 8 12.375C9.19744 12.3782 10.3692 12.0282 11.3687 11.3687" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M1.75 1.75L14.25 14.25" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,4 +1,13 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.7339 2C14.0997 2 13.4915 2.25192 13.0431 2.70034L3.00447 12.739C2.91636 12.8271 2.85386 12.9375 2.82363 13.0584L2.02054 16.2708C1.96197 16.505 2.03062 16.7529 2.20138 16.9236C2.37214 17.0944 2.61998 17.163 2.85426 17.1045L6.06663 16.3014C6.18751 16.2712 6.29791 16.2087 6.38602 16.1205L16.4247 6.08189C16.6467 5.85985 16.8228 5.59626 16.943 5.30616C17.0632 5.01605 17.125 4.70512 17.125 4.39112C17.125 4.07711 17.0632 3.76618 16.943 3.47608C16.8228 3.18597 16.6467 2.92238 16.4247 2.70034C16.2026 2.47831 15.939 2.30218 15.6489 2.18201C15.3588 2.06185 15.0479 2 14.7339 2ZM14.0154 3.67261C14.206 3.48205 14.4644 3.375 14.7339 3.375C14.8673 3.375 14.9995 3.40128 15.1227 3.45235C15.246 3.50341 15.358 3.57826 15.4524 3.67261C15.5468 3.76697 15.6216 3.87898 15.6727 4.00226C15.7237 4.12555 15.75 4.25768 15.75 4.39112C15.75 4.52455 15.7237 4.65669 15.6727 4.77997C15.6216 4.90325 15.5468 5.01526 15.4524 5.10962L5.5484 15.0136L3.63239 15.4926L4.11139 13.5766L14.0154 3.67261Z" fill="#333333"/> <g clip-path="url(#clip0_65_16)">
<path d="M9.56251 15.75C9.18282 15.75 8.87501 16.0578 8.87501 16.4375C8.87501 16.8172 9.18282 17.125 9.56251 17.125H17.8125C18.1922 17.125 18.5 16.8172 18.5 16.4375C18.5 16.0578 18.1922 15.75 17.8125 15.75H9.56251Z" fill="#333333"/> <path d="M8.33777 14.5813H15.2568" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.7972 1.89644C12.6849 1.00875 14.2007 1.41488 14.5256 2.6275C14.6764 3.19031 14.5155 3.79075 14.1035 4.20275L4.49383 13.8124L1.4187 14.5813L2.18751 11.5061L11.7972 1.89644Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M10.644 3.04956L12.9504 5.35594" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_65_16">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 697 B

View File

@ -0,0 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.03447 10.2533C1.45334 9.49838 1.16284 9.12088 1.16284 8C1.16284 6.87913 1.4534 6.50163 2.03447 5.74669C3.19478 4.23925 5.14078 2.53025 8.00003 2.53025C10.8593 2.53025 12.8052 4.23925 13.9655 5.74669C14.5467 6.50163 14.8372 6.87913 14.8372 8C14.8372 9.12088 14.5467 9.49838 13.9656 10.2533C12.8052 11.7608 10.8593 13.4698 8.00003 13.4698C5.14078 13.4698 3.19478 11.7608 2.03447 10.2533Z" stroke="black"/>
<path d="M10.0512 8C10.0512 9.13288 9.13292 10.0512 8.00004 10.0512C6.86717 10.0512 5.94885 9.13288 5.94885 8C5.94885 6.86713 6.86717 5.94881 8.00004 5.94881C9.13292 5.94881 10.0512 6.86713 10.0512 8Z" stroke="black"/>
</svg>

After

Width:  |  Height:  |  Size: 738 B

View File

@ -1,4 +1,5 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.01097 13.6526C4.30282 12.6533 4.30282 11.3467 5.01097 10.3474C6.26959 8.57133 8.66728 6 12 6C15.3327 6 17.7304 8.57133 18.989 10.3474C19.6972 11.3467 19.6972 12.6533 18.989 13.6526C17.7304 15.4287 15.3327 18 12 18C8.66728 18 6.26959 15.4287 5.01097 13.6526Z" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M2.41663 12C2.41663 12 5.29163 5.29167 12 5.29167C18.7083 5.29167 21.5833 12 21.5833 12C21.5833 12 18.7083 18.7083 12 18.7083C5.29163 18.7083 2.41663 12 2.41663 12Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11.9999 14.25C13.2049 14.25 14.1818 13.2426 14.1818 12C14.1818 10.7574 13.2049 9.75 11.9999 9.75C10.7949 9.75 9.81812 10.7574 9.81812 12C9.81812 13.2426 10.7949 14.25 11.9999 14.25Z" stroke="#333333" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> <path d="M9.125 12C9.125 12.7625 9.4279 13.4938 9.96707 14.0329C10.5062 14.5721 11.2375 14.875 12 14.875C12.7625 14.875 13.4938 14.5721 14.0329 14.0329C14.5721 13.4938 14.875 12.7625 14.875 12C14.875 11.2375 14.5721 10.5062 14.0329 9.96707C13.4938 9.4279 12.7625 9.125 12 9.125C11.2375 9.125 10.5062 9.4279 9.96707 9.96707C9.4279 10.5062 9.125 11.2375 9.125 12Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 737 B

After

Width:  |  Height:  |  Size: 770 B

View File

@ -1653,7 +1653,7 @@
"placeholderText": "Upload or embed a file", "placeholderText": "Upload or embed a file",
"placeholderDragging": "Drop the file to upload", "placeholderDragging": "Drop the file to upload",
"dropFileToUpload": "Drop the file to upload", "dropFileToUpload": "Drop the file to upload",
"fileUploadHint": "Drag and drop a file here\nor click to select a file.", "fileUploadHint": "Drop a file here to upload\nor click to browse",
"networkHint": "Paste a file link", "networkHint": "Paste a file link",
"networkUrlInvalid": "Invalid URL, please correct the URL and try again", "networkUrlInvalid": "Invalid URL, please correct the URL and try again",
"networkAction": "Embed file link", "networkAction": "Embed file link",
@ -1883,6 +1883,7 @@
}, },
"search": { "search": {
"label": "Search", "label": "Search",
"sidebarSearchIcon": "Search and quickly jump to a page",
"placeholder": { "placeholder": {
"actions": "Search actions..." "actions": "Search actions..."
} }