mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-07 12:29:50 +08:00
fix(core): some ux enhancements on comments (#13105)
fix PD-2688 #### PR Dependency Tree * **PR #13105** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **New Features** * Added configurable support for enabling or disabling inline comments. * Introduced visual indication (strikethrough) for deleted comments in the comment sidebar. * Sidebar now shows when a comment is no longer present in the editor. * Added a localized placeholder prompt ("What are your thoughts?") in the comment editor. * Integrated detailed event tracking for comment actions: create, edit, delete, and resolve. * **Improvements** * Inline comments are now disabled in shared mode. * Enhanced synchronization between editor comments and provider state to remove stale comments. * Inline comment features now respect the document’s read-only state. * Improved mention handling and tracking in comment creation and editing. * Comment manager and entities now dynamically track comments present in the editor. * Comment configuration updated to enable or disable inline comments based on settings. * **Bug Fixes** * Prevented comment block creation when in read-only mode. * **Localization** * Added English localization for the comment prompt. <!-- end of auto-generated comment: release notes by coderabbit.ai --> #### PR Dependency Tree * **PR #13105** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal)
This commit is contained in:
@@ -59,7 +59,7 @@ interface BlocksuiteEditorProps {
|
||||
defaultOpenProperty?: DefaultOpenProperty;
|
||||
}
|
||||
|
||||
const usePatchSpecs = (mode: DocMode) => {
|
||||
const usePatchSpecs = (mode: DocMode, shared?: boolean) => {
|
||||
const [reactToLit, portals] = useLitPortalFactory();
|
||||
const { workspaceService, featureFlagService } = useServices({
|
||||
WorkspaceService,
|
||||
@@ -86,7 +86,8 @@ const usePatchSpecs = (mode: DocMode) => {
|
||||
const serverConfig = useLiveData(serverService.server.config$);
|
||||
|
||||
// comment may not be supported by the server
|
||||
const enableComment = serverConfig.features.includes(ServerFeature.Comment);
|
||||
const enableComment =
|
||||
serverConfig.features.includes(ServerFeature.Comment) && !shared;
|
||||
|
||||
const patchedSpecs = useMemo(() => {
|
||||
const manager = getViewManager()
|
||||
@@ -206,7 +207,7 @@ export const BlocksuiteDocEditor = forwardRef<
|
||||
[externalTitleRef]
|
||||
);
|
||||
|
||||
const [specs, portals] = usePatchSpecs('page');
|
||||
const [specs, portals] = usePatchSpecs('page', shared);
|
||||
|
||||
const displayBiDirectionalLink = useLiveData(
|
||||
editorSettingService.editorSetting.settings$.selector(
|
||||
|
||||
@@ -33,6 +33,7 @@ import type {
|
||||
import { ViewExtensionManager } from '@blocksuite/affine/ext-loader';
|
||||
import { getInternalViewExtensions } from '@blocksuite/affine/extensions/view';
|
||||
import { FoundationViewExtension } from '@blocksuite/affine/foundation/view';
|
||||
import { InlineCommentViewExtension } from '@blocksuite/affine/inlines/comment';
|
||||
import { AffineCanvasTextFonts } from '@blocksuite/affine/shared/services';
|
||||
import { LinkedDocViewExtension } from '@blocksuite/affine/widgets/linked-doc/view';
|
||||
import type { FrameworkProvider } from '@toeverything/infra';
|
||||
@@ -340,6 +341,11 @@ class ViewProvider {
|
||||
enableComment,
|
||||
framework,
|
||||
});
|
||||
|
||||
this._manager.configure(InlineCommentViewExtension, {
|
||||
enabled: enableComment,
|
||||
});
|
||||
|
||||
return this.config;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ class AffineCommentService implements CommentProvider {
|
||||
private readonly framework: FrameworkProvider
|
||||
) {
|
||||
this.docCommentManager = framework.get(DocCommentManagerService);
|
||||
this.docCommentManager.std = std;
|
||||
}
|
||||
|
||||
private get currentDocId(): string {
|
||||
|
||||
Reference in New Issue
Block a user