Fossil SCM

When sided by side make the text area small so it will always fit in the column. After page loaded enlarge the text area with Javascript. But leave a little room (40px) as a margin between the two columns. This insurers that side by side always succeeds.

renez 2012-04-30 09:33 side-by-side-edit
Commit 396eceb9e41290e37b4c07817bdcce46e7f60ccf
1 file changed +8 -1
+8 -1
--- src/wiki.c
+++ src/wiki.c
@@ -375,11 +375,15 @@
375375
@ <form method="POST" action="%s(g.zTop)/wikiedit">
376376
login_insert_csrf_secret();
377377
@ <input type="hidden" name="name" value="%h(zPageName)" />
378378
@ <div> <input type="submit" id="ssb" name="ssb" value="Toggle Side-by-side" />
379379
@ </div><input type="hidden" name="ss" value="%d(ss)" />
380
- @ <textarea id="w" name="w" class="wikiedit" cols="60" rows="%d(n)"
380
+ if(ss){
381
+ @ <textarea id="w" name="w" class="wikiedit" cols="20" rows="5"
382
+ } else {
383
+ @ <textarea id="w" name="w" class="wikiedit" cols="60" rows="%d(n)"
384
+ }
381385
@ wrap="virtual">%h(zBody)</textarea>
382386
@ <br />
383387
if(!ss){
384388
@ <input type="submit" name="preview" value="Preview Your Changes" />
385389
}
@@ -484,10 +488,13 @@
484488
@ x.send("w="+encodeURIComponent(window.ta.value))
485489
@ }
486490
@ setTimeout(preview,sto)
487491
@ }
488492
@ function pageLoaded(e){
493
+ @ if( window.ta.offsetWidth<window.prvw.offsetWidth ){
494
+ @ window.ta.style.width=(window.prvw.offsetWidth-40)+"px"
495
+ @ }
489496
@ if( window.ta.offsetHeight<window.prvw.offsetHeight ){
490497
@ window.ta.style.height=window.prvw.offsetHeight+"px"
491498
@ }
492499
@ window.isChanged =0
493500
@ setTimeout(preview,sto)
494501
--- src/wiki.c
+++ src/wiki.c
@@ -375,11 +375,15 @@
375 @ <form method="POST" action="%s(g.zTop)/wikiedit">
376 login_insert_csrf_secret();
377 @ <input type="hidden" name="name" value="%h(zPageName)" />
378 @ <div> <input type="submit" id="ssb" name="ssb" value="Toggle Side-by-side" />
379 @ </div><input type="hidden" name="ss" value="%d(ss)" />
380 @ <textarea id="w" name="w" class="wikiedit" cols="60" rows="%d(n)"
 
 
 
 
381 @ wrap="virtual">%h(zBody)</textarea>
382 @ <br />
383 if(!ss){
384 @ <input type="submit" name="preview" value="Preview Your Changes" />
385 }
@@ -484,10 +488,13 @@
484 @ x.send("w="+encodeURIComponent(window.ta.value))
485 @ }
486 @ setTimeout(preview,sto)
487 @ }
488 @ function pageLoaded(e){
 
 
 
489 @ if( window.ta.offsetHeight<window.prvw.offsetHeight ){
490 @ window.ta.style.height=window.prvw.offsetHeight+"px"
491 @ }
492 @ window.isChanged =0
493 @ setTimeout(preview,sto)
494
--- src/wiki.c
+++ src/wiki.c
@@ -375,11 +375,15 @@
375 @ <form method="POST" action="%s(g.zTop)/wikiedit">
376 login_insert_csrf_secret();
377 @ <input type="hidden" name="name" value="%h(zPageName)" />
378 @ <div> <input type="submit" id="ssb" name="ssb" value="Toggle Side-by-side" />
379 @ </div><input type="hidden" name="ss" value="%d(ss)" />
380 if(ss){
381 @ <textarea id="w" name="w" class="wikiedit" cols="20" rows="5"
382 } else {
383 @ <textarea id="w" name="w" class="wikiedit" cols="60" rows="%d(n)"
384 }
385 @ wrap="virtual">%h(zBody)</textarea>
386 @ <br />
387 if(!ss){
388 @ <input type="submit" name="preview" value="Preview Your Changes" />
389 }
@@ -484,10 +488,13 @@
488 @ x.send("w="+encodeURIComponent(window.ta.value))
489 @ }
490 @ setTimeout(preview,sto)
491 @ }
492 @ function pageLoaded(e){
493 @ if( window.ta.offsetWidth<window.prvw.offsetWidth ){
494 @ window.ta.style.width=(window.prvw.offsetWidth-40)+"px"
495 @ }
496 @ if( window.ta.offsetHeight<window.prvw.offsetHeight ){
497 @ window.ta.style.height=window.prvw.offsetHeight+"px"
498 @ }
499 @ window.isChanged =0
500 @ setTimeout(preview,sto)
501

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button