mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: Dynamic preview page content can be deleted when AI menu is present #349
This commit is contained in:
parent
8acceb5ba9
commit
0f87065806
2 changed files with 5 additions and 14 deletions
|
|
@ -163,7 +163,9 @@ function AIActionButton(props: {
|
||||||
})
|
})
|
||||||
await dispatchAIChatBot({ type: 'setIsWaitingForResponse' })
|
await dispatchAIChatBot({ type: 'setIsWaitingForResponse' })
|
||||||
const response = await startActivityAIChatSession(
|
const response = await startActivityAIChatSession(
|
||||||
message, access_token
|
message,
|
||||||
|
access_token,
|
||||||
|
props.activity.activity_uuid
|
||||||
)
|
)
|
||||||
if (response.success == false) {
|
if (response.success == false) {
|
||||||
await dispatchAIChatBot({ type: 'setIsNoLongerWaitingForResponse' })
|
await dispatchAIChatBot({ type: 'setIsNoLongerWaitingForResponse' })
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,8 @@ export const NoTextInput = Extension.create({
|
||||||
new Plugin({
|
new Plugin({
|
||||||
key: new PluginKey('noTextInput'),
|
key: new PluginKey('noTextInput'),
|
||||||
filterTransaction: (transaction) => {
|
filterTransaction: (transaction) => {
|
||||||
// If the transaction is adding text, stop it
|
// Block all content-changing transactions
|
||||||
return (
|
return !transaction.docChanged
|
||||||
!transaction.docChanged ||
|
|
||||||
transaction.steps.every((step) => {
|
|
||||||
const { slice } = step.toJSON()
|
|
||||||
return (
|
|
||||||
!slice ||
|
|
||||||
!slice.content.some(
|
|
||||||
(node: { type: string }) => node.type === 'text'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
})
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue