documentation/template-playground/template-playground.component.ts
| selector | template-playground-root |
| styles |
.template-playground {
display: flex;
flex-direction: column;
height: 100vh;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.template-playground-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 2rem;
background: #f8f9fa;
border-bottom: 1px solid #dee2e6;
}
.template-playground-status {
display: flex;
align-items: center;
gap: 1rem;
font-size: 0.875rem;
}
.session-info {
color: #6c757d;
font-family: monospace;
}
.saving-indicator {
color: #ffc107;
font-weight: bold;
}
.last-saved {
color: #28a745;
}
.template-playground-actions {
display: flex;
gap: 0.5rem;
}
.config-panel {
background: #e9ecef;
padding: 1rem 2rem;
border-bottom: 1px solid #dee2e6;
transition: all 0.3s ease;
max-height: 200px;
overflow: hidden;
}
.config-panel.collapsed {
max-height: 0;
padding: 0 2rem;
}
.config-options {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 0.5rem;
margin-top: 0.5rem;
}
.config-options label {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
}
.template-playground-body {
display: flex;
flex: 1;
overflow: hidden;
}
.template-playground-sidebar {
width: 250px;
background: #f8f9fa;
border-right: 1px solid #dee2e6;
overflow-y: auto;
}
.template-file-list {
padding: 1rem;
}
.template-file-list h3 {
margin: 0 0 0.5rem 0;
font-size: 0.875rem;
font-weight: 600;
color: #495057;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.file-list {
list-style: none;
padding: 0;
margin: 0 0 1.5rem 0;
}
.file-list li {
display: flex;
align-items: center;
padding: 0.5rem;
cursor: pointer;
border-radius: 4px;
font-size: 0.875rem;
transition: background-color 0.15s ease;
}
.file-list li:hover {
background: #e9ecef;
}
.file-list li.active {
background: #007bff;
color: white;
}
.file-icon {
margin-right: 0.5rem;
opacity: 0.7;
}
.file-type {
margin-left: auto;
font-size: 0.75rem;
opacity: 0.7;
text-transform: uppercase;
}
.loading-templates {
text-align: center;
color: #6c757d;
font-style: italic;
padding: 2rem;
}
.template-playground-main {
flex: 1;
display: flex;
overflow: hidden;
}
.template-playground-editor {
width: 50%;
display: flex;
flex-direction: column;
border-right: 1px solid #dee2e6;
}
.editor-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
background: #f8f9fa;
border-bottom: 1px solid #dee2e6;
}
.editor-header h4 {
margin: 0;
font-size: 0.875rem;
font-weight: 600;
}
.file-type-badge {
background: #6c757d;
color: white;
padding: 0.125rem 0.5rem;
border-radius: 12px;
font-size: 0.75rem;
text-transform: uppercase;
}
.editor-container {
flex: 1;
position: relative;
}
.template-playground-preview {
width: 50%;
display: flex;
flex-direction: column;
}
.preview-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1rem;
background: #f8f9fa;
border-bottom: 1px solid #dee2e6;
}
.preview-header h4 {
margin: 0;
font-size: 0.875rem;
font-weight: 600;
}
.preview-frame {
flex: 1;
border: none;
background: white;
}
.btn {
padding: 0.375rem 0.75rem;
border: 1px solid transparent;
border-radius: 0.25rem;
font-size: 0.875rem;
font-weight: 500;
text-decoration: none;
cursor: pointer;
transition: all 0.15s ease;
}
.btn-primary {
background: #007bff;
border-color: #007bff;
color: white;
}
.btn-primary:hover {
background: #0056b3;
border-color: #004085;
}
.btn-secondary {
background: #6c757d;
border-color: #6c757d;
color: white;
}
.btn-secondary:hover {
background: #545b62;
border-color: #4e555b;
}
.btn-success {
background: #28a745;
border-color: #28a745;
color: white;
}
.btn-success:hover {
background: #1e7e34;
border-color: #1c7430;
}
.btn-sm {
padding: 0.25rem 0.5rem;
font-size: 0.75rem;
}
|
| template | |
Properties |
Methods |
|
Accessors |
constructor(http: HttpClient, editorService: TemplateEditorService, zipService: ZipExportService, hbsService: HbsRenderService)
|
|||||||||||||||
|
Parameters :
|
| Async exportZip |
exportZip()
|
|
Returns :
Promise<void>
|
| initializeEditor |
initializeEditor()
|
|
Returns :
void
|
| ngOnDestroy |
ngOnDestroy()
|
|
Returns :
void
|
| Async ngOnInit |
ngOnInit()
|
|
Returns :
any
|
| refreshPreview |
refreshPreview()
|
|
Returns :
void
|
| resetToDefault |
resetToDefault()
|
|
Returns :
void
|
| Async selectFile | ||||||
selectFile(template: Template)
|
||||||
|
Parameters :
Returns :
any
|
| toggleConfigPanel |
toggleConfigPanel()
|
|
Returns :
void
|
| trackByName |
trackByName(index: number, item: Template)
|
|
Returns :
string
|
| Async updateConfig |
updateConfig()
|
|
Returns :
Promise<void>
|
| config |
Type : CompoDocConfig
|
Default value : {}
|
| editorContainer |
Type : ElementRef
|
Decorators :
@ViewChild('editorContainer', {static: true})
|
| lastSaved |
Type : Date | null
|
Default value : null
|
| previewFrame |
Type : ElementRef
|
Decorators :
@ViewChild('previewFrame', {static: true})
|
| saving |
Type : boolean
|
Default value : false
|
| selectedFile |
Type : Template | null
|
Default value : null
|
| sessionId |
Type : string
|
Default value : ''
|
| showConfigPanel |
Type : boolean
|
Default value : false
|
| templates |
Type : Template[]
|
Default value : []
|
| previewUrl |
getpreviewUrl()
|