diff --git a/src/plugins/header/header.less b/src/plugins/header/header.less index 2bef7956..7fcd6d58 100644 --- a/src/plugins/header/header.less +++ b/src/plugins/header/header.less @@ -9,12 +9,15 @@ border-bottom: 1px solid @section-border; .copy-icon { - min-height: 24px; - min-width: 24px; margin-left: 0.6rem; border: none; cursor: pointer; - background: transparent center no-repeat url("data:image/svg+xml;utf8,"); + background-color: transparent; + svg { + width: 1.5rem; + height: 1.5rem; + pointer-events: none; + } } @media @mobile { diff --git a/src/plugins/header/header.ts b/src/plugins/header/header.ts index fbc008e0..c5a1be4d 100644 --- a/src/plugins/header/header.ts +++ b/src/plugins/header/header.ts @@ -1,7 +1,7 @@ import {EventUtils} from '@exadel/esl/modules/esl-utils/dom/events'; import {listen} from '@exadel/esl/modules/esl-utils/decorators/listen'; import {UIPPlugin} from '../../core/base/plugin'; -import {UIPOptions, UIPSnippets} from '../registration'; +import {UIPOptionIcons, UIPOptions, UIPSnippets} from '../registration'; /** * Header {@link UIPPlugin} custom element definition @@ -42,6 +42,7 @@ export class UIPHeader extends UIPPlugin { const icon = document.createElement('button'); icon.title = 'copy markup'; icon.classList.add('copy-icon'); + icon.append(UIPOptionIcons.copySVG); this.append(icon); } diff --git a/src/plugins/header/options/OptionIcons.tsx b/src/plugins/header/options/OptionIcons.tsx index fb03523b..3b12a7ed 100644 --- a/src/plugins/header/options/OptionIcons.tsx +++ b/src/plugins/header/options/OptionIcons.tsx @@ -39,4 +39,12 @@ export class UIPOptionIcons { ) as HTMLElement; + + /** Default svg for copy icon */ + public static copySVG: HTMLElement = ( + + + + + ) as HTMLElement; } diff --git a/src/plugins/header/options/option/option.less b/src/plugins/header/options/option/option.less index 36a943c8..bcd59f99 100644 --- a/src/plugins/header/options/option/option.less +++ b/src/plugins/header/options/option/option.less @@ -41,8 +41,13 @@ uip-option { &.editor-collapsed-option { width: 2rem; + &.active svg { fill: #5f5f5f; } } + + svg { + pointer-events: none + } } diff --git a/src/plugins/header/options/options.ts b/src/plugins/header/options/options.ts index f33de6c3..8a9be75f 100644 --- a/src/plugins/header/options/options.ts +++ b/src/plugins/header/options/options.ts @@ -95,10 +95,9 @@ export class UIPOptions extends UIPPlugin { * Handles {@link UIPOption} `click` event * to manage {@link UIPRoot} options attributes */ - @listen({event: 'click'}) + @listen({event: 'click', selector: '.uip-option'}) protected _onOptionClick(e: Event) { - e.stopPropagation(); - const option = (e.target as HTMLElement).closest('uip-option') as UIPOption; + const option = e.target as UIPOption; this.root?.toggleAttribute(option.attribute, option.active); }