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].
Commit
4bb5515caefa6826fa2f0d54b5d6f5f22dba097323295427175b6d059fceeed8
Parent
0c6e669a7b0eacb…
10 files changed
+4
-2
+17
-4
+17
-4
+15
-2
+15
-2
+25
-5
+25
-5
+4
-2
-1
+18
-2
+4
-2
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -1698,19 +1698,20 @@ | ||
| 1698 | 1698 | "class='hidden'" |
| 1699 | 1699 | ">"); |
| 1700 | 1700 | CX("<div id='fileedit-file-selector'></div>"); |
| 1701 | 1701 | CX("</div>"/*#fileedit-tab-fileselect*/); |
| 1702 | 1702 | } |
| 1703 | - | |
| 1703 | + | |
| 1704 | 1704 | /******* Content tab *******/ |
| 1705 | 1705 | { |
| 1706 | 1706 | CX("<div id='fileedit-tab-content' " |
| 1707 | 1707 | "data-tab-parent='fileedit-tabs' " |
| 1708 | 1708 | "data-tab-label='File Content' " |
| 1709 | 1709 | "class='hidden'" |
| 1710 | 1710 | ">"); |
| 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'>"); | |
| 1712 | 1713 | CX("<div class='input-with-label'>" |
| 1713 | 1714 | "<button class='fileedit-content-reload confirmer' " |
| 1714 | 1715 | ">Discard & Reload</button>" |
| 1715 | 1716 | "<div class='help-buttonlet'>" |
| 1716 | 1717 | "Reload the file from the server, discarding " |
| @@ -1724,10 +1725,11 @@ | ||
| 1724 | 1725 | NULL/*tooltip*/, |
| 1725 | 1726 | 100, |
| 1726 | 1727 | "100%", 100, "125%", 125, |
| 1727 | 1728 | "150%", 150, "175%", 175, |
| 1728 | 1729 | "200%", 200, NULL); |
| 1730 | + wikiedit_emit_toggle_preview(); | |
| 1729 | 1731 | CX("</div>"); |
| 1730 | 1732 | CX("<div class='flex-container flex-column stretch'>"); |
| 1731 | 1733 | CX("<textarea name='content' id='fileedit-content-editor' " |
| 1732 | 1734 | "class='fileedit' rows='25'>"); |
| 1733 | 1735 | CX("</textarea>"); |
| 1734 | 1736 |
| --- 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 & 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 & 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 |
+17
-4
| --- src/fossil.page.chat.js | ||
| +++ src/fossil.page.chat.js | ||
| @@ -1,16 +1,17 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | This file contains the client-side implementation of fossil's /chat |
| 3 | - application. | |
| 3 | + application. | |
| 4 | 4 | */ |
| 5 | 5 | window.fossil.onPageLoad(function(){ |
| 6 | 6 | const F = window.fossil, D = F.dom; |
| 7 | 7 | const E1 = function(selector){ |
| 8 | 8 | const e = document.querySelector(selector); |
| 9 | 9 | if(!e) throw new Error("missing required DOM element: "+selector); |
| 10 | 10 | return e; |
| 11 | 11 | }; |
| 12 | + | |
| 12 | 13 | /** |
| 13 | 14 | Returns true if e is entirely within the bounds of the window's viewport. |
| 14 | 15 | */ |
| 15 | 16 | const isEntirelyInViewport = function(e) { |
| 16 | 17 | const rect = e.getBoundingClientRect(); |
| @@ -396,10 +397,15 @@ | ||
| 396 | 397 | /* When on, the edit field starts as a single line and |
| 397 | 398 | expands as the user types, and the relevant buttons are |
| 398 | 399 | laid out in a compact form. When off, the edit field and |
| 399 | 400 | buttons are larger. */ |
| 400 | 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), | |
| 401 | 407 | /* When on, sets the font-family on messages and the edit |
| 402 | 408 | field to monospace. */ |
| 403 | 409 | "monospace-messages": false, |
| 404 | 410 | /* When on, non-chat UI elements (page header/footer) are |
| 405 | 411 | hidden */ |
| @@ -1499,11 +1505,11 @@ | ||
| 1499 | 1505 | switch back to message view. */ |
| 1500 | 1506 | if(Chat.e.currentView===Chat.e.viewPreview && !text){ |
| 1501 | 1507 | Chat.setCurrentView(Chat.e.viewMessages); |
| 1502 | 1508 | }else if(!text){ |
| 1503 | 1509 | f.$toggleCompact(compactMode); |
| 1504 | - }else{ | |
| 1510 | + }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){ | |
| 1505 | 1511 | Chat.e.btnPreview.click(); |
| 1506 | 1512 | } |
| 1507 | 1513 | return false; |
| 1508 | 1514 | } |
| 1509 | 1515 | if(ev.ctrlKey && !text && !BlobXferState.blob){ |
| @@ -1515,11 +1521,11 @@ | ||
| 1515 | 1521 | } |
| 1516 | 1522 | if(!ctrlMode && ev.ctrlKey && text){ |
| 1517 | 1523 | //console.debug("!ctrlMode && ev.ctrlKey && text."); |
| 1518 | 1524 | /* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a |
| 1519 | 1525 | 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 | |
| 1521 | 1527 | instead of a textarea). Forcibly appending a newline do the |
| 1522 | 1528 | input area does not work, also for unknown reasons, and would |
| 1523 | 1529 | only be suitable when we're at the end of the input. |
| 1524 | 1530 | |
| 1525 | 1531 | Strangely, this approach DOES work for shift-enter, but we |
| @@ -1533,11 +1539,11 @@ | ||
| 1533 | 1539 | ev.preventDefault(); |
| 1534 | 1540 | ev.stopPropagation(); |
| 1535 | 1541 | Chat.submitMessage(); |
| 1536 | 1542 | return false; |
| 1537 | 1543 | } |
| 1538 | - }; | |
| 1544 | + }; | |
| 1539 | 1545 | Chat.e.inputFields.forEach( |
| 1540 | 1546 | (e)=>e.addEventListener('keydown', inputWidgetKeydown, false) |
| 1541 | 1547 | ); |
| 1542 | 1548 | Chat.e.btnSubmit.addEventListener('click',(e)=>{ |
| 1543 | 1549 | e.preventDefault(); |
| @@ -1667,10 +1673,17 @@ | ||
| 1667 | 1673 | "When enabled, chat input uses a so-called 'contenteditable' ", |
| 1668 | 1674 | "field. Though generally more comfortable and modern than ", |
| 1669 | 1675 | "plain-text input fields, browser-specific quirks and bugs ", |
| 1670 | 1676 | "may lead to frustration. Ideal for mobile devices." |
| 1671 | 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' | |
| 1672 | 1685 | }] |
| 1673 | 1686 | },{ |
| 1674 | 1687 | label: "Appearance Options...", |
| 1675 | 1688 | children:[{ |
| 1676 | 1689 | label: "Left-align my posts", |
| 1677 | 1690 |
| --- 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 |
+17
-4
| --- src/fossil.page.chat.js | ||
| +++ src/fossil.page.chat.js | ||
| @@ -1,16 +1,17 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | This file contains the client-side implementation of fossil's /chat |
| 3 | - application. | |
| 3 | + application. | |
| 4 | 4 | */ |
| 5 | 5 | window.fossil.onPageLoad(function(){ |
| 6 | 6 | const F = window.fossil, D = F.dom; |
| 7 | 7 | const E1 = function(selector){ |
| 8 | 8 | const e = document.querySelector(selector); |
| 9 | 9 | if(!e) throw new Error("missing required DOM element: "+selector); |
| 10 | 10 | return e; |
| 11 | 11 | }; |
| 12 | + | |
| 12 | 13 | /** |
| 13 | 14 | Returns true if e is entirely within the bounds of the window's viewport. |
| 14 | 15 | */ |
| 15 | 16 | const isEntirelyInViewport = function(e) { |
| 16 | 17 | const rect = e.getBoundingClientRect(); |
| @@ -396,10 +397,15 @@ | ||
| 396 | 397 | /* When on, the edit field starts as a single line and |
| 397 | 398 | expands as the user types, and the relevant buttons are |
| 398 | 399 | laid out in a compact form. When off, the edit field and |
| 399 | 400 | buttons are larger. */ |
| 400 | 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), | |
| 401 | 407 | /* When on, sets the font-family on messages and the edit |
| 402 | 408 | field to monospace. */ |
| 403 | 409 | "monospace-messages": false, |
| 404 | 410 | /* When on, non-chat UI elements (page header/footer) are |
| 405 | 411 | hidden */ |
| @@ -1499,11 +1505,11 @@ | ||
| 1499 | 1505 | switch back to message view. */ |
| 1500 | 1506 | if(Chat.e.currentView===Chat.e.viewPreview && !text){ |
| 1501 | 1507 | Chat.setCurrentView(Chat.e.viewMessages); |
| 1502 | 1508 | }else if(!text){ |
| 1503 | 1509 | f.$toggleCompact(compactMode); |
| 1504 | - }else{ | |
| 1510 | + }else if(Chat.settings.getBool('edit-shift-enter-preview', true)){ | |
| 1505 | 1511 | Chat.e.btnPreview.click(); |
| 1506 | 1512 | } |
| 1507 | 1513 | return false; |
| 1508 | 1514 | } |
| 1509 | 1515 | if(ev.ctrlKey && !text && !BlobXferState.blob){ |
| @@ -1515,11 +1521,11 @@ | ||
| 1515 | 1521 | } |
| 1516 | 1522 | if(!ctrlMode && ev.ctrlKey && text){ |
| 1517 | 1523 | //console.debug("!ctrlMode && ev.ctrlKey && text."); |
| 1518 | 1524 | /* Ctrl-enter in Enter-sends mode SHOULD, with this logic add a |
| 1519 | 1525 | 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 | |
| 1521 | 1527 | instead of a textarea). Forcibly appending a newline do the |
| 1522 | 1528 | input area does not work, also for unknown reasons, and would |
| 1523 | 1529 | only be suitable when we're at the end of the input. |
| 1524 | 1530 | |
| 1525 | 1531 | Strangely, this approach DOES work for shift-enter, but we |
| @@ -1533,11 +1539,11 @@ | ||
| 1533 | 1539 | ev.preventDefault(); |
| 1534 | 1540 | ev.stopPropagation(); |
| 1535 | 1541 | Chat.submitMessage(); |
| 1536 | 1542 | return false; |
| 1537 | 1543 | } |
| 1538 | - }; | |
| 1544 | + }; | |
| 1539 | 1545 | Chat.e.inputFields.forEach( |
| 1540 | 1546 | (e)=>e.addEventListener('keydown', inputWidgetKeydown, false) |
| 1541 | 1547 | ); |
| 1542 | 1548 | Chat.e.btnSubmit.addEventListener('click',(e)=>{ |
| 1543 | 1549 | e.preventDefault(); |
| @@ -1667,10 +1673,17 @@ | ||
| 1667 | 1673 | "When enabled, chat input uses a so-called 'contenteditable' ", |
| 1668 | 1674 | "field. Though generally more comfortable and modern than ", |
| 1669 | 1675 | "plain-text input fields, browser-specific quirks and bugs ", |
| 1670 | 1676 | "may lead to frustration. Ideal for mobile devices." |
| 1671 | 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' | |
| 1672 | 1685 | }] |
| 1673 | 1686 | },{ |
| 1674 | 1687 | label: "Appearance Options...", |
| 1675 | 1688 | children:[{ |
| 1676 | 1689 | label: "Left-align my posts", |
| 1677 | 1690 |
| --- 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 |
+15
-2
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -70,11 +70,17 @@ | ||
| 70 | 70 | const E = (s)=>document.querySelector(s), |
| 71 | 71 | D = F.dom, |
| 72 | 72 | P = F.page; |
| 73 | 73 | |
| 74 | 74 | 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) | |
| 76 | 82 | }; |
| 77 | 83 | |
| 78 | 84 | /** |
| 79 | 85 | $stash is an internal-use-only object for managing "stashed" |
| 80 | 86 | local edits, to help avoid that users accidentally lose content |
| @@ -724,11 +730,11 @@ | ||
| 724 | 730 | ); |
| 725 | 731 | //////////////////////////////////////////////////////////// |
| 726 | 732 | // Trigger preview on Ctrl-Enter. This only works on the built-in |
| 727 | 733 | // editor widget, not a client-provided one. |
| 728 | 734 | P.e.taEditor.addEventListener('keydown',function(ev){ |
| 729 | - if(ev.shiftKey && 13 === ev.keyCode){ | |
| 735 | + if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){ | |
| 730 | 736 | ev.preventDefault(); |
| 731 | 737 | ev.stopPropagation(); |
| 732 | 738 | P.e.taEditor.blur(/*force change event, if needed*/); |
| 733 | 739 | P.tabs.switchToTab(P.e.tabs.preview); |
| 734 | 740 | if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */ |
| @@ -845,10 +851,17 @@ | ||
| 845 | 851 | |
| 846 | 852 | P.fileSelectWidget.init(); |
| 847 | 853 | P.stashWidget.init( |
| 848 | 854 | P.e.tabs.content.lastElementChild |
| 849 | 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; | |
| 850 | 863 | }/*F.onPageLoad()*/); |
| 851 | 864 | |
| 852 | 865 | /** |
| 853 | 866 | Getter (if called with no args) or setter (if passed an arg) for |
| 854 | 867 | the current file content. |
| 855 | 868 |
| --- 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 |
+15
-2
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -70,11 +70,17 @@ | ||
| 70 | 70 | const E = (s)=>document.querySelector(s), |
| 71 | 71 | D = F.dom, |
| 72 | 72 | P = F.page; |
| 73 | 73 | |
| 74 | 74 | 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) | |
| 76 | 82 | }; |
| 77 | 83 | |
| 78 | 84 | /** |
| 79 | 85 | $stash is an internal-use-only object for managing "stashed" |
| 80 | 86 | local edits, to help avoid that users accidentally lose content |
| @@ -724,11 +730,11 @@ | ||
| 724 | 730 | ); |
| 725 | 731 | //////////////////////////////////////////////////////////// |
| 726 | 732 | // Trigger preview on Ctrl-Enter. This only works on the built-in |
| 727 | 733 | // editor widget, not a client-provided one. |
| 728 | 734 | P.e.taEditor.addEventListener('keydown',function(ev){ |
| 729 | - if(ev.shiftKey && 13 === ev.keyCode){ | |
| 735 | + if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){ | |
| 730 | 736 | ev.preventDefault(); |
| 731 | 737 | ev.stopPropagation(); |
| 732 | 738 | P.e.taEditor.blur(/*force change event, if needed*/); |
| 733 | 739 | P.tabs.switchToTab(P.e.tabs.preview); |
| 734 | 740 | if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */ |
| @@ -845,10 +851,17 @@ | ||
| 845 | 851 | |
| 846 | 852 | P.fileSelectWidget.init(); |
| 847 | 853 | P.stashWidget.init( |
| 848 | 854 | P.e.tabs.content.lastElementChild |
| 849 | 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; | |
| 850 | 863 | }/*F.onPageLoad()*/); |
| 851 | 864 | |
| 852 | 865 | /** |
| 853 | 866 | Getter (if called with no args) or setter (if passed an arg) for |
| 854 | 867 | the current file content. |
| 855 | 868 |
| --- 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 |
+25
-5
| --- src/fossil.page.wikiedit.js | ||
| +++ src/fossil.page.wikiedit.js | ||
| @@ -75,11 +75,24 @@ | ||
| 75 | 75 | "confirmer" step, else they will not. The confirmer topic has |
| 76 | 76 | been the source of much contention in the forum. */ |
| 77 | 77 | save: false, |
| 78 | 78 | reload: true, |
| 79 | 79 | 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) | |
| 81 | 94 | }; |
| 82 | 95 | |
| 83 | 96 | /** |
| 84 | 97 | $stash is an internal-use-only object for managing "stashed" |
| 85 | 98 | local edits, to help avoid that users accidentally lose content |
| @@ -454,11 +467,11 @@ | ||
| 454 | 467 | self._refreshStashMarks(opt); |
| 455 | 468 | }); |
| 456 | 469 | D.enable(sel); |
| 457 | 470 | if(P.winfo) sel.value = P.winfo.name; |
| 458 | 471 | }, |
| 459 | - | |
| 472 | + | |
| 460 | 473 | /** Loads the page list and populates the selection list. */ |
| 461 | 474 | loadList: function callee(){ |
| 462 | 475 | if(!callee.onload){ |
| 463 | 476 | const self = this; |
| 464 | 477 | callee.onload = function(list){ |
| @@ -651,11 +664,11 @@ | ||
| 651 | 664 | D.append( |
| 652 | 665 | parentElem, |
| 653 | 666 | D.append(D.addClass(D.div(), 'fieldset-wrapper'), |
| 654 | 667 | fsFilter, fsNewPage, fsLegend) |
| 655 | 668 | ); |
| 656 | - | |
| 669 | + | |
| 657 | 670 | D.append(parentElem, btn); |
| 658 | 671 | btn.addEventListener('click', ()=>this.loadList(), false); |
| 659 | 672 | this.loadList(); |
| 660 | 673 | const onSelect = (e)=>P.loadPage(e.target.value); |
| 661 | 674 | sel.addEventListener('change', onSelect, false); |
| @@ -674,12 +687,19 @@ | ||
| 674 | 687 | self._refreshStashMarks(opt); |
| 675 | 688 | }else if('sandbox'!==page.type){ |
| 676 | 689 | F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name); |
| 677 | 690 | } |
| 678 | 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; | |
| 679 | 699 | delete this.init; |
| 680 | - } | |
| 700 | + }/*init()*/ | |
| 681 | 701 | }; |
| 682 | 702 | |
| 683 | 703 | /** |
| 684 | 704 | Widget for listing and selecting $stash entries. |
| 685 | 705 | */ |
| @@ -914,11 +934,11 @@ | ||
| 914 | 934 | ); |
| 915 | 935 | //////////////////////////////////////////////////////////// |
| 916 | 936 | // Trigger preview on Ctrl-Enter. This only works on the built-in |
| 917 | 937 | // editor widget, not a client-provided one. |
| 918 | 938 | P.e.taEditor.addEventListener('keydown',function(ev){ |
| 919 | - if(ev.shiftKey && 13 === ev.keyCode){ | |
| 939 | + if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){ | |
| 920 | 940 | ev.preventDefault(); |
| 921 | 941 | ev.stopPropagation(); |
| 922 | 942 | P.e.taEditor.blur(/*force change event, if needed*/); |
| 923 | 943 | P.tabs.switchToTab(P.e.tabs.preview); |
| 924 | 944 | if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */ |
| 925 | 945 |
| --- 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 |
+25
-5
| --- src/fossil.page.wikiedit.js | ||
| +++ src/fossil.page.wikiedit.js | ||
| @@ -75,11 +75,24 @@ | ||
| 75 | 75 | "confirmer" step, else they will not. The confirmer topic has |
| 76 | 76 | been the source of much contention in the forum. */ |
| 77 | 77 | save: false, |
| 78 | 78 | reload: true, |
| 79 | 79 | 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) | |
| 81 | 94 | }; |
| 82 | 95 | |
| 83 | 96 | /** |
| 84 | 97 | $stash is an internal-use-only object for managing "stashed" |
| 85 | 98 | local edits, to help avoid that users accidentally lose content |
| @@ -454,11 +467,11 @@ | ||
| 454 | 467 | self._refreshStashMarks(opt); |
| 455 | 468 | }); |
| 456 | 469 | D.enable(sel); |
| 457 | 470 | if(P.winfo) sel.value = P.winfo.name; |
| 458 | 471 | }, |
| 459 | - | |
| 472 | + | |
| 460 | 473 | /** Loads the page list and populates the selection list. */ |
| 461 | 474 | loadList: function callee(){ |
| 462 | 475 | if(!callee.onload){ |
| 463 | 476 | const self = this; |
| 464 | 477 | callee.onload = function(list){ |
| @@ -651,11 +664,11 @@ | ||
| 651 | 664 | D.append( |
| 652 | 665 | parentElem, |
| 653 | 666 | D.append(D.addClass(D.div(), 'fieldset-wrapper'), |
| 654 | 667 | fsFilter, fsNewPage, fsLegend) |
| 655 | 668 | ); |
| 656 | - | |
| 669 | + | |
| 657 | 670 | D.append(parentElem, btn); |
| 658 | 671 | btn.addEventListener('click', ()=>this.loadList(), false); |
| 659 | 672 | this.loadList(); |
| 660 | 673 | const onSelect = (e)=>P.loadPage(e.target.value); |
| 661 | 674 | sel.addEventListener('change', onSelect, false); |
| @@ -674,12 +687,19 @@ | ||
| 674 | 687 | self._refreshStashMarks(opt); |
| 675 | 688 | }else if('sandbox'!==page.type){ |
| 676 | 689 | F.error("BUG: internal mis-handling of page object: missing OPTION for page "+page.name); |
| 677 | 690 | } |
| 678 | 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; | |
| 679 | 699 | delete this.init; |
| 680 | - } | |
| 700 | + }/*init()*/ | |
| 681 | 701 | }; |
| 682 | 702 | |
| 683 | 703 | /** |
| 684 | 704 | Widget for listing and selecting $stash entries. |
| 685 | 705 | */ |
| @@ -914,11 +934,11 @@ | ||
| 914 | 934 | ); |
| 915 | 935 | //////////////////////////////////////////////////////////// |
| 916 | 936 | // Trigger preview on Ctrl-Enter. This only works on the built-in |
| 917 | 937 | // editor widget, not a client-provided one. |
| 918 | 938 | P.e.taEditor.addEventListener('keydown',function(ev){ |
| 919 | - if(ev.shiftKey && 13 === ev.keyCode){ | |
| 939 | + if(P.config.shiftEnterPreview && ev.shiftKey && 13===ev.keyCode){ | |
| 920 | 940 | ev.preventDefault(); |
| 921 | 941 | ev.stopPropagation(); |
| 922 | 942 | P.e.taEditor.blur(/*force change event, if needed*/); |
| 923 | 943 | P.tabs.switchToTab(P.e.tabs.preview); |
| 924 | 944 | if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */ |
| 925 | 945 |
| --- 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 |
+4
-2
| --- src/style.fileedit.css | ||
| +++ src/style.fileedit.css | ||
| @@ -76,10 +76,13 @@ | ||
| 76 | 76 | body.fileedit #fileedit-tab-preview-wrapper > pre { |
| 77 | 77 | margin: 0; |
| 78 | 78 | } |
| 79 | 79 | body.fileedit #fileedit-tab-fileselect > h1 { |
| 80 | 80 | margin: 0; |
| 81 | +} | |
| 82 | +body.fileedit .fileedit-options > div > * { | |
| 83 | + margin: 0.25em; | |
| 81 | 84 | } |
| 82 | 85 | body.fileedit .fileedit-options.commit-message > div { |
| 83 | 86 | display: flex; |
| 84 | 87 | flex-direction: column; |
| 85 | 88 | align-items: stretch; |
| @@ -105,12 +108,11 @@ | ||
| 105 | 108 | body.fileedit .tab-container > .tabs > .tab-panel > .fileedit-options > input { |
| 106 | 109 | vertical-align: middle; |
| 107 | 110 | margin: 0.5em; |
| 108 | 111 | } |
| 109 | 112 | 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; | |
| 112 | 114 | } |
| 113 | 115 | body.fileedit .fileedit-options > div > * { |
| 114 | 116 | margin: 0.25em; |
| 115 | 117 | } |
| 116 | 118 | body.fileedit .fileedit-options.flex-container.flex-row { |
| 117 | 119 |
| --- 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 @@ | ||
| 43 | 43 | body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > input { |
| 44 | 44 | vertical-align: middle; |
| 45 | 45 | margin: 0.5em; |
| 46 | 46 | } |
| 47 | 47 | body.wikiedit .tab-container > .tabs > .tab-panel > .wikiedit-options > .input-with-label { |
| 48 | - vertical-align: middle; | |
| 49 | 48 | margin: 0 0.5em 0.25em 0.5em; |
| 50 | 49 | } |
| 51 | 50 | body.wikiedit label { |
| 52 | 51 | display: inline; /* some skins set label display to block! */ |
| 53 | 52 | } |
| 54 | 53 |
| --- 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 @@ | ||
| 1247 | 1247 | "connections)."); |
| 1248 | 1248 | return; |
| 1249 | 1249 | } |
| 1250 | 1250 | pRoute->xCallback(); |
| 1251 | 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 | +} | |
| 1252 | 1268 | |
| 1253 | 1269 | /* |
| 1254 | 1270 | ** WEBPAGE: wikiedit |
| 1255 | 1271 | ** URL: /wikedit?name=PAGENAME |
| 1256 | 1272 | ** |
| @@ -1311,11 +1327,11 @@ | ||
| 1311 | 1327 | |
| 1312 | 1328 | CX("<div id='wikiedit-edit-status''>" |
| 1313 | 1329 | "<span class='name'></span>" |
| 1314 | 1330 | "<span class='links'></span>" |
| 1315 | 1331 | "</div>"); |
| 1316 | - | |
| 1332 | + | |
| 1317 | 1333 | /* Main tab container... */ |
| 1318 | 1334 | CX("<div id='wikiedit-tabs' class='tab-container'>Loading...</div>"); |
| 1319 | 1335 | /* The .hidden class on the following tab elements is to help lessen |
| 1320 | 1336 | the FOUC effect of the tabs before JS re-assembles them. */ |
| 1321 | 1337 | |
| @@ -1371,11 +1387,11 @@ | ||
| 1371 | 1387 | "any local edits. To help avoid accidental loss of " |
| 1372 | 1388 | "edits, it requires confirmation (a second click) within " |
| 1373 | 1389 | "a few seconds or it will not reload." |
| 1374 | 1390 | "</div>" |
| 1375 | 1391 | "</div>"); |
| 1376 | - | |
| 1392 | + wikiedit_emit_toggle_preview(); | |
| 1377 | 1393 | CX("</div>"); |
| 1378 | 1394 | CX("<div class='flex-container flex-column stretch'>"); |
| 1379 | 1395 | CX("<textarea name='content' id='wikiedit-content-editor' " |
| 1380 | 1396 | "class='wikiedit' rows='25'>"); |
| 1381 | 1397 | CX("</textarea>"); |
| 1382 | 1398 |
| --- 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 |