Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | The save button now is now moved to the current tab when switching tabs, for the save/preview/diff tabs. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | ajax-wiki-editor |
| Files: | files | file ages | folders |
| SHA3-256: |
acdd76539ca6f9efc5607ecbf86bf625 |
| User & Date: | stephan 2020-07-31 09:57:50.528 |
Context
|
2020-07-31
| ||
| 12:03 | Merge enhancements from trunk into the ajax-wiki-editor branch. ... (check-in: a8cb9b1a7b user: drh tags: ajax-wiki-editor) | |
| 09:57 | The save button now is now moved to the current tab when switching tabs, for the save/preview/diff tabs. ... (check-in: acdd76539c user: stephan tags: ajax-wiki-editor) | |
| 05:14 | Minimize the FOUC effect before the tabs are re-assembed in JS by initially hiding all tabs. ... (check-in: d8f18bc54e user: stephan tags: ajax-wiki-editor) | |
Changes
Changes to src/fossil.page.wikiedit.js.
| ︙ | ︙ | |||
524 525 526 527 528 529 530 |
fsFilter, fsNewPage, fsLegend)
);
D.append(parentElem, btn);
btn.addEventListener('click', ()=>this.loadList(), false);
this.loadList();
sel.addEventListener('change', (e)=>P.loadPage(e.target.value), false);
| | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 |
fsFilter, fsNewPage, fsLegend)
);
D.append(parentElem, btn);
btn.addEventListener('click', ()=>this.loadList(), false);
this.loadList();
sel.addEventListener('change', (e)=>P.loadPage(e.target.value), false);
F.page.addEventListener('wiki-stash-updated', ()=>this.refreshStashMarks());
delete this.init;
}
};
/**
Keep track of how many in-flight AJAX requests there are so we
can disable input elements while any are pending. For
|
| ︙ | ︙ | |||
608 609 610 611 612 613 614 |
tab panels. Seems to be the best fit in terms of
functionality and visibility. */
E('#fossil-status-bar'), P.tabs.e.tabs
);
P.tabs.addEventListener(
/* Set up some before-switch-to tab event tasks... */
'before-switch-to', function(ev){
| > > > > > > > | < | | > | | | 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 |
tab panels. Seems to be the best fit in terms of
functionality and visibility. */
E('#fossil-status-bar'), P.tabs.e.tabs
);
P.tabs.addEventListener(
/* Set up some before-switch-to tab event tasks... */
'before-switch-to', function(ev){
const theTab = ev.detail, btnSlot = theTab.querySelector('.save-button-slot');
if(btnSlot){
/* Several places make sense for a save button, so we'll
move that button around to those tabs where it makes sense. */
btnSlot.parentNode.insertBefore( P.e.btnSave, btnSlot );
P.updateSaveButton();
}
if(theTab===P.e.tabs.preview){
P.baseHrefForWiki();
if(P.previewNeedsUpdate && P.e.cbAutoPreview.checked) P.preview();
}else if(theTab===P.e.tabs.diff){
/* Work around a weird bug where the page gets wider than
the window when the diff tab is NOT in view and the
current SBS diff widget is wider than the window. When
the diff IS in view then CSS overflow magically reduces
the page size again. Weird. Maybe FF-specific. Note that
this weirdness happens even though P.e.diffTarget's parent
is hidden (and therefore P.e.diffTarget is also hidden).
*/
D.removeClass(P.e.diffTarget, 'hidden');
}else if(theTab===P.e.tabs.misc){
P.updateAttachmentView();
}
}
);
P.tabs.addEventListener(
/* Set up auto-refresh of the preview tab... */
'before-switch-from', function(ev){
const theTab = ev.detail;
if(theTab===P.e.tabs.preview){
P.baseHrefRestore();
}else if(theTab===P.e.tabs.diff){
/* See notes in the before-switch-to handler. */
D.addClass(P.e.diffTarget, 'hidden');
}
}
);
F.connectPagePreviewers(
|
| ︙ | ︙ | |||
765 766 767 768 769 770 771 |
if(!winfo.version && winfo.type!=='sandbox'){
F.error('You are editing a new, unsaved page:',winfo.name);
}
P.updatePageTitle();
},
false
);
| > | | 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
if(!winfo.version && winfo.type!=='sandbox'){
F.error('You are editing a new, unsaved page:',winfo.name);
}
P.updatePageTitle();
},
false
);
P.addEventListener('wiki-stash-updated', ()=>P.updateSaveButton())
.updatePageTitle().updateAttachmentView().updateSaveButton();
}/*F.onPageLoad()*/);
/**
Returns true if fossil.page.winfo is set, indicating that a page
has been loaded, else it reports an error and returns false.
If passed a truthy value any error message about not having
|
| ︙ | ︙ |
Changes to src/style.wikiedit.css.
| ︙ | ︙ | |||
102 103 104 105 106 107 108 |
}
body.wikiedit #wikiedit-tab-misc h3 {
margin: 0;
}
body.wikiedit span.mini-tip {
font-size: 80%;
}
| > > > > > > > | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
}
body.wikiedit #wikiedit-tab-misc h3 {
margin: 0;
}
body.wikiedit span.mini-tip {
font-size: 80%;
}
body.wikiedit span.save-button-slot {
/* These invisible placeholders mark spots in the UI
(max. 1 per tab) to where the save button gets
relocated as we switch between tabs. */
display: none;
}
|
Changes to src/wiki.c.
| ︙ | ︙ | |||
1129 1130 1131 1132 1133 1134 1135 |
CX("</div>"/*#wikiedit-tab-pages*/);
}
/******* Content tab *******/
{
CX("<div id='wikiedit-tab-content' "
"data-tab-parent='wikiedit-tabs' "
| | > > > | < > > | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 |
CX("</div>"/*#wikiedit-tab-pages*/);
}
/******* Content tab *******/
{
CX("<div id='wikiedit-tab-content' "
"data-tab-parent='wikiedit-tabs' "
"data-tab-label='Editor' "
"class='hidden'"
">");
CX("<div class='flex-container flex-row child-gap-small'>");
CX("<span class='input-with-label'>"
"<label>Mime type</label>");
mimetype_option_menu(0);
CX("</span>");
style_select_list_int("select-font-size",
"editor_font_size", "Editor font size",
NULL/*tooltip*/,
100,
"100%", 100, "125%", 125,
"150%", 150, "175%", 175,
"200%", 200, NULL);
CX("<button class='wikiedit-content-reload' "
"title='Reload the file from the server, discarding "
"any local edits. To help avoid accidental loss of "
"edits, it requires confirmation (a second click) within "
"a few seconds or it will not reload.'"
">Discard & Reload</button>");
CX("<button class='wikiedit-save' disabled='disabled'>"
"Save</button>"/*will get moved around dynamically*/);
CX("<span class='save-button-slot'></span>");
CX("</div>");
CX("<div class='flex-container flex-column stretch'>");
CX("<textarea name='content' id='wikiedit-content-editor' "
"class='wikiedit' "
"rows='25' cols='80'>");
CX("</textarea>");
CX("</div>"/*textarea wrapper*/);
CX("</div>"/*#tab-file-content*/);
}
/****** Preview tab ******/
{
CX("<div id='wikiedit-tab-preview' "
"data-tab-parent='wikiedit-tabs' "
"data-tab-label='Preview' "
"class='hidden'"
">");
CX("<div class='wikiedit-options flex-container flex-row'>");
CX("<button id='btn-preview-refresh' "
"data-f-preview-from='wikiContent' "
/* ^^^ fossil.page[methodName]() OR text source elem ID,
** but we need a method in order to support clients swapping out
** the text editor with their own. */
"data-f-preview-via='_postPreview' "
/* ^^^ fossil.page[methodName](content, callback) */
"data-f-preview-to='#wikiedit-tab-preview-wrapper' "
/* ^^^ dest elem ID */
">Refresh</button>");
/* Toggle auto-update of preview when the Preview tab is selected. */
style_labeled_checkbox("cb-preview-autoupdate",
NULL,
"Auto-refresh?",
"1", 1,
"If on, the preview will automatically "
"refresh when this tab is selected.");
CX("<span class='save-button-slot'></span>");
CX("</div>"/*.wikiedit-options*/);
CX("<div id='wikiedit-tab-preview-wrapper'></div>");
CX("</div>"/*#wikiedit-tab-preview*/);
}
/****** Diff tab ******/
{
CX("<div id='wikiedit-tab-diff' "
"data-tab-parent='wikiedit-tabs' "
"data-tab-label='Diff' "
"class='hidden'"
">");
CX("<div class='wikiedit-options flex-container flex-row' "
"id='wikiedit-tab-diff-buttons'>");
CX("<button class='sbs'>Side-by-side</button>"
"<button class='unified'>Unified</button>");
CX("<span class='save-button-slot'></span>");
CX("</div>");
CX("<div id='wikiedit-tab-diff-wrapper'>"
"Diffs will be shown here."
"</div>");
CX("</div>"/*#wikiedit-tab-diff*/);
}
|
| ︙ | ︙ |