This commit is contained in:
Juergen Kunz
2025-06-24 23:15:56 +00:00
parent 71d64fccb8
commit 474385a939
5 changed files with 246 additions and 5 deletions

View File

@ -699,11 +699,17 @@ export class DeesWysiwygBlock extends DeesElement {
];
protected shouldUpdate(changedProperties: Map<string, any>): boolean {
// If selection state changed, we need to update for non-editable blocks
const nonEditableTypes = ['divider', 'image', 'youtube', 'markdown', 'html', 'attachment'];
if (changedProperties.has('isSelected') && this.block && nonEditableTypes.includes(this.block.type)) {
// For non-editable blocks, we need to update the selected class
const element = this.shadowRoot?.querySelector('.block') as HTMLElement;
// If selection state changed, update the selected class without re-rendering
if (changedProperties.has('isSelected') && this.block) {
// Find the block element based on block type
let element: HTMLElement | null = null;
// Build the specific selector based on block type
const blockType = this.block.type;
const selector = `.block.${blockType}`;
element = this.shadowRoot?.querySelector(selector) as HTMLElement;
if (element) {
if (this.isSelected) {
element.classList.add('selected');