Fossil SCM

Moved the hard-coded edit state markers to fossil.page.config so that skins can change them.

stephan 2020-07-31 01:31 ajax-wiki-editor
Commit 4c1a2dd4e1f78c843b8b5c436e2da2a1ca1083be8ac09f03fcb0c02298999bfa
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -64,11 +64,19 @@
6464
*/
6565
const E = (s)=>document.querySelector(s),
6666
D = F.dom,
6767
P = F.page;
6868
69
- P.config = {};
69
+ P.config = {
70
+ /* Symbolic markers to denote certain edit state. Note that
71
+ the symbols themselves are *actually* defined in CSS, so if
72
+ they're changed there they also need to be changed here.*/
73
+ editStateMarkers: {
74
+ isNew: '[+]',
75
+ isModified: '[*]'
76
+ }
77
+ };
7078
7179
/**
7280
$stash is an internal-use-only object for managing "stashed"
7381
local edits, to help avoid that users accidentally lose content
7482
by switching tabs or following links or some such. The basic
@@ -400,12 +408,14 @@
400408
fsLegendBody = D.div();
401409
D.append(fsLegend, fsLegendBody);
402410
D.addClass(fsLegendBody, 'flex-container', 'flex-column', 'stretch');
403411
D.append(
404412
fsLegendBody,
405
- D.append(D.span(), "[*] = page has local edits"),
406
- D.append(D.span(), "[+] = page is new/unsaved")
413
+ D.append(D.span(), P.config.editStateMarkers.isModified,
414
+ " = page has local edits"),
415
+ D.append(D.span(), P.config.editStateMarkers.isNew,
416
+ " = page is new/unsaved")
407417
);
408418
409419
D.append(
410420
parentElem,
411421
D.append(D.addClass(D.div(), 'fieldset-wrapper'),
@@ -686,12 +696,12 @@
686696
f.titleElement = document.head.querySelector('title');
687697
f.pageTitleHeader = document.querySelector('div.header .title');
688698
}
689699
var title = ['Wiki Editor:'];
690700
if(P.winfo){
691
- if(!P.winfo.version) title.push('[+]');
692
- else if($stash.getWinfo(P.winfo)) title.push('[*]')
701
+ if(!P.winfo.version) title.push(P.config.editStateMarkers.isNew);
702
+ else if($stash.getWinfo(P.winfo)) title.push(P.config.editStateMarkers.isModified)
693703
title.push(P.winfo.name);
694704
}else{
695705
title.push('(no page loaded)');
696706
}
697707
title = title.join(' ');
698708
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -64,11 +64,19 @@
64 */
65 const E = (s)=>document.querySelector(s),
66 D = F.dom,
67 P = F.page;
68
69 P.config = {};
 
 
 
 
 
 
 
 
70
71 /**
72 $stash is an internal-use-only object for managing "stashed"
73 local edits, to help avoid that users accidentally lose content
74 by switching tabs or following links or some such. The basic
@@ -400,12 +408,14 @@
400 fsLegendBody = D.div();
401 D.append(fsLegend, fsLegendBody);
402 D.addClass(fsLegendBody, 'flex-container', 'flex-column', 'stretch');
403 D.append(
404 fsLegendBody,
405 D.append(D.span(), "[*] = page has local edits"),
406 D.append(D.span(), "[+] = page is new/unsaved")
 
 
407 );
408
409 D.append(
410 parentElem,
411 D.append(D.addClass(D.div(), 'fieldset-wrapper'),
@@ -686,12 +696,12 @@
686 f.titleElement = document.head.querySelector('title');
687 f.pageTitleHeader = document.querySelector('div.header .title');
688 }
689 var title = ['Wiki Editor:'];
690 if(P.winfo){
691 if(!P.winfo.version) title.push('[+]');
692 else if($stash.getWinfo(P.winfo)) title.push('[*]')
693 title.push(P.winfo.name);
694 }else{
695 title.push('(no page loaded)');
696 }
697 title = title.join(' ');
698
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -64,11 +64,19 @@
64 */
65 const E = (s)=>document.querySelector(s),
66 D = F.dom,
67 P = F.page;
68
69 P.config = {
70 /* Symbolic markers to denote certain edit state. Note that
71 the symbols themselves are *actually* defined in CSS, so if
72 they're changed there they also need to be changed here.*/
73 editStateMarkers: {
74 isNew: '[+]',
75 isModified: '[*]'
76 }
77 };
78
79 /**
80 $stash is an internal-use-only object for managing "stashed"
81 local edits, to help avoid that users accidentally lose content
82 by switching tabs or following links or some such. The basic
@@ -400,12 +408,14 @@
408 fsLegendBody = D.div();
409 D.append(fsLegend, fsLegendBody);
410 D.addClass(fsLegendBody, 'flex-container', 'flex-column', 'stretch');
411 D.append(
412 fsLegendBody,
413 D.append(D.span(), P.config.editStateMarkers.isModified,
414 " = page has local edits"),
415 D.append(D.span(), P.config.editStateMarkers.isNew,
416 " = page is new/unsaved")
417 );
418
419 D.append(
420 parentElem,
421 D.append(D.addClass(D.div(), 'fieldset-wrapper'),
@@ -686,12 +696,12 @@
696 f.titleElement = document.head.querySelector('title');
697 f.pageTitleHeader = document.querySelector('div.header .title');
698 }
699 var title = ['Wiki Editor:'];
700 if(P.winfo){
701 if(!P.winfo.version) title.push(P.config.editStateMarkers.isNew);
702 else if($stash.getWinfo(P.winfo)) title.push(P.config.editStateMarkers.isModified)
703 title.push(P.winfo.name);
704 }else{
705 title.push('(no page loaded)');
706 }
707 title = title.join(' ');
708
--- src/style.wikiedit.css
+++ src/style.wikiedit.css
@@ -56,12 +56,11 @@
5656
margin: 0.5em 0;
5757
}
5858
body.wikiedit .wikiedit-page-list-wrapper select option.stashed::before {
5959
/* Maintenance reminder: the option.stashed/stashed-new "content" values
6060
are duplicated in fossil.page.wikiedit.js and need to be changed there
61
- if they are changed here. i.e. they're not "really" customizable
62
- by client code. */
61
+ if they are changed here: see fossil.page.config.editStateMarkers */
6362
content: "[*] ";
6463
}
6564
body.wikiedit .wikiedit-page-list-wrapper select option.stashed-new::before {
6665
content: "[+] ";
6766
}
6867
--- src/style.wikiedit.css
+++ src/style.wikiedit.css
@@ -56,12 +56,11 @@
56 margin: 0.5em 0;
57 }
58 body.wikiedit .wikiedit-page-list-wrapper select option.stashed::before {
59 /* Maintenance reminder: the option.stashed/stashed-new "content" values
60 are duplicated in fossil.page.wikiedit.js and need to be changed there
61 if they are changed here. i.e. they're not "really" customizable
62 by client code. */
63 content: "[*] ";
64 }
65 body.wikiedit .wikiedit-page-list-wrapper select option.stashed-new::before {
66 content: "[+] ";
67 }
68
--- src/style.wikiedit.css
+++ src/style.wikiedit.css
@@ -56,12 +56,11 @@
56 margin: 0.5em 0;
57 }
58 body.wikiedit .wikiedit-page-list-wrapper select option.stashed::before {
59 /* Maintenance reminder: the option.stashed/stashed-new "content" values
60 are duplicated in fossil.page.wikiedit.js and need to be changed there
61 if they are changed here: see fossil.page.config.editStateMarkers */
 
62 content: "[*] ";
63 }
64 body.wikiedit .wikiedit-page-list-wrapper select option.stashed-new::before {
65 content: "[+] ";
66 }
67

Keyboard Shortcuts

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