This commit is contained in:
Julia Gru
2023-08-04 12:44:10 +02:00
parent 77b5ed2310
commit 4f6dda5513
4 changed files with 40 additions and 47 deletions

View File

@@ -93,33 +93,6 @@ export const data: Array<StylesheetDBItem> = [
color: pink;
}`,
},
{
path: 'Folder 1/Stylesheet File 3.css',
isFolder: false,
icon: 'style',
name: 'Stylesheet File 3.css',
type: 'stylesheet',
hasChildren: false,
content: ` h1 {
color: red;
}
/**umb_name:bjjh*/
h1 {
color: red;
}
/**umb_name:comeone*/
h1 {
color: red;
}
/**umb_name:lol*/
h1 {
color: red;
}`,
},
];
// Temp mocked database

View File

@@ -27,9 +27,12 @@ const workspaceEditorViews: Array<ManifestWorkspaceEditorView> = [
pathname: 'code',
icon: 'umb:brackets',
},
conditions: {
workspaces: ['Umb.Workspace.StyleSheet'],
},
conditions: [
{
alias: 'Umb.Condition.WorkspaceAlias',
match: 'Umb.Workspace.StyleSheet',
},
],
},
{
type: 'workspaceEditorView',
@@ -42,9 +45,12 @@ const workspaceEditorViews: Array<ManifestWorkspaceEditorView> = [
pathname: 'rich-text-editor',
icon: 'umb:font',
},
conditions: {
workspaces: ['Umb.Workspace.StyleSheet'],
},
conditions: [
{
alias: 'Umb.Condition.WorkspaceAlias',
match: 'Umb.Workspace.StyleSheet',
},
],
},
];
const workspaceActions: Array<ManifestWorkspaceAction> = [
@@ -58,9 +64,12 @@ const workspaceActions: Array<ManifestWorkspaceAction> = [
color: 'positive',
api: UmbSaveWorkspaceAction,
},
conditions: {
workspaces: ['Umb.Workspace.StyleSheet'],
},
conditions: [
{
alias: 'Umb.Condition.WorkspaceAlias',
match: 'Umb.Workspace.StyleSheet',
},
],
},
];

View File

@@ -1,8 +1,8 @@
import { UUIInputElement, UUIInputEvent, UUITextStyles } from '@umbraco-cms/backoffice/external/uui';
import { css, html, LitElement, customElement, state } from '@umbraco-cms/backoffice/external/lit';
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbStylesheetWorkspaceContext } from './stylesheet-workspace.context.js';
import { UMB_MODAL_MANAGER_CONTEXT_TOKEN, UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
import { UMB_ENTITY_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';
import { UMB_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';
import { UmbLitElement } from '@umbraco-cms/internal/lit-element';
@customElement('umb-stylesheet-workspace-edit')
@@ -20,7 +20,7 @@ export class UmbStylesheetWorkspaceEditElement extends UmbLitElement {
constructor() {
super();
this.consumeContext(UMB_ENTITY_WORKSPACE_CONTEXT, (instance) => {
this.consumeContext(UMB_WORKSPACE_CONTEXT, (instance) => {
this.#workspaceContext = instance as UmbStylesheetWorkspaceContext;
this.#observeNameAndPath();
});
@@ -50,7 +50,7 @@ export class UmbStylesheetWorkspaceEditElement extends UmbLitElement {
return html`
<umb-workspace-editor alias="Umb.Workspace.StyleSheet">
<div id="header" slot="header">
<uui-input id="name" .value=${this._name} @input="${this.#onNameChange}"> </uui-input>
<uui-input label="stylesheet name" id="name" .value=${this._name} @input="${this.#onNameChange}"> </uui-input>
<small>${this._path}</small>
</div>

View File

@@ -14,20 +14,31 @@ export class UmbStylesheetWorkspaceElement extends UmbLitElement {
@state()
_routes: UmbRoute[] = [
// {
// path: 'create/:parentId',
// component: () => this.#element,
// setup: async (_component, info) => {
// const path = info.match.params.path;
// const serverPath = serverFilePathFromUrlFriendlyPath(path);
// this.#workspaceContext.setIsNew(false);
// console.log('load');
// await this.#workspaceContext.load(serverPath);
// new UmbWorkspaceIsNewRedirectController(
// this,
// this.#workspaceContext,
// this.shadowRoot!.querySelector('umb-router-slot')!
// );
// },
// },
{
path: 'edit/:path',
component: () => this.#element,
setup: (_component, info) => {
this.removeControllerByAlias('_observeIsNew');
const path = info.match.params.path;
const serverPath = serverFilePathFromUrlFriendlyPath(path);
console.log('load');
this.#workspaceContext.load(serverPath);
new UmbWorkspaceIsNewRedirectController(
this,
this.#workspaceContext,
this.shadowRoot!.querySelector('umb-router-slot')!
);
},
},
];