Fossil SCM
Consolidated /wikiedit, /pikchrshow, /fileedit, and /chat to use shift-enter to run preview mode. The former 3 previously used ctrl-enter but it was poorly documented and probably not widely used like ctrl-enter is in chat (to send a message).
Commit
13fabf3f4d87d0016fc97bb0035273c1e0f8785fe433db74ba63c083d6c49aef
Parent
000f80213eb639b…
8 files changed
+12
-4
+22
-17
+2
-2
+3
-2
+2
-2
+1
-1
+3
+5
+12
-4
| --- src/chat.c | ||
| +++ src/chat.c | ||
| @@ -142,35 +142,42 @@ | ||
| 142 | 142 | ** send new chat message, delete older messages, or poll for changes. |
| 143 | 143 | */ |
| 144 | 144 | void chat_webpage(void){ |
| 145 | 145 | char *zAlert; |
| 146 | 146 | char *zProjectName; |
| 147 | + const char * zInputPlaceholder1 = /* Placeholder for 1-line input */ | |
| 148 | + "Enter sends and Shift-Enter previews."; | |
| 149 | + const char * zInputPlaceholder2 = /* Placeholder for textarea input*/ | |
| 150 | + "Ctrl-Enter sends and Shift-Enter previews."; | |
| 151 | + char * zInputPlaceholder0; /* Common text input placeholder value */ | |
| 147 | 152 | login_check_credentials(); |
| 148 | 153 | if( !g.perm.Chat ){ |
| 149 | 154 | login_needed(g.anon.Chat); |
| 150 | 155 | return; |
| 151 | 156 | } |
| 152 | 157 | zAlert = mprintf("%s/builtin/%s", g.zBaseURL, |
| 153 | 158 | db_get("chat-alert-sound","alerts/plunk.wav")); |
| 154 | 159 | zProjectName = db_get("project-name","Unnamed project"); |
| 160 | + zInputPlaceholder0 = | |
| 161 | + mprintf("Type markdown-formatted message for %h.", zProjectName); | |
| 155 | 162 | style_set_current_feature("chat"); |
| 156 | 163 | style_header("Chat"); |
| 157 | 164 | @ <div id='chat-input-area'> |
| 158 | 165 | @ <div id='chat-input-line' class='single-line'> |
| 159 | 166 | @ <input type="text" name="msg" id="chat-input-single" \ |
| 160 | - @ placeholder="Type markdown-formatted message for %h(zProjectName)." \ | |
| 167 | + @ placeholder="%h(zInputPlaceholder0) %h(zInputPlaceholder1)" \ | |
| 161 | 168 | @ autocomplete="off"> |
| 162 | 169 | @ <textarea rows="8" id="chat-input-multi" \ |
| 163 | - @ placeholder="Type markdown-formatted message for %h(zProjectName). Ctrl-Enter sends it." \ | |
| 170 | + @ placeholder="%h(zInputPlaceholder0) %h(zInputPlaceholder2)" \ | |
| 164 | 171 | @ class="hidden"></textarea> |
| 165 | 172 | @ <div id='chat-edit-buttons'> |
| 166 | 173 | @ <button id="chat-preview-button" \ |
| 167 | - @ title="Preview message">👁</button> | |
| 174 | + @ title="Preview message (Shift-Enter)">👁</button> | |
| 168 | 175 | @ <button id="chat-settings-button" \ |
| 169 | 176 | @ title="Configure chat">⚙</button> |
| 170 | 177 | @ <button id="chat-message-submit" \ |
| 171 | - @ title="Send message">📤</button> | |
| 178 | + @ title="Send message (Ctrl-Enter)">📤</button> | |
| 172 | 179 | @ </div> |
| 173 | 180 | @ </div> |
| 174 | 181 | @ <div id='chat-input-file-area'> |
| 175 | 182 | @ <div class='file-selection-wrapper'> |
| 176 | 183 | @ <div class='help-buttonlet'> |
| @@ -209,10 +216,11 @@ | ||
| 209 | 216 | @ <div id='chat-messages-wrapper' class='chat-view'> |
| 210 | 217 | /* New chat messages get inserted immediately after this element */ |
| 211 | 218 | @ <span id='message-inject-point'></span> |
| 212 | 219 | @ </div> |
| 213 | 220 | fossil_free(zProjectName); |
| 221 | + fossil_free(zInputPlaceholder0); | |
| 214 | 222 | builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch", |
| 215 | 223 | "pikchr", "confirmer", NULL); |
| 216 | 224 | /* Always in-line the javascript for the chat page */ |
| 217 | 225 | @ <script nonce="%h(style_nonce())">/* chat.c:%d(__LINE__) */ |
| 218 | 226 | /* We need an onload handler to ensure that window.fossil is |
| 219 | 227 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -142,35 +142,42 @@ | |
| 142 | ** send new chat message, delete older messages, or poll for changes. |
| 143 | */ |
| 144 | void chat_webpage(void){ |
| 145 | char *zAlert; |
| 146 | char *zProjectName; |
| 147 | login_check_credentials(); |
| 148 | if( !g.perm.Chat ){ |
| 149 | login_needed(g.anon.Chat); |
| 150 | return; |
| 151 | } |
| 152 | zAlert = mprintf("%s/builtin/%s", g.zBaseURL, |
| 153 | db_get("chat-alert-sound","alerts/plunk.wav")); |
| 154 | zProjectName = db_get("project-name","Unnamed project"); |
| 155 | style_set_current_feature("chat"); |
| 156 | style_header("Chat"); |
| 157 | @ <div id='chat-input-area'> |
| 158 | @ <div id='chat-input-line' class='single-line'> |
| 159 | @ <input type="text" name="msg" id="chat-input-single" \ |
| 160 | @ placeholder="Type markdown-formatted message for %h(zProjectName)." \ |
| 161 | @ autocomplete="off"> |
| 162 | @ <textarea rows="8" id="chat-input-multi" \ |
| 163 | @ placeholder="Type markdown-formatted message for %h(zProjectName). Ctrl-Enter sends it." \ |
| 164 | @ class="hidden"></textarea> |
| 165 | @ <div id='chat-edit-buttons'> |
| 166 | @ <button id="chat-preview-button" \ |
| 167 | @ title="Preview message">👁</button> |
| 168 | @ <button id="chat-settings-button" \ |
| 169 | @ title="Configure chat">⚙</button> |
| 170 | @ <button id="chat-message-submit" \ |
| 171 | @ title="Send message">📤</button> |
| 172 | @ </div> |
| 173 | @ </div> |
| 174 | @ <div id='chat-input-file-area'> |
| 175 | @ <div class='file-selection-wrapper'> |
| 176 | @ <div class='help-buttonlet'> |
| @@ -209,10 +216,11 @@ | |
| 209 | @ <div id='chat-messages-wrapper' class='chat-view'> |
| 210 | /* New chat messages get inserted immediately after this element */ |
| 211 | @ <span id='message-inject-point'></span> |
| 212 | @ </div> |
| 213 | fossil_free(zProjectName); |
| 214 | builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch", |
| 215 | "pikchr", "confirmer", NULL); |
| 216 | /* Always in-line the javascript for the chat page */ |
| 217 | @ <script nonce="%h(style_nonce())">/* chat.c:%d(__LINE__) */ |
| 218 | /* We need an onload handler to ensure that window.fossil is |
| 219 |
| --- src/chat.c | |
| +++ src/chat.c | |
| @@ -142,35 +142,42 @@ | |
| 142 | ** send new chat message, delete older messages, or poll for changes. |
| 143 | */ |
| 144 | void chat_webpage(void){ |
| 145 | char *zAlert; |
| 146 | char *zProjectName; |
| 147 | const char * zInputPlaceholder1 = /* Placeholder for 1-line input */ |
| 148 | "Enter sends and Shift-Enter previews."; |
| 149 | const char * zInputPlaceholder2 = /* Placeholder for textarea input*/ |
| 150 | "Ctrl-Enter sends and Shift-Enter previews."; |
| 151 | char * zInputPlaceholder0; /* Common text input placeholder value */ |
| 152 | login_check_credentials(); |
| 153 | if( !g.perm.Chat ){ |
| 154 | login_needed(g.anon.Chat); |
| 155 | return; |
| 156 | } |
| 157 | zAlert = mprintf("%s/builtin/%s", g.zBaseURL, |
| 158 | db_get("chat-alert-sound","alerts/plunk.wav")); |
| 159 | zProjectName = db_get("project-name","Unnamed project"); |
| 160 | zInputPlaceholder0 = |
| 161 | mprintf("Type markdown-formatted message for %h.", zProjectName); |
| 162 | style_set_current_feature("chat"); |
| 163 | style_header("Chat"); |
| 164 | @ <div id='chat-input-area'> |
| 165 | @ <div id='chat-input-line' class='single-line'> |
| 166 | @ <input type="text" name="msg" id="chat-input-single" \ |
| 167 | @ placeholder="%h(zInputPlaceholder0) %h(zInputPlaceholder1)" \ |
| 168 | @ autocomplete="off"> |
| 169 | @ <textarea rows="8" id="chat-input-multi" \ |
| 170 | @ placeholder="%h(zInputPlaceholder0) %h(zInputPlaceholder2)" \ |
| 171 | @ class="hidden"></textarea> |
| 172 | @ <div id='chat-edit-buttons'> |
| 173 | @ <button id="chat-preview-button" \ |
| 174 | @ title="Preview message (Shift-Enter)">👁</button> |
| 175 | @ <button id="chat-settings-button" \ |
| 176 | @ title="Configure chat">⚙</button> |
| 177 | @ <button id="chat-message-submit" \ |
| 178 | @ title="Send message (Ctrl-Enter)">📤</button> |
| 179 | @ </div> |
| 180 | @ </div> |
| 181 | @ <div id='chat-input-file-area'> |
| 182 | @ <div class='file-selection-wrapper'> |
| 183 | @ <div class='help-buttonlet'> |
| @@ -209,10 +216,11 @@ | |
| 216 | @ <div id='chat-messages-wrapper' class='chat-view'> |
| 217 | /* New chat messages get inserted immediately after this element */ |
| 218 | @ <span id='message-inject-point'></span> |
| 219 | @ </div> |
| 220 | fossil_free(zProjectName); |
| 221 | fossil_free(zInputPlaceholder0); |
| 222 | builtin_fossil_js_bundle_or("popupwidget", "storage", "fetch", |
| 223 | "pikchr", "confirmer", NULL); |
| 224 | /* Always in-line the javascript for the chat page */ |
| 225 | @ <script nonce="%h(style_nonce())">/* chat.c:%d(__LINE__) */ |
| 226 | /* We need an onload handler to ensure that window.fossil is |
| 227 |
+22
-17
| --- src/fossil.page.chat.js | ||
| +++ src/fossil.page.chat.js | ||
| @@ -202,11 +202,10 @@ | ||
| 202 | 202 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 203 | 203 | const mh2 = m.clientHeight; |
| 204 | 204 | m.scrollTo(0, sTop + (mh1-mh2)); |
| 205 | 205 | this.e.inputCurrent.value = old.value; |
| 206 | 206 | old.value = ''; |
| 207 | - this.animate(this.e.inputCurrent, "anim-flip-v"); | |
| 208 | 207 | return this; |
| 209 | 208 | }, |
| 210 | 209 | /** |
| 211 | 210 | If passed true or no arguments, switches to multi-line mode |
| 212 | 211 | if currently in single-line mode. If passed false, switches |
| @@ -1195,26 +1194,32 @@ | ||
| 1195 | 1194 | }); |
| 1196 | 1195 | BlobXferState.clear(); |
| 1197 | 1196 | Chat.inputValue("").inputFocus(); |
| 1198 | 1197 | }; |
| 1199 | 1198 | |
| 1200 | - Chat.e.inputSingle.addEventListener('keydown',function(ev){ | |
| 1201 | - if(13===ev.keyCode/*ENTER*/){ | |
| 1202 | - ev.preventDefault(); | |
| 1203 | - ev.stopPropagation(); | |
| 1204 | - Chat.submitMessage(); | |
| 1205 | - return false; | |
| 1206 | - } | |
| 1207 | - }, false); | |
| 1208 | - Chat.e.inputMulti.addEventListener('keydown',function(ev){ | |
| 1209 | - if(ev.ctrlKey && 13 === ev.keyCode){ | |
| 1210 | - ev.preventDefault(); | |
| 1211 | - ev.stopPropagation(); | |
| 1212 | - Chat.submitMessage(); | |
| 1213 | - return false; | |
| 1214 | - } | |
| 1215 | - }, false); | |
| 1199 | + const inputWidgetKeydown = function(ev){ | |
| 1200 | + if(13 === ev.keyCode){ | |
| 1201 | + if(ev.shiftKey){ | |
| 1202 | + ev.preventDefault(); | |
| 1203 | + ev.stopPropagation(); | |
| 1204 | + Chat.e.btnPreview.click(); | |
| 1205 | + return false; | |
| 1206 | + }else if((Chat.e.inputSingle===ev.target) | |
| 1207 | + || (ev.ctrlKey && Chat.e.inputMulti===ev.target)){ | |
| 1208 | + /* ^^^ note that it is intended that both ctrl-enter and enter | |
| 1209 | + work for single-line input mode. */ | |
| 1210 | + ev.preventDefault(); | |
| 1211 | + ev.stopPropagation(); | |
| 1212 | + Chat.submitMessage(); | |
| 1213 | + return false; | |
| 1214 | + } | |
| 1215 | + } | |
| 1216 | + }; | |
| 1217 | + Chat.e.inputSingle | |
| 1218 | + .addEventListener('keydown', inputWidgetKeydown, false); | |
| 1219 | + Chat.e.inputMulti | |
| 1220 | + .addEventListener('keydown', inputWidgetKeydown, false); | |
| 1216 | 1221 | Chat.e.btnSubmit.addEventListener('click',(e)=>{ |
| 1217 | 1222 | e.preventDefault(); |
| 1218 | 1223 | Chat.submitMessage(); |
| 1219 | 1224 | return false; |
| 1220 | 1225 | }); |
| 1221 | 1226 |
| --- src/fossil.page.chat.js | |
| +++ src/fossil.page.chat.js | |
| @@ -202,11 +202,10 @@ | |
| 202 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 203 | const mh2 = m.clientHeight; |
| 204 | m.scrollTo(0, sTop + (mh1-mh2)); |
| 205 | this.e.inputCurrent.value = old.value; |
| 206 | old.value = ''; |
| 207 | this.animate(this.e.inputCurrent, "anim-flip-v"); |
| 208 | return this; |
| 209 | }, |
| 210 | /** |
| 211 | If passed true or no arguments, switches to multi-line mode |
| 212 | if currently in single-line mode. If passed false, switches |
| @@ -1195,26 +1194,32 @@ | |
| 1195 | }); |
| 1196 | BlobXferState.clear(); |
| 1197 | Chat.inputValue("").inputFocus(); |
| 1198 | }; |
| 1199 | |
| 1200 | Chat.e.inputSingle.addEventListener('keydown',function(ev){ |
| 1201 | if(13===ev.keyCode/*ENTER*/){ |
| 1202 | ev.preventDefault(); |
| 1203 | ev.stopPropagation(); |
| 1204 | Chat.submitMessage(); |
| 1205 | return false; |
| 1206 | } |
| 1207 | }, false); |
| 1208 | Chat.e.inputMulti.addEventListener('keydown',function(ev){ |
| 1209 | if(ev.ctrlKey && 13 === ev.keyCode){ |
| 1210 | ev.preventDefault(); |
| 1211 | ev.stopPropagation(); |
| 1212 | Chat.submitMessage(); |
| 1213 | return false; |
| 1214 | } |
| 1215 | }, false); |
| 1216 | Chat.e.btnSubmit.addEventListener('click',(e)=>{ |
| 1217 | e.preventDefault(); |
| 1218 | Chat.submitMessage(); |
| 1219 | return false; |
| 1220 | }); |
| 1221 |
| --- src/fossil.page.chat.js | |
| +++ src/fossil.page.chat.js | |
| @@ -202,11 +202,10 @@ | |
| 202 | D.removeClass(this.e.inputCurrent, 'hidden'); |
| 203 | const mh2 = m.clientHeight; |
| 204 | m.scrollTo(0, sTop + (mh1-mh2)); |
| 205 | this.e.inputCurrent.value = old.value; |
| 206 | old.value = ''; |
| 207 | return this; |
| 208 | }, |
| 209 | /** |
| 210 | If passed true or no arguments, switches to multi-line mode |
| 211 | if currently in single-line mode. If passed false, switches |
| @@ -1195,26 +1194,32 @@ | |
| 1194 | }); |
| 1195 | BlobXferState.clear(); |
| 1196 | Chat.inputValue("").inputFocus(); |
| 1197 | }; |
| 1198 | |
| 1199 | const inputWidgetKeydown = function(ev){ |
| 1200 | if(13 === ev.keyCode){ |
| 1201 | if(ev.shiftKey){ |
| 1202 | ev.preventDefault(); |
| 1203 | ev.stopPropagation(); |
| 1204 | Chat.e.btnPreview.click(); |
| 1205 | return false; |
| 1206 | }else if((Chat.e.inputSingle===ev.target) |
| 1207 | || (ev.ctrlKey && Chat.e.inputMulti===ev.target)){ |
| 1208 | /* ^^^ note that it is intended that both ctrl-enter and enter |
| 1209 | work for single-line input mode. */ |
| 1210 | ev.preventDefault(); |
| 1211 | ev.stopPropagation(); |
| 1212 | Chat.submitMessage(); |
| 1213 | return false; |
| 1214 | } |
| 1215 | } |
| 1216 | }; |
| 1217 | Chat.e.inputSingle |
| 1218 | .addEventListener('keydown', inputWidgetKeydown, false); |
| 1219 | Chat.e.inputMulti |
| 1220 | .addEventListener('keydown', inputWidgetKeydown, false); |
| 1221 | Chat.e.btnSubmit.addEventListener('click',(e)=>{ |
| 1222 | e.preventDefault(); |
| 1223 | Chat.submitMessage(); |
| 1224 | return false; |
| 1225 | }); |
| 1226 |
+2
-2
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -724,11 +724,11 @@ | ||
| 724 | 724 | ); |
| 725 | 725 | //////////////////////////////////////////////////////////// |
| 726 | 726 | // Trigger preview on Ctrl-Enter. This only works on the built-in |
| 727 | 727 | // editor widget, not a client-provided one. |
| 728 | 728 | P.e.taEditor.addEventListener('keydown',function(ev){ |
| 729 | - if(ev.ctrlKey && 13 === ev.keyCode){ | |
| 729 | + if(ev.shiftKey && 13 === ev.keyCode){ | |
| 730 | 730 | ev.preventDefault(); |
| 731 | 731 | ev.stopPropagation(); |
| 732 | 732 | P.e.taEditor.blur(/*force change event, if needed*/); |
| 733 | 733 | P.tabs.switchToTab(P.e.tabs.preview); |
| 734 | 734 | if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */ |
| @@ -737,11 +737,11 @@ | ||
| 737 | 737 | return false; |
| 738 | 738 | } |
| 739 | 739 | }, false); |
| 740 | 740 | // If we're in the preview tab, have ctrl-enter switch back to the editor. |
| 741 | 741 | document.body.addEventListener('keydown',function(ev){ |
| 742 | - if(ev.ctrlKey && 13 === ev.keyCode){ | |
| 742 | + if(ev.shiftKey && 13 === ev.keyCode){ | |
| 743 | 743 | if(currentTab === P.e.tabs.preview){ |
| 744 | 744 | ev.preventDefault(); |
| 745 | 745 | ev.stopPropagation(); |
| 746 | 746 | P.tabs.switchToTab(P.e.tabs.content); |
| 747 | 747 | P.e.taEditor.focus(/*doesn't work for client-supplied editor widget! |
| 748 | 748 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -724,11 +724,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.ctrlKey && 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. */ |
| @@ -737,11 +737,11 @@ | |
| 737 | return false; |
| 738 | } |
| 739 | }, false); |
| 740 | // If we're in the preview tab, have ctrl-enter switch back to the editor. |
| 741 | document.body.addEventListener('keydown',function(ev){ |
| 742 | if(ev.ctrlKey && 13 === ev.keyCode){ |
| 743 | if(currentTab === P.e.tabs.preview){ |
| 744 | ev.preventDefault(); |
| 745 | ev.stopPropagation(); |
| 746 | P.tabs.switchToTab(P.e.tabs.content); |
| 747 | P.e.taEditor.focus(/*doesn't work for client-supplied editor widget! |
| 748 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -724,11 +724,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. */ |
| @@ -737,11 +737,11 @@ | |
| 737 | return false; |
| 738 | } |
| 739 | }, false); |
| 740 | // If we're in the preview tab, have ctrl-enter switch back to the editor. |
| 741 | document.body.addEventListener('keydown',function(ev){ |
| 742 | if(ev.shiftKey && 13 === ev.keyCode){ |
| 743 | if(currentTab === P.e.tabs.preview){ |
| 744 | ev.preventDefault(); |
| 745 | ev.stopPropagation(); |
| 746 | P.tabs.switchToTab(P.e.tabs.content); |
| 747 | P.e.taEditor.focus(/*doesn't work for client-supplied editor widget! |
| 748 |
+3
-2
| --- src/fossil.page.pikchrshow.js | ||
| +++ src/fossil.page.pikchrshow.js | ||
| @@ -98,13 +98,13 @@ | ||
| 98 | 98 | P.e.previewCopyButton, |
| 99 | 99 | P.e.previewModeLabel, |
| 100 | 100 | P.e.markupAlignWrapper ); |
| 101 | 101 | |
| 102 | 102 | //////////////////////////////////////////////////////////// |
| 103 | - // Trigger preview on Ctrl-Enter. | |
| 103 | + // Trigger preview on Shift-Enter. | |
| 104 | 104 | P.e.taContent.addEventListener('keydown',function(ev){ |
| 105 | - if(ev.ctrlKey && 13 === ev.keyCode){ | |
| 105 | + if(ev.shiftKey && 13 === ev.keyCode){ | |
| 106 | 106 | ev.preventDefault(); |
| 107 | 107 | ev.stopPropagation(); |
| 108 | 108 | P.preview(); |
| 109 | 109 | return false; |
| 110 | 110 | } |
| @@ -390,10 +390,11 @@ | ||
| 390 | 390 | } |
| 391 | 391 | D.append(D.clearElement(preTgt), this.e.taPreviewText); |
| 392 | 392 | break; |
| 393 | 393 | } |
| 394 | 394 | this.e.previewModeLabel.innerText = label; |
| 395 | + this.e.taContent.focus(/*not sure why this gets lost on preview!*/); | |
| 395 | 396 | }; |
| 396 | 397 | |
| 397 | 398 | /** |
| 398 | 399 | Fetches the preview from the server and updates the preview to |
| 399 | 400 | the rendered SVG content or error report. |
| 400 | 401 |
| --- src/fossil.page.pikchrshow.js | |
| +++ src/fossil.page.pikchrshow.js | |
| @@ -98,13 +98,13 @@ | |
| 98 | P.e.previewCopyButton, |
| 99 | P.e.previewModeLabel, |
| 100 | P.e.markupAlignWrapper ); |
| 101 | |
| 102 | //////////////////////////////////////////////////////////// |
| 103 | // Trigger preview on Ctrl-Enter. |
| 104 | P.e.taContent.addEventListener('keydown',function(ev){ |
| 105 | if(ev.ctrlKey && 13 === ev.keyCode){ |
| 106 | ev.preventDefault(); |
| 107 | ev.stopPropagation(); |
| 108 | P.preview(); |
| 109 | return false; |
| 110 | } |
| @@ -390,10 +390,11 @@ | |
| 390 | } |
| 391 | D.append(D.clearElement(preTgt), this.e.taPreviewText); |
| 392 | break; |
| 393 | } |
| 394 | this.e.previewModeLabel.innerText = label; |
| 395 | }; |
| 396 | |
| 397 | /** |
| 398 | Fetches the preview from the server and updates the preview to |
| 399 | the rendered SVG content or error report. |
| 400 |
| --- src/fossil.page.pikchrshow.js | |
| +++ src/fossil.page.pikchrshow.js | |
| @@ -98,13 +98,13 @@ | |
| 98 | P.e.previewCopyButton, |
| 99 | P.e.previewModeLabel, |
| 100 | P.e.markupAlignWrapper ); |
| 101 | |
| 102 | //////////////////////////////////////////////////////////// |
| 103 | // Trigger preview on Shift-Enter. |
| 104 | P.e.taContent.addEventListener('keydown',function(ev){ |
| 105 | if(ev.shiftKey && 13 === ev.keyCode){ |
| 106 | ev.preventDefault(); |
| 107 | ev.stopPropagation(); |
| 108 | P.preview(); |
| 109 | return false; |
| 110 | } |
| @@ -390,10 +390,11 @@ | |
| 390 | } |
| 391 | D.append(D.clearElement(preTgt), this.e.taPreviewText); |
| 392 | break; |
| 393 | } |
| 394 | this.e.previewModeLabel.innerText = label; |
| 395 | this.e.taContent.focus(/*not sure why this gets lost on preview!*/); |
| 396 | }; |
| 397 | |
| 398 | /** |
| 399 | Fetches the preview from the server and updates the preview to |
| 400 | the rendered SVG content or error report. |
| 401 |
+2
-2
| --- src/fossil.page.wikiedit.js | ||
| +++ src/fossil.page.wikiedit.js | ||
| @@ -914,11 +914,11 @@ | ||
| 914 | 914 | ); |
| 915 | 915 | //////////////////////////////////////////////////////////// |
| 916 | 916 | // Trigger preview on Ctrl-Enter. This only works on the built-in |
| 917 | 917 | // editor widget, not a client-provided one. |
| 918 | 918 | P.e.taEditor.addEventListener('keydown',function(ev){ |
| 919 | - if(ev.ctrlKey && 13 === ev.keyCode){ | |
| 919 | + if(ev.shiftKey && 13 === ev.keyCode){ | |
| 920 | 920 | ev.preventDefault(); |
| 921 | 921 | ev.stopPropagation(); |
| 922 | 922 | P.e.taEditor.blur(/*force change event, if needed*/); |
| 923 | 923 | P.tabs.switchToTab(P.e.tabs.preview); |
| 924 | 924 | if(!P.e.cbAutoPreview.checked){/* If NOT in auto-preview mode, trigger an update. */ |
| @@ -926,11 +926,11 @@ | ||
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | }, false); |
| 929 | 929 | // If we're in the preview tab, have ctrl-enter switch back to the editor. |
| 930 | 930 | document.body.addEventListener('keydown',function(ev){ |
| 931 | - if(ev.ctrlKey && 13 === ev.keyCode){ | |
| 931 | + if(ev.shiftKey && 13 === ev.keyCode){ | |
| 932 | 932 | if(currentTab === P.e.tabs.preview){ |
| 933 | 933 | ev.preventDefault(); |
| 934 | 934 | ev.stopPropagation(); |
| 935 | 935 | P.tabs.switchToTab(P.e.tabs.content); |
| 936 | 936 | P.e.taEditor.focus(/*doesn't work for client-supplied editor widget! |
| 937 | 937 |
| --- src/fossil.page.wikiedit.js | |
| +++ src/fossil.page.wikiedit.js | |
| @@ -914,11 +914,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.ctrlKey && 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. */ |
| @@ -926,11 +926,11 @@ | |
| 926 | } |
| 927 | } |
| 928 | }, false); |
| 929 | // If we're in the preview tab, have ctrl-enter switch back to the editor. |
| 930 | document.body.addEventListener('keydown',function(ev){ |
| 931 | if(ev.ctrlKey && 13 === ev.keyCode){ |
| 932 | if(currentTab === P.e.tabs.preview){ |
| 933 | ev.preventDefault(); |
| 934 | ev.stopPropagation(); |
| 935 | P.tabs.switchToTab(P.e.tabs.content); |
| 936 | P.e.taEditor.focus(/*doesn't work for client-supplied editor widget! |
| 937 |
| --- src/fossil.page.wikiedit.js | |
| +++ src/fossil.page.wikiedit.js | |
| @@ -914,11 +914,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. */ |
| @@ -926,11 +926,11 @@ | |
| 926 | } |
| 927 | } |
| 928 | }, false); |
| 929 | // If we're in the preview tab, have ctrl-enter switch back to the editor. |
| 930 | document.body.addEventListener('keydown',function(ev){ |
| 931 | if(ev.shiftKey && 13 === ev.keyCode){ |
| 932 | if(currentTab === P.e.tabs.preview){ |
| 933 | ev.preventDefault(); |
| 934 | ev.stopPropagation(); |
| 935 | P.tabs.switchToTab(P.e.tabs.content); |
| 936 | P.e.taEditor.focus(/*doesn't work for client-supplied editor widget! |
| 937 |
+1
-1
| --- src/pikchrshow.c | ||
| +++ src/pikchrshow.c | ||
| @@ -335,11 +335,11 @@ | ||
| 335 | 335 | CX("body.pikchrshow .v-align-middle{" |
| 336 | 336 | "vertical-align: middle" |
| 337 | 337 | "}\n"); |
| 338 | 338 | CX(".dragover {border: 3px dotted rgba(0,255,0,0.6)}\n"); |
| 339 | 339 | } CX("</style>"); |
| 340 | - CX("<div>Input pikchr code and tap Preview (or Ctrl-Enter) to render " | |
| 340 | + CX("<div>Input pikchr code and tap Preview (or Shift-Enter) to render " | |
| 341 | 341 | "it:</div>"); |
| 342 | 342 | CX("<div id='sbs-wrapper'>"); { |
| 343 | 343 | CX("<div id='pikchrshow-form'>"); { |
| 344 | 344 | CX("<textarea id='content' name='content' rows='15'>" |
| 345 | 345 | "%s</textarea>",zContent/*safe-for-%s*/); |
| 346 | 346 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -335,11 +335,11 @@ | |
| 335 | CX("body.pikchrshow .v-align-middle{" |
| 336 | "vertical-align: middle" |
| 337 | "}\n"); |
| 338 | CX(".dragover {border: 3px dotted rgba(0,255,0,0.6)}\n"); |
| 339 | } CX("</style>"); |
| 340 | CX("<div>Input pikchr code and tap Preview (or Ctrl-Enter) to render " |
| 341 | "it:</div>"); |
| 342 | CX("<div id='sbs-wrapper'>"); { |
| 343 | CX("<div id='pikchrshow-form'>"); { |
| 344 | CX("<textarea id='content' name='content' rows='15'>" |
| 345 | "%s</textarea>",zContent/*safe-for-%s*/); |
| 346 |
| --- src/pikchrshow.c | |
| +++ src/pikchrshow.c | |
| @@ -335,11 +335,11 @@ | |
| 335 | CX("body.pikchrshow .v-align-middle{" |
| 336 | "vertical-align: middle" |
| 337 | "}\n"); |
| 338 | CX(".dragover {border: 3px dotted rgba(0,255,0,0.6)}\n"); |
| 339 | } CX("</style>"); |
| 340 | CX("<div>Input pikchr code and tap Preview (or Shift-Enter) to render " |
| 341 | "it:</div>"); |
| 342 | CX("<div id='sbs-wrapper'>"); { |
| 343 | CX("<div id='pikchrshow-form'>"); { |
| 344 | CX("<textarea id='content' name='content' rows='15'>" |
| 345 | "%s</textarea>",zContent/*safe-for-%s*/); |
| 346 |
| --- src/style.fileedit.css | ||
| +++ src/style.fileedit.css | ||
| @@ -70,10 +70,13 @@ | ||
| 70 | 70 | body.fileedit #fileedit-tabs { |
| 71 | 71 | margin: 0.5em 0 0 0; |
| 72 | 72 | } |
| 73 | 73 | body.fileedit #fileedit-tab-preview-wrapper { |
| 74 | 74 | overflow: auto; |
| 75 | +} | |
| 76 | +body.fileedit #fileedit-tab-preview-wrapper > pre { | |
| 77 | + margin: 0; | |
| 75 | 78 | } |
| 76 | 79 | body.fileedit #fileedit-tab-fileselect > h1 { |
| 77 | 80 | margin: 0; |
| 78 | 81 | } |
| 79 | 82 | body.fileedit .fileedit-options.commit-message > div { |
| 80 | 83 |
| --- src/style.fileedit.css | |
| +++ src/style.fileedit.css | |
| @@ -70,10 +70,13 @@ | |
| 70 | body.fileedit #fileedit-tabs { |
| 71 | margin: 0.5em 0 0 0; |
| 72 | } |
| 73 | body.fileedit #fileedit-tab-preview-wrapper { |
| 74 | overflow: auto; |
| 75 | } |
| 76 | body.fileedit #fileedit-tab-fileselect > h1 { |
| 77 | margin: 0; |
| 78 | } |
| 79 | body.fileedit .fileedit-options.commit-message > div { |
| 80 |
| --- src/style.fileedit.css | |
| +++ src/style.fileedit.css | |
| @@ -70,10 +70,13 @@ | |
| 70 | body.fileedit #fileedit-tabs { |
| 71 | margin: 0.5em 0 0 0; |
| 72 | } |
| 73 | body.fileedit #fileedit-tab-preview-wrapper { |
| 74 | overflow: auto; |
| 75 | } |
| 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 |
+5
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -45,10 +45,15 @@ | ||
| 45 | 45 | markdown features, instead of the prior small subset of markup it |
| 46 | 46 | previously supported. This retroactively applies to all chat messages, |
| 47 | 47 | as they are markdown-processed when they are sent instead of when they |
| 48 | 48 | are saved. Added a preview mode so messages can be previewed before |
| 49 | 49 | being sent. See [./chat.md#usage|the chat docs] for more details. |
| 50 | + * The hotkey to activate preview mode in [/help?cmd=/wikiedit|/wikiedit], | |
| 51 | + [/help?cmd=/fileedit|/fileedit], and [/help?cmd=/pikchrshow|/pikchrshow] | |
| 52 | + was changed from ctrl-enter to shift-enter in order to align with | |
| 53 | + [/help?cmd=/chat|/chat]'s new preview feature and related future | |
| 54 | + changes. | |
| 50 | 55 | |
| 51 | 56 | <h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2> |
| 52 | 57 | * <b>Security:</b> Fix the client-side TLS so that it verifies that the |
| 53 | 58 | server hostname matches its certificate. |
| 54 | 59 | * The default "ssh" command on Windows is changed to "ssh" instead of the |
| 55 | 60 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -45,10 +45,15 @@ | |
| 45 | markdown features, instead of the prior small subset of markup it |
| 46 | previously supported. This retroactively applies to all chat messages, |
| 47 | as they are markdown-processed when they are sent instead of when they |
| 48 | are saved. Added a preview mode so messages can be previewed before |
| 49 | being sent. See [./chat.md#usage|the chat docs] for more details. |
| 50 | |
| 51 | <h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2> |
| 52 | * <b>Security:</b> Fix the client-side TLS so that it verifies that the |
| 53 | server hostname matches its certificate. |
| 54 | * The default "ssh" command on Windows is changed to "ssh" instead of the |
| 55 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -45,10 +45,15 @@ | |
| 45 | markdown features, instead of the prior small subset of markup it |
| 46 | previously supported. This retroactively applies to all chat messages, |
| 47 | as they are markdown-processed when they are sent instead of when they |
| 48 | are saved. Added a preview mode so messages can be previewed before |
| 49 | being sent. See [./chat.md#usage|the chat docs] for more details. |
| 50 | * The hotkey to activate preview mode in [/help?cmd=/wikiedit|/wikiedit], |
| 51 | [/help?cmd=/fileedit|/fileedit], and [/help?cmd=/pikchrshow|/pikchrshow] |
| 52 | was changed from ctrl-enter to shift-enter in order to align with |
| 53 | [/help?cmd=/chat|/chat]'s new preview feature and related future |
| 54 | changes. |
| 55 | |
| 56 | <h2 id='v2_16'>Changes for Version 2.16 (2021-07-02)</h2> |
| 57 | * <b>Security:</b> Fix the client-side TLS so that it verifies that the |
| 58 | server hostname matches its certificate. |
| 59 | * The default "ssh" command on Windows is changed to "ssh" instead of the |
| 60 |