fix: Dynamic preview page content can be deleted when AI menu is present #349

This commit is contained in:
swve 2024-11-28 23:47:57 +01:00
parent 8acceb5ba9
commit 0f87065806
2 changed files with 5 additions and 14 deletions

View file

@ -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' })

View file

@ -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'
)
)
})
)
}, },
}), }),
] ]