A combination of inputrules and placeholder?

Hi ProseMirror People! This is my first topic in the forum! At first I want to say thank you for createing such a good editor!

Apologies if this has already been discussed, I’ve found some discussions related when searching. I am still new to the editor and the community so thanks in advance for your patients!

I am trying to create a functionality that will propmt on what to type next when the current input matches a regex pattern.

For example: When user type “2024/02/” the editor will add a prompt “day” at the end of the current input. The prompt:

  • Should not be part of the document’s content ( I am assumthing this means I need to use decoration?)
  • Should disappear when the user keeps typing. For example: when users types “2024/02/” the prompt will appear “2024/02/day” and when user keeps typing, the prompt will disappear “2024/02/1”.

Is this something I can achieve with inputRule?

No. You’ll want to create a custom plugin that scans the text before the cursor after every transaction that changes the document or selection, and if it matches something you want to show a suggestion for, create a widget decoration with the suggested text.