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) {
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,
color: const Color(0xFFD95A0B),
),
),
);
} 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,
color: Color(0xFF8F959E),
blendMode: null,
),
),
);
}
return const SizedBox.shrink();

View file

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

View file

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

View file

@ -203,7 +203,12 @@ void _customBlockOptionActions(
} else {
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),
child: BlockActionList(
blockComponentContext: context,
@ -217,10 +222,14 @@ void _customBlockOptionActions(
shouldInsertSlash: false,
deleteKeywordsByDefault: true,
style: styleCustomizer.selectionMenuStyleBuilder(),
supportSlashMenuNodeTypes: supportSlashMenuNodeTypes,
supportSlashMenuNodeTypes:
supportSlashMenuNodeTypes,
).handler.call(editorState)
: () {},
),
),
);
},
);
};
}

View file

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

View file

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

View file

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

View file

@ -556,7 +556,7 @@
}
},
"accountPage": {
"menuLabel": "My account",
"menuLabel": "Account & App",
"title": "My account",
"general": {
"title": "Account name & profile image",
@ -2008,8 +2008,8 @@
"searchForAnImage": "Search for an image",
"pleaseInputYourOpenAIKey": "please input your AI key in Settings page",
"saveImageToGallery": "Save image",
"failedToAddImageToGallery": "Failed to add image to gallery",
"successToAddImageToGallery": "Image added to gallery successfully",
"failedToAddImageToGallery": "Failed to save image",
"successToAddImageToGallery": "Saved image to Photos",
"unableToLoadImage": "Unable to load image",
"maximumImageSize": "Maximum supported upload image size is 10MB",
"uploadImageErrorImageSizeTooBig": "Image size must be less than 10MB",
@ -3097,13 +3097,13 @@
"autoUpdate": {
"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.",
"criticalUpdateButton": "Update now",
"criticalUpdateButton": "Update",
"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",
"settingsUpdateTitle": "New Version ({newVersion}) Available!",
"settingsUpdateDescription": "Current version: {currentVersion} (Official build) → {newVersion}",
"settingsUpdateButton": "Update now",
"settingsUpdateButton": "Update",
"settingsUpdateWhatsNew": "What's new"
},
"lockPage": {