fix(ts_web): resolve TypeScript nullability and event typing issues across web components
This commit is contained in:
@@ -129,8 +129,8 @@ export class DeesWorkspaceMarkdown extends DeesElement {
|
||||
@state()
|
||||
accessor isDragging: boolean = false;
|
||||
|
||||
private resizeHandleElement: HTMLElement;
|
||||
private containerElement: HTMLElement;
|
||||
private resizeHandleElement!: HTMLElement;
|
||||
private containerElement!: HTMLElement;
|
||||
|
||||
public render() {
|
||||
return html`
|
||||
@@ -173,26 +173,26 @@ const hello = 'yes'
|
||||
`;
|
||||
}
|
||||
|
||||
public async firstUpdated(_changedPropertiesArg) {
|
||||
public async firstUpdated(_changedPropertiesArg: Map<string | number | symbol, unknown>) {
|
||||
await super.firstUpdated(_changedPropertiesArg);
|
||||
|
||||
// Initialize current ratio from property
|
||||
this.currentSplitRatio = this.splitRatio;
|
||||
|
||||
// Cache elements
|
||||
this.containerElement = this.shadowRoot.querySelector('.splitContainer');
|
||||
this.resizeHandleElement = this.shadowRoot.querySelector('.resizeHandle');
|
||||
this.containerElement = this.shadowRoot!.querySelector('.splitContainer')!;
|
||||
this.resizeHandleElement = this.shadowRoot!.querySelector('.resizeHandle')!;
|
||||
|
||||
const editor = this.shadowRoot.querySelector('dees-workspace-monaco') as DeesWorkspaceMonaco;
|
||||
const editor = this.shadowRoot!.querySelector('dees-workspace-monaco') as DeesWorkspaceMonaco;
|
||||
|
||||
// Wire up markdown rendering
|
||||
const markdownOutlet = this.shadowRoot.querySelector('dees-workspace-markdownoutlet');
|
||||
const markdownOutlet = this.shadowRoot!.querySelector('dees-workspace-markdownoutlet');
|
||||
const smartmarkdownInstance = new domtools.plugins.smartmarkdown.SmartMarkdown();
|
||||
const mdParsedResult = await smartmarkdownInstance.getMdParsedResultFromMarkdown('loading...')
|
||||
editor.contentSubject.subscribe(async contentArg => {
|
||||
await mdParsedResult.updateFromMarkdownString(contentArg)
|
||||
const html = mdParsedResult.html;
|
||||
markdownOutlet.updateHtmlText(html);
|
||||
markdownOutlet!.updateHtmlText(html);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ const hello = 'yes'
|
||||
document.removeEventListener('mouseup', this.handleMouseUp);
|
||||
|
||||
// Trigger resize on monaco editor
|
||||
const editor = this.shadowRoot.querySelector('dees-workspace-monaco') as DeesWorkspaceMonaco;
|
||||
const editor = this.shadowRoot!.querySelector('dees-workspace-monaco') as DeesWorkspaceMonaco;
|
||||
if (editor) {
|
||||
// Monaco needs to be notified of size changes
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
|
||||
Reference in New Issue
Block a user