From bb408dd355892e3e950e74967ea4f605e39d097c Mon Sep 17 00:00:00 2001 From: Julia Gru <56249914+julczka@users.noreply.github.com> Date: Tue, 29 Aug 2023 14:23:12 +0200 Subject: [PATCH] clenaup --- .../packages/templating/stylesheets/index.ts | 2 -- .../stylesheet-workspace-editor.element.ts | 15 ------------- ...heet-workspace-view-code-editor.element.ts | 22 +------------------ ...-rich-text-editor-style-sidebar.element.ts | 2 +- ...workspace-view-rich-text-editor.element.ts | 5 ++--- 5 files changed, 4 insertions(+), 42 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/index.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/index.ts index e3d083d6f8..ec91672f86 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/index.ts @@ -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'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/stylesheet-workspace-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/stylesheet-workspace-editor.element.ts index 337ba18cbe..404ec695ca 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/stylesheet-workspace-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/stylesheet-workspace-editor.element.ts @@ -24,10 +24,6 @@ export class UmbStylesheetWorkspaceEditorElement extends UmbLitElement { @state() private _path?: string; - private _modalContext?: UmbModalManagerContext; - - #isNew = false; - private inputQuery$ = new Subject(); 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) { diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/code-editor/stylesheet-workspace-view-code-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/code-editor/stylesheet-workspace-view-code-editor.element.ts index 0387291433..614870d536 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/code-editor/stylesheet-workspace-view-code-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/code-editor/stylesheet-workspace-view-code-editor.element.ts @@ -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}>`; } - render() { return html`
diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor-style-sidebar.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor-style-sidebar.element.ts index 147952cf48..6b1c8c51da 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor-style-sidebar.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor-style-sidebar.element.ts @@ -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; diff --git a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor.element.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor.element.ts index a84967deb4..d6db2a93f2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor.element.ts @@ -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; }, });