mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 10:00:08 +00:00
added basic selection -- stub
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
66c29d3f21
commit
76f7a94559
@ -51,6 +51,11 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* XXX are we selecting subtrees or blocks??? */
|
||||
.editor [selected] {
|
||||
background: silver;
|
||||
}
|
||||
|
||||
.editor div:focus {
|
||||
/*outline: solid 0.2em silver;*/
|
||||
outline: none;
|
||||
|
||||
@ -101,7 +101,7 @@ var Outline = {
|
||||
: node == 'editable' ?
|
||||
[...this.dom.querySelectorAll('[tabindex]>textarea')]
|
||||
: node == 'selected' ?
|
||||
[...this.dom.querySelectorAll('[tabindex].selected')]
|
||||
[...this.dom.querySelectorAll('[tabindex][selected]')]
|
||||
: node == 'top' ?
|
||||
[...this.dom.children]
|
||||
.filter(function(elem){
|
||||
@ -349,6 +349,16 @@ var Outline = {
|
||||
var next = this.get('next')
|
||||
this.get()?.remove()
|
||||
next?.focus() },
|
||||
|
||||
// select...
|
||||
' ': function(evt){
|
||||
if(this.get('edited') != null){
|
||||
return }
|
||||
evt.preventDefault()
|
||||
var focused = this.get()
|
||||
focused.getAttribute('selected') != null ?
|
||||
focused.removeAttribute('selected')
|
||||
: focused.setAttribute('selected', '') },
|
||||
},
|
||||
|
||||
setup: function(dom){
|
||||
|
||||
@ -9,12 +9,13 @@
|
||||
<script src="editor.js"></script>
|
||||
<script>
|
||||
|
||||
var editor
|
||||
|
||||
var setup = function(){
|
||||
window.editor = {
|
||||
__proto__: Outline,
|
||||
}.setup(
|
||||
document.querySelector('.editor'))
|
||||
}
|
||||
document.querySelector('.editor')) }
|
||||
|
||||
</script>
|
||||
</head>
|
||||
@ -58,7 +59,10 @@ TODO:
|
||||
- <s>shift subtree up/down</s>
|
||||
- <s>create node</s>
|
||||
- <s>edit node</s>
|
||||
- undo delete node
|
||||
- undo
|
||||
- delete node
|
||||
- indent/deindent
|
||||
- edit node
|
||||
- copy/paste nodes/trees
|
||||
- shifting nodes up/down
|
||||
- multiple node selection
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user