smartcomponents icon indicating copy to clipboard operation
smartcomponents copied to clipboard

Add a way to opt-out for some fileds

Open dbochicchio opened this issue 1 year ago • 2 comments

First of all: brilliant work!

I have very large forms where I know certain fields are usually ignored and not pasted.

I think a way to ignore certain fields via data attribute (ie: data-smartpaste-ignore="true") could speed up the computing and save some tokens.

Even something like ```data-smartpaste-explicit="true"on the form and thendata-smartpaste-include="true"`` on the fields we want to use could be OK.

dbochicchio avatar Mar 18 '24 16:03 dbochicchio

Very good suggestion, thanks.

A pattern we've often used in other products is to allow it to be set hierarchically. So for each field, we'd scan up the DOM hierarchy to find the closest element (which could be the field itself, or some parent div, or the parent form, or the top-level <html> element) that has a data-smartpaste-include attribute.

So:

  • Since the default is "include", you could exclude by putting data-smartpaste-include="false" on the input element itself
  • Or if you want to change the default to be "exclude", you'd do that by putting data-smartpaste-include="false" on the <form>, and then put data-smartpaste-include="true" on individual fields.

That's almost the same as what you already suggested, except slightly generalizing it so you can put this attribute at any level in the hierarchy.

SteveSandersonMS avatar Mar 19 '24 10:03 SteveSandersonMS