mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-31 19:10: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;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* XXX are we selecting subtrees or blocks??? */
|
||||||
|
.editor [selected] {
|
||||||
|
background: silver;
|
||||||
|
}
|
||||||
|
|
||||||
.editor div:focus {
|
.editor div:focus {
|
||||||
/*outline: solid 0.2em silver;*/
|
/*outline: solid 0.2em silver;*/
|
||||||
outline: none;
|
outline: none;
|
||||||
|
|||||||
@ -101,7 +101,7 @@ var Outline = {
|
|||||||
: node == 'editable' ?
|
: node == 'editable' ?
|
||||||
[...this.dom.querySelectorAll('[tabindex]>textarea')]
|
[...this.dom.querySelectorAll('[tabindex]>textarea')]
|
||||||
: node == 'selected' ?
|
: node == 'selected' ?
|
||||||
[...this.dom.querySelectorAll('[tabindex].selected')]
|
[...this.dom.querySelectorAll('[tabindex][selected]')]
|
||||||
: node == 'top' ?
|
: node == 'top' ?
|
||||||
[...this.dom.children]
|
[...this.dom.children]
|
||||||
.filter(function(elem){
|
.filter(function(elem){
|
||||||
@ -349,6 +349,16 @@ var Outline = {
|
|||||||
var next = this.get('next')
|
var next = this.get('next')
|
||||||
this.get()?.remove()
|
this.get()?.remove()
|
||||||
next?.focus() },
|
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){
|
setup: function(dom){
|
||||||
|
|||||||
@ -9,12 +9,13 @@
|
|||||||
<script src="editor.js"></script>
|
<script src="editor.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
var editor
|
||||||
|
|
||||||
var setup = function(){
|
var setup = function(){
|
||||||
window.editor = {
|
window.editor = {
|
||||||
__proto__: Outline,
|
__proto__: Outline,
|
||||||
}.setup(
|
}.setup(
|
||||||
document.querySelector('.editor'))
|
document.querySelector('.editor')) }
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
@ -58,7 +59,10 @@ 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>
|
||||||
- undo delete node
|
- undo
|
||||||
|
- delete node
|
||||||
|
- indent/deindent
|
||||||
|
- edit node
|
||||||
- copy/paste nodes/trees
|
- copy/paste nodes/trees
|
||||||
- shifting nodes up/down
|
- shifting nodes up/down
|
||||||
- multiple node selection
|
- multiple node selection
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user