-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Designer): Add Custom Editor for Vs-Code To Display DM Editor (#…
…4592) * addeddraft using http connector * added logic for displaytext * removed console logs * cleaned up * moved displayText to editorOptions * added flag to only display for vscode * changed structure and passed workflowService * added vscode extension commands * fixed typo * removed unused code * changed based on suggestions * removed unused markdown * changed back unwanted change * nit * connected services * removed previous non custom editor logic * removed manifest sample change from http * fixed nit --------- Co-authored-by: Travis Harris <hartra344@users.noreply.github.com>
- Loading branch information
1 parent
88df97d
commit 3a936cd
Showing
6 changed files
with
84 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
apps/vs-code-react/src/app/designer/customEditorService.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import type { IEditorParameterInfo, IEditorProps, IEditorService } from '@microsoft/logic-apps-shared'; | ||
import { Link } from '@fluentui/react'; | ||
|
||
export interface CustomEditorServiceOptions { | ||
areCustomEditorsEnabled?: boolean; | ||
openRelativeLink?: (relativeLink: string) => void; | ||
} | ||
|
||
export class CustomEditorService implements IEditorService { | ||
_areCustomEditorsEnabled = true; | ||
|
||
constructor(public readonly options: CustomEditorServiceOptions) { | ||
const { areCustomEditorsEnabled } = options; | ||
this._areCustomEditorsEnabled = areCustomEditorsEnabled ?? true; | ||
} | ||
|
||
public getEditor = (props: IEditorParameterInfo) => { | ||
if (!this._areCustomEditorsEnabled) { | ||
return undefined; | ||
} | ||
|
||
const { operationInfo, parameter } = props; | ||
const { connectorId, operationId } = operationInfo ?? {}; | ||
const { parameterName, editor, editorOptions } = parameter ?? {}; | ||
|
||
if (connectorId === 'connectionProviders/dataMapperOperations' && operationId === 'xsltTransform' && parameterName === 'text') { | ||
return { | ||
EditorComponent: this.DisplayTextEditor, | ||
hideLabel: true, | ||
editor, | ||
editorOptions, | ||
}; | ||
} | ||
|
||
return undefined; | ||
}; | ||
|
||
DisplayTextEditor = ({ editorOptions }: IEditorProps) => { | ||
return ( | ||
<> | ||
{editorOptions?.displayText?.text} | ||
<Link | ||
onClick={() => { | ||
this.options?.openRelativeLink?.(editorOptions?.displayText?.relativeLink ?? ''); | ||
}} | ||
> | ||
{editorOptions?.displayText?.relativeLinkText} | ||
</Link> | ||
</> | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters