Disable A Section of the Editor, Instead of the Full Editor
nkreiger opened this issue · comments
Clear and concise description of the problem
In client facing editors, sometimes you want to ensure certain values are always there, and cannot be removed by the user. You could hide them, however, sometimes if its code related the user might accidentally add them back.
Suggested solution
I have written a workaround, around this
const ne = (start, stop) => EditorView.updateListener.of((viewUpdate) => {
if (viewUpdate.docChanged) {
if (viewUpdate.changes.touchesRange(start, stop)) {
// rollback deletes, ignore create
// rollback state
nextTick(() => {
input.value = props.rollback;
});
}
}
});
// extensions
const rego_extensions = [rego_lang(), ne(props.disableStart, props.disableStop)];
moving something along these lines to:
vue-codemirror/src/codemirror.ts
Line 14 in 609ef5b
based on props
Alternative
Multiple combined editors.
Additional context
No response
Validations
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.