Dynamic highlighter while typing #1812
Answered
by
philippkuehn
LuizPelegrini
asked this question in
Questions & Help
-
Beta Was this translation helpful? Give feedback.
Answered by
philippkuehn
Aug 28, 2021
Replies: 1 comment
-
You could also solve this with decorations. Read about it in the ProseMirror guide. The linter experiment is maybe a good reference. Another way is to dynamically add a class to the editor based on its content: new Plugin({
props: {
attributes: state => {
if (state.doc.textContent.length <= 10) {
return {
class: 'your-custom-class',
}
}
},
},
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hanspagel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also solve this with decorations. Read about it in the ProseMirror guide. The linter experiment is maybe a good reference.
Another way is to dynamically add a class to the editor based on its content: