update codeblock

This commit is contained in:
Juergen Kunz
2025-06-26 11:41:58 +00:00
parent 4a26307e1b
commit 09e35d0245
3 changed files with 1038 additions and 359 deletions

View File

@ -48,12 +48,12 @@ export class DeesWysiwygBlock extends DeesElement {
private lastKnownCursorPosition: number = 0;
private lastSelectedText: string = '';
private static handlerStylesInjected = false;
private handlerStylesInjected = false;
private injectHandlerStyles(): void {
// Only inject once per component class
if (DeesWysiwygBlock.handlerStylesInjected) return;
DeesWysiwygBlock.handlerStylesInjected = true;
// Only inject once per instance
if (this.handlerStylesInjected) return;
this.handlerStylesInjected = true;
// Get styles from all registered block handlers
let styles = '';
@ -131,20 +131,7 @@ export class DeesWysiwygBlock extends DeesElement {
margin: 16px 0;
}
.block.code {
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
font-size: 14px;
background: ${cssManager.bdTheme('#f8f8f8', '#0d0d0d')};
border: 1px solid ${cssManager.bdTheme('#e0e0e0', '#2a2a2a')};
padding: 16px 20px;
padding-top: 32px;
border-radius: 6px;
white-space: pre-wrap;
color: ${cssManager.bdTheme('#24292e', '#e1e4e8')};
line-height: 1.5;
overflow-x: auto;
margin: 20px 0;
}
/* Code block styles moved to handler */
.block.list {
padding: 0;
@ -200,24 +187,7 @@ export class DeesWysiwygBlock extends DeesElement {
border-bottom-color: ${cssManager.bdTheme('#0066cc', '#4d94ff')};
}
.code-language {
position: absolute;
top: 0;
right: 0;
background: ${cssManager.bdTheme('#e1e4e8', '#333333')};
color: ${cssManager.bdTheme('#586069', '#8b949e')};
padding: 4px 12px;
font-size: 12px;
border-radius: 0 6px 0 6px;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
text-transform: lowercase;
z-index: 1;
}
.code-block-container {
position: relative;
margin: 20px 0;
}
/* Code block container and language styles moved to handler */
/* Selection styles */
.block ::selection {