mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
fix: ai button should not display in readonly mode (#7415)
[BS-737](https://linear.app/affine-design/issue/BS-737/shared-page-也可以用-ai)
This commit is contained in:
@@ -33,7 +33,7 @@ export function setupCodeToolbarEntry(codeToolbar: AffineCodeToolbarWidget) {
|
||||
name: 'Ask AI',
|
||||
tooltip: 'Ask AI',
|
||||
icon: AIStarIcon,
|
||||
showWhen: () => true,
|
||||
showWhen: CodeBlockComponent => !CodeBlockComponent.doc.readonly,
|
||||
render(codeBlock: CodeBlockComponent, onClick?: () => void) {
|
||||
return html`<ask-ai-button
|
||||
class="code-toolbar-button ask-ai"
|
||||
|
||||
@@ -44,7 +44,7 @@ export function setupImageToolbarEntry(imageToolbar: AffineImageToolbarWidget) {
|
||||
}}
|
||||
></ask-ai-button>`;
|
||||
},
|
||||
showWhen: () => true,
|
||||
showWhen: imageBlockComponent => !imageBlockComponent.doc.readonly,
|
||||
},
|
||||
],
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user