fix: fix order of executed plugins, fix #1547

This commit is contained in:
Philipp Kühn
2021-10-03 18:55:33 +02:00
parent dc868b3d2a
commit f8efdf797a
2 changed files with 75 additions and 2 deletions

View File

@@ -205,8 +205,12 @@ export default class ExtensionManager {
}
get plugins(): Plugin[] {
return [...this.extensions]
.reverse()
// With ProseMirror, first plugins within an array are executed first.
// In tiptap, we provide the ability to override plugins,
// so it feels more natural to run plugins at the end of an array first.
// Thats why we have to reverse the `extensions` array and sort again
// based on the `priority` option.
return ExtensionManager.sort([...this.extensions].reverse())
.map(extension => {
const context = {
name: extension.name,