Fossil SCM

fileedit confirmer buttons now use the new pinSize confirmer option. Minor style consistency tweak. fileedit no longer complains when discarding stashed edits when no file is loaded, and reloads the current file only if it was in the now-discarded local edits.

stephan 2020-08-11 15:29 trunk
Commit 83a95dbff1be67438d447b44b07e6a2fbaf5fa3d3d4e024fb909897e1cffc5e3
+2 -1
--- src/fileedit.c
+++ src/fileedit.c
@@ -1803,11 +1803,12 @@
18031803
"data-tab-parent='fileedit-tabs' "
18041804
"data-tab-label='Diff' "
18051805
"class='hidden'"
18061806
">");
18071807
1808
- CX("<div class='fileedit-options flex-container flex-row' "
1808
+ CX("<div class='fileedit-options flex-container "
1809
+ "flex-row child-gap-small' "
18091810
"id='fileedit-tab-diff-buttons'>");
18101811
CX("<button class='sbs'>Side-by-side</button>"
18111812
"<button class='unified'>Unified</button>");
18121813
if(0){
18131814
/* For the time being let's just ignore all whitespace
18141815
--- src/fileedit.c
+++ src/fileedit.c
@@ -1803,11 +1803,12 @@
1803 "data-tab-parent='fileedit-tabs' "
1804 "data-tab-label='Diff' "
1805 "class='hidden'"
1806 ">");
1807
1808 CX("<div class='fileedit-options flex-container flex-row' "
 
1809 "id='fileedit-tab-diff-buttons'>");
1810 CX("<button class='sbs'>Side-by-side</button>"
1811 "<button class='unified'>Unified</button>");
1812 if(0){
1813 /* For the time being let's just ignore all whitespace
1814
--- src/fileedit.c
+++ src/fileedit.c
@@ -1803,11 +1803,12 @@
1803 "data-tab-parent='fileedit-tabs' "
1804 "data-tab-label='Diff' "
1805 "class='hidden'"
1806 ">");
1807
1808 CX("<div class='fileedit-options flex-container "
1809 "flex-row child-gap-small' "
1810 "id='fileedit-tab-diff-buttons'>");
1811 CX("<button class='sbs'>Side-by-side</button>"
1812 "<button class='unified'>Unified</button>");
1813 if(0){
1814 /* For the time being let's just ignore all whitespace
1815
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -464,11 +464,11 @@
464464
D.attr(D.div(),'id','fileedit-stash-selector'),
465465
'input-with-label'
466466
);
467467
const sel = this.e.select = D.select();
468468
const btnClear = this.e.btnClear
469
- = D.addClass(D.button("Clear"),'hidden');
469
+ = D.button("Clear");
470470
D.append(wrapper, "Local edits (",
471471
D.append(D.code(),
472472
F.storage.storageImplName()),
473473
"):",
474474
sel, btnClear);
@@ -483,23 +483,34 @@
483483
F.page.addEventListener('fileedit-file-loaded',(e)=>this.updateList($stash, e.detail));
484484
sel.addEventListener('change',function(e){
485485
const opt = this.selectedOptions[0];
486486
if(opt && opt._finfo) P.loadFile(opt._finfo);
487487
});
488
- F.confirmer(btnClear, {
489
- confirmText: "REALLY delete ALL local edits?",
490
- onconfirm: (e)=>P.clearStash().loadFile(/*in case P.finfo was in the stash*/),
491
- ticks: F.config.confirmerButtonTicks
492
- });
493488
if(F.storage.isTransient()){/*Warn if our storage is particularly transient...*/
494489
D.append(wrapper, D.append(
495490
D.addClass(D.span(),'warning'),
496491
"Warning: persistent storage is not available, "+
497492
"so uncomitted edits will not survive a page reload."
498493
));
499494
}
500495
domInsertPoint.parentNode.insertBefore(wrapper, domInsertPoint);
496
+ F.confirmer(btnClear, {
497
+ /* must come after insertion into the DOM for the pinSize option to work. */
498
+ pinSize: true,
499
+ confirmText: "DELETE all local edits?",
500
+ onconfirm: function(e){
501
+ if(P.finfo){
502
+ const stashed = P.getStashedFinfo(P.finfo);
503
+ P.clearStash();
504
+ if(stashed) P.loadFile(/*reload after discarding edits*/);
505
+ }else{
506
+ P.clearStash();
507
+ }
508
+ },
509
+ ticks: F.config.confirmerButtonTicks
510
+ });
511
+ D.addClass(this.e.btnClear,'hidden' /* must not be set until after confirmer is set up!*/);
501512
$stash._fireStashEvent(/*read the page-load-time stash*/);
502513
delete this.init;
503514
},
504515
/**
505516
Regenerates the edit selection list.
@@ -726,10 +737,11 @@
726737
);
727738
P.e.btnCommit.addEventListener(
728739
"click",(e)=>P.commit(), false
729740
);
730741
F.confirmer(P.e.btnReload, {
742
+ pinSize: true,
731743
confirmText: "Really reload, losing edits?",
732744
onconfirm: (e)=>P.unstashContent().loadFile(),
733745
ticks: F.config.confirmerButtonTicks
734746
});
735747
E('#comment-toggle').addEventListener(
736748
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -464,11 +464,11 @@
464 D.attr(D.div(),'id','fileedit-stash-selector'),
465 'input-with-label'
466 );
467 const sel = this.e.select = D.select();
468 const btnClear = this.e.btnClear
469 = D.addClass(D.button("Clear"),'hidden');
470 D.append(wrapper, "Local edits (",
471 D.append(D.code(),
472 F.storage.storageImplName()),
473 "):",
474 sel, btnClear);
@@ -483,23 +483,34 @@
483 F.page.addEventListener('fileedit-file-loaded',(e)=>this.updateList($stash, e.detail));
484 sel.addEventListener('change',function(e){
485 const opt = this.selectedOptions[0];
486 if(opt && opt._finfo) P.loadFile(opt._finfo);
487 });
488 F.confirmer(btnClear, {
489 confirmText: "REALLY delete ALL local edits?",
490 onconfirm: (e)=>P.clearStash().loadFile(/*in case P.finfo was in the stash*/),
491 ticks: F.config.confirmerButtonTicks
492 });
493 if(F.storage.isTransient()){/*Warn if our storage is particularly transient...*/
494 D.append(wrapper, D.append(
495 D.addClass(D.span(),'warning'),
496 "Warning: persistent storage is not available, "+
497 "so uncomitted edits will not survive a page reload."
498 ));
499 }
500 domInsertPoint.parentNode.insertBefore(wrapper, domInsertPoint);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501 $stash._fireStashEvent(/*read the page-load-time stash*/);
502 delete this.init;
503 },
504 /**
505 Regenerates the edit selection list.
@@ -726,10 +737,11 @@
726 );
727 P.e.btnCommit.addEventListener(
728 "click",(e)=>P.commit(), false
729 );
730 F.confirmer(P.e.btnReload, {
 
731 confirmText: "Really reload, losing edits?",
732 onconfirm: (e)=>P.unstashContent().loadFile(),
733 ticks: F.config.confirmerButtonTicks
734 });
735 E('#comment-toggle').addEventListener(
736
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -464,11 +464,11 @@
464 D.attr(D.div(),'id','fileedit-stash-selector'),
465 'input-with-label'
466 );
467 const sel = this.e.select = D.select();
468 const btnClear = this.e.btnClear
469 = D.button("Clear");
470 D.append(wrapper, "Local edits (",
471 D.append(D.code(),
472 F.storage.storageImplName()),
473 "):",
474 sel, btnClear);
@@ -483,23 +483,34 @@
483 F.page.addEventListener('fileedit-file-loaded',(e)=>this.updateList($stash, e.detail));
484 sel.addEventListener('change',function(e){
485 const opt = this.selectedOptions[0];
486 if(opt && opt._finfo) P.loadFile(opt._finfo);
487 });
 
 
 
 
 
488 if(F.storage.isTransient()){/*Warn if our storage is particularly transient...*/
489 D.append(wrapper, D.append(
490 D.addClass(D.span(),'warning'),
491 "Warning: persistent storage is not available, "+
492 "so uncomitted edits will not survive a page reload."
493 ));
494 }
495 domInsertPoint.parentNode.insertBefore(wrapper, domInsertPoint);
496 F.confirmer(btnClear, {
497 /* must come after insertion into the DOM for the pinSize option to work. */
498 pinSize: true,
499 confirmText: "DELETE all local edits?",
500 onconfirm: function(e){
501 if(P.finfo){
502 const stashed = P.getStashedFinfo(P.finfo);
503 P.clearStash();
504 if(stashed) P.loadFile(/*reload after discarding edits*/);
505 }else{
506 P.clearStash();
507 }
508 },
509 ticks: F.config.confirmerButtonTicks
510 });
511 D.addClass(this.e.btnClear,'hidden' /* must not be set until after confirmer is set up!*/);
512 $stash._fireStashEvent(/*read the page-load-time stash*/);
513 delete this.init;
514 },
515 /**
516 Regenerates the edit selection list.
@@ -726,10 +737,11 @@
737 );
738 P.e.btnCommit.addEventListener(
739 "click",(e)=>P.commit(), false
740 );
741 F.confirmer(P.e.btnReload, {
742 pinSize: true,
743 confirmText: "Really reload, losing edits?",
744 onconfirm: (e)=>P.unstashContent().loadFile(),
745 ticks: F.config.confirmerButtonTicks
746 });
747 E('#comment-toggle').addEventListener(
748

Keyboard Shortcuts

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