extract rules from content

This commit is contained in:
Julia Gru
2023-08-24 15:18:28 +02:00
parent b9625757f8
commit cee92f3a85
3 changed files with 11 additions and 1 deletions

View File

@@ -88,6 +88,9 @@ export class UmbStylesheetWorkspaceContext extends UmbWorkspaceContext<UmbStyles
}
async sendContentGetRules() {
if (!this.getData()?.content) return Promise.reject('There is no content to extract rules from...');
const requestBody = {
content: this.getData()?.content,
};

View File

@@ -65,6 +65,11 @@ export class UmbStylesheetWorkspaceViewCodeEditorElement extends UmbLitElement {
@input=${this.#onCodeEditorInput}></umb-code-editor>`;
}
disconnectedCallback(): void {
super.disconnectedCallback();
console.log('disconnected');
}
render() {
return html` <uui-box>
<div slot="header" id="code-editor-menu-container"></div>

View File

@@ -49,9 +49,9 @@ export class UmbStylesheetWorkspaceViewRichTextEditorElement extends UmbLitEleme
constructor() {
super();
//tODO: should this be called something else here?
this.consumeContext(UMB_WORKSPACE_CONTEXT, (workspaceContext) => {
this.#context = workspaceContext as UmbStylesheetWorkspaceContext;
this.#context.sendContentGetRules();
this.observe(this.#context.content, (content) => {
this._content = content ?? '';
@@ -79,6 +79,8 @@ export class UmbStylesheetWorkspaceViewRichTextEditorElement extends UmbLitEleme
});
}
#openModal = (rule: RichTextRuleModel | null = null) => {
if (!this._modalContext) throw new Error('Modal context not found');
this.#currentlyEditing = rule;