mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 02:50:08 +00:00 
			
		
		
		
	tweaking....
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									30bbe21088
								
							
						
					
					
						commit
						aaff6360a4
					
				| @ -14,7 +14,8 @@ | |||||||
| .editor .outline { | .editor .outline { | ||||||
| 	display: block; | 	display: block; | ||||||
| 	position: relative; | 	position: relative; | ||||||
| 	width: calc(100% - var(--button-size)); | 	/* XXX do a better calculation... */ | ||||||
|  | 	width: calc(100% - (var(--button-size) + 4em)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .editor .outline [tabindex] { | .editor .outline [tabindex] { | ||||||
| @ -36,7 +37,6 @@ | |||||||
| 
 | 
 | ||||||
| 	font-family: sans-serif; | 	font-family: sans-serif; | ||||||
| 	font-size: 5mm; | 	font-size: 5mm; | ||||||
| 	white-space: pre; |  | ||||||
| 
 | 
 | ||||||
| 	outline: none; | 	outline: none; | ||||||
| 	border: none; | 	border: none; | ||||||
| @ -92,10 +92,13 @@ | |||||||
| 	right: 1em; | 	right: 1em; | ||||||
| } | } | ||||||
| .editor .toolbar button { | .editor .toolbar button { | ||||||
|  | 	--margin: 0.1em; | ||||||
|  | 
 | ||||||
| 	display: block; | 	display: block; | ||||||
| 
 | 
 | ||||||
| 	width: var(--button-size); | 	width: calc(var(--button-size) + var(--margin) * 2); | ||||||
| 	height: var(--button-size); | 	height: var(--button-size); | ||||||
|  | 	margin: var(--margin); | ||||||
| 
 | 
 | ||||||
| 	font-size: var(--button-size); | 	font-size: var(--button-size); | ||||||
| } | } | ||||||
|  | |||||||
| @ -289,13 +289,23 @@ var Outline = { | |||||||
| 	// block serialization...
 | 	// block serialization...
 | ||||||
| 	__code2html__: function(code){ | 	__code2html__: function(code){ | ||||||
| 		return code  | 		return code  | ||||||
|  | 			.replace(/\n\s*/g, '<br>') | ||||||
| 			// XXX STUB...
 | 			// XXX STUB...
 | ||||||
|  | 			.replace(/^# (.*)\s*$/g, '<h1>$1</h1>') | ||||||
|  | 			.replace(/^## (.*)\s*$/g, '<h2>$1</h2>') | ||||||
|  | 			.replace(/^### (.*)\s*$/g, '<h3>$1</h3>') | ||||||
|  | 			.replace(/^#### (.*)\s*$/g, '<h4>$1</h4>') | ||||||
| 			.replace(/\*(.*)\*/g, '<b>$1</b>') | 			.replace(/\*(.*)\*/g, '<b>$1</b>') | ||||||
| 			.replace(/~([^~]*)~/g, '<s>$1</s>') | 			.replace(/~([^~]*)~/g, '<s>$1</s>') | ||||||
| 			.replace(/_([^_]*)_/g, '<i>$1</i>') }, | 			.replace(/_([^_]*)_/g, '<i>$1</i>') }, | ||||||
| 	__html2code__: function(html){ | 	__html2code__: function(html){ | ||||||
| 		return html  | 		return html  | ||||||
|  | 			.replace(/<br>\s*/g, '\n') | ||||||
| 			// XXX STUB...
 | 			// XXX STUB...
 | ||||||
|  | 			.replace(/^<h1>(.*)<\/h1>\s*$/g, '# $1') | ||||||
|  | 			.replace(/^<h2>(.*)<\/h2>\s*$/g, '## $1') | ||||||
|  | 			.replace(/^<h3>(.*)<\/h3>\s*$/g, '### $1') | ||||||
|  | 			.replace(/^<h4>(.*)<\/h4>\s*$/g, '#### $1') | ||||||
| 			.replace(/<b>(.*)<\/b>/g, '*$1*') | 			.replace(/<b>(.*)<\/b>/g, '*$1*') | ||||||
| 			.replace(/<s>(.*)<\/s>/g, '~$1~') | 			.replace(/<s>(.*)<\/s>/g, '~$1~') | ||||||
| 			.replace(/<i>(.*)<\/i>/g, '_$1_') }, | 			.replace(/<i>(.*)<\/i>/g, '_$1_') }, | ||||||
| @ -347,6 +357,7 @@ var Outline = { | |||||||
| 	// XXX add scrollIntoView(..) to nav...
 | 	// XXX add scrollIntoView(..) to nav...
 | ||||||
| 	keyboard: { | 	keyboard: { | ||||||
| 		// vertical navigation...
 | 		// vertical navigation...
 | ||||||
|  | 		// XXX wrapped line navigation is broken...
 | ||||||
| 		ArrowUp: function(evt){ | 		ArrowUp: function(evt){ | ||||||
| 			var state = 'focused' | 			var state = 'focused' | ||||||
| 			var edited = this.get('edited') | 			var edited = this.get('edited') | ||||||
|  | |||||||
| @ -3,6 +3,9 @@ | |||||||
| <link href="editor.css" rel="stylesheet"/> | <link href="editor.css" rel="stylesheet"/> | ||||||
| <style> | <style> | ||||||
| 
 | 
 | ||||||
|  | .add-row { | ||||||
|  | 	height: 1.2em !important; | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| </style> | </style> | ||||||
| <script src="generic.js"></script> | <script src="generic.js"></script> | ||||||
| @ -42,17 +45,19 @@ var setup = function(){ | |||||||
| 			<div tabindex=0><span>C</span><textarea></textarea> | 			<div tabindex=0><span>C</span><textarea></textarea> | ||||||
| 				<div tabindex=0><span>This is a line of text</span><textarea></textarea> | 				<div tabindex=0><span>This is a line of text</span><textarea></textarea> | ||||||
| 				</div> | 				</div> | ||||||
| 				<div tabindex=0><span>This is a set | 				<div tabindex=0><span>This is a set<br> | ||||||
| text lines</span><textarea></textarea> | 					text lines</span><textarea></textarea> | ||||||
| 				</div> | 				</div> | ||||||
| 			</div> | 			</div> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
|  | 	<!-- toolbar (optional) --> | ||||||
| 	<div class="toolbar"> | 	<div class="toolbar"> | ||||||
| 		<button onclick="editor.deindent().focus()"><</button> | 		<button onclick="editor.deindent().focus()"><</button> | ||||||
| 		<button onclick="editor.indent().focus()">></button> | 		<button onclick="editor.indent().focus()">></button> | ||||||
| 		<button onclick="editor.Block('before').focus()">-<sup>+</sup>-</button> | 		<button onclick="editor.Block('before').focus()" class="add-row">+</button> | ||||||
| 		<button onclick="editor.Block('after').focus()">-<sub>+</sub>-</button> | 		<hr> | ||||||
|  | 		<button onclick="editor.Block('after').focus()" class="add-row">+</button> | ||||||
| 		<button onclick="editor.toggleCollapse()?.focus()">˅˄</button> | 		<button onclick="editor.toggleCollapse()?.focus()">˅˄</button> | ||||||
| 		<button onclick="editor.remove()">×</button> | 		<button onclick="editor.remove()">×</button> | ||||||
| 	</div> | 	</div> | ||||||
| @ -70,13 +75,13 @@ TODO: | |||||||
| - <s>shift subtree up/down</s> | - <s>shift subtree up/down</s> | ||||||
| - <s>create node</s> | - <s>create node</s> | ||||||
| - <s>edit node</s> | - <s>edit node</s> | ||||||
|  | - shifting nodes up/down | ||||||
|  | - multiple node selection | ||||||
| - undo  | - undo  | ||||||
|   - delete node |   - delete node | ||||||
|   - indent/deindent |   - indent/deindent | ||||||
|   - edit node |   - edit node | ||||||
| - copy/paste nodes/trees | - copy/paste nodes/trees | ||||||
| - shifting nodes up/down |  | ||||||
| - multiple node selection |  | ||||||
| - <s>serialize</s>/deserialize | - <s>serialize</s>/deserialize | ||||||
| - <s>add optional text styling to nodes</s> | - <s>add optional text styling to nodes</s> | ||||||
| 
 | 
 | ||||||
| @ -94,6 +99,7 @@ Controls: | |||||||
| 	esc        - exit edit mode  | 	esc        - exit edit mode  | ||||||
| </pre> | </pre> | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
| <!-- vim:set ts=4 sw=4 : --> | <!-- vim:set ts=4 sw=4 : --> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user