clenaup
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { StylesheetResponseModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
|
||||
// TODO: temp until we have a proper stylesheet model
|
||||
export type StylesheetDetails = StylesheetResponseModel;
|
||||
|
||||
|
||||
export * from './repository/index.js';
|
||||
|
||||
@@ -24,10 +24,6 @@ export class UmbStylesheetWorkspaceEditorElement extends UmbLitElement {
|
||||
@state()
|
||||
private _path?: string;
|
||||
|
||||
private _modalContext?: UmbModalManagerContext;
|
||||
|
||||
#isNew = false;
|
||||
|
||||
private inputQuery$ = new Subject<string>();
|
||||
|
||||
constructor() {
|
||||
@@ -40,23 +36,12 @@ export class UmbStylesheetWorkspaceEditorElement extends UmbLitElement {
|
||||
this.#workspaceContext?.setName(`${nameInputValue}.css`);
|
||||
});
|
||||
});
|
||||
|
||||
this.consumeContext(UMB_MODAL_MANAGER_CONTEXT_TOKEN, (instance) => {
|
||||
this._modalContext = instance;
|
||||
});
|
||||
}
|
||||
|
||||
#observeNameAndPath() {
|
||||
if (!this.#workspaceContext) return;
|
||||
this.observe(this.#workspaceContext.name, (name) => (this._name = name ?? ''), '_observeName');
|
||||
this.observe(this.#workspaceContext.path, (path) => (this._path = path ?? ''), '_observePath');
|
||||
this.observe(
|
||||
this.#workspaceContext.isNew,
|
||||
(isNew) => {
|
||||
this.#isNew = !!isNew;
|
||||
},
|
||||
'_observeIsNew',
|
||||
);
|
||||
}
|
||||
|
||||
#onNameChange(event: UUIInputEvent) {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { UUITextStyles } from '@umbraco-ui/uui-css';
|
||||
import { css, html } from 'lit';
|
||||
import { customElement, query, state } from 'lit/decorators.js';
|
||||
import { customElement, state } from 'lit/decorators.js';
|
||||
import { UmbStylesheetWorkspaceContext } from '../../stylesheet-workspace.context.js';
|
||||
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
|
||||
import { UmbCodeEditorElement } from '@umbraco-cms/backoffice/code-editor';
|
||||
import { UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
|
||||
import { UMB_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';
|
||||
|
||||
@customElement('umb-stylesheet-workspace-view-code-editor')
|
||||
@@ -12,24 +11,14 @@ export class UmbStylesheetWorkspaceViewCodeEditorElement extends UmbLitElement {
|
||||
@state()
|
||||
private _content?: string | null = '';
|
||||
|
||||
@state()
|
||||
private _path?: string | null = '';
|
||||
|
||||
@state()
|
||||
private _ready?: boolean = false;
|
||||
|
||||
@query('umb-code-editor')
|
||||
private _codeEditor?: UmbCodeEditorElement;
|
||||
|
||||
#stylesheetWorkspaceContext?: UmbStylesheetWorkspaceContext;
|
||||
private _modalContext?: UmbModalManagerContext;
|
||||
|
||||
#isNew = false;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
//tODO: should this be called something else here?
|
||||
this.consumeContext(UMB_WORKSPACE_CONTEXT, (workspaceContext) => {
|
||||
this.#stylesheetWorkspaceContext = workspaceContext as UmbStylesheetWorkspaceContext;
|
||||
|
||||
@@ -37,14 +26,6 @@ export class UmbStylesheetWorkspaceViewCodeEditorElement extends UmbLitElement {
|
||||
this._content = content;
|
||||
});
|
||||
|
||||
this.observe(this.#stylesheetWorkspaceContext.path, (path) => {
|
||||
this._path = path;
|
||||
});
|
||||
|
||||
this.observe(this.#stylesheetWorkspaceContext.isNew, (isNew) => {
|
||||
this.#isNew = !!isNew;
|
||||
});
|
||||
|
||||
this.observe(this.#stylesheetWorkspaceContext.isCodeEditorReady, (isReady) => {
|
||||
this._ready = isReady;
|
||||
});
|
||||
@@ -65,7 +46,6 @@ export class UmbStylesheetWorkspaceViewCodeEditorElement extends UmbLitElement {
|
||||
@input=${this.#onCodeEditorInput}></umb-code-editor>`;
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
return html` <uui-box>
|
||||
<div slot="header" id="code-editor-menu-container"></div>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { RichTextRuleModelSortable } from '../../stylesheet-workspace.context.js';
|
||||
import { UUITextStyles } from '@umbraco-cms/backoffice/external/uui';
|
||||
import { css, html, customElement, ifDefined, state } from '@umbraco-cms/backoffice/external/lit';
|
||||
import { UmbModalBaseElement } from '@umbraco-cms/internal/modal';
|
||||
import { RichTextRuleModel } from '@umbraco-cms/backoffice/backend-api';
|
||||
import { RichTextRuleModelSortable } from '../../stylesheet-workspace.context.js';
|
||||
|
||||
export interface StylesheetRichTextEditorStyleModalData {
|
||||
rule: RichTextRuleModelSortable | null;
|
||||
|
||||
@@ -47,11 +47,10 @@ export class UmbStylesheetWorkspaceViewRichTextEditorElement extends UmbLitEleme
|
||||
#sorter = new UmbSorterController(this, {
|
||||
...SORTER_CONFIG,
|
||||
performItemInsert: ({ item, newIndex }) => {
|
||||
//return true;
|
||||
|
||||
return this.#context?.findNewSortOrder(item, newIndex) ?? false;
|
||||
},
|
||||
performItemRemove: (args) => {
|
||||
performItemRemove: () => {
|
||||
//defined so the default does not run
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user