fix: lock page issues (#7380)

* fix: unable to click the swith to lock/unlock page

* fix: add divider above delete button on mobile

* fix: enable lock/unlock page by tapping the lock icon

* chore: update translations

* fix: hide cursor when the page is locked

* fix: the inline databaes still can be edited if the document is locked

* fix: disable auto update checker

* chore: change my account to account & app
This commit is contained in:
Lucas 2025-02-14 17:02:25 +08:00 committed by GitHub
parent 0e7ac85f90
commit e028e45e93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 90 additions and 34 deletions

View file

@ -368,15 +368,45 @@ class _MobileViewPageState extends State<MobileViewPage> {
}, },
builder: (context, state) { builder: (context, state) {
if (state.isLocked) { if (state.isLocked) {
return FlowySvg( return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
context.read<ViewLockStatusBloc>().add(
const ViewLockStatusEvent.unlock(),
);
},
child: Padding(
padding: const EdgeInsets.only(
top: 4.0,
right: 8,
bottom: 4.0,
),
child: FlowySvg(
FlowySvgs.lock_page_s, FlowySvgs.lock_page_s,
color: const Color(0xFFD95A0B), color: const Color(0xFFD95A0B),
),
),
); );
} else if (!state.isLocked && state.lockCounter > 0) { } else if (!state.isLocked && state.lockCounter > 0) {
return FlowySvg( return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
context.read<ViewLockStatusBloc>().add(
const ViewLockStatusEvent.lock(),
);
},
child: Padding(
padding: const EdgeInsets.only(
top: 4.0,
right: 8,
bottom: 4.0,
),
child: FlowySvg(
FlowySvgs.unlock_page_s, FlowySvgs.unlock_page_s,
color: Color(0xFF8F959E), color: Color(0xFF8F959E),
blendMode: null, blendMode: null,
),
),
); );
} }
return const SizedBox.shrink(); return const SizedBox.shrink();

View file

@ -182,6 +182,7 @@ class MobileViewBottomSheetBody extends StatelessWidget {
), ),
_divider(), _divider(),
..._buildPublishActions(context), ..._buildPublishActions(context),
_divider(),
MobileQuickActionButton( MobileQuickActionButton(
text: LocaleKeys.button_delete.tr(), text: LocaleKeys.button_delete.tr(),
textColor: Theme.of(context).colorScheme.error, textColor: Theme.of(context).colorScheme.error,
@ -275,7 +276,7 @@ class _LockPageRightIconBuilder extends StatelessWidget {
onAction( onAction(
MobileViewBottomSheetBodyAction.lockPage, MobileViewBottomSheetBodyAction.lockPage,
arguments: { arguments: {
MobileViewBottomSheetBodyActionArguments.isLockedKey: !value, MobileViewBottomSheetBodyActionArguments.isLockedKey: value,
}, },
); );
}, },

View file

@ -165,6 +165,7 @@ class _DocumentPageState extends State<DocumentPage>
context: context, context: context,
width: width, width: width,
padding: EditorStyleCustomizer.documentPadding, padding: EditorStyleCustomizer.documentPadding,
editorState: editorState,
), ),
header: buildCoverAndIcon(context, state), header: buildCoverAndIcon(context, state),
initialSelection: initialSelection, initialSelection: initialSelection,
@ -183,6 +184,7 @@ class _DocumentPageState extends State<DocumentPage>
context: context, context: context,
width: width, width: width,
padding: EditorStyleCustomizer.documentPadding, padding: EditorStyleCustomizer.documentPadding,
editorState: editorState,
), ),
header: buildCoverAndIcon(context, state), header: buildCoverAndIcon(context, state),
initialSelection: initialSelection, initialSelection: initialSelection,

View file

@ -203,7 +203,12 @@ void _customBlockOptionActions(
} else { } else {
top += 2.0; top += 2.0;
} }
return Padding( return ValueListenableBuilder(
valueListenable: editorState.editableNotifier,
builder: (_, editable, child) {
return Opacity(
opacity: editable ? 1.0 : 0.0,
child: Padding(
padding: EdgeInsets.only(top: top), padding: EdgeInsets.only(top: top),
child: BlockActionList( child: BlockActionList(
blockComponentContext: context, blockComponentContext: context,
@ -217,10 +222,14 @@ void _customBlockOptionActions(
shouldInsertSlash: false, shouldInsertSlash: false,
deleteKeywordsByDefault: true, deleteKeywordsByDefault: true,
style: styleCustomizer.selectionMenuStyleBuilder(), style: styleCustomizer.selectionMenuStyleBuilder(),
supportSlashMenuNodeTypes: supportSlashMenuNodeTypes, supportSlashMenuNodeTypes:
supportSlashMenuNodeTypes,
).handler.call(editorState) ).handler.call(editorState)
: () {}, : () {},
), ),
),
);
},
); );
}; };
} }

View file

@ -95,6 +95,12 @@ class _DatabaseBlockComponentWidgetState
); );
} }
if (!editorState.editable) {
child = IgnorePointer(
child: child,
);
}
return child; return child;
} }
} }

View file

@ -32,11 +32,13 @@ class EditorStyleCustomizer {
required this.context, required this.context,
required this.padding, required this.padding,
this.width, this.width,
this.editorState,
}); });
final BuildContext context; final BuildContext context;
final EdgeInsets padding; final EdgeInsets padding;
final double? width; final double? width;
final EditorState? editorState;
static const double maxDocumentWidth = 480 * 4; static const double maxDocumentWidth = 480 * 4;
static const double minDocumentWidth = 480; static const double minDocumentWidth = 480;
@ -76,11 +78,15 @@ class EditorStyleCustomizer {
fontFamily = appearanceFont; fontFamily = appearanceFont;
} }
final cursorColor = (editorState?.editable ?? true)
? (appearance.cursorColor ??
DefaultAppearanceSettings.getDefaultCursorColor(context))
: Colors.transparent;
return EditorStyle.desktop( return EditorStyle.desktop(
padding: padding, padding: padding,
maxWidth: width, maxWidth: width,
cursorColor: appearance.cursorColor ?? cursorColor: cursorColor,
DefaultAppearanceSettings.getDefaultCursorColor(context),
selectionColor: appearance.selectionColor ?? selectionColor: appearance.selectionColor ??
DefaultAppearanceSettings.getDefaultSelectionColor(context), DefaultAppearanceSettings.getDefaultSelectionColor(context),
defaultTextDirection: appearance.defaultTextDirection, defaultTextDirection: appearance.defaultTextDirection,

View file

@ -23,6 +23,8 @@ class VersionChecker {
if (UniversalPlatform.isWindows || UniversalPlatform.isMacOS) { if (UniversalPlatform.isWindows || UniversalPlatform.isMacOS) {
autoUpdater.setFeedURL(url); autoUpdater.setFeedURL(url);
// disable the auto update check
autoUpdater.setScheduledCheckInterval(0);
} }
} }

View file

@ -556,7 +556,7 @@
} }
}, },
"accountPage": { "accountPage": {
"menuLabel": "My account", "menuLabel": "Account & App",
"title": "My account", "title": "My account",
"general": { "general": {
"title": "Account name & profile image", "title": "Account name & profile image",
@ -2008,8 +2008,8 @@
"searchForAnImage": "Search for an image", "searchForAnImage": "Search for an image",
"pleaseInputYourOpenAIKey": "please input your AI key in Settings page", "pleaseInputYourOpenAIKey": "please input your AI key in Settings page",
"saveImageToGallery": "Save image", "saveImageToGallery": "Save image",
"failedToAddImageToGallery": "Failed to add image to gallery", "failedToAddImageToGallery": "Failed to save image",
"successToAddImageToGallery": "Image added to gallery successfully", "successToAddImageToGallery": "Saved image to Photos",
"unableToLoadImage": "Unable to load image", "unableToLoadImage": "Unable to load image",
"maximumImageSize": "Maximum supported upload image size is 10MB", "maximumImageSize": "Maximum supported upload image size is 10MB",
"uploadImageErrorImageSizeTooBig": "Image size must be less than 10MB", "uploadImageErrorImageSizeTooBig": "Image size must be less than 10MB",
@ -3097,13 +3097,13 @@
"autoUpdate": { "autoUpdate": {
"criticalUpdateTitle": "Update required to continue", "criticalUpdateTitle": "Update required to continue",
"criticalUpdateDescription": "We've made improvements to enhance your experience! Please update from {currentVersion} to {newVersion} to keep using the app.", "criticalUpdateDescription": "We've made improvements to enhance your experience! Please update from {currentVersion} to {newVersion} to keep using the app.",
"criticalUpdateButton": "Update now", "criticalUpdateButton": "Update",
"bannerUpdateTitle": "New Version Available!", "bannerUpdateTitle": "New Version Available!",
"bannerUpdateDescription": "Get the latest features and bug fixes. Click \"Update\" to install now", "bannerUpdateDescription": "Get the latest features and fixes. Click \"Update\" to install now",
"bannerUpdateButton": "Update", "bannerUpdateButton": "Update",
"settingsUpdateTitle": "New Version ({newVersion}) Available!", "settingsUpdateTitle": "New Version ({newVersion}) Available!",
"settingsUpdateDescription": "Current version: {currentVersion} (Official build) → {newVersion}", "settingsUpdateDescription": "Current version: {currentVersion} (Official build) → {newVersion}",
"settingsUpdateButton": "Update now", "settingsUpdateButton": "Update",
"settingsUpdateWhatsNew": "What's new" "settingsUpdateWhatsNew": "What's new"
}, },
"lockPage": { "lockPage": {