Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JavaScript][Deregistering a property from the parser/render] #4414

Closed
mokandre opened this issue Jul 17, 2020 · 4 comments · Fixed by #4419
Closed

[JavaScript][Deregistering a property from the parser/render] #4414

mokandre opened this issue Jul 17, 2020 · 4 comments · Fixed by #4419
Assignees
Labels
Partner-CiscoWebEx Bugs impacting CiscoWebEx integration scenarios Platform-JavaScript Bugs or features related to the JavaScript renderer Request

Comments

@mokandre
Copy link

mokandre commented Jul 17, 2020

What platform is your feature request related to?

  • JavaScript

Is your feature request related to a problem? Please describe.

We would like to disable the functionality of unsupported properties on parser/render

Describe the solution you'd like
It would be great to have a way to Deregister a property from the parser/render

Deregister has to work for the following cases:

  • Deregister the property for a particular element( For Example: Deregister the Height property of columnSet)
  • Deregister the property for all elements(For Example: Deregister the verticalContentAlignment property for all the elements where it supports)

For Example

Unsupported Property : maxLines for TextBlock element.

After deregistering a property, though users try to add maxLines property to their JSON then that property shouldn't render/parse.

Current behavior:

Screenshot 2020-07-17 at 11 37 18 AM

If possible, validator have to point out that the unsupported properties are not supported as warning message

For Example:(Warning Message)

Unknown/Unsupported property :maxLines of TextBlock Element

@shalinijoshi19 shalinijoshi19 added Platform-JavaScript Bugs or features related to the JavaScript renderer javascript Partner-CiscoWebEx Bugs impacting CiscoWebEx integration scenarios labels Jul 17, 2020
@dclaux
Copy link
Member

dclaux commented Jul 17, 2020

@mokandre This is actually already supported, via the SrializableObject.onRegisterCustomProperties event. Example:

Adaptive.SerializableObject.onRegisterCustomProperties = (sender: Adaptive.SerializableObject, schema: Adaptive.SerializableObjectSchema) => {
    if (sender instanceof Adaptive.TextBlock) {
        schema.remove(Adaptive.TextBlock.heightProperty);
    }
}

Can you please try this and close this issue if that solves your problem?

@mokandre
Copy link
Author

@mokandre This is actually already supported, via the SrializableObject.onRegisterCustomProperties event. Example:

Adaptive.SerializableObject.onRegisterCustomProperties = (sender: Adaptive.SerializableObject, schema: Adaptive.SerializableObjectSchema) => {
    if (sender instanceof Adaptive.TextBlock) {
        schema.remove(Adaptive.TextBlock.heightProperty);
    }
}

Can you please try this and close this issue if that solves your problem?

@dclaux Able to deregister some of the properties but
Following are some issues facing while deregistering (fallback and requires) properties

  • Deregistering requires property:

Screenshot 2020-07-20 at 2 28 37 PM

Output:
Screenshot 2020-07-20 at 2 47 49 PM

  • I'm not able to access the fallback property in element (Example: Adaptive.TextBlock. ? ). Can you give me an example of how to deregister fallback property for all elements?

@dclaux
Copy link
Member

dclaux commented Jul 20, 2020

@mokandre I will implement another model for property deregistration. I could just fix the bug you mentioned, but I fear there will be more such bugs as the renderer expects and needs some properties to be registered.

As for fallback, it is not handled as a property internally and therefore cannot be unregistered. Fallback is mainly a parse-time feature, and fallback elements are not parsed if they are not needed. I will add a global flag to disable fallback.

@microsoft microsoft deleted a comment Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Partner-CiscoWebEx Bugs impacting CiscoWebEx integration scenarios Platform-JavaScript Bugs or features related to the JavaScript renderer Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants