cleanup and notes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-12 23:35:14 +03:00
parent ad2df7c676
commit 28501e458b
3 changed files with 38 additions and 21 deletions

View File

@ -28,8 +28,6 @@
/*text-size-adjust: none;*/ /*text-size-adjust: none;*/
text-size-adjust: 150%; text-size-adjust: 150%;
} }
.editor { .editor {
@ -233,7 +231,9 @@ editor .outline .block:focus {
/********************************************************** Styles ***/ /********************************************************** Styles ***/
/* Headings... */
/*------------------------------------------------------ Headings ---*/
.editor .outline .heading-1, .editor .outline .heading-1,
.editor .outline .heading-2, .editor .outline .heading-2,
.editor .outline .heading-3, .editor .outline .heading-3,
@ -276,7 +276,8 @@ editor .outline .block:focus {
} }
/* Quote... */ /*--------------------------------------------------------- Quote ---*/
.editor .outline .quote>.text { .editor .outline .quote>.text {
--indent: 1rem; --indent: 1rem;
--margin: 0.7rem; --margin: 0.7rem;
@ -298,8 +299,8 @@ editor .outline .block:focus {
} }
/* List... */ /*---------------------------------------------------------- List ---*/
/* XXX needs to be in the middle of the first .view but with universal size... */
.editor .outline .list-item>.view:before, .editor .outline .list-item>.view:before,
.editor .outline .list>.children>.block>.view:not(:empty):before { .editor .outline .list>.children>.block>.view:not(:empty):before {
content: "◼"; content: "◼";
@ -325,16 +326,15 @@ editor .outline .block:focus {
} }
/* List... */ /*------------------------------------------------ Numbered lists ---*/
/* XXX nested lists are broken -- seems that I need a container for the children... */
.editor .outline .numbered-list>.children {
counter-reset: numbered-list;
}
.editor .outline .numbered-list>.children>.block>.view:not(:empty):before { .editor .outline .numbered-list>.children>.block>.view:not(:empty):before {
counter-increment: numbered-list; counter-increment: numbered-list;
content: counter(numbered-list) "."; content: counter(numbered-list) ".";
color: gray; color: gray;
} }
/* numbered lists... */
.editor .outline .editor .outline
.numbered-list>.children .numbered-list>.children
>.numbered-list>.children>.block>.view:not(:empty):before { >.numbered-list>.children>.block>.view:not(:empty):before {
@ -361,7 +361,8 @@ editor .outline .block:focus {
} }
/* Notes... */ /*--------------------------------------------------------- Notes ---*/
.editor .outline .NOTE { .editor .outline .NOTE {
--margin: 1rem; --margin: 1rem;
--padding-h: 2rem; --padding-h: 2rem;
@ -393,7 +394,8 @@ editor .outline .block:focus {
} }
/* Highlightes... */ /*--------------------------------------------------- Highlightes ---*/
.editor .outline .highlight { .editor .outline .highlight {
font-weight: bold; font-weight: bold;
background: yellow; background: yellow;
@ -403,7 +405,8 @@ editor .outline .block:focus {
} }
/* Comments... */ /*------------------------------------------------------ Comments ---*/
.editor.hide-comments .outline .comment { .editor.hide-comments .outline .comment {
display: none; display: none;
} }
@ -412,7 +415,8 @@ editor .outline .block:focus {
} }
/* Checkboxes... */ /*---------------------------------------------------- Checkboxes ---*/
.editor .outline .block.todo>.view { .editor .outline .block.todo>.view {
width: calc( width: calc(
100% 100%
@ -449,7 +453,8 @@ editor .outline .block:focus {
} }
/* code... */ /*---------------------------------------------------------- Code ---*/
.editor .outline .block>.view pre, .editor .outline .block>.view pre,
.editor .outline .block>.view code { .editor .outline .block>.view code {
padding: 0.1em 0.3em; padding: 0.1em 0.3em;
@ -463,7 +468,8 @@ editor .outline .block:focus {
} }
/* Tables... */ /*-------------------------------------------------------- Tables ---*/
.editor .outline .block>.view>table { .editor .outline .block>.view>table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;

View File

@ -316,6 +316,8 @@ var Outline = {
if(code.trim() == ''){ if(code.trim() == ''){
elem.text = '' elem.text = ''
return elem } return elem }
// helpers...
var style = function(style, code=undefined){ var style = function(style, code=undefined){
style = [style].flat() style = [style].flat()
that.__styles = [...new Set([ that.__styles = [...new Set([
@ -343,10 +345,10 @@ var Outline = {
.replace(/\s*\|\s*\n\s*\|\s*/gm, '</td></tr>\n<tr><td>') .replace(/\s*\|\s*\n\s*\|\s*/gm, '</td></tr>\n<tr><td>')
.replace(/\s*\|\s*/gm, '</td><td>') .replace(/\s*\|\s*/gm, '</td><td>')
}</td></td></table>` } }</td></td></table>` }
elem.text = code elem.text = code
// hidden attributes... // hidden attributes...
// XXX make this generic... // XXX make this generic...
// XXX should these be hidden from code too???
// collapsed... // collapsed...
.replace(/(\n|^)\s*collapsed::\s*(.*)\s*(\n|$)/, .replace(/(\n|^)\s*collapsed::\s*(.*)\s*(\n|$)/,
function(_, value){ function(_, value){
@ -583,7 +585,9 @@ var Outline = {
&& (code.innerHTML = this.text()) && (code.innerHTML = this.text())
return this }, return this },
// XXX move the code here into methods/actions...
// XXX add scrollIntoView(..) to nav... // XXX add scrollIntoView(..) to nav...
// XXX use keyboard.js...
keyboard: { keyboard: {
// vertical navigation... // vertical navigation...
// XXX this is a bit hacky but it works -- the caret blinks at // XXX this is a bit hacky but it works -- the caret blinks at

View File

@ -37,9 +37,14 @@ var setup = function(){
- -
- ## Bugs: - ## Bugs:
- BUG: ASAP: editor: `-` at start of line is interpreted as block marker... - BUG: ASAP: editor: `-` at start of line is interpreted as block marker...
- need to either:
- quote the `-` in .text() -- _preferreed_
- split the lines starting with `-` into nested nodes (a-la .load())
- BUG? pressing down from a longer line will jump over a shorter line - BUG? pressing down from a longer line will jump over a shorter line
- here is the line to jump from, for example from here - to reproduce\:
an we'll not get here... - here is the line to jump from, for example from here
an we'll not get here...
-
- ## ToDo: - ## ToDo:
- ASAP: editor: bksapce/del at start/end of a block should join it with prev/next - ASAP: editor: bksapce/del at start/end of a block should join it with prev/next
- ASAP: editor: pressing enter in text edit mode should split text into two blocks - ASAP: editor: pressing enter in text edit mode should split text into two blocks
@ -54,7 +59,7 @@ var setup = function(){
- _...use `[%]`, `%%`, or something similar..._ - _...use `[%]`, `%%`, or something similar..._
- read-only mode - read-only mode
- should bulets be on the same level as nodes or offset?? - should bulets be on the same level as nodes or offset??
- A) justified to bulet: - A) justified to bullet:
* list item * list item
* list item * list item
block text block text
@ -63,6 +68,8 @@ var setup = function(){
* list item * list item
block text block text
- NOTE: this is only a problem if making list-items manually -- disable??? - NOTE: this is only a problem if making list-items manually -- disable???
- FF: figure out a way to draw expand/collapse bullets without the use of CSS' `:has(..)`
- Nerd fonts (options?)
- ~do a better expand/collapse icons~ - ~do a better expand/collapse icons~
- ~loading from DOM -- fill textarea~ - ~loading from DOM -- fill textarea~
- ~focus management~ - ~focus management~