comparison src/editor.tp @ 131:8285784f5ff5

Implement previous and next buttons
author Mike Pavone <pavone@retrodev.com>
date Wed, 07 Aug 2013 10:01:28 -0700
parents 2b25d0ce2946
children 15aac5334b64
comparison
equal deleted inserted replaced
130:6a1a716bb8c6 131:8285784f5ff5
47 setSelection:withInNode <- :astnode :innode { 47 setSelection:withInNode <- :astnode :innode {
48 fakeEvent <- #{ 48 fakeEvent <- #{
49 stopPropagation <- :Blah { 49 stopPropagation <- :Blah {
50 } 50 }
51 } 51 }
52
52 selection <- #{ 53 selection <- #{
53 valid? <- true 54 valid? <- true
54 in <- { 55 in <- {
55 (innode domNode) onclick: fakeEvent 56 (innode domNode) onclick: fakeEvent
57 }
58 out <- {
59 ((astnode up) domNode) onclick: fakeEvent
60 }
61 next <- {
62 (((astnode up) getNext: astnode) domNode) onclick: fakeEvent
63 }
64
65 previous <- {
66 (((astnode up) getPrev: astnode) domNode) onclick: fakeEvent
67 }
68 }
69 }
70
71 setSelection <- :astnode {
72 fakeEvent <- #{
73 stopPropagation <- :Blah {
74 }
75 }
76 selection <- #{
77 valid? <- true
78 in <- {
56 } 79 }
57 out <- { 80 out <- {
58 fakeEvent <- #{ 81 fakeEvent <- #{
59 stopPropagation <- :Blah { 82 stopPropagation <- :Blah {
60 } 83 }
61 } 84 }
62 ((astnode up) domNode) onclick: fakeEvent 85 ((astnode up) domNode) onclick: fakeEvent
63 } 86 }
64 } 87 next <- {
65 } 88 console log: "selection next"
66 89 (((astnode up) getNext: astnode) domNode) onclick: fakeEvent
67 setSelection <- :astnode { 90 }
68 fakeEvent <- #{ 91 previous <- {
69 stopPropagation <- :Blah { 92 (((astnode up) getPrev: astnode) domNode) onclick: fakeEvent
70 }
71 }
72 selection <- #{
73 valid? <- true
74 in <- {
75 }
76 out <- {
77 fakeEvent <- #{
78 stopPropagation <- :Blah {
79 }
80 }
81 ((astnode up) domNode) onclick: fakeEvent
82 } 93 }
83 } 94 }
84 } 95 }
85 96
86 editFile <- :path { 97 editFile <- :path {
319 if: (selection valid?) { 330 if: (selection valid?) {
320 selection out 331 selection out
321 } 332 }
322 } 333 }
323 334
335 (q: "#next") onclick!: :event {
336 if: (selection valid?) {
337 selection next
338 }
339 }
340
341 (q: "#prev") onclick!: :event {
342 if: (selection valid?) {
343 selection previous
344 }
345 }
346
324 path <- (window location) pathname 347 path <- (window location) pathname
325 if: (path indexOf: "/edit/") = 0 { 348 if: (path indexOf: "/edit/") = 0 {
326 editFile: (path substr: 5) 349 editFile: (path substr: 5)
327 } 350 }
328 (q: "#fullscreen") onclick!: :event { 351 (q: "#fullscreen") onclick!: :event {