Not selecting and Copying hidden characters

Is it possible in some way to not copy/select a hidden text after doing a Decoration.replace to hide it? Just to clarify for example a given text:

# Title

Would show as:

Title

with bigger fonts and so on.

What I’m currently trying to achieve is after setting editable to false and the user select the text it won’t copy the first two characters (# and blank space).

Copying and cutting is done from the actual document, not its visible representation. That’s usually the appropriate thing. You’ll have to write your own event handler if you want the library to behave differently.

1 Like