mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-25 12:21:58 +00:00
Compare commits
No commits in common. "71cb3f1f97fe1ac10a32c6e17f165b579e9bb317" and "d2d10c68fb291eb4ecbf31dabd4529f08433990f" have entirely different histories.
71cb3f1f97
...
d2d10c68fb
@ -89,21 +89,11 @@
|
|||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
/* show/hide node's view/code... */
|
/* show/hide node's view/code... */
|
||||||
/*.editor .outline [tabindex]>textarea:focus+span,*/
|
.editor .outline [tabindex]>textarea:focus+span,
|
||||||
.editor .outline [tabindex]>textarea:not(:focus) {
|
.editor .outline [tabindex]>textarea:not(:focus) {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
/* hide span content but show before/after -- keep bulets and touch zones... */
|
|
||||||
.editor .outline [tabindex]>textarea:focus+span {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
.editor .outline [tabindex]>textarea:focus+span:before,
|
|
||||||
.editor .outline [tabindex]>textarea:focus+span:after {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
/* click through the span text to the textarea */
|
/* click through the span text to the textarea */
|
||||||
.editor .outline [tabindex]>span {
|
.editor .outline [tabindex]>span {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -234,14 +224,6 @@ editor .outline [tabindex]:focus {
|
|||||||
/********************************************************** Styles ***/
|
/********************************************************** Styles ***/
|
||||||
|
|
||||||
/* Headings... */
|
/* Headings... */
|
||||||
.editor .outline .heading-1,
|
|
||||||
.editor .outline .heading-2,
|
|
||||||
.editor .outline .heading-3,
|
|
||||||
.editor .outline .heading-4,
|
|
||||||
.editor .outline .heading-5,
|
|
||||||
.editor .outline .heading-6 {
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
.editor .outline .heading-1>span,
|
.editor .outline .heading-1>span,
|
||||||
.editor .outline .heading-1>textarea,
|
.editor .outline .heading-1>textarea,
|
||||||
.editor .outline .heading-2>span,
|
.editor .outline .heading-2>span,
|
||||||
@ -254,6 +236,7 @@ editor .outline [tabindex]:focus {
|
|||||||
.editor .outline .heading-5>textarea,
|
.editor .outline .heading-5>textarea,
|
||||||
.editor .outline .heading-6>span,
|
.editor .outline .heading-6>span,
|
||||||
.editor .outline .heading-6>textarea {
|
.editor .outline .heading-6>textarea {
|
||||||
|
margin-top: 1rem;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.editor .outline .heading-1>span,
|
.editor .outline .heading-1>span,
|
||||||
@ -314,7 +297,7 @@ editor .outline [tabindex]:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* List... */
|
/* Lists... */
|
||||||
/* XXX needs to be in the middle of the first span but with universal size... */
|
/* XXX needs to be in the middle of the first span but with universal size... */
|
||||||
.editor .outline .list-item>span:before,
|
.editor .outline .list-item>span:before,
|
||||||
.editor .outline .list>[tabindex]>span:not(:empty):before {
|
.editor .outline .list>[tabindex]>span:not(:empty):before {
|
||||||
@ -331,19 +314,6 @@ editor .outline [tabindex]:focus {
|
|||||||
content: "▪";
|
content: "▪";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* List... */
|
|
||||||
/* XXX nested lists are broken -- seems that I need a container for the children... */
|
|
||||||
.editor .outline .numbered-list {
|
|
||||||
counter-reset: numbered-list;
|
|
||||||
}
|
|
||||||
.editor .outline .numbered-list>[tabindex]>span:not(:empty):before {
|
|
||||||
counter-increment: numbered-list;
|
|
||||||
content: counter(numbered-list) ".";
|
|
||||||
color: gray;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Notes... */
|
/* Notes... */
|
||||||
.editor .outline .NOTE {
|
.editor .outline .NOTE {
|
||||||
--margin: 1rem;
|
--margin: 1rem;
|
||||||
@ -403,8 +373,8 @@ editor .outline [tabindex]:focus {
|
|||||||
var(--checkbox-size)
|
var(--checkbox-size)
|
||||||
+ var(--checkbox-margin));
|
+ var(--checkbox-margin));
|
||||||
}
|
}
|
||||||
.editor .outline [tabindex].check>span input[type=checkbox],
|
.editor .outline [tabindex].check>span>input[type=checkbox],
|
||||||
.editor .outline [tabindex].todo>span input[type=checkbox] {
|
.editor .outline [tabindex].todo>span>input[type=checkbox] {
|
||||||
height: var(--checkbox-size);
|
height: var(--checkbox-size);
|
||||||
width: var(--checkbox-size);
|
width: var(--checkbox-size);
|
||||||
|
|
||||||
@ -417,7 +387,7 @@ editor .outline [tabindex]:focus {
|
|||||||
/* NOTE: this appears to be needed for the em sizes above to work correctly */
|
/* NOTE: this appears to be needed for the em sizes above to work correctly */
|
||||||
font-size: 1em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
.editor .outline [tabindex].todo>span input[type=checkbox]:first-child {
|
.editor .outline [tabindex].todo>span>input[type=checkbox]:first-child {
|
||||||
margin-left: calc(
|
margin-left: calc(
|
||||||
-1 * var(--checkbox-size)
|
-1 * var(--checkbox-size)
|
||||||
- var(--checkbox-margin));
|
- var(--checkbox-margin));
|
||||||
@ -439,25 +409,6 @@ editor .outline [tabindex]:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Tables... */
|
|
||||||
.editor .outline [tabindex]>span>table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
.editor .outline [tabindex]>span>table tr:nth-child(odd) {
|
|
||||||
background: rgba(0,0,0,0.03);
|
|
||||||
}
|
|
||||||
.editor .outline [tabindex]>span>table tr:first-child {
|
|
||||||
font-weight: bold;
|
|
||||||
border-bottom: solid 0.1rem silver;
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
.editor .outline [tabindex]>span>table td {
|
|
||||||
height: calc(1em + var(--item-padding) * 2);
|
|
||||||
padding: 0 1em;
|
|
||||||
/*text-align: center;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/********************************************************* Testing ***/
|
/********************************************************* Testing ***/
|
||||||
|
|
||||||
|
|||||||
@ -93,13 +93,6 @@ var Outline = {
|
|||||||
|
|
||||||
var outline = this.outline
|
var outline = this.outline
|
||||||
|
|
||||||
// get parent node...
|
|
||||||
if(node instanceof HTMLElement){
|
|
||||||
while(!node.getAttribute('tabindex')){
|
|
||||||
node = node.parentElement
|
|
||||||
if(node === this.outline){
|
|
||||||
return undefined } } }
|
|
||||||
|
|
||||||
// node lists...
|
// node lists...
|
||||||
var NO_NODES = {}
|
var NO_NODES = {}
|
||||||
var nodes =
|
var nodes =
|
||||||
@ -311,12 +304,6 @@ var Outline = {
|
|||||||
elem.style.push(...style)
|
elem.style.push(...style)
|
||||||
return code
|
return code
|
||||||
?? text } }
|
?? text } }
|
||||||
var table = function(_, body){
|
|
||||||
return `<table><tr><td>${
|
|
||||||
body
|
|
||||||
.replace(/\s*\|\s*\n\s*\|\s*/gm, '</td></tr>\n<tr><td>')
|
|
||||||
.replace(/\s*\|\s*/gm, '</td><td>')
|
|
||||||
}</td></td></table>` }
|
|
||||||
elem.text = code
|
elem.text = code
|
||||||
// hidden attributes...
|
// hidden attributes...
|
||||||
// XXX make this generic...
|
// XXX make this generic...
|
||||||
@ -342,7 +329,6 @@ var Outline = {
|
|||||||
// style: list...
|
// style: list...
|
||||||
//.replace(/^(?<!\\)[-\*]\s+(.*)$/m, style('list-item'))
|
//.replace(/^(?<!\\)[-\*]\s+(.*)$/m, style('list-item'))
|
||||||
.replace(/^\s*(.*)(?<!\\):\s*$/m, style('list'))
|
.replace(/^\s*(.*)(?<!\\):\s*$/m, style('list'))
|
||||||
.replace(/^\s*(.*)(?<!\\)#\s*$/m, style('numbered-list'))
|
|
||||||
// style: misc...
|
// style: misc...
|
||||||
.replace(/^\s*(?<!\\)>\s+(.*)$/m, style('quote'))
|
.replace(/^\s*(?<!\\)>\s+(.*)$/m, style('quote'))
|
||||||
.replace(/^\s*(?<!\\)((\/\/|;)\s+.*)$/m, style('comment'))
|
.replace(/^\s*(?<!\\)((\/\/|;)\s+.*)$/m, style('comment'))
|
||||||
@ -365,8 +351,6 @@ var Outline = {
|
|||||||
style('check', '<input type="checkbox">'))
|
style('check', '<input type="checkbox">'))
|
||||||
.replace(/\s*(?<!\\)\[[Xx]\]\s*/gm,
|
.replace(/\s*(?<!\\)\[[Xx]\]\s*/gm,
|
||||||
style('check', '<input type="checkbox" checked>'))
|
style('check', '<input type="checkbox" checked>'))
|
||||||
// tables...
|
|
||||||
.replace(/^\s*(?<!\\)\|\s*((.|\n)*)\s*\|\s*$/, table)
|
|
||||||
// basic styling...
|
// basic styling...
|
||||||
// XXX revise...
|
// XXX revise...
|
||||||
.replace(/(?<!\\)\*(?=[^\s*])(([^*]|\\\*)*[^\s*])(?<!\\)\*/gm, '<b>$1</b>')
|
.replace(/(?<!\\)\*(?=[^\s*])(([^*]|\\\*)*[^\s*])(?<!\\)\*/gm, '<b>$1</b>')
|
||||||
@ -375,14 +359,8 @@ var Outline = {
|
|||||||
.replace(/(?<!\\)`(?=[^\s])(([^`]|\\`)*[^\s])(?<!\\)`/gm, '<code>$1</code>')
|
.replace(/(?<!\\)`(?=[^\s])(([^`]|\\`)*[^\s])(?<!\\)`/gm, '<code>$1</code>')
|
||||||
// XXX support "\==" in mark...
|
// XXX support "\==" in mark...
|
||||||
.replace(/(?<!\\)==(?=[^\s])(.*[^\s])(?<!\\)==/gm, '<mark>$1</mark>')
|
.replace(/(?<!\\)==(?=[^\s])(.*[^\s])(?<!\\)==/gm, '<mark>$1</mark>')
|
||||||
// links...
|
|
||||||
.replace(/(?<!\\)\[([^\]]*)\]\(([^)]*)\)/g, '<a href="$2">$1</a>')
|
|
||||||
.replace(/((?:https?:|ftps?:)[^\s]*)(\s*)/g, '<a href="$1">$1</a>$2')
|
|
||||||
// characters...
|
// characters...
|
||||||
// XXX use ligatures for these???
|
// XXX use ligatures for these???
|
||||||
.replace(/(?<!\\)\(i\)/gm, '🛈')
|
|
||||||
.replace(/(?<!\\)\(c\)/gm, '©')
|
|
||||||
.replace(/(?<!\\)\/!\\/gm, '⚠')
|
|
||||||
.replace(/(?<!\\)---(?!-)/gm, '—')
|
.replace(/(?<!\\)---(?!-)/gm, '—')
|
||||||
.replace(/(?<!\\)--(?!-)/gm, '–')
|
.replace(/(?<!\\)--(?!-)/gm, '–')
|
||||||
// quoting...
|
// quoting...
|
||||||
@ -707,7 +685,7 @@ var Outline = {
|
|||||||
|
|
||||||
// click: right of elem (outside)
|
// click: right of elem (outside)
|
||||||
} else if(elem.offsetWidth < evt.offsetX){
|
} else if(elem.offsetWidth < evt.offsetX){
|
||||||
that.toggleCollapse(that.get(elem))
|
that.toggleCollapse(elem.parentElement)
|
||||||
|
|
||||||
// click inside element...
|
// click inside element...
|
||||||
} else {
|
} else {
|
||||||
@ -722,7 +700,7 @@ var Outline = {
|
|||||||
|
|
||||||
// toggle checkbox...
|
// toggle checkbox...
|
||||||
if(elem.type == 'checkbox'){
|
if(elem.type == 'checkbox'){
|
||||||
var node = that.get(elem)
|
var node = elem.parentElement.parentElement
|
||||||
var text = node.querySelector('textarea')
|
var text = node.querySelector('textarea')
|
||||||
// get the checkbox order...
|
// get the checkbox order...
|
||||||
var i = [...node.querySelectorAll('input[type=checkbox]')].indexOf(elem)
|
var i = [...node.querySelectorAll('input[type=checkbox]')].indexOf(elem)
|
||||||
|
|||||||
@ -40,8 +40,6 @@ var setup = function(){
|
|||||||
- 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
|
- here is the line to jump from, for example from here
|
||||||
an we'll not get here...
|
an we'll not get here...
|
||||||
- ASAP: fix quotes
|
|
||||||
- Example: /\n\s*\|\s+/ -> <tr><td>
|
|
||||||
- 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
|
||||||
- ASAP: editor: shifting nodes up/down
|
- ASAP: editor: shifting nodes up/down
|
||||||
@ -80,6 +78,14 @@ var setup = function(){
|
|||||||
- delete node
|
- delete node
|
||||||
- indent/deindent
|
- indent/deindent
|
||||||
- edit node
|
- edit node
|
||||||
|
- markdown: tables
|
||||||
|
collapsed:: true
|
||||||
|
- /^\s*(\|\s+.*\s+\|)\s*$/m -> <table><tr><td>$1</td></tr><table>
|
||||||
|
- /\n\s*\|\s+/ -> <tr><td>
|
||||||
|
- /\s+\|\s*\n/ -> </td></tr>
|
||||||
|
- /\s+\|\s+/ -> </td><td>
|
||||||
|
- ASAP: fix quotes
|
||||||
|
- Example: /\n\s*\|\s+/ -> <tr><td>
|
||||||
- empty item height is a bit off...
|
- empty item height is a bit off...
|
||||||
- ~handle links gracefully -- open/edit
|
- ~handle links gracefully -- open/edit
|
||||||
_just click in the empty space_~
|
_just click in the empty space_~
|
||||||
@ -98,18 +104,10 @@ var setup = function(){
|
|||||||
- ##### Heading 5
|
- ##### Heading 5
|
||||||
- ###### Heading 6
|
- ###### Heading 6
|
||||||
- Text
|
- Text
|
||||||
- Lists::
|
- List::
|
||||||
- bullet:
|
|
||||||
- a
|
- a
|
||||||
- b
|
- b
|
||||||
- c
|
- c
|
||||||
- numbered#
|
|
||||||
- a
|
|
||||||
- b#
|
|
||||||
- x
|
|
||||||
- y
|
|
||||||
- z
|
|
||||||
- c
|
|
||||||
- > quoted text
|
- > quoted text
|
||||||
- Notes
|
- Notes
|
||||||
- NOTE: a note text
|
- NOTE: a note text
|
||||||
@ -119,31 +117,21 @@ var setup = function(){
|
|||||||
- // C-style comment
|
- // C-style comment
|
||||||
- ; ASM-style comment
|
- ; ASM-style comment
|
||||||
- XXX Highlight
|
- XXX Highlight
|
||||||
- Basic inline *bold*, _italic_ and ~striked~
|
|
||||||
- Marking ==text==
|
|
||||||
- Line
|
- Line
|
||||||
- ---
|
- ---
|
||||||
- Markers: ASAP, BUG, FIX, HACK, STUB, WARNING, and CAUTION
|
- Markers: ASAP, BUG, FIX, HACK, STUB, WARNING, and CAUTION
|
||||||
|
- Basic inline *bold*, _italic_ and ~striked~
|
||||||
|
- Marking ==text==
|
||||||
- Inline [X] checkboxes [_]
|
- Inline [X] checkboxes [_]
|
||||||
- To do items/blocks
|
- To do items/blocks
|
||||||
- [_] undone item
|
- [_] undone item
|
||||||
_(clicking the checkbox updates the item)_
|
_(clicking the checkbox updates the item)_
|
||||||
- [X] done item
|
- [X] done item
|
||||||
- [_] we can also add inline [x] checkboxes
|
- [_] we can also add inline [x] checkboxes
|
||||||
- link
|
- link <a href="about:blank">example</a>
|
||||||
- [example](about:blank)
|
|
||||||
- https://example.com
|
|
||||||
- ./path/to/file /path/to -- not supported yet
|
|
||||||
- Tables
|
|
||||||
- | a | b | c |
|
|
||||||
| 1 | 2 | 3 |
|
|
||||||
| 11 | 22 | 33 |
|
|
||||||
- Symbols -- should these be ligatures?
|
|
||||||
- (i), (c), /!\, ...
|
|
||||||
- -- and ---
|
|
||||||
- markdown:
|
- markdown:
|
||||||
- numbered lists
|
- numbered lists
|
||||||
- ~tables~
|
- tables
|
||||||
- code blocks
|
- code blocks
|
||||||
- ~alerts~
|
- ~alerts~
|
||||||
- footnotes??
|
- footnotes??
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user