Fossil SCM

After committing, reload the leaves/files list. Added a reload button to the leaves/files widget. Several style improvements.

stephan 2020-05-12 08:28 fileedit-ajaxify
Commit 2318c419c9e2c3c13e17ae6be8ac601b97bf0ebb9f9eff7e9e0fe823c3d58508
--- src/default_css.txt
+++ src/default_css.txt
@@ -958,11 +958,12 @@
958958
body.fileedit fieldset > legend {
959959
margin: 0 0 0 1em;
960960
padding: 0 0.5em 0 0.5em;
961961
}
962962
body.fileedit fieldset > div {
963
- margin: 0 0.25em 0.25em 0.25em;
963
+ margin: 0 0.25em 0 0.25em;
964
+ padding: 0;
964965
}
965966
body.fileedit fieldset > div > .input-with-label {
966967
margin: 0.25em 0.5em;
967968
}
968969
body.fileedit fieldset > div > button {
@@ -987,17 +988,26 @@
987988
}
988989
div.fileedit-preview {
989990
margin: 0;
990991
padding: 0;
991992
}
992
-div.fileedit-tab-diff-wrapper {
993
+#fileedit-tab-diff-wrapper {
993994
margin: 0;
994995
padding: 0;
996
+ overflow: auto;
997
+}
998
+#fileedit-tab-preview-wrapper {
999
+ overflow: auto;
9951000
}
996
-#fileedit-comment {
997
- width: 100%;
1001
+.fileedit-options.commit-message > div {
1002
+ display: flex;
1003
+ flex-direction: column;
1004
+ justify-content: stretch;
9981005
font-family: monospace;
1006
+}
1007
+.fileedit-options.commit-message > div > * {
1008
+ margin: 0.25em;
9991009
}
10001010
#fileedit-commit-button-wrapper {
10011011
margin: 0.25em;
10021012
}
10031013
.tab-container > .tabs > .tab-panel > .fileedit-options {
@@ -1056,20 +1066,28 @@
10561066
padding: 0 0.25em;
10571067
margin: 0;
10581068
min-height: 12em;
10591069
}
10601070
#fileedit-file-selector select {
1071
+ margin: 0 0 0.5em 0;
10611072
height: initial;
10621073
font-family: monospace;
10631074
}
10641075
#fileedit-file-selector select:focus {
10651076
border: none;
10661077
}
1078
+#fileedit-file-selector > div {
1079
+ padding: 0;
1080
+ margin: 0;
1081
+}
1082
+#fileedit-file-selector > div > * {
1083
+ margin: 0.25em 0.5em 0.25em 0;
1084
+}
10671085
.flex-container.flex-row.stretch {
1068
- flex-direction: row;
10691086
flex-wrap: wrap;
1070
- align-items: stretch;
1087
+ align-items: baseline;
1088
+ justify-content: stretch;
10711089
margin: 0;
10721090
}
10731091
.flex-container.flex-column {
10741092
flex-direction: column;
10751093
flex-wrap: wrap;
10761094
--- src/default_css.txt
+++ src/default_css.txt
@@ -958,11 +958,12 @@
958 body.fileedit fieldset > legend {
959 margin: 0 0 0 1em;
960 padding: 0 0.5em 0 0.5em;
961 }
962 body.fileedit fieldset > div {
963 margin: 0 0.25em 0.25em 0.25em;
 
964 }
965 body.fileedit fieldset > div > .input-with-label {
966 margin: 0.25em 0.5em;
967 }
968 body.fileedit fieldset > div > button {
@@ -987,17 +988,26 @@
987 }
988 div.fileedit-preview {
989 margin: 0;
990 padding: 0;
991 }
992 div.fileedit-tab-diff-wrapper {
993 margin: 0;
994 padding: 0;
 
 
 
 
995 }
996 #fileedit-comment {
997 width: 100%;
 
 
998 font-family: monospace;
 
 
 
999 }
1000 #fileedit-commit-button-wrapper {
1001 margin: 0.25em;
1002 }
1003 .tab-container > .tabs > .tab-panel > .fileedit-options {
@@ -1056,20 +1066,28 @@
1056 padding: 0 0.25em;
1057 margin: 0;
1058 min-height: 12em;
1059 }
1060 #fileedit-file-selector select {
 
1061 height: initial;
1062 font-family: monospace;
1063 }
1064 #fileedit-file-selector select:focus {
1065 border: none;
1066 }
 
 
 
 
 
 
 
1067 .flex-container.flex-row.stretch {
1068 flex-direction: row;
1069 flex-wrap: wrap;
1070 align-items: stretch;
 
1071 margin: 0;
1072 }
1073 .flex-container.flex-column {
1074 flex-direction: column;
1075 flex-wrap: wrap;
1076
--- src/default_css.txt
+++ src/default_css.txt
@@ -958,11 +958,12 @@
958 body.fileedit fieldset > legend {
959 margin: 0 0 0 1em;
960 padding: 0 0.5em 0 0.5em;
961 }
962 body.fileedit fieldset > div {
963 margin: 0 0.25em 0 0.25em;
964 padding: 0;
965 }
966 body.fileedit fieldset > div > .input-with-label {
967 margin: 0.25em 0.5em;
968 }
969 body.fileedit fieldset > div > button {
@@ -987,17 +988,26 @@
988 }
989 div.fileedit-preview {
990 margin: 0;
991 padding: 0;
992 }
993 #fileedit-tab-diff-wrapper {
994 margin: 0;
995 padding: 0;
996 overflow: auto;
997 }
998 #fileedit-tab-preview-wrapper {
999 overflow: auto;
1000 }
1001 .fileedit-options.commit-message > div {
1002 display: flex;
1003 flex-direction: column;
1004 justify-content: stretch;
1005 font-family: monospace;
1006 }
1007 .fileedit-options.commit-message > div > * {
1008 margin: 0.25em;
1009 }
1010 #fileedit-commit-button-wrapper {
1011 margin: 0.25em;
1012 }
1013 .tab-container > .tabs > .tab-panel > .fileedit-options {
@@ -1056,20 +1066,28 @@
1066 padding: 0 0.25em;
1067 margin: 0;
1068 min-height: 12em;
1069 }
1070 #fileedit-file-selector select {
1071 margin: 0 0 0.5em 0;
1072 height: initial;
1073 font-family: monospace;
1074 }
1075 #fileedit-file-selector select:focus {
1076 border: none;
1077 }
1078 #fileedit-file-selector > div {
1079 padding: 0;
1080 margin: 0;
1081 }
1082 #fileedit-file-selector > div > * {
1083 margin: 0.25em 0.5em 0.25em 0;
1084 }
1085 .flex-container.flex-row.stretch {
 
1086 flex-wrap: wrap;
1087 align-items: baseline;
1088 justify-content: stretch;
1089 margin: 0;
1090 }
1091 .flex-container.flex-column {
1092 flex-direction: column;
1093 flex-wrap: wrap;
1094
+1 -1
--- src/fileedit.c
+++ src/fileedit.c
@@ -1899,11 +1899,11 @@
18991899
NULL);
19001900
CX("</div>"/*checkboxes*/);
19011901
}
19021902
19031903
{ /******* Commit comment, button, and result manifest *******/
1904
- CX("<fieldset class='fileedit-options'>"
1904
+ CX("<fieldset class='fileedit-options commit-message'>"
19051905
"<legend>Message (required)</legend><div>\n");
19061906
/* We have two comment input fields, defaulting to single-line
19071907
** mode. JS code sets up the ability to toggle between single-
19081908
** and multi-line modes. */
19091909
CX("<input type='text' name='comment' "
19101910
--- src/fileedit.c
+++ src/fileedit.c
@@ -1899,11 +1899,11 @@
1899 NULL);
1900 CX("</div>"/*checkboxes*/);
1901 }
1902
1903 { /******* Commit comment, button, and result manifest *******/
1904 CX("<fieldset class='fileedit-options'>"
1905 "<legend>Message (required)</legend><div>\n");
1906 /* We have two comment input fields, defaulting to single-line
1907 ** mode. JS code sets up the ability to toggle between single-
1908 ** and multi-line modes. */
1909 CX("<input type='text' name='comment' "
1910
--- src/fileedit.c
+++ src/fileedit.c
@@ -1899,11 +1899,11 @@
1899 NULL);
1900 CX("</div>"/*checkboxes*/);
1901 }
1902
1903 { /******* Commit comment, button, and result manifest *******/
1904 CX("<fieldset class='fileedit-options commit-message'>"
1905 "<legend>Message (required)</legend><div>\n");
1906 /* We have two comment input fields, defaulting to single-line
1907 ** mode. JS code sets up the ability to toggle between single-
1908 ** and multi-line modes. */
1909 CX("<input type='text' name='comment' "
1910
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -7,11 +7,11 @@
77
const E = (s)=>document.querySelector(s),
88
D = F.dom,
99
P = F.page;
1010
1111
/**
12
- Manager object for the checkin/file selection list.
12
+ Widget for the checkin/file selection list.
1313
*/
1414
P.fileSelector = {
1515
e:{
1616
container: E('#fileedit-file-selector')
1717
},
@@ -18,12 +18,20 @@
1818
finfo: {},
1919
cache: {
2020
checkins: undefined,
2121
files:{}
2222
},
23
+ /**
24
+ Fetches the list of leaf checkins from the server and updates
25
+ the UI with that list.
26
+ */
2327
loadLeaves: function(){
24
- D.append(D.clearElement(this.e.ciListLabel),"Loading leaves...");
28
+ D.append(D.clearElement(
29
+ this.e.ciListLabel,
30
+ this.e.selectCi,
31
+ this.e.selectFiles
32
+ ),"Loading leaves...");
2533
D.disable(this.e.btnLoadFile, this.e.selectFiles, this.e.selectCi);
2634
const self = this;
2735
F.fetch('fileedit',{
2836
urlParams:'ajax=filelist&leaves',
2937
responseType: 'json',
@@ -40,10 +48,16 @@
4048
});
4149
self.loadFiles(loadThisOne ? loadThisOne.checkin : false);
4250
}
4351
});
4452
},
53
+ /**
54
+ Loads the file list for the given checkin UUID. It uses a
55
+ cached copy on subsequent calls for the same UUID. If passed a
56
+ falsy value, it instead clears and disables the file selection
57
+ list.
58
+ */
4559
loadFiles: function(ciUuid){
4660
delete this.finfo.filename;
4761
this.finfo.checkin = ciUuid;
4862
const selFiles = this.e.selectFiles;
4963
if(!ciUuid){
@@ -79,20 +93,31 @@
7993
responseType: 'json',
8094
onload
8195
});
8296
return this;
8397
},
98
+ /**
99
+ Initializes the checkin/file selector widget. Must only be
100
+ called once.
101
+ */
84102
init: function(){
85103
const selCi = this.e.selectCi = D.select(),
86104
selFiles = this.e.selectFiles
87105
= D.addClass(D.select(), 'file-list'),
88106
btnLoad = this.e.btnLoadFile =
89107
D.addClass(D.button("Load file"), "flex-shrink"),
90108
filesLabel = this.e.fileListLabel =
91109
D.addClass(D.div(),'flex-shrink','file-list-label'),
110
+ ciLabelWrapper = D.addClass(
111
+ D.div(), 'flex-container','flex-row', 'flex-shrink',
112
+ 'stretch'
113
+ ),
114
+ btnReload = D.addClass(
115
+ D.button('Reload'), 'flex-shrink'
116
+ ),
92117
ciLabel = this.e.ciListLabel =
93
- D.addClass(D.div(),'flex-shrink','checkin-list-label')
118
+ D.addClass(D.span(),'flex-shrink','checkin-list-label')
94119
;
95120
D.attr(selCi, 'title',"The list of opened leaves.");
96121
D.attr(selFiles, 'title',
97122
"The list of editable files for the selected checkin.");
98123
D.attr(btnLoad, 'title',
@@ -99,17 +124,17 @@
99124
"Load the selected file into the editor.");
100125
D.disable(selCi, selFiles, btnLoad);
101126
D.attr(selFiles, 'size', 10);
102127
D.append(
103128
this.e.container,
104
- ciLabel,
129
+ D.append(ciLabelWrapper,
130
+ btnReload, ciLabel),
105131
selCi,
106132
filesLabel,
107133
selFiles,
108134
btnLoad
109135
);
110
-
111136
this.loadLeaves();
112137
selCi.addEventListener(
113138
'change', (e)=>this.loadFiles(e.target.value), false
114139
);
115140
btnLoad.addEventListener(
@@ -118,10 +143,13 @@
118143
if(this.finfo.filename){
119144
P.loadFile(this.finfo.filename, this.finfo.checkin);
120145
}
121146
}, false
122147
);
148
+ btnReload.addEventListener(
149
+ 'click', (e)=>this.loadLeaves(), false
150
+ );
123151
delete this.init;
124152
}
125153
};
126154
127155
window.addEventListener("load", function() {
@@ -246,10 +274,28 @@
246274
// Force UI update
247275
new Event('change',{target:selectFontSize})
248276
);
249277
}
250278
}, false)/*onload event handler*/;
279
+
280
+ /**
281
+ Getter (if called with no args) or setter (if passed an arg) for
282
+ the current file content. We use a function, rather than direct
283
+ access so that clients can hypothetically swap out this method
284
+ from their skin in order to facilitate plugging-in of fancy
285
+ 3rd-party editor widgets.
286
+
287
+ The setter form returns this object.
288
+ */
289
+ P.value = function(){
290
+ if(0===arguments.length){
291
+ return this.e.taEditor.value;
292
+ }else{
293
+ this.e.taEditor.value = arguments[0];
294
+ return this;
295
+ }
296
+ };
251297
252298
/**
253299
Toggles between single- and multi-line comment
254300
mode.
255301
*/
@@ -344,11 +390,11 @@
344390
filename:file,
345391
checkin:rev
346392
},
347393
onload:(r)=>{
348394
F.message('Loaded content.');
349
- self.e.taEditor.value = r;
395
+ self.value(r);
350396
self.updateVersion(file,rev);
351397
self.tabs.switchToTab(self.e.tabs.content);
352398
}
353399
});
354400
return this;
@@ -372,11 +418,11 @@
372418
const updateView = function(c){
373419
D.clearElement(f.target);
374420
if('string'===typeof c) f.target.innerHTML = c;
375421
if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
376422
};
377
- return this._postPreview(this.e.taEditor.value, updateView);
423
+ return this._postPreview(this.value(), updateView);
378424
};
379425
380426
/**
381427
Callback for use with F.connectPagePreviewers()
382428
*/
@@ -416,11 +462,11 @@
416462
417463
Returns this object, noting that the operation is async.
418464
*/
419465
P.diff = function f(sbs){
420466
if(!affirmHasFile()) return this;
421
- const content = this.e.taEditor.value,
467
+ const content = this.value(),
422468
self = this;
423469
if(!f.target){
424470
f.target = this.e.tabs.diff.querySelector(
425471
'#fileedit-tab-diff-wrapper'
426472
);
@@ -456,11 +502,11 @@
456502
Returns this object.
457503
*/
458504
P.commit = function f(){
459505
if(!affirmHasFile()) return this;
460506
const self = this;
461
- const content = this.e.taEditor.value,
507
+ const content = this.value(),
462508
target = document.querySelector('#fileedit-manifest'),
463509
cbDryRun = E('[name=dry_run]'),
464510
isDryRun = cbDryRun.checked,
465511
filename = this.finfo.filename;
466512
if(!f.updateView){
@@ -480,11 +526,12 @@
480526
];
481527
if(!c.dryRun){
482528
msg.push('Re-activating dry-run mode.');
483529
self.e.taComment.value = '';
484530
cbDryRun.checked = true;
485
- P.updateVersion(filename, c.uuid);
531
+ self.updateVersion(filename, c.uuid);
532
+ self.fileSelector.loadLeaves();
486533
}
487534
F.message.apply(fossil, msg);
488535
self.tabs.switchToTab(self.e.tabs.commit);
489536
};
490537
}
491538
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -7,11 +7,11 @@
7 const E = (s)=>document.querySelector(s),
8 D = F.dom,
9 P = F.page;
10
11 /**
12 Manager object for the checkin/file selection list.
13 */
14 P.fileSelector = {
15 e:{
16 container: E('#fileedit-file-selector')
17 },
@@ -18,12 +18,20 @@
18 finfo: {},
19 cache: {
20 checkins: undefined,
21 files:{}
22 },
 
 
 
 
23 loadLeaves: function(){
24 D.append(D.clearElement(this.e.ciListLabel),"Loading leaves...");
 
 
 
 
25 D.disable(this.e.btnLoadFile, this.e.selectFiles, this.e.selectCi);
26 const self = this;
27 F.fetch('fileedit',{
28 urlParams:'ajax=filelist&leaves',
29 responseType: 'json',
@@ -40,10 +48,16 @@
40 });
41 self.loadFiles(loadThisOne ? loadThisOne.checkin : false);
42 }
43 });
44 },
 
 
 
 
 
 
45 loadFiles: function(ciUuid){
46 delete this.finfo.filename;
47 this.finfo.checkin = ciUuid;
48 const selFiles = this.e.selectFiles;
49 if(!ciUuid){
@@ -79,20 +93,31 @@
79 responseType: 'json',
80 onload
81 });
82 return this;
83 },
 
 
 
 
84 init: function(){
85 const selCi = this.e.selectCi = D.select(),
86 selFiles = this.e.selectFiles
87 = D.addClass(D.select(), 'file-list'),
88 btnLoad = this.e.btnLoadFile =
89 D.addClass(D.button("Load file"), "flex-shrink"),
90 filesLabel = this.e.fileListLabel =
91 D.addClass(D.div(),'flex-shrink','file-list-label'),
 
 
 
 
 
 
 
92 ciLabel = this.e.ciListLabel =
93 D.addClass(D.div(),'flex-shrink','checkin-list-label')
94 ;
95 D.attr(selCi, 'title',"The list of opened leaves.");
96 D.attr(selFiles, 'title',
97 "The list of editable files for the selected checkin.");
98 D.attr(btnLoad, 'title',
@@ -99,17 +124,17 @@
99 "Load the selected file into the editor.");
100 D.disable(selCi, selFiles, btnLoad);
101 D.attr(selFiles, 'size', 10);
102 D.append(
103 this.e.container,
104 ciLabel,
 
105 selCi,
106 filesLabel,
107 selFiles,
108 btnLoad
109 );
110
111 this.loadLeaves();
112 selCi.addEventListener(
113 'change', (e)=>this.loadFiles(e.target.value), false
114 );
115 btnLoad.addEventListener(
@@ -118,10 +143,13 @@
118 if(this.finfo.filename){
119 P.loadFile(this.finfo.filename, this.finfo.checkin);
120 }
121 }, false
122 );
 
 
 
123 delete this.init;
124 }
125 };
126
127 window.addEventListener("load", function() {
@@ -246,10 +274,28 @@
246 // Force UI update
247 new Event('change',{target:selectFontSize})
248 );
249 }
250 }, false)/*onload event handler*/;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
251
252 /**
253 Toggles between single- and multi-line comment
254 mode.
255 */
@@ -344,11 +390,11 @@
344 filename:file,
345 checkin:rev
346 },
347 onload:(r)=>{
348 F.message('Loaded content.');
349 self.e.taEditor.value = r;
350 self.updateVersion(file,rev);
351 self.tabs.switchToTab(self.e.tabs.content);
352 }
353 });
354 return this;
@@ -372,11 +418,11 @@
372 const updateView = function(c){
373 D.clearElement(f.target);
374 if('string'===typeof c) f.target.innerHTML = c;
375 if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
376 };
377 return this._postPreview(this.e.taEditor.value, updateView);
378 };
379
380 /**
381 Callback for use with F.connectPagePreviewers()
382 */
@@ -416,11 +462,11 @@
416
417 Returns this object, noting that the operation is async.
418 */
419 P.diff = function f(sbs){
420 if(!affirmHasFile()) return this;
421 const content = this.e.taEditor.value,
422 self = this;
423 if(!f.target){
424 f.target = this.e.tabs.diff.querySelector(
425 '#fileedit-tab-diff-wrapper'
426 );
@@ -456,11 +502,11 @@
456 Returns this object.
457 */
458 P.commit = function f(){
459 if(!affirmHasFile()) return this;
460 const self = this;
461 const content = this.e.taEditor.value,
462 target = document.querySelector('#fileedit-manifest'),
463 cbDryRun = E('[name=dry_run]'),
464 isDryRun = cbDryRun.checked,
465 filename = this.finfo.filename;
466 if(!f.updateView){
@@ -480,11 +526,12 @@
480 ];
481 if(!c.dryRun){
482 msg.push('Re-activating dry-run mode.');
483 self.e.taComment.value = '';
484 cbDryRun.checked = true;
485 P.updateVersion(filename, c.uuid);
 
486 }
487 F.message.apply(fossil, msg);
488 self.tabs.switchToTab(self.e.tabs.commit);
489 };
490 }
491
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -7,11 +7,11 @@
7 const E = (s)=>document.querySelector(s),
8 D = F.dom,
9 P = F.page;
10
11 /**
12 Widget for the checkin/file selection list.
13 */
14 P.fileSelector = {
15 e:{
16 container: E('#fileedit-file-selector')
17 },
@@ -18,12 +18,20 @@
18 finfo: {},
19 cache: {
20 checkins: undefined,
21 files:{}
22 },
23 /**
24 Fetches the list of leaf checkins from the server and updates
25 the UI with that list.
26 */
27 loadLeaves: function(){
28 D.append(D.clearElement(
29 this.e.ciListLabel,
30 this.e.selectCi,
31 this.e.selectFiles
32 ),"Loading leaves...");
33 D.disable(this.e.btnLoadFile, this.e.selectFiles, this.e.selectCi);
34 const self = this;
35 F.fetch('fileedit',{
36 urlParams:'ajax=filelist&leaves',
37 responseType: 'json',
@@ -40,10 +48,16 @@
48 });
49 self.loadFiles(loadThisOne ? loadThisOne.checkin : false);
50 }
51 });
52 },
53 /**
54 Loads the file list for the given checkin UUID. It uses a
55 cached copy on subsequent calls for the same UUID. If passed a
56 falsy value, it instead clears and disables the file selection
57 list.
58 */
59 loadFiles: function(ciUuid){
60 delete this.finfo.filename;
61 this.finfo.checkin = ciUuid;
62 const selFiles = this.e.selectFiles;
63 if(!ciUuid){
@@ -79,20 +93,31 @@
93 responseType: 'json',
94 onload
95 });
96 return this;
97 },
98 /**
99 Initializes the checkin/file selector widget. Must only be
100 called once.
101 */
102 init: function(){
103 const selCi = this.e.selectCi = D.select(),
104 selFiles = this.e.selectFiles
105 = D.addClass(D.select(), 'file-list'),
106 btnLoad = this.e.btnLoadFile =
107 D.addClass(D.button("Load file"), "flex-shrink"),
108 filesLabel = this.e.fileListLabel =
109 D.addClass(D.div(),'flex-shrink','file-list-label'),
110 ciLabelWrapper = D.addClass(
111 D.div(), 'flex-container','flex-row', 'flex-shrink',
112 'stretch'
113 ),
114 btnReload = D.addClass(
115 D.button('Reload'), 'flex-shrink'
116 ),
117 ciLabel = this.e.ciListLabel =
118 D.addClass(D.span(),'flex-shrink','checkin-list-label')
119 ;
120 D.attr(selCi, 'title',"The list of opened leaves.");
121 D.attr(selFiles, 'title',
122 "The list of editable files for the selected checkin.");
123 D.attr(btnLoad, 'title',
@@ -99,17 +124,17 @@
124 "Load the selected file into the editor.");
125 D.disable(selCi, selFiles, btnLoad);
126 D.attr(selFiles, 'size', 10);
127 D.append(
128 this.e.container,
129 D.append(ciLabelWrapper,
130 btnReload, ciLabel),
131 selCi,
132 filesLabel,
133 selFiles,
134 btnLoad
135 );
 
136 this.loadLeaves();
137 selCi.addEventListener(
138 'change', (e)=>this.loadFiles(e.target.value), false
139 );
140 btnLoad.addEventListener(
@@ -118,10 +143,13 @@
143 if(this.finfo.filename){
144 P.loadFile(this.finfo.filename, this.finfo.checkin);
145 }
146 }, false
147 );
148 btnReload.addEventListener(
149 'click', (e)=>this.loadLeaves(), false
150 );
151 delete this.init;
152 }
153 };
154
155 window.addEventListener("load", function() {
@@ -246,10 +274,28 @@
274 // Force UI update
275 new Event('change',{target:selectFontSize})
276 );
277 }
278 }, false)/*onload event handler*/;
279
280 /**
281 Getter (if called with no args) or setter (if passed an arg) for
282 the current file content. We use a function, rather than direct
283 access so that clients can hypothetically swap out this method
284 from their skin in order to facilitate plugging-in of fancy
285 3rd-party editor widgets.
286
287 The setter form returns this object.
288 */
289 P.value = function(){
290 if(0===arguments.length){
291 return this.e.taEditor.value;
292 }else{
293 this.e.taEditor.value = arguments[0];
294 return this;
295 }
296 };
297
298 /**
299 Toggles between single- and multi-line comment
300 mode.
301 */
@@ -344,11 +390,11 @@
390 filename:file,
391 checkin:rev
392 },
393 onload:(r)=>{
394 F.message('Loaded content.');
395 self.value(r);
396 self.updateVersion(file,rev);
397 self.tabs.switchToTab(self.e.tabs.content);
398 }
399 });
400 return this;
@@ -372,11 +418,11 @@
418 const updateView = function(c){
419 D.clearElement(f.target);
420 if('string'===typeof c) f.target.innerHTML = c;
421 if(switchToTab) self.tabs.switchToTab(self.e.tabs.preview);
422 };
423 return this._postPreview(this.value(), updateView);
424 };
425
426 /**
427 Callback for use with F.connectPagePreviewers()
428 */
@@ -416,11 +462,11 @@
462
463 Returns this object, noting that the operation is async.
464 */
465 P.diff = function f(sbs){
466 if(!affirmHasFile()) return this;
467 const content = this.value(),
468 self = this;
469 if(!f.target){
470 f.target = this.e.tabs.diff.querySelector(
471 '#fileedit-tab-diff-wrapper'
472 );
@@ -456,11 +502,11 @@
502 Returns this object.
503 */
504 P.commit = function f(){
505 if(!affirmHasFile()) return this;
506 const self = this;
507 const content = this.value(),
508 target = document.querySelector('#fileedit-manifest'),
509 cbDryRun = E('[name=dry_run]'),
510 isDryRun = cbDryRun.checked,
511 filename = this.finfo.filename;
512 if(!f.updateView){
@@ -480,11 +526,12 @@
526 ];
527 if(!c.dryRun){
528 msg.push('Re-activating dry-run mode.');
529 self.e.taComment.value = '';
530 cbDryRun.checked = true;
531 self.updateVersion(filename, c.uuid);
532 self.fileSelector.loadLeaves();
533 }
534 F.message.apply(fossil, msg);
535 self.tabs.switchToTab(self.e.tabs.commit);
536 };
537 }
538

Keyboard Shortcuts

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