diff --git a/experiments/outline-editor/editor.css b/experiments/outline-editor/editor.css index 1a627f3..fdd080f 100755 --- a/experiments/outline-editor/editor.css +++ b/experiments/outline-editor/editor.css @@ -14,7 +14,8 @@ .editor .outline { display: block; position: relative; - width: calc(100% - var(--button-size)); + /* XXX do a better calculation... */ + width: calc(100% - (var(--button-size) + 4em)); } .editor .outline [tabindex] { @@ -36,7 +37,6 @@ font-family: sans-serif; font-size: 5mm; - white-space: pre; outline: none; border: none; @@ -92,10 +92,13 @@ right: 1em; } .editor .toolbar button { + --margin: 0.1em; + display: block; - width: var(--button-size); + width: calc(var(--button-size) + var(--margin) * 2); height: var(--button-size); + margin: var(--margin); font-size: var(--button-size); } diff --git a/experiments/outline-editor/editor.js b/experiments/outline-editor/editor.js index 3c2d56a..d2a37e6 100755 --- a/experiments/outline-editor/editor.js +++ b/experiments/outline-editor/editor.js @@ -289,13 +289,23 @@ var Outline = { // block serialization... __code2html__: function(code){ return code + .replace(/\n\s*/g, '
') // XXX STUB... + .replace(/^# (.*)\s*$/g, '

$1

') + .replace(/^## (.*)\s*$/g, '

$1

') + .replace(/^### (.*)\s*$/g, '

$1

') + .replace(/^#### (.*)\s*$/g, '

$1

') .replace(/\*(.*)\*/g, '$1') .replace(/~([^~]*)~/g, '$1') .replace(/_([^_]*)_/g, '$1') }, __html2code__: function(html){ return html + .replace(/
\s*/g, '\n') // XXX STUB... + .replace(/^

(.*)<\/h1>\s*$/g, '# $1') + .replace(/^

(.*)<\/h2>\s*$/g, '## $1') + .replace(/^

(.*)<\/h3>\s*$/g, '### $1') + .replace(/^

(.*)<\/h4>\s*$/g, '#### $1') .replace(/(.*)<\/b>/g, '*$1*') .replace(/(.*)<\/s>/g, '~$1~') .replace(/(.*)<\/i>/g, '_$1_') }, @@ -347,6 +357,7 @@ var Outline = { // XXX add scrollIntoView(..) to nav... keyboard: { // vertical navigation... + // XXX wrapped line navigation is broken... ArrowUp: function(evt){ var state = 'focused' var edited = this.get('edited') diff --git a/experiments/outline-editor/index.html b/experiments/outline-editor/index.html index 13660f9..fe001fa 100755 --- a/experiments/outline-editor/index.html +++ b/experiments/outline-editor/index.html @@ -3,6 +3,9 @@ @@ -42,17 +45,19 @@ var setup = function(){
C
This is a line of text
-
This is a set -text lines +
This is a set
+ text lines
+
- - + +
+
@@ -70,13 +75,13 @@ TODO: - shift subtree up/down - create node - edit node +- shifting nodes up/down +- multiple node selection - undo - delete node - indent/deindent - edit node - copy/paste nodes/trees -- shifting nodes up/down -- multiple node selection - serialize/deserialize - add optional text styling to nodes @@ -94,6 +99,7 @@ Controls: esc - exit edit mode +