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
|
|
@ -9,19 +9,8 @@ export const NoTextInput = Extension.create({
|
|||
new Plugin({
|
||||
key: new PluginKey('noTextInput'),
|
||||
filterTransaction: (transaction) => {
|
||||
// If the transaction is adding text, stop it
|
||||
return (
|
||||
!transaction.docChanged ||
|
||||
transaction.steps.every((step) => {
|
||||
const { slice } = step.toJSON()
|
||||
return (
|
||||
!slice ||
|
||||
!slice.content.some(
|
||||
(node: { type: string }) => node.type === 'text'
|
||||
)
|
||||
)
|
||||
})
|
||||
)
|
||||
// Block all content-changing transactions
|
||||
return !transaction.docChanged
|
||||
},
|
||||
}),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue