Files
Foundry-VTT-Docker/resources/app/common/prosemirror/dirty-plugin.mjs

23 lines
562 B
JavaScript
Raw Normal View History

2025-01-04 00:34:03 +01:00
import ProseMirrorPlugin from "./plugin.mjs";
import {Plugin} from "prosemirror-state";
/**
* A simple plugin that records the dirty state of the editor.
* @extends {ProseMirrorPlugin}
*/
export default class ProseMirrorDirtyPlugin extends ProseMirrorPlugin {
/** @inheritdoc */
static build(schema, options={}) {
return new Plugin({
state: {
init() {
return false;
},
apply() {
return true; // If any transaction is applied to the state, we mark the editor as dirty.
}
}
});
}
}