Fossil SCM

Fixed legacy pikchrshow preview button, broken by hijacking its URI for the new pikchrshow mode. In side-by-side mode when auto-render is on, cap each half at max-width 50% to help keep the UI from flopping around.

stephan 2022-06-06 18:51 pikchrshow-wasm
Commit c8e911656579ec10d5904006114e9984e4a634362c7485db1d2ab4070a303dc5
+15 -13
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -344,11 +344,11 @@
344344
"vertical-align: middle"
345345
"}\n");
346346
CX(".dragover {border: 3px dotted rgba(0,255,0,0.6)}\n");
347347
} CX("</style>");
348348
CX("<div>Input pikchr code and tap Preview (or Shift-Enter) to render "
349
- "it:</div>");
349
+ "it. <a href='?wasm'>Switch to WASM mode</a>.</div>");
350350
CX("<div id='sbs-wrapper'>"); {
351351
CX("<div id='pikchrshow-form'>"); {
352352
CX("<textarea id='content' name='content' rows='15'>"
353353
"%s</textarea>",zContent/*safe-for-%s*/);
354354
CX("<div id='pikchrshow-controls'>"); {
@@ -399,18 +399,18 @@
399399
** /pikchrshowcs.
400400
*/
401401
void pikchrshow_page(void){
402402
const char *zContent = 0;
403403
404
+ if(P("legacy") || P("ajax")){
405
+ pikchrshowcs_page();
406
+ return;
407
+ }
404408
login_check_credentials();
405409
if( !g.perm.RdWiki && !g.perm.Read && !g.perm.RdForum ){
406410
cgi_redirectf("%R/login?g=pikchrshow");
407411
}
408
- if(P("legacy")){
409
- pikchrshowcs_page();
410
- return;
411
- }
412412
style_emit_noscript_for_js_page();
413413
style_header("PikchrShow");
414414
zContent = PD("content",P("p"));
415415
if(!zContent){
416416
zContent = "arrow right 200% \"Markdown\" \"Source\"\n"
@@ -437,30 +437,32 @@
437437
CX("<div id='view-split' class='app-view initially-hidden'>"); {
438438
CX("<div class='fieldset options collapsible'>"); {
439439
CX("<span class='legend'><span>Options</span></span>");
440440
CX("<div>");
441441
CX("<span class='labeled-input'>");
442
- CX("<input type='checkbox' id='opt-cb-sbs'");
443
- CX("data-csstgt='#main-wrapper'");
444
- CX("data-cssclass='side-by-side'");
442
+ CX("<input type='checkbox' id='opt-cb-sbs' ");
443
+ CX("data-csstgt='#main-wrapper' ");
444
+ CX("data-cssclass='side-by-side' ");
445445
CX("data-config='sideBySide'>");
446446
CX("<label for='opt-cb-sbs'>Side-by-side</label>");
447447
CX("</span>");
448448
CX("<span class='labeled-input'>");
449
- CX("<input type='checkbox' id='opt-cb-swapio'");
450
- CX("data-csstgt='#main-wrapper'");
451
- CX("data-cssclass='swapio'");
449
+ CX("<input type='checkbox' id='opt-cb-swapio' ");
450
+ CX("data-csstgt='#main-wrapper' ");
451
+ CX("data-cssclass='swapio' ");
452452
CX("data-config='swapInOut'>");
453453
CX("<label for='opt-cb-swapio'>Swap in/out</label>");
454454
CX("</span>");
455455
CX("<span class='labeled-input'>");
456
- CX("<input type='checkbox' id='opt-cb-autoscale'");
456
+ CX("<input type='checkbox' id='opt-cb-autoscale' ");
457457
CX("data-config='renderAutoScale'>");
458458
CX("<label for='opt-cb-autoscale'>Auto-scale SVG</label>");
459459
CX("</span>");
460460
CX("<span class='labeled-input'>");
461
- CX("<input type='checkbox' id='opt-cb-autorender'");
461
+ CX("<input type='checkbox' id='opt-cb-autorender' ");
462
+ CX("data-csstgt='#main-wrapper' ");
463
+ CX("data-cssclass='auto-render' ");
462464
CX("data-config='renderWhileTyping'>");
463465
CX("<label for='opt-cb-autorender'>Render while typing</label>");
464466
CX("</span>");
465467
CX("<span class='labeled-input'>");
466468
CX("<a href='?legacy'>Legacy mode</a>");
467469
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -344,11 +344,11 @@
344 "vertical-align: middle"
345 "}\n");
346 CX(".dragover {border: 3px dotted rgba(0,255,0,0.6)}\n");
347 } CX("</style>");
348 CX("<div>Input pikchr code and tap Preview (or Shift-Enter) to render "
349 "it:</div>");
350 CX("<div id='sbs-wrapper'>"); {
351 CX("<div id='pikchrshow-form'>"); {
352 CX("<textarea id='content' name='content' rows='15'>"
353 "%s</textarea>",zContent/*safe-for-%s*/);
354 CX("<div id='pikchrshow-controls'>"); {
@@ -399,18 +399,18 @@
399 ** /pikchrshowcs.
400 */
401 void pikchrshow_page(void){
402 const char *zContent = 0;
403
 
 
 
 
404 login_check_credentials();
405 if( !g.perm.RdWiki && !g.perm.Read && !g.perm.RdForum ){
406 cgi_redirectf("%R/login?g=pikchrshow");
407 }
408 if(P("legacy")){
409 pikchrshowcs_page();
410 return;
411 }
412 style_emit_noscript_for_js_page();
413 style_header("PikchrShow");
414 zContent = PD("content",P("p"));
415 if(!zContent){
416 zContent = "arrow right 200% \"Markdown\" \"Source\"\n"
@@ -437,30 +437,32 @@
437 CX("<div id='view-split' class='app-view initially-hidden'>"); {
438 CX("<div class='fieldset options collapsible'>"); {
439 CX("<span class='legend'><span>Options</span></span>");
440 CX("<div>");
441 CX("<span class='labeled-input'>");
442 CX("<input type='checkbox' id='opt-cb-sbs'");
443 CX("data-csstgt='#main-wrapper'");
444 CX("data-cssclass='side-by-side'");
445 CX("data-config='sideBySide'>");
446 CX("<label for='opt-cb-sbs'>Side-by-side</label>");
447 CX("</span>");
448 CX("<span class='labeled-input'>");
449 CX("<input type='checkbox' id='opt-cb-swapio'");
450 CX("data-csstgt='#main-wrapper'");
451 CX("data-cssclass='swapio'");
452 CX("data-config='swapInOut'>");
453 CX("<label for='opt-cb-swapio'>Swap in/out</label>");
454 CX("</span>");
455 CX("<span class='labeled-input'>");
456 CX("<input type='checkbox' id='opt-cb-autoscale'");
457 CX("data-config='renderAutoScale'>");
458 CX("<label for='opt-cb-autoscale'>Auto-scale SVG</label>");
459 CX("</span>");
460 CX("<span class='labeled-input'>");
461 CX("<input type='checkbox' id='opt-cb-autorender'");
 
 
462 CX("data-config='renderWhileTyping'>");
463 CX("<label for='opt-cb-autorender'>Render while typing</label>");
464 CX("</span>");
465 CX("<span class='labeled-input'>");
466 CX("<a href='?legacy'>Legacy mode</a>");
467
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -344,11 +344,11 @@
344 "vertical-align: middle"
345 "}\n");
346 CX(".dragover {border: 3px dotted rgba(0,255,0,0.6)}\n");
347 } CX("</style>");
348 CX("<div>Input pikchr code and tap Preview (or Shift-Enter) to render "
349 "it. <a href='?wasm'>Switch to WASM mode</a>.</div>");
350 CX("<div id='sbs-wrapper'>"); {
351 CX("<div id='pikchrshow-form'>"); {
352 CX("<textarea id='content' name='content' rows='15'>"
353 "%s</textarea>",zContent/*safe-for-%s*/);
354 CX("<div id='pikchrshow-controls'>"); {
@@ -399,18 +399,18 @@
399 ** /pikchrshowcs.
400 */
401 void pikchrshow_page(void){
402 const char *zContent = 0;
403
404 if(P("legacy") || P("ajax")){
405 pikchrshowcs_page();
406 return;
407 }
408 login_check_credentials();
409 if( !g.perm.RdWiki && !g.perm.Read && !g.perm.RdForum ){
410 cgi_redirectf("%R/login?g=pikchrshow");
411 }
 
 
 
 
412 style_emit_noscript_for_js_page();
413 style_header("PikchrShow");
414 zContent = PD("content",P("p"));
415 if(!zContent){
416 zContent = "arrow right 200% \"Markdown\" \"Source\"\n"
@@ -437,30 +437,32 @@
437 CX("<div id='view-split' class='app-view initially-hidden'>"); {
438 CX("<div class='fieldset options collapsible'>"); {
439 CX("<span class='legend'><span>Options</span></span>");
440 CX("<div>");
441 CX("<span class='labeled-input'>");
442 CX("<input type='checkbox' id='opt-cb-sbs' ");
443 CX("data-csstgt='#main-wrapper' ");
444 CX("data-cssclass='side-by-side' ");
445 CX("data-config='sideBySide'>");
446 CX("<label for='opt-cb-sbs'>Side-by-side</label>");
447 CX("</span>");
448 CX("<span class='labeled-input'>");
449 CX("<input type='checkbox' id='opt-cb-swapio' ");
450 CX("data-csstgt='#main-wrapper' ");
451 CX("data-cssclass='swapio' ");
452 CX("data-config='swapInOut'>");
453 CX("<label for='opt-cb-swapio'>Swap in/out</label>");
454 CX("</span>");
455 CX("<span class='labeled-input'>");
456 CX("<input type='checkbox' id='opt-cb-autoscale' ");
457 CX("data-config='renderAutoScale'>");
458 CX("<label for='opt-cb-autoscale'>Auto-scale SVG</label>");
459 CX("</span>");
460 CX("<span class='labeled-input'>");
461 CX("<input type='checkbox' id='opt-cb-autorender' ");
462 CX("data-csstgt='#main-wrapper' ");
463 CX("data-cssclass='auto-render' ");
464 CX("data-config='renderWhileTyping'>");
465 CX("<label for='opt-cb-autorender'>Render while typing</label>");
466 CX("</span>");
467 CX("<span class='labeled-input'>");
468 CX("<a href='?legacy'>Legacy mode</a>");
469
--- src/style.pikchrshow.css
+++ src/style.pikchrshow.css
@@ -51,10 +51,15 @@
5151
margin: 0 0.25em;
5252
flex: 1 1 auto;
5353
}
5454
.zone-wrapper.output {
5555
}
56
+#main-wrapper.auto-render.side-by-side .zone-wrapper {
57
+ /* Keep the layout from "flopping around" when
58
+ render-while-typing mode is on. */
59
+ max-width: 50%;
60
+}
5661
#pikchr-output {
5762
/*flex: 1 1 auto;*/
5863
/*overflow: auto;*/
5964
padding: 0;
6065
margin: 0;
@@ -117,11 +122,11 @@
117122
display: flex;
118123
flex-direction: column;
119124
}
120125
.fieldset > .legend {
121126
position: relative;
122
- top: -1.5ex;
127
+ top: -1.25ex;
123128
padding: 0 0.5em;
124129
font-size: 85%;
125130
margin-left: 0.5em;
126131
flex: 0 1 auto;
127132
align-self: self-start;
128133
--- src/style.pikchrshow.css
+++ src/style.pikchrshow.css
@@ -51,10 +51,15 @@
51 margin: 0 0.25em;
52 flex: 1 1 auto;
53 }
54 .zone-wrapper.output {
55 }
 
 
 
 
 
56 #pikchr-output {
57 /*flex: 1 1 auto;*/
58 /*overflow: auto;*/
59 padding: 0;
60 margin: 0;
@@ -117,11 +122,11 @@
117 display: flex;
118 flex-direction: column;
119 }
120 .fieldset > .legend {
121 position: relative;
122 top: -1.5ex;
123 padding: 0 0.5em;
124 font-size: 85%;
125 margin-left: 0.5em;
126 flex: 0 1 auto;
127 align-self: self-start;
128
--- src/style.pikchrshow.css
+++ src/style.pikchrshow.css
@@ -51,10 +51,15 @@
51 margin: 0 0.25em;
52 flex: 1 1 auto;
53 }
54 .zone-wrapper.output {
55 }
56 #main-wrapper.auto-render.side-by-side .zone-wrapper {
57 /* Keep the layout from "flopping around" when
58 render-while-typing mode is on. */
59 max-width: 50%;
60 }
61 #pikchr-output {
62 /*flex: 1 1 auto;*/
63 /*overflow: auto;*/
64 padding: 0;
65 margin: 0;
@@ -117,11 +122,11 @@
122 display: flex;
123 flex-direction: column;
124 }
125 .fieldset > .legend {
126 position: relative;
127 top: -1.25ex;
128 padding: 0 0.5em;
129 font-size: 85%;
130 margin-left: 0.5em;
131 flex: 0 1 auto;
132 align-self: self-start;
133
--- tools/mkbuiltin.c
+++ tools/mkbuiltin.c
@@ -354,14 +354,10 @@
354354
while( pData[nSkip]=='#' ){
355355
while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; }
356356
if( pData[nSkip]=='\n' ) nSkip++;
357357
}
358358
359
-#if 1
360
- /* 2022-06-06: temporarily disabled for the sake of the pikchr
361
- ** wasm build, as "something" in this compression is breaking the
362
- ** module loader. */
363359
#ifndef FOSSIL_DEBUG
364360
/* Compress javascript source files */
365361
nName = (int)strlen(aRes[i].zName);
366362
if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
367363
|| (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
@@ -368,11 +364,10 @@
368364
){
369365
int x = sz-nSkip;
370366
compressJavascript(pData+nSkip, &x);
371367
sz = x + nSkip;
372368
}
373
-#endif
374369
#endif
375370
376371
aRes[i].nByte = sz - nSkip;
377372
aRes[i].idx = i;
378373
printf("/* Content of file %s */\n", aRes[i].zName);
379374
--- tools/mkbuiltin.c
+++ tools/mkbuiltin.c
@@ -354,14 +354,10 @@
354 while( pData[nSkip]=='#' ){
355 while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; }
356 if( pData[nSkip]=='\n' ) nSkip++;
357 }
358
359 #if 1
360 /* 2022-06-06: temporarily disabled for the sake of the pikchr
361 ** wasm build, as "something" in this compression is breaking the
362 ** module loader. */
363 #ifndef FOSSIL_DEBUG
364 /* Compress javascript source files */
365 nName = (int)strlen(aRes[i].zName);
366 if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
367 || (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
@@ -368,11 +364,10 @@
368 ){
369 int x = sz-nSkip;
370 compressJavascript(pData+nSkip, &x);
371 sz = x + nSkip;
372 }
373 #endif
374 #endif
375
376 aRes[i].nByte = sz - nSkip;
377 aRes[i].idx = i;
378 printf("/* Content of file %s */\n", aRes[i].zName);
379
--- tools/mkbuiltin.c
+++ tools/mkbuiltin.c
@@ -354,14 +354,10 @@
354 while( pData[nSkip]=='#' ){
355 while( pData[nSkip]!=0 && pData[nSkip]!='\n' ){ nSkip++; }
356 if( pData[nSkip]=='\n' ) nSkip++;
357 }
358
 
 
 
 
359 #ifndef FOSSIL_DEBUG
360 /* Compress javascript source files */
361 nName = (int)strlen(aRes[i].zName);
362 if( (nName>3 && strcmp(&aRes[i].zName[nName-3],".js")==0)
363 || (nName>7 && strcmp(&aRes[i].zName[nName-7], "/js.txt")==0)
@@ -368,11 +364,10 @@
364 ){
365 int x = sz-nSkip;
366 compressJavascript(pData+nSkip, &x);
367 sz = x + nSkip;
368 }
 
369 #endif
370
371 aRes[i].nByte = sz - nSkip;
372 aRes[i].idx = i;
373 printf("/* Content of file %s */\n", aRes[i].zName);
374

Keyboard Shortcuts

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