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

feat: let VisualEditor accept dynamic uischema instead of hardcoding #1995

Merged
merged 8 commits into from
Feb 14, 2020

Conversation

yeze322
Copy link
Contributor

@yeze322 yeze322 commented Feb 14, 2020

Description

closes #1984

To support the scenario that users can customize their own editor schema under a bot project, Visual Editor should have the capability to consume dynamic passed-in uischema instead of consume a hardcoded one.

This PR refactor the schema provider logic in Visual Editor and make it possible to accept dynamic uischema from external sources.

// 1 - create a schema provider
import schemaV1 from './schemas/v1';

const schemaV1Provider = new SchemaProvider(schemaV1);
const SendActivity = schemaV1Provider.get('Microsoft.SendActivity');


// 2 - pass the provider through context
<UISchemaContext.Provider value={uiSchemaV1Provider}>
  <VisualEditor />
<UISchemaContext.Provider>

// 3 - consume the schema
const Action = (props) => {
  const schemaProvider = useContext(UISchemaProvider)
  const sendActivitySchema = schemaProvider.get('Microsoft.SendActivity');
  return renderWithSchema(sendActivitySchema);
}

Task Item

#1984

Screenshots

@yeze322 yeze322 marked this pull request as ready for review February 14, 2020 15:31
@yeze322 yeze322 changed the title refactor: let VisualEditor accept dynamic uischema instead of hardcoding feat: let VisualEditor accept dynamic uischema instead of hardcoding Feb 14, 2020
@cwhitten cwhitten merged commit e387ade into microsoft:master Feb 14, 2020
@a-b-r-o-w-n a-b-r-o-w-n mentioned this pull request Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants