From 8a5db330ee560cd863ce707976b0fe8ac6871b93 Mon Sep 17 00:00:00 2001 From: Julia Gru <56249914+julczka@users.noreply.github.com> Date: Fri, 11 Aug 2023 13:29:54 +0200 Subject: [PATCH] create form with preview --- ...ace-view-rich-text-editor-style-sidebar.ts | 73 ++++++++++++++++--- ...workspace-view-rich-text-editor.element.ts | 11 ++- 2 files changed, 73 insertions(+), 11 deletions(-) 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.ts b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor-style-sidebar.ts index 768758b1f5..6b3681a33a 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor-style-sidebar.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/templating/stylesheets/workspace/views/rich-text-editor/stylesheet-workspace-view-rich-text-editor-style-sidebar.ts @@ -1,5 +1,5 @@ import { UUITextStyles } from '@umbraco-cms/backoffice/external/uui'; -import { css, html, customElement } from '@umbraco-cms/backoffice/external/lit'; +import { css, html, customElement, ifDefined } from '@umbraco-cms/backoffice/external/lit'; import { UmbModalBaseElement } from '@umbraco-cms/internal/modal'; import { RichTextRuleModel } from '@umbraco-cms/backoffice/backend-api'; @@ -20,19 +20,63 @@ export default class UmbStylesheetRichTextEditorStyleModalElement extends UmbMod this.modalContext?.reject(); } + #submit() { + const rule = this.data?.rule ?? {}; + this.modalContext?.submit({ rule }); + } + render() { return html` - +
-

Rule

-

${this.data?.rule?.name}

-

${this.data?.rule?.selector}

-

${this.data?.rule?.styles}

+ +
+ + Name + The name displayed in the editor style selector + + + + + Selector + Uses CSS syntax, e.g. "h1" or ".redHeader" + + + + + Selector + The CSS that should be applied in the rich text editor, e.g. "color:red;" + + + + + Preview + How the text will look like in the rich text editor. +
+ a b c d e f g h i j k l m n o p q r s t u v w x t z +
+ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z +
+ 1 2 3 4 5 6 7 8 9 0 € £ $ % & (.,;:'"!?) +
+ Just keep examining every bid quoted for zinc etchings. +
+
+
+
Close + Submit
`; @@ -59,9 +103,20 @@ export default class UmbStylesheetRichTextEditorStyleModalElement extends UmbMod margin-bottom: var(--uui-size-space-5); } - h3, - p { - text-align: left; + uui-input { + width: 100%; + } + + #styles { + font-family: + Monaco, + Menlo, + Consolas, + Courier New, + monospace; + --uui-textarea-min-height: 100px; + resize: none; + width: 300px; } `, ]; 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 c7d7883ac4..d84c269358 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 @@ -18,7 +18,7 @@ export const UMB_MODAL_TEMPLATING_STYLESHEET_RTF_STYLE_SIDEBAR_MODAL = new UmbMo UMB_MODAL_TEMPLATING_STYLESHEET_RTF_STYLE_SIDEBAR, { type: 'sidebar', - size: 'small', + size: 'medium', }, ); @customElement('umb-stylesheet-workspace-view-rich-text-editor') @@ -96,12 +96,19 @@ export class UmbStylesheetWorkspaceViewRichTextEditorElement extends UmbLitEleme }); }; + #removeRule = (rule: RichTextRuleModel) => { + this._rules = this._rules?.filter((r) => r !== rule); + throw new Error('Method not implemented.'); + }; + renderRule(rule: RichTextRuleModel) { return html`
${rule.name}
this.#openModal(rule)}>EditRemove + > this.#removeRule(rule)} + >Remove
`; }