@readable-js/react-codemirror
Version:
React component for ReadableJS
23 lines • 823 B
JavaScript
import { ViewPlugin } from "@codemirror/view";
import { readableMessages } from './readableMessages';
/**
*
* @param getCallStack
* @param currentStep
* @param skipEvaluation when forcing update with reconfigure, you don't want to execute the code again.
*/
export const readablePlugin = (getCallStack, currentStep, skipEvaluation) => {
return ViewPlugin.fromClass(class {
constructor(view) {
this.decorations = readableMessages(view, getCallStack, currentStep, skipEvaluation);
}
update(update) {
if (update.docChanged) {
this.decorations = readableMessages(update.view, getCallStack, currentStep);
}
}
}, {
decorations: v => v.decorations,
});
};
//# sourceMappingURL=readable-plugin.js.map