:root { --button-size: 2em; font-family: sans-serif; font-size: 5mm; } .editor { display: block; position: relative; } .editor .outline { display: block; position: relative; width: calc(100% - var(--button-size)); } .editor .outline [tabindex] { position: relative; } .editor .outline div [tabindex] { margin-left: 2em; } .editor .outline [tabindex]>span, .editor .outline [tabindex]>textarea { --padding: 0.2em; display: block; width: 100%; /* XXX this is a tiny bit off and using textarea's height here is off too... */ min-height: 1em; padding: var(--padding); margin: 0; font-family: sans-serif; font-size: 5mm; white-space: pre; outline: none; border: none; } .editor .outline [tabindex]>textarea { height: calc(2 * var(--padding) + 1em); overflow: hidden; resize: none; } /* show/hide node's view/code... */ .editor .outline [tabindex]>span+textarea:not(:focus), /* XXX not sure how to do this without :has(..)... */ .editor .outline [tabindex]:has(>span+textarea:focus)>span:has(+textarea), .editor .outline [tabindex]:focus>span+textarea { position: absolute; opacity: 0; top: 0; } /* focus... */ .editor .outline [tabindex]:focus { /*outline: solid 0.2em silver;*/ outline: none; } .editor .outline [tabindex]:focus>span, .editor .outline [tabindex]:focus>textarea { background: rgba(0,0,0,0.1); } .editor .outline [tabindex].focused:not(:focus)>span, .editor .outline [tabindex].focused:not(:focus)>textarea { background: rgba(0,0,0,0.05); } .editor .outline div[collapsed] { border-bottom: solid 1px silver; } .editor .outline div[collapsed] div { display: none; } /* XXX are we selecting subtrees or blocks??? */ .editor .outline [selected] { background: silver; } .editor .toolbar { display: inline-block; position: absolute; top: 1em; right: 1em; } .editor .toolbar button { display: block; width: var(--button-size); height: var(--button-size); font-size: var(--button-size); }