Fossil SCM

Add option to disable the shift-enter preview hotkey in /wikiedit, /fileedit, and /chat as a workaround for software keyboards which report the shift key being pressed when auto-capitalizing text, per discussion in [forum:dbd5b68366147ce8|forum post dbd5b68366147ce8].

stephan 2023-12-22 14:32 trunk merge
Commit 4bb5515caefa6826fa2f0d54b5d6f5f22dba097323295427175b6d059fceeed8
+4 -2
--- src/fileedit.c
+++ src/fileedit.c
@@ -1698,19 +1698,20 @@
16981698
"class='hidden'"
16991699
">");
17001700
CX("<div id='fileedit-file-selector'></div>");
17011701
CX("</div>"/*#fileedit-tab-fileselect*/);
17021702
}
1703
-
1703
+
17041704
/******* Content tab *******/
17051705
{
17061706
CX("<div id='fileedit-tab-content' "
17071707
"data-tab-parent='fileedit-tabs' "
17081708
"data-tab-label='File Content' "
17091709
"class='hidden'"
17101710
">");
1711
- CX("<div class='flex-container flex-row child-gap-small'>");
1711
+ CX("<div class='fileedit-options flex-container "
1712
+ "flex-row child-gap-small'>");
17121713
CX("<div class='input-with-label'>"
17131714
"<button class='fileedit-content-reload confirmer' "
17141715
">Discard &amp; Reload</button>"
17151716
"<div class='help-buttonlet'>"
17161717
"Reload the file from the server, discarding "
@@ -1724,10 +1725,11 @@
17241725
NULL/*tooltip*/,
17251726
100,
17261727
"100%", 100, "125%", 125,
17271728
"150%", 150, "175%", 175,
17281729
"200%", 200, NULL);
1730
+ wikiedit_emit_toggle_preview();
17291731
CX("</div>");
17301732
CX("<div class='flex-container flex-column stretch'>");
17311733
CX("<textarea name='content' id='fileedit-content-editor' "
17321734
"class='fileedit' rows='25'>");
17331735
CX("</textarea>");
17341736
--- src/fileedit.c
+++ src/fileedit.c
@@ -1698,19 +1698,20 @@
1698 "class='hidden'"
1699 ">");
1700 CX("<div id='fileedit-file-selector'></div>");
1701 CX("</div>"/*#fileedit-tab-fileselect*/);
1702 }
1703
1704 /******* Content tab *******/
1705 {
1706 CX("<div id='fileedit-tab-content' "
1707 "data-tab-parent='fileedit-tabs' "
1708 "data-tab-label='File Content' "
1709 "class='hidden'"
1710 ">");
1711 CX("<div class='flex-container flex-row child-gap-small'>");
 
1712 CX("<div class='input-with-label'>"
1713 "<button class='fileedit-content-reload confirmer' "
1714 ">Discard &amp; Reload</button>"
1715 "<div class='help-buttonlet'>"
1716 "Reload the file from the server, discarding "
@@ -1724,10 +1725,11 @@
1724 NULL/*tooltip*/,
1725 100,
1726 "100%", 100, "125%", 125,
1727 "150%", 150, "175%", 175,
1728 "200%", 200, NULL);
 
1729 CX("</div>");
1730 CX("<div class='flex-container flex-column stretch'>");
1731 CX("<textarea name='content' id='fileedit-content-editor' "
1732 "class='fileedit' rows='25'>");
1733 CX("</textarea>");
1734
--- src/fileedit.c
+++ src/fileedit.c
@@ -1698,19 +1698,20 @@
1698 "class='hidden'"
1699 ">");
1700 CX("<div id='fileedit-file-selector'></div>");
1701 CX("</div>"/*#fileedit-tab-fileselect*/);
1702 }
1703
1704 /******* Content tab *******/
1705 {
1706 CX("<div id='fileedit-tab-content' "
1707 "data-tab-parent='fileedit-tabs' "
1708 "data-tab-label='File Content' "
1709 "class='hidden'"
1710 ">");
1711 CX("<div class='fileedit-options flex-container "
1712 "flex-row child-gap-small'>");
1713 CX("<div class='input-with-label'>"
1714 "<button class='fileedit-content-reload confirmer' "
1715 ">Discard &amp; Reload</button>"
1716 "<div class='help-buttonlet'>"
1717 "Reload the file from the server, discarding "
@@ -1724,10 +1725,11 @@
1725 NULL/*tooltip*/,
1726 100,
1727 "100%", 100, "125%", 125,
1728 "150%", 150, "175%", 175,
1729 "200%", 200, NULL);
1730 wikiedit_emit_toggle_preview();
1731 CX("</div>");
1732 CX("<div class='flex-container flex-column stretch'>");
1733 CX("<textarea name='content' id='fileedit-content-editor' "
1734 "class='fileedit' rows='25'>");
1735 CX("</textarea>");
1736
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1,16 +1,17 @@
11
/**
22
This file contains the client-side implementation of fossil's /chat
3
- application.
3
+ application.
44
*/
55
window.fossil.onPageLoad(function(){
66
const F = window.fossil, D = F.dom;
77
const E1 = function(selector){
88
const e = document.querySelector(selector);
99
if(!e) throw new Error("missing required DOM element: "+selector);
1010
return e;
1111
};
12
+
1213
/**
1314
Returns true if e is entirely within the bounds of the window's viewport.
1415
*/
1516
const isEntirelyInViewport = function(e) {
1617
const rect = e.getBoundingClientRect();
@@ -396,10 +397,15 @@
396397
/* When on, the edit field starts as a single line and
397398
expands as the user types, and the relevant buttons are
398399
laid out in a compact form. When off, the edit field and
399400
buttons are larger. */
400401
"edit-compact-mode": true,
402
+ /* See notes for this setting in fossil.page.wikiedit.js.
403
+ Both /wikiedit and /fileedit share this persistent config
404
+ option under the same storage key. */
405
+ "edit-shift-enter-preview":
406
+ F.storage.getBool('edit-shift-enter-preview', true),
401407
/* When on, sets the font-family on messages and the edit
402408
field to monospace. */
403409
"monospace-messages": false,
404410
/* When on, non-chat UI elements (page header/footer) are
405411
hidden */
@@ -1499,11 +1505,11 @@
14991505
switch back to message view. */
15001506
if(Chat.e.currentView===Chat.e.viewPreview && !text){
15011507
Chat.setCurrentView(Chat.e.viewMessages);
15021508
}else if(!text){
15031509
f.$toggleCompact(compactMode);
1504
- }else{
1510
+ }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){
15051511
Chat.e.btnPreview.click();
15061512
}
15071513
return false;
15081514
}
15091515
if(ev.ctrlKey && !text && !BlobXferState.blob){
@@ -1515,11 +1521,11 @@
15151521
}
15161522
if(!ctrlMode && ev.ctrlKey && text){
15171523
//console.debug("!ctrlMode && ev.ctrlKey && text.");
15181524
/* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a
15191525
newline, but that is not happening, for unknown reasons
1520
- (possibly related to this element being a conteneditable DIV
1526
+ (possibly related to this element being a contenteditable DIV
15211527
instead of a textarea). Forcibly appending a newline do the
15221528
input area does not work, also for unknown reasons, and would
15231529
only be suitable when we're at the end of the input.
15241530
15251531
Strangely, this approach DOES work for shift-enter, but we
@@ -1533,11 +1539,11 @@
15331539
ev.preventDefault();
15341540
ev.stopPropagation();
15351541
Chat.submitMessage();
15361542
return false;
15371543
}
1538
- };
1544
+ };
15391545
Chat.e.inputFields.forEach(
15401546
(e)=>e.addEventListener('keydown', inputWidgetKeydown, false)
15411547
);
15421548
Chat.e.btnSubmit.addEventListener('click',(e)=>{
15431549
e.preventDefault();
@@ -1667,10 +1673,17 @@
16671673
"When enabled, chat input uses a so-called 'contenteditable' ",
16681674
"field. Though generally more comfortable and modern than ",
16691675
"plain-text input fields, browser-specific quirks and bugs ",
16701676
"may lead to frustration. Ideal for mobile devices."
16711677
].join('')
1678
+ },{
1679
+ label: "Shift-enter to preview",
1680
+ hint: ["Use shift-enter to preview being-edited messages. ",
1681
+ "This is normally desirable but some software-mode ",
1682
+ "keyboards misinteract with this, in which cases it can be ",
1683
+ "disabled."],
1684
+ boolValue: 'edit-shift-enter-preview'
16721685
}]
16731686
},{
16741687
label: "Appearance Options...",
16751688
children:[{
16761689
label: "Left-align my posts",
16771690
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1,16 +1,17 @@
1 /**
2 This file contains the client-side implementation of fossil's /chat
3 application.
4 */
5 window.fossil.onPageLoad(function(){
6 const F = window.fossil, D = F.dom;
7 const E1 = function(selector){
8 const e = document.querySelector(selector);
9 if(!e) throw new Error("missing required DOM element: "+selector);
10 return e;
11 };
 
12 /**
13 Returns true if e is entirely within the bounds of the window's viewport.
14 */
15 const isEntirelyInViewport = function(e) {
16 const rect = e.getBoundingClientRect();
@@ -396,10 +397,15 @@
396 /* When on, the edit field starts as a single line and
397 expands as the user types, and the relevant buttons are
398 laid out in a compact form. When off, the edit field and
399 buttons are larger. */
400 "edit-compact-mode": true,
 
 
 
 
 
401 /* When on, sets the font-family on messages and the edit
402 field to monospace. */
403 "monospace-messages": false,
404 /* When on, non-chat UI elements (page header/footer) are
405 hidden */
@@ -1499,11 +1505,11 @@
1499 switch back to message view. */
1500 if(Chat.e.currentView===Chat.e.viewPreview && !text){
1501 Chat.setCurrentView(Chat.e.viewMessages);
1502 }else if(!text){
1503 f.$toggleCompact(compactMode);
1504 }else{
1505 Chat.e.btnPreview.click();
1506 }
1507 return false;
1508 }
1509 if(ev.ctrlKey && !text && !BlobXferState.blob){
@@ -1515,11 +1521,11 @@
1515 }
1516 if(!ctrlMode && ev.ctrlKey && text){
1517 //console.debug("!ctrlMode && ev.ctrlKey && text.");
1518 /* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a
1519 newline, but that is not happening, for unknown reasons
1520 (possibly related to this element being a conteneditable DIV
1521 instead of a textarea). Forcibly appending a newline do the
1522 input area does not work, also for unknown reasons, and would
1523 only be suitable when we're at the end of the input.
1524
1525 Strangely, this approach DOES work for shift-enter, but we
@@ -1533,11 +1539,11 @@
1533 ev.preventDefault();
1534 ev.stopPropagation();
1535 Chat.submitMessage();
1536 return false;
1537 }
1538 };
1539 Chat.e.inputFields.forEach(
1540 (e)=>e.addEventListener('keydown', inputWidgetKeydown, false)
1541 );
1542 Chat.e.btnSubmit.addEventListener('click',(e)=>{
1543 e.preventDefault();
@@ -1667,10 +1673,17 @@
1667 "When enabled, chat input uses a so-called 'contenteditable' ",
1668 "field. Though generally more comfortable and modern than ",
1669 "plain-text input fields, browser-specific quirks and bugs ",
1670 "may lead to frustration. Ideal for mobile devices."
1671 ].join('')
 
 
 
 
 
 
 
1672 }]
1673 },{
1674 label: "Appearance Options...",
1675 children:[{
1676 label: "Left-align my posts",
1677
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1,16 +1,17 @@
1 /**
2 This file contains the client-side implementation of fossil's /chat
3 application.
4 */
5 window.fossil.onPageLoad(function(){
6 const F = window.fossil, D = F.dom;
7 const E1 = function(selector){
8 const e = document.querySelector(selector);
9 if(!e) throw new Error("missing required DOM element: "+selector);
10 return e;
11 };
12
13 /**
14 Returns true if e is entirely within the bounds of the window's viewport.
15 */
16 const isEntirelyInViewport = function(e) {
17 const rect = e.getBoundingClientRect();
@@ -396,10 +397,15 @@
397 /* When on, the edit field starts as a single line and
398 expands as the user types, and the relevant buttons are
399 laid out in a compact form. When off, the edit field and
400 buttons are larger. */
401 "edit-compact-mode": true,
402 /* See notes for this setting in fossil.page.wikiedit.js.
403 Both /wikiedit and /fileedit share this persistent config
404 option under the same storage key. */
405 "edit-shift-enter-preview":
406 F.storage.getBool('edit-shift-enter-preview', true),
407 /* When on, sets the font-family on messages and the edit
408 field to monospace. */
409 "monospace-messages": false,
410 /* When on, non-chat UI elements (page header/footer) are
411 hidden */
@@ -1499,11 +1505,11 @@
1505 switch back to message view. */
1506 if(Chat.e.currentView===Chat.e.viewPreview && !text){
1507 Chat.setCurrentView(Chat.e.viewMessages);
1508 }else if(!text){
1509 f.$toggleCompact(compactMode);
1510 }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){
1511 Chat.e.btnPreview.click();
1512 }
1513 return false;
1514 }
1515 if(ev.ctrlKey && !text && !BlobXferState.blob){
@@ -1515,11 +1521,11 @@
1521 }
1522 if(!ctrlMode && ev.ctrlKey && text){
1523 //console.debug("!ctrlMode && ev.ctrlKey && text.");
1524 /* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a
1525 newline, but that is not happening, for unknown reasons
1526 (possibly related to this element being a contenteditable DIV
1527 instead of a textarea). Forcibly appending a newline do the
1528 input area does not work, also for unknown reasons, and would
1529 only be suitable when we're at the end of the input.
1530
1531 Strangely, this approach DOES work for shift-enter, but we
@@ -1533,11 +1539,11 @@
1539 ev.preventDefault();
1540 ev.stopPropagation();
1541 Chat.submitMessage();
1542 return false;
1543 }
1544 };
1545 Chat.e.inputFields.forEach(
1546 (e)=>e.addEventListener('keydown', inputWidgetKeydown, false)
1547 );
1548 Chat.e.btnSubmit.addEventListener('click',(e)=>{
1549 e.preventDefault();
@@ -1667,10 +1673,17 @@
1673 "When enabled, chat input uses a so-called 'contenteditable' ",
1674 "field. Though generally more comfortable and modern than ",
1675 "plain-text input fields, browser-specific quirks and bugs ",
1676 "may lead to frustration. Ideal for mobile devices."
1677 ].join('')
1678 },{
1679 label: "Shift-enter to preview",
1680 hint: ["Use shift-enter to preview being-edited messages. ",
1681 "This is normally desirable but some software-mode ",
1682 "keyboards misinteract with this, in which cases it can be ",
1683 "disabled."],
1684 boolValue: 'edit-shift-enter-preview'
1685 }]
1686 },{
1687 label: "Appearance Options...",
1688 children:[{
1689 label: "Left-align my posts",
1690
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1,16 +1,17 @@
11
/**
22
This file contains the client-side implementation of fossil's /chat
3
- application.
3
+ application.
44
*/
55
window.fossil.onPageLoad(function(){
66
const F = window.fossil, D = F.dom;
77
const E1 = function(selector){
88
const e = document.querySelector(selector);
99
if(!e) throw new Error("missing required DOM element: "+selector);
1010
return e;
1111
};
12
+
1213
/**
1314
Returns true if e is entirely within the bounds of the window's viewport.
1415
*/
1516
const isEntirelyInViewport = function(e) {
1617
const rect = e.getBoundingClientRect();
@@ -396,10 +397,15 @@
396397
/* When on, the edit field starts as a single line and
397398
expands as the user types, and the relevant buttons are
398399
laid out in a compact form. When off, the edit field and
399400
buttons are larger. */
400401
"edit-compact-mode": true,
402
+ /* See notes for this setting in fossil.page.wikiedit.js.
403
+ Both /wikiedit and /fileedit share this persistent config
404
+ option under the same storage key. */
405
+ "edit-shift-enter-preview":
406
+ F.storage.getBool('edit-shift-enter-preview', true),
401407
/* When on, sets the font-family on messages and the edit
402408
field to monospace. */
403409
"monospace-messages": false,
404410
/* When on, non-chat UI elements (page header/footer) are
405411
hidden */
@@ -1499,11 +1505,11 @@
14991505
switch back to message view. */
15001506
if(Chat.e.currentView===Chat.e.viewPreview && !text){
15011507
Chat.setCurrentView(Chat.e.viewMessages);
15021508
}else if(!text){
15031509
f.$toggleCompact(compactMode);
1504
- }else{
1510
+ }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){
15051511
Chat.e.btnPreview.click();
15061512
}
15071513
return false;
15081514
}
15091515
if(ev.ctrlKey && !text && !BlobXferState.blob){
@@ -1515,11 +1521,11 @@
15151521
}
15161522
if(!ctrlMode && ev.ctrlKey && text){
15171523
//console.debug("!ctrlMode && ev.ctrlKey && text.");
15181524
/* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a
15191525
newline, but that is not happening, for unknown reasons
1520
- (possibly related to this element being a conteneditable DIV
1526
+ (possibly related to this element being a contenteditable DIV
15211527
instead of a textarea). Forcibly appending a newline do the
15221528
input area does not work, also for unknown reasons, and would
15231529
only be suitable when we're at the end of the input.
15241530
15251531
Strangely, this approach DOES work for shift-enter, but we
@@ -1533,11 +1539,11 @@
15331539
ev.preventDefault();
15341540
ev.stopPropagation();
15351541
Chat.submitMessage();
15361542
return false;
15371543
}
1538
- };
1544
+ };
15391545
Chat.e.inputFields.forEach(
15401546
(e)=>e.addEventListener('keydown', inputWidgetKeydown, false)
15411547
);
15421548
Chat.e.btnSubmit.addEventListener('click',(e)=>{
15431549
e.preventDefault();
@@ -1667,10 +1673,17 @@
16671673
"When enabled, chat input uses a so-called 'contenteditable' ",
16681674
"field. Though generally more comfortable and modern than ",
16691675
"plain-text input fields, browser-specific quirks and bugs ",
16701676
"may lead to frustration. Ideal for mobile devices."
16711677
].join('')
1678
+ },{
1679
+ label: "Shift-enter to preview",
1680
+ hint: ["Use shift-enter to preview being-edited messages. ",
1681
+ "This is normally desirable but some software-mode ",
1682
+ "keyboards misinteract with this, in which cases it can be ",
1683
+ "disabled."],
1684
+ boolValue: 'edit-shift-enter-preview'
16721685
}]
16731686
},{
16741687
label: "Appearance Options...",
16751688
children:[{
16761689
label: "Left-align my posts",
16771690
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1,16 +1,17 @@
1 /**
2 This file contains the client-side implementation of fossil's /chat
3 application.
4 */
5 window.fossil.onPageLoad(function(){
6 const F = window.fossil, D = F.dom;
7 const E1 = function(selector){
8 const e = document.querySelector(selector);
9 if(!e) throw new Error("missing required DOM element: "+selector);
10 return e;
11 };
 
12 /**
13 Returns true if e is entirely within the bounds of the window's viewport.
14 */
15 const isEntirelyInViewport = function(e) {
16 const rect = e.getBoundingClientRect();
@@ -396,10 +397,15 @@
396 /* When on, the edit field starts as a single line and
397 expands as the user types, and the relevant buttons are
398 laid out in a compact form. When off, the edit field and
399 buttons are larger. */
400 "edit-compact-mode": true,
 
 
 
 
 
401 /* When on, sets the font-family on messages and the edit
402 field to monospace. */
403 "monospace-messages": false,
404 /* When on, non-chat UI elements (page header/footer) are
405 hidden */
@@ -1499,11 +1505,11 @@
1499 switch back to message view. */
1500 if(Chat.e.currentView===Chat.e.viewPreview && !text){
1501 Chat.setCurrentView(Chat.e.viewMessages);
1502 }else if(!text){
1503 f.$toggleCompact(compactMode);
1504 }else{
1505 Chat.e.btnPreview.click();
1506 }
1507 return false;
1508 }
1509 if(ev.ctrlKey && !text && !BlobXferState.blob){
@@ -1515,11 +1521,11 @@
1515 }
1516 if(!ctrlMode && ev.ctrlKey && text){
1517 //console.debug("!ctrlMode && ev.ctrlKey && text.");
1518 /* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a
1519 newline, but that is not happening, for unknown reasons
1520 (possibly related to this element being a conteneditable DIV
1521 instead of a textarea). Forcibly appending a newline do the
1522 input area does not work, also for unknown reasons, and would
1523 only be suitable when we're at the end of the input.
1524
1525 Strangely, this approach DOES work for shift-enter, but we
@@ -1533,11 +1539,11 @@
1533 ev.preventDefault();
1534 ev.stopPropagation();
1535 Chat.submitMessage();
1536 return false;
1537 }
1538 };
1539 Chat.e.inputFields.forEach(
1540 (e)=>e.addEventListener('keydown', inputWidgetKeydown, false)
1541 );
1542 Chat.e.btnSubmit.addEventListener('click',(e)=>{
1543 e.preventDefault();
@@ -1667,10 +1673,17 @@
1667 "When enabled, chat input uses a so-called 'contenteditable' ",
1668 "field. Though generally more comfortable and modern than ",
1669 "plain-text input fields, browser-specific quirks and bugs ",
1670 "may lead to frustration. Ideal for mobile devices."
1671 ].join('')
 
 
 
 
 
 
 
1672 }]
1673 },{
1674 label: "Appearance Options...",
1675 children:[{
1676 label: "Left-align my posts",
1677
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1,16 +1,17 @@
1 /**
2 This file contains the client-side implementation of fossil's /chat
3 application.
4 */
5 window.fossil.onPageLoad(function(){
6 const F = window.fossil, D = F.dom;
7 const E1 = function(selector){
8 const e = document.querySelector(selector);
9 if(!e) throw new Error("missing required DOM element: "+selector);
10 return e;
11 };
12
13 /**
14 Returns true if e is entirely within the bounds of the window's viewport.
15 */
16 const isEntirelyInViewport = function(e) {
17 const rect = e.getBoundingClientRect();
@@ -396,10 +397,15 @@
397 /* When on, the edit field starts as a single line and
398 expands as the user types, and the relevant buttons are
399 laid out in a compact form. When off, the edit field and
400 buttons are larger. */
401 "edit-compact-mode": true,
402 /* See notes for this setting in fossil.page.wikiedit.js.
403 Both /wikiedit and /fileedit share this persistent config
404 option under the same storage key. */
405 "edit-shift-enter-preview":
406 F.storage.getBool('edit-shift-enter-preview', true),
407 /* When on, sets the font-family on messages and the edit
408 field to monospace. */
409 "monospace-messages": false,
410 /* When on, non-chat UI elements (page header/footer) are
411 hidden */
@@ -1499,11 +1505,11 @@
1505 switch back to message view. */
1506 if(Chat.e.currentView===Chat.e.viewPreview && !text){
1507 Chat.setCurrentView(Chat.e.viewMessages);
1508 }else if(!text){
1509 f.$toggleCompact(compactMode);
1510 }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){
1511 Chat.e.btnPreview.click();
1512 }
1513 return false;
1514 }
1515 if(ev.ctrlKey && !text && !BlobXferState.blob){
@@ -1515,11 +1521,11 @@
1521 }
1522 if(!ctrlMode && ev.ctrlKey && text){
1523 //console.debug("!ctrlMode && ev.ctrlKey && text.");
1524 /* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a
1525 newline, but that is not happening, for unknown reasons
1526 (possibly related to this element being a contenteditable DIV
1527 instead of a textarea). Forcibly appending a newline do the
1528 input area does not work, also for unknown reasons, and would
1529 only be suitable when we're at the end of the input.
1530
1531 Strangely, this approach DOES work for shift-enter, but we
@@ -1533,11 +1539,11 @@
1539 ev.preventDefault();
1540 ev.stopPropagation();
1541 Chat.submitMessage();
1542 return false;
1543 }
1544 };
1545 Chat.e.inputFields.forEach(
1546 (e)=>e.addEventListener('keydown', inputWidgetKeydown, false)
1547 );
1548 Chat.e.btnSubmit.addEventListener('click',(e)=>{
1549 e.preventDefault();
@@ -1667,10 +1673,17 @@
1673 "When enabled, chat input uses a so-called 'contenteditable' ",
1674 "field. Though generally more comfortable and modern than ",
1675 "plain-text input fields, browser-specific quirks and bugs ",
1676 "may lead to frustration. Ideal for mobile devices."
1677 ].join('')
1678 },{
1679 label: "Shift-enter to preview",
1680 hint: ["Use shift-enter to preview being-edited messages. ",
1681 "This is normally desirable but some software-mode ",
1682 "keyboards misinteract with this, in which cases it can be ",
1683 "disabled."],
1684 boolValue: 'edit-shift-enter-preview'
1685 }]
1686 },{
1687 label: "Appearance Options...",
1688 children:[{
1689 label: "Left-align my posts",
1690
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -70,11 +70,17 @@
7070
const E = (s)=>document.querySelector(s),
7171
D = F.dom,
7272
P = F.page;
7373
7474
P.config = {
75
- defaultMaxStashSize: 7
75
+ defaultMaxStashSize: 7,
76
+ /**
77
+ See notes for this setting in fossil.page.wikiedit.js. Both
78
+ /wikiedit and /fileedit share this persistent config option
79
+ under the same storage key.
80
+ */
81
+ shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
7682
};
7783
7884
/**
7985
$stash is an internal-use-only object for managing "stashed"
8086
local edits, to help avoid that users accidentally lose content
@@ -724,11 +730,11 @@
724730
);
725731
////////////////////////////////////////////////////////////
726732
// Trigger preview on Ctrl-Enter. This only works on the built-in
727733
// editor widget, not a client-provided one.
728734
P.e.taEditor.addEventListener('keydown',function(ev){
729
- if(ev.shiftKey && 13 === ev.keyCode){
735
+ if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
730736
ev.preventDefault();
731737
ev.stopPropagation();
732738
P.e.taEditor.blur(/*force change event, if needed*/);
733739
P.tabs.switchToTab(P.e.tabs.preview);
734740
if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
@@ -845,10 +851,17 @@
845851
846852
P.fileSelectWidget.init();
847853
P.stashWidget.init(
848854
P.e.tabs.content.lastElementChild
849855
);
856
+
857
+ const cbEditPreview = E('#edit-shift-enter-preview');
858
+ cbEditPreview.addEventListener('change', function(e){
859
+ F.storage.set('edit-shift-enter-preview',
860
+ P.config.shiftEnterPreview = e.target.checked);
861
+ }, false);
862
+ cbEditPreview.checked = P.config.shiftEnterPreview;
850863
}/*F.onPageLoad()*/);
851864
852865
/**
853866
Getter (if called with no args) or setter (if passed an arg) for
854867
the current file content.
855868
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -70,11 +70,17 @@
70 const E = (s)=>document.querySelector(s),
71 D = F.dom,
72 P = F.page;
73
74 P.config = {
75 defaultMaxStashSize: 7
 
 
 
 
 
 
76 };
77
78 /**
79 $stash is an internal-use-only object for managing "stashed"
80 local edits, to help avoid that users accidentally lose content
@@ -724,11 +730,11 @@
724 );
725 ////////////////////////////////////////////////////////////
726 // Trigger preview on Ctrl-Enter. This only works on the built-in
727 // editor widget, not a client-provided one.
728 P.e.taEditor.addEventListener('keydown',function(ev){
729 if(ev.shiftKey && 13 === ev.keyCode){
730 ev.preventDefault();
731 ev.stopPropagation();
732 P.e.taEditor.blur(/*force change event, if needed*/);
733 P.tabs.switchToTab(P.e.tabs.preview);
734 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
@@ -845,10 +851,17 @@
845
846 P.fileSelectWidget.init();
847 P.stashWidget.init(
848 P.e.tabs.content.lastElementChild
849 );
 
 
 
 
 
 
 
850 }/*F.onPageLoad()*/);
851
852 /**
853 Getter (if called with no args) or setter (if passed an arg) for
854 the current file content.
855
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -70,11 +70,17 @@
70 const E = (s)=>document.querySelector(s),
71 D = F.dom,
72 P = F.page;
73
74 P.config = {
75 defaultMaxStashSize: 7,
76 /**
77 See notes for this setting in fossil.page.wikiedit.js. Both
78 /wikiedit and /fileedit share this persistent config option
79 under the same storage key.
80 */
81 shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
82 };
83
84 /**
85 $stash is an internal-use-only object for managing "stashed"
86 local edits, to help avoid that users accidentally lose content
@@ -724,11 +730,11 @@
730 );
731 ////////////////////////////////////////////////////////////
732 // Trigger preview on Ctrl-Enter. This only works on the built-in
733 // editor widget, not a client-provided one.
734 P.e.taEditor.addEventListener('keydown',function(ev){
735 if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
736 ev.preventDefault();
737 ev.stopPropagation();
738 P.e.taEditor.blur(/*force change event, if needed*/);
739 P.tabs.switchToTab(P.e.tabs.preview);
740 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
@@ -845,10 +851,17 @@
851
852 P.fileSelectWidget.init();
853 P.stashWidget.init(
854 P.e.tabs.content.lastElementChild
855 );
856
857 const cbEditPreview = E('#edit-shift-enter-preview');
858 cbEditPreview.addEventListener('change', function(e){
859 F.storage.set('edit-shift-enter-preview',
860 P.config.shiftEnterPreview = e.target.checked);
861 }, false);
862 cbEditPreview.checked = P.config.shiftEnterPreview;
863 }/*F.onPageLoad()*/);
864
865 /**
866 Getter (if called with no args) or setter (if passed an arg) for
867 the current file content.
868
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -70,11 +70,17 @@
7070
const E = (s)=>document.querySelector(s),
7171
D = F.dom,
7272
P = F.page;
7373
7474
P.config = {
75
- defaultMaxStashSize: 7
75
+ defaultMaxStashSize: 7,
76
+ /**
77
+ See notes for this setting in fossil.page.wikiedit.js. Both
78
+ /wikiedit and /fileedit share this persistent config option
79
+ under the same storage key.
80
+ */
81
+ shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
7682
};
7783
7884
/**
7985
$stash is an internal-use-only object for managing "stashed"
8086
local edits, to help avoid that users accidentally lose content
@@ -724,11 +730,11 @@
724730
);
725731
////////////////////////////////////////////////////////////
726732
// Trigger preview on Ctrl-Enter. This only works on the built-in
727733
// editor widget, not a client-provided one.
728734
P.e.taEditor.addEventListener('keydown',function(ev){
729
- if(ev.shiftKey && 13 === ev.keyCode){
735
+ if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
730736
ev.preventDefault();
731737
ev.stopPropagation();
732738
P.e.taEditor.blur(/*force change event, if needed*/);
733739
P.tabs.switchToTab(P.e.tabs.preview);
734740
if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
@@ -845,10 +851,17 @@
845851
846852
P.fileSelectWidget.init();
847853
P.stashWidget.init(
848854
P.e.tabs.content.lastElementChild
849855
);
856
+
857
+ const cbEditPreview = E('#edit-shift-enter-preview');
858
+ cbEditPreview.addEventListener('change', function(e){
859
+ F.storage.set('edit-shift-enter-preview',
860
+ P.config.shiftEnterPreview = e.target.checked);
861
+ }, false);
862
+ cbEditPreview.checked = P.config.shiftEnterPreview;
850863
}/*F.onPageLoad()*/);
851864
852865
/**
853866
Getter (if called with no args) or setter (if passed an arg) for
854867
the current file content.
855868
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -70,11 +70,17 @@
70 const E = (s)=>document.querySelector(s),
71 D = F.dom,
72 P = F.page;
73
74 P.config = {
75 defaultMaxStashSize: 7
 
 
 
 
 
 
76 };
77
78 /**
79 $stash is an internal-use-only object for managing "stashed"
80 local edits, to help avoid that users accidentally lose content
@@ -724,11 +730,11 @@
724 );
725 ////////////////////////////////////////////////////////////
726 // Trigger preview on Ctrl-Enter. This only works on the built-in
727 // editor widget, not a client-provided one.
728 P.e.taEditor.addEventListener('keydown',function(ev){
729 if(ev.shiftKey && 13 === ev.keyCode){
730 ev.preventDefault();
731 ev.stopPropagation();
732 P.e.taEditor.blur(/*force change event, if needed*/);
733 P.tabs.switchToTab(P.e.tabs.preview);
734 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
@@ -845,10 +851,17 @@
845
846 P.fileSelectWidget.init();
847 P.stashWidget.init(
848 P.e.tabs.content.lastElementChild
849 );
 
 
 
 
 
 
 
850 }/*F.onPageLoad()*/);
851
852 /**
853 Getter (if called with no args) or setter (if passed an arg) for
854 the current file content.
855
--- src/fossil.page.fileedit.js
+++ src/fossil.page.fileedit.js
@@ -70,11 +70,17 @@
70 const E = (s)=>document.querySelector(s),
71 D = F.dom,
72 P = F.page;
73
74 P.config = {
75 defaultMaxStashSize: 7,
76 /**
77 See notes for this setting in fossil.page.wikiedit.js. Both
78 /wikiedit and /fileedit share this persistent config option
79 under the same storage key.
80 */
81 shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
82 };
83
84 /**
85 $stash is an internal-use-only object for managing "stashed"
86 local edits, to help avoid that users accidentally lose content
@@ -724,11 +730,11 @@
730 );
731 ////////////////////////////////////////////////////////////
732 // Trigger preview on Ctrl-Enter. This only works on the built-in
733 // editor widget, not a client-provided one.
734 P.e.taEditor.addEventListener('keydown',function(ev){
735 if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
736 ev.preventDefault();
737 ev.stopPropagation();
738 P.e.taEditor.blur(/*force change event, if needed*/);
739 P.tabs.switchToTab(P.e.tabs.preview);
740 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
@@ -845,10 +851,17 @@
851
852 P.fileSelectWidget.init();
853 P.stashWidget.init(
854 P.e.tabs.content.lastElementChild
855 );
856
857 const cbEditPreview = E('#edit-shift-enter-preview');
858 cbEditPreview.addEventListener('change', function(e){
859 F.storage.set('edit-shift-enter-preview',
860 P.config.shiftEnterPreview = e.target.checked);
861 }, false);
862 cbEditPreview.checked = P.config.shiftEnterPreview;
863 }/*F.onPageLoad()*/);
864
865 /**
866 Getter (if called with no args) or setter (if passed an arg) for
867 the current file content.
868
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -75,11 +75,24 @@
7575
"confirmer" step, else they will not. The confirmer topic has
7676
been the source of much contention in the forum. */
7777
save: false,
7878
reload: true,
7979
discardStash: true
80
- }
80
+ },
81
+ /**
82
+ If true, a keyboard combo of shift-enter (from the editor)
83
+ toggles between preview and edit modes. This is normally
84
+ desired but at least one software keyboard is known to
85
+ misinteract with this, treating an Enter after
86
+ automatically-capitalized letters as a shift-enter:
87
+
88
+ https://fossil-scm.org/forum/forumpost/dbd5b68366147ce8
89
+
90
+ Maintenance note: /fileedit also uses this same key for the
91
+ same purpose.
92
+ */
93
+ shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
8194
};
8295
8396
/**
8497
$stash is an internal-use-only object for managing "stashed"
8598
local edits, to help avoid that users accidentally lose content
@@ -454,11 +467,11 @@
454467
self._refreshStashMarks(opt);
455468
});
456469
D.enable(sel);
457470
if(P.winfo) sel.value = P.winfo.name;
458471
},
459
-
472
+
460473
/** Loads the page list and populates the selection list. */
461474
loadList: function callee(){
462475
if(!callee.onload){
463476
const self = this;
464477
callee.onload = function(list){
@@ -651,11 +664,11 @@
651664
D.append(
652665
parentElem,
653666
D.append(D.addClass(D.div(), 'fieldset-wrapper'),
654667
fsFilter, fsNewPage, fsLegend)
655668
);
656
-
669
+
657670
D.append(parentElem, btn);
658671
btn.addEventListener('click', ()=>this.loadList(), false);
659672
this.loadList();
660673
const onSelect = (e)=>P.loadPage(e.target.value);
661674
sel.addEventListener('change', onSelect, false);
@@ -674,12 +687,19 @@
674687
self._refreshStashMarks(opt);
675688
}else if('sandbox'!==page.type){
676689
F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name);
677690
}
678691
});
692
+
693
+ const cbEditPreview = E('#edit-shift-enter-preview');
694
+ cbEditPreview.addEventListener('change', function(e){
695
+ F.storage.set('edit-shift-enter-preview',
696
+ P.config.shiftEnterPreview = e.target.checked);
697
+ }, false);
698
+ cbEditPreview.checked = P.config.shiftEnterPreview;
679699
delete this.init;
680
- }
700
+ }/*init()*/
681701
};
682702
683703
/**
684704
Widget for listing and selecting $stash entries.
685705
*/
@@ -914,11 +934,11 @@
914934
);
915935
////////////////////////////////////////////////////////////
916936
// Trigger preview on Ctrl-Enter. This only works on the built-in
917937
// editor widget, not a client-provided one.
918938
P.e.taEditor.addEventListener('keydown',function(ev){
919
- if(ev.shiftKey && 13 === ev.keyCode){
939
+ if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
920940
ev.preventDefault();
921941
ev.stopPropagation();
922942
P.e.taEditor.blur(/*force change event, if needed*/);
923943
P.tabs.switchToTab(P.e.tabs.preview);
924944
if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
925945
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -75,11 +75,24 @@
75 "confirmer" step, else they will not. The confirmer topic has
76 been the source of much contention in the forum. */
77 save: false,
78 reload: true,
79 discardStash: true
80 }
 
 
 
 
 
 
 
 
 
 
 
 
 
81 };
82
83 /**
84 $stash is an internal-use-only object for managing "stashed"
85 local edits, to help avoid that users accidentally lose content
@@ -454,11 +467,11 @@
454 self._refreshStashMarks(opt);
455 });
456 D.enable(sel);
457 if(P.winfo) sel.value = P.winfo.name;
458 },
459
460 /** Loads the page list and populates the selection list. */
461 loadList: function callee(){
462 if(!callee.onload){
463 const self = this;
464 callee.onload = function(list){
@@ -651,11 +664,11 @@
651 D.append(
652 parentElem,
653 D.append(D.addClass(D.div(), 'fieldset-wrapper'),
654 fsFilter, fsNewPage, fsLegend)
655 );
656
657 D.append(parentElem, btn);
658 btn.addEventListener('click', ()=>this.loadList(), false);
659 this.loadList();
660 const onSelect = (e)=>P.loadPage(e.target.value);
661 sel.addEventListener('change', onSelect, false);
@@ -674,12 +687,19 @@
674 self._refreshStashMarks(opt);
675 }else if('sandbox'!==page.type){
676 F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name);
677 }
678 });
 
 
 
 
 
 
 
679 delete this.init;
680 }
681 };
682
683 /**
684 Widget for listing and selecting $stash entries.
685 */
@@ -914,11 +934,11 @@
914 );
915 ////////////////////////////////////////////////////////////
916 // Trigger preview on Ctrl-Enter. This only works on the built-in
917 // editor widget, not a client-provided one.
918 P.e.taEditor.addEventListener('keydown',function(ev){
919 if(ev.shiftKey && 13 === ev.keyCode){
920 ev.preventDefault();
921 ev.stopPropagation();
922 P.e.taEditor.blur(/*force change event, if needed*/);
923 P.tabs.switchToTab(P.e.tabs.preview);
924 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
925
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -75,11 +75,24 @@
75 "confirmer" step, else they will not. The confirmer topic has
76 been the source of much contention in the forum. */
77 save: false,
78 reload: true,
79 discardStash: true
80 },
81 /**
82 If true, a keyboard combo of shift-enter (from the editor)
83 toggles between preview and edit modes. This is normally
84 desired but at least one software keyboard is known to
85 misinteract with this, treating an Enter after
86 automatically-capitalized letters as a shift-enter:
87
88 https://fossil-scm.org/forum/forumpost/dbd5b68366147ce8
89
90 Maintenance note: /fileedit also uses this same key for the
91 same purpose.
92 */
93 shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
94 };
95
96 /**
97 $stash is an internal-use-only object for managing "stashed"
98 local edits, to help avoid that users accidentally lose content
@@ -454,11 +467,11 @@
467 self._refreshStashMarks(opt);
468 });
469 D.enable(sel);
470 if(P.winfo) sel.value = P.winfo.name;
471 },
472
473 /** Loads the page list and populates the selection list. */
474 loadList: function callee(){
475 if(!callee.onload){
476 const self = this;
477 callee.onload = function(list){
@@ -651,11 +664,11 @@
664 D.append(
665 parentElem,
666 D.append(D.addClass(D.div(), 'fieldset-wrapper'),
667 fsFilter, fsNewPage, fsLegend)
668 );
669
670 D.append(parentElem, btn);
671 btn.addEventListener('click', ()=>this.loadList(), false);
672 this.loadList();
673 const onSelect = (e)=>P.loadPage(e.target.value);
674 sel.addEventListener('change', onSelect, false);
@@ -674,12 +687,19 @@
687 self._refreshStashMarks(opt);
688 }else if('sandbox'!==page.type){
689 F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name);
690 }
691 });
692
693 const cbEditPreview = E('#edit-shift-enter-preview');
694 cbEditPreview.addEventListener('change', function(e){
695 F.storage.set('edit-shift-enter-preview',
696 P.config.shiftEnterPreview = e.target.checked);
697 }, false);
698 cbEditPreview.checked = P.config.shiftEnterPreview;
699 delete this.init;
700 }/*init()*/
701 };
702
703 /**
704 Widget for listing and selecting $stash entries.
705 */
@@ -914,11 +934,11 @@
934 );
935 ////////////////////////////////////////////////////////////
936 // Trigger preview on Ctrl-Enter. This only works on the built-in
937 // editor widget, not a client-provided one.
938 P.e.taEditor.addEventListener('keydown',function(ev){
939 if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
940 ev.preventDefault();
941 ev.stopPropagation();
942 P.e.taEditor.blur(/*force change event, if needed*/);
943 P.tabs.switchToTab(P.e.tabs.preview);
944 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
945
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -75,11 +75,24 @@
7575
"confirmer" step, else they will not. The confirmer topic has
7676
been the source of much contention in the forum. */
7777
save: false,
7878
reload: true,
7979
discardStash: true
80
- }
80
+ },
81
+ /**
82
+ If true, a keyboard combo of shift-enter (from the editor)
83
+ toggles between preview and edit modes. This is normally
84
+ desired but at least one software keyboard is known to
85
+ misinteract with this, treating an Enter after
86
+ automatically-capitalized letters as a shift-enter:
87
+
88
+ https://fossil-scm.org/forum/forumpost/dbd5b68366147ce8
89
+
90
+ Maintenance note: /fileedit also uses this same key for the
91
+ same purpose.
92
+ */
93
+ shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
8194
};
8295
8396
/**
8497
$stash is an internal-use-only object for managing "stashed"
8598
local edits, to help avoid that users accidentally lose content
@@ -454,11 +467,11 @@
454467
self._refreshStashMarks(opt);
455468
});
456469
D.enable(sel);
457470
if(P.winfo) sel.value = P.winfo.name;
458471
},
459
-
472
+
460473
/** Loads the page list and populates the selection list. */
461474
loadList: function callee(){
462475
if(!callee.onload){
463476
const self = this;
464477
callee.onload = function(list){
@@ -651,11 +664,11 @@
651664
D.append(
652665
parentElem,
653666
D.append(D.addClass(D.div(), 'fieldset-wrapper'),
654667
fsFilter, fsNewPage, fsLegend)
655668
);
656
-
669
+
657670
D.append(parentElem, btn);
658671
btn.addEventListener('click', ()=>this.loadList(), false);
659672
this.loadList();
660673
const onSelect = (e)=>P.loadPage(e.target.value);
661674
sel.addEventListener('change', onSelect, false);
@@ -674,12 +687,19 @@
674687
self._refreshStashMarks(opt);
675688
}else if('sandbox'!==page.type){
676689
F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name);
677690
}
678691
});
692
+
693
+ const cbEditPreview = E('#edit-shift-enter-preview');
694
+ cbEditPreview.addEventListener('change', function(e){
695
+ F.storage.set('edit-shift-enter-preview',
696
+ P.config.shiftEnterPreview = e.target.checked);
697
+ }, false);
698
+ cbEditPreview.checked = P.config.shiftEnterPreview;
679699
delete this.init;
680
- }
700
+ }/*init()*/
681701
};
682702
683703
/**
684704
Widget for listing and selecting $stash entries.
685705
*/
@@ -914,11 +934,11 @@
914934
);
915935
////////////////////////////////////////////////////////////
916936
// Trigger preview on Ctrl-Enter. This only works on the built-in
917937
// editor widget, not a client-provided one.
918938
P.e.taEditor.addEventListener('keydown',function(ev){
919
- if(ev.shiftKey && 13 === ev.keyCode){
939
+ if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
920940
ev.preventDefault();
921941
ev.stopPropagation();
922942
P.e.taEditor.blur(/*force change event, if needed*/);
923943
P.tabs.switchToTab(P.e.tabs.preview);
924944
if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
925945
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -75,11 +75,24 @@
75 "confirmer" step, else they will not. The confirmer topic has
76 been the source of much contention in the forum. */
77 save: false,
78 reload: true,
79 discardStash: true
80 }
 
 
 
 
 
 
 
 
 
 
 
 
 
81 };
82
83 /**
84 $stash is an internal-use-only object for managing "stashed"
85 local edits, to help avoid that users accidentally lose content
@@ -454,11 +467,11 @@
454 self._refreshStashMarks(opt);
455 });
456 D.enable(sel);
457 if(P.winfo) sel.value = P.winfo.name;
458 },
459
460 /** Loads the page list and populates the selection list. */
461 loadList: function callee(){
462 if(!callee.onload){
463 const self = this;
464 callee.onload = function(list){
@@ -651,11 +664,11 @@
651 D.append(
652 parentElem,
653 D.append(D.addClass(D.div(), 'fieldset-wrapper'),
654 fsFilter, fsNewPage, fsLegend)
655 );
656
657 D.append(parentElem, btn);
658 btn.addEventListener('click', ()=>this.loadList(), false);
659 this.loadList();
660 const onSelect = (e)=>P.loadPage(e.target.value);
661 sel.addEventListener('change', onSelect, false);
@@ -674,12 +687,19 @@
674 self._refreshStashMarks(opt);
675 }else if('sandbox'!==page.type){
676 F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name);
677 }
678 });
 
 
 
 
 
 
 
679 delete this.init;
680 }
681 };
682
683 /**
684 Widget for listing and selecting $stash entries.
685 */
@@ -914,11 +934,11 @@
914 );
915 ////////////////////////////////////////////////////////////
916 // Trigger preview on Ctrl-Enter. This only works on the built-in
917 // editor widget, not a client-provided one.
918 P.e.taEditor.addEventListener('keydown',function(ev){
919 if(ev.shiftKey && 13 === ev.keyCode){
920 ev.preventDefault();
921 ev.stopPropagation();
922 P.e.taEditor.blur(/*force change event, if needed*/);
923 P.tabs.switchToTab(P.e.tabs.preview);
924 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
925
--- src/fossil.page.wikiedit.js
+++ src/fossil.page.wikiedit.js
@@ -75,11 +75,24 @@
75 "confirmer" step, else they will not. The confirmer topic has
76 been the source of much contention in the forum. */
77 save: false,
78 reload: true,
79 discardStash: true
80 },
81 /**
82 If true, a keyboard combo of shift-enter (from the editor)
83 toggles between preview and edit modes. This is normally
84 desired but at least one software keyboard is known to
85 misinteract with this, treating an Enter after
86 automatically-capitalized letters as a shift-enter:
87
88 https://fossil-scm.org/forum/forumpost/dbd5b68366147ce8
89
90 Maintenance note: /fileedit also uses this same key for the
91 same purpose.
92 */
93 shiftEnterPreview: F.storage.getBool('edit-shift-enter-preview', true)
94 };
95
96 /**
97 $stash is an internal-use-only object for managing "stashed"
98 local edits, to help avoid that users accidentally lose content
@@ -454,11 +467,11 @@
467 self._refreshStashMarks(opt);
468 });
469 D.enable(sel);
470 if(P.winfo) sel.value = P.winfo.name;
471 },
472
473 /** Loads the page list and populates the selection list. */
474 loadList: function callee(){
475 if(!callee.onload){
476 const self = this;
477 callee.onload = function(list){
@@ -651,11 +664,11 @@
664 D.append(
665 parentElem,
666 D.append(D.addClass(D.div(), 'fieldset-wrapper'),
667 fsFilter, fsNewPage, fsLegend)
668 );
669
670 D.append(parentElem, btn);
671 btn.addEventListener('click', ()=>this.loadList(), false);
672 this.loadList();
673 const onSelect = (e)=>P.loadPage(e.target.value);
674 sel.addEventListener('change', onSelect, false);
@@ -674,12 +687,19 @@
687 self._refreshStashMarks(opt);
688 }else if('sandbox'!==page.type){
689 F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name);
690 }
691 });
692
693 const cbEditPreview = E('#edit-shift-enter-preview');
694 cbEditPreview.addEventListener('change', function(e){
695 F.storage.set('edit-shift-enter-preview',
696 P.config.shiftEnterPreview = e.target.checked);
697 }, false);
698 cbEditPreview.checked = P.config.shiftEnterPreview;
699 delete this.init;
700 }/*init()*/
701 };
702
703 /**
704 Widget for listing and selecting $stash entries.
705 */
@@ -914,11 +934,11 @@
934 );
935 ////////////////////////////////////////////////////////////
936 // Trigger preview on Ctrl-Enter. This only works on the built-in
937 // editor widget, not a client-provided one.
938 P.e.taEditor.addEventListener('keydown',function(ev){
939 if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){
940 ev.preventDefault();
941 ev.stopPropagation();
942 P.e.taEditor.blur(/*force change event, if needed*/);
943 P.tabs.switchToTab(P.e.tabs.preview);
944 if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */
945
--- src/style.fileedit.css
+++ src/style.fileedit.css
@@ -76,10 +76,13 @@
7676
body.fileedit #fileedit-tab-preview-wrapper > pre {
7777
margin: 0;
7878
}
7979
body.fileedit #fileedit-tab-fileselect > h1 {
8080
margin: 0;
81
+}
82
+body.fileedit .fileedit-options > div > * {
83
+ margin: 0.25em;
8184
}
8285
body.fileedit .fileedit-options.commit-message > div {
8386
display: flex;
8487
flex-direction: column;
8588
align-items: stretch;
@@ -105,12 +108,11 @@
105108
body.fileedit .tab-container > .tabs > .tab-panel > .fileedit-options > input {
106109
vertical-align: middle;
107110
margin: 0.5em;
108111
}
109112
body.fileedit .tab-container > .tabs > .tab-panel > .fileedit-options > .input-with-label {
110
- vertical-align: middle;
111
- margin: 0.5em;
113
+ margin: 0 0.5em 0.25em 0.5em;
112114
}
113115
body.fileedit .fileedit-options > div > * {
114116
margin: 0.25em;
115117
}
116118
body.fileedit .fileedit-options.flex-container.flex-row {
117119
--- src/style.fileedit.css
+++ src/style.fileedit.css
@@ -76,10 +76,13 @@
76 body.fileedit #fileedit-tab-preview-wrapper > pre {
77 margin: 0;
78 }
79 body.fileedit #fileedit-tab-fileselect > h1 {
80 margin: 0;
 
 
 
81 }
82 body.fileedit .fileedit-options.commit-message > div {
83 display: flex;
84 flex-direction: column;
85 align-items: stretch;
@@ -105,12 +108,11 @@
105 body.fileedit .tab-container > .tabs > .tab-panel > .fileedit-options > input {
106 vertical-align: middle;
107 margin: 0.5em;
108 }
109 body.fileedit .tab-container > .tabs > .tab-panel > .fileedit-options > .input-with-label {
110 vertical-align: middle;
111 margin: 0.5em;
112 }
113 body.fileedit .fileedit-options > div > * {
114 margin: 0.25em;
115 }
116 body.fileedit .fileedit-options.flex-container.flex-row {
117
--- src/style.fileedit.css
+++ src/style.fileedit.css
@@ -76,10 +76,13 @@
76 body.fileedit #fileedit-tab-preview-wrapper > pre {
77 margin: 0;
78 }
79 body.fileedit #fileedit-tab-fileselect > h1 {
80 margin: 0;
81 }
82 body.fileedit .fileedit-options > div > * {
83 margin: 0.25em;
84 }
85 body.fileedit .fileedit-options.commit-message > div {
86 display: flex;
87 flex-direction: column;
88 align-items: stretch;
@@ -105,12 +108,11 @@
108 body.fileedit .tab-container > .tabs > .tab-panel > .fileedit-options > input {
109 vertical-align: middle;
110 margin: 0.5em;
111 }
112 body.fileedit .tab-container > .tabs > .tab-panel > .fileedit-options > .input-with-label {
113 margin: 0 0.5em 0.25em 0.5em;
 
114 }
115 body.fileedit .fileedit-options > div > * {
116 margin: 0.25em;
117 }
118 body.fileedit .fileedit-options.flex-container.flex-row {
119
--- src/style.wikiedit.css
+++ src/style.wikiedit.css
@@ -43,11 +43,10 @@
4343
body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > input {
4444
vertical-align: middle;
4545
margin: 0.5em;
4646
}
4747
body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > .input-with-label {
48
- vertical-align: middle;
4948
margin: 0 0.5em 0.25em 0.5em;
5049
}
5150
body.wikiedit label {
5251
display: inline; /* some skins set label display to block! */
5352
}
5453
--- src/style.wikiedit.css
+++ src/style.wikiedit.css
@@ -43,11 +43,10 @@
43 body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > input {
44 vertical-align: middle;
45 margin: 0.5em;
46 }
47 body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > .input-with-label {
48 vertical-align: middle;
49 margin: 0 0.5em 0.25em 0.5em;
50 }
51 body.wikiedit label {
52 display: inline; /* some skins set label display to block! */
53 }
54
--- src/style.wikiedit.css
+++ src/style.wikiedit.css
@@ -43,11 +43,10 @@
43 body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > input {
44 vertical-align: middle;
45 margin: 0.5em;
46 }
47 body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > .input-with-label {
 
48 margin: 0 0.5em 0.25em 0.5em;
49 }
50 body.wikiedit label {
51 display: inline; /* some skins set label display to block! */
52 }
53
+18 -2
--- src/wiki.c
+++ src/wiki.c
@@ -1247,10 +1247,26 @@
12471247
"connections).");
12481248
return;
12491249
}
12501250
pRoute->xCallback();
12511251
}
1252
+
1253
+/*
1254
+** Emits a preview-toggle option widget for /wikiedit and /fileedit.
1255
+*/
1256
+void wikiedit_emit_toggle_preview(void){
1257
+ CX("<div class='input-with-label'>"
1258
+ "<input type='checkbox' id='edit-shift-enter-preview' "
1259
+ "></input><label for='edit-shift-enter-preview'>"
1260
+ "Shift-enter previews</label>"
1261
+ "<div class='help-buttonlet'>"
1262
+ "When enabled, shift-enter switches between preview and edit modes. "
1263
+ "Some software-based keyboards misinteract with this, so it can be "
1264
+ "disabled when needed."
1265
+ "</div>"
1266
+ "</div>");
1267
+}
12521268
12531269
/*
12541270
** WEBPAGE: wikiedit
12551271
** URL: /wikedit?name=PAGENAME
12561272
**
@@ -1311,11 +1327,11 @@
13111327
13121328
CX("<div id='wikiedit-edit-status''>"
13131329
"<span class='name'></span>"
13141330
"<span class='links'></span>"
13151331
"</div>");
1316
-
1332
+
13171333
/* Main tab container... */
13181334
CX("<div id='wikiedit-tabs' class='tab-container'>Loading...</div>");
13191335
/* The .hidden class on the following tab elements is to help lessen
13201336
the FOUC effect of the tabs before JS re-assembles them. */
13211337
@@ -1371,11 +1387,11 @@
13711387
"any local edits. To help avoid accidental loss of "
13721388
"edits, it requires confirmation (a second click) within "
13731389
"a few seconds or it will not reload."
13741390
"</div>"
13751391
"</div>");
1376
-
1392
+ wikiedit_emit_toggle_preview();
13771393
CX("</div>");
13781394
CX("<div class='flex-container flex-column stretch'>");
13791395
CX("<textarea name='content' id='wikiedit-content-editor' "
13801396
"class='wikiedit' rows='25'>");
13811397
CX("</textarea>");
13821398
--- src/wiki.c
+++ src/wiki.c
@@ -1247,10 +1247,26 @@
1247 "connections).");
1248 return;
1249 }
1250 pRoute->xCallback();
1251 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1252
1253 /*
1254 ** WEBPAGE: wikiedit
1255 ** URL: /wikedit?name=PAGENAME
1256 **
@@ -1311,11 +1327,11 @@
1311
1312 CX("<div id='wikiedit-edit-status''>"
1313 "<span class='name'></span>"
1314 "<span class='links'></span>"
1315 "</div>");
1316
1317 /* Main tab container... */
1318 CX("<div id='wikiedit-tabs' class='tab-container'>Loading...</div>");
1319 /* The .hidden class on the following tab elements is to help lessen
1320 the FOUC effect of the tabs before JS re-assembles them. */
1321
@@ -1371,11 +1387,11 @@
1371 "any local edits. To help avoid accidental loss of "
1372 "edits, it requires confirmation (a second click) within "
1373 "a few seconds or it will not reload."
1374 "</div>"
1375 "</div>");
1376
1377 CX("</div>");
1378 CX("<div class='flex-container flex-column stretch'>");
1379 CX("<textarea name='content' id='wikiedit-content-editor' "
1380 "class='wikiedit' rows='25'>");
1381 CX("</textarea>");
1382
--- src/wiki.c
+++ src/wiki.c
@@ -1247,10 +1247,26 @@
1247 "connections).");
1248 return;
1249 }
1250 pRoute->xCallback();
1251 }
1252
1253 /*
1254 ** Emits a preview-toggle option widget for /wikiedit and /fileedit.
1255 */
1256 void wikiedit_emit_toggle_preview(void){
1257 CX("<div class='input-with-label'>"
1258 "<input type='checkbox' id='edit-shift-enter-preview' "
1259 "></input><label for='edit-shift-enter-preview'>"
1260 "Shift-enter previews</label>"
1261 "<div class='help-buttonlet'>"
1262 "When enabled, shift-enter switches between preview and edit modes. "
1263 "Some software-based keyboards misinteract with this, so it can be "
1264 "disabled when needed."
1265 "</div>"
1266 "</div>");
1267 }
1268
1269 /*
1270 ** WEBPAGE: wikiedit
1271 ** URL: /wikedit?name=PAGENAME
1272 **
@@ -1311,11 +1327,11 @@
1327
1328 CX("<div id='wikiedit-edit-status''>"
1329 "<span class='name'></span>"
1330 "<span class='links'></span>"
1331 "</div>");
1332
1333 /* Main tab container... */
1334 CX("<div id='wikiedit-tabs' class='tab-container'>Loading...</div>");
1335 /* The .hidden class on the following tab elements is to help lessen
1336 the FOUC effect of the tabs before JS re-assembles them. */
1337
@@ -1371,11 +1387,11 @@
1387 "any local edits. To help avoid accidental loss of "
1388 "edits, it requires confirmation (a second click) within "
1389 "a few seconds or it will not reload."
1390 "</div>"
1391 "</div>");
1392 wikiedit_emit_toggle_preview();
1393 CX("</div>");
1394 CX("<div class='flex-container flex-column stretch'>");
1395 CX("<textarea name='content' id='wikiedit-content-editor' "
1396 "class='wikiedit' rows='25'>");
1397 CX("</textarea>");
1398

Keyboard Shortcuts

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