Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | The filename/version block on the first fileedit tab is now generated completely dynamically, rather than being filled out with '???' with broken links before a file is loaded. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | fileedit-ajaxify |
| Files: | files | file ages | folders |
| SHA3-256: |
371b162ff38c0b2154efec53a72421aa |
| User & Date: | stephan 2020-05-14 03:39:40.058 |
Context
|
2020-05-14
| ||
| 03:55 | Minor help text, style, and layout tweaks. ... (check-in: 28b2261b75 user: stephan tags: fileedit-ajaxify) | |
| 03:39 | The filename/version block on the first fileedit tab is now generated completely dynamically, rather than being filled out with '???' with broken links before a file is loaded. ... (check-in: 371b162ff3 user: stephan tags: fileedit-ajaxify) | |
| 03:00 | fileedit: now gets the file perms via the response header and updates the Is Executable checkbox accordingly. Similary, mimetype is now harvested from the response headers and is used, in place of file extensions, for the "is this a wiki page?" determination. Added fossil-level event infrastructure to allow pages to communicate page-specific events to skin-injected/user-supplied JS code, and fileedit now emits a fileedit-file-loaded event when it loads a new file. Replaced old uses of the term "save" with "commit", per forum feedback. ... (check-in: f1b2e509e7 user: stephan tags: fileedit-ajaxify) | |
Changes
Changes to src/default_css.txt.
| ︙ | ︙ | |||
942 943 944 945 946 947 948 | opacity: 1.0; border-top-style: outset; border-left-style: outset; border-right-style: outset; } ////////////////////////////////// // Styles for /fileedit: | | > | 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
opacity: 1.0;
border-top-style: outset;
border-left-style: outset;
border-right-style: outset;
}
//////////////////////////////////
// Styles for /fileedit:
body.fileedit textarea {
font-family: monospace;
width: 100%;
flex: 10 1 auto;
}
body.fileedit fieldset {
margin: 0.5em 0 0.5em 0;
padding: 0.25em 0;
border-radius: 0.5em;
border-color: inherit;
border-width: 1px;
font-size: 85%;
}
body.fileedit fieldset > legend {
margin: 0 0 0 1em;
|
| ︙ | ︙ |
Changes to src/fileedit.c.
| ︙ | ︙ | |||
1753 1754 1755 1756 1757 1758 1759 |
/***** File/version info tab *****/
{
CX("<div id='fileedit-tab-version' "
"data-tab-parent='fileedit-tabs' "
"data-tab-label='File Info & Selection'"
">");
| | < | < < < < < < < < | | | 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 |
/***** File/version info tab *****/
{
CX("<div id='fileedit-tab-version' "
"data-tab-parent='fileedit-tabs' "
"data-tab-label='File Info & Selection'"
">");
CX("<fieldset id='file-version-details'>"
"<legend>File/Version</legend>"
"<div>No file loaded.</div>"
"</fieldset>");
CX("<h1>Select a file to edit:</h1>");
CX("<div id='fileedit-file-selector'></div>");
CX("</div>"/*#fileedit-tab-version*/);
}
/******* Content tab *******/
{
|
| ︙ | ︙ |
Changes to src/fossil.page.fileedit.js.
| ︙ | ︙ | |||
206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
+"button.fileedit-content-reload"),
selectPreviewMode: E('#select-preview-mode select'),
selectHtmlEmsWrap: E('#select-preview-html-ems'),
selectEolWrap: E('#select-preview-html-ems'),
cbLineNumbersWrap: E('#cb-line-numbers'),
cbAutoPreview: E('#cb-preview-autoupdate > input[type=checkbox]'),
cbIsExe: E('input[type=checkbox][name=exec_bit]'),
tabs:{
content: E('#fileedit-tab-content'),
preview: E('#fileedit-tab-preview'),
diff: E('#fileedit-tab-diff'),
commit: E('#fileedit-tab-commit')
}
};
| > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
+"button.fileedit-content-reload"),
selectPreviewMode: E('#select-preview-mode select'),
selectHtmlEmsWrap: E('#select-preview-html-ems'),
selectEolWrap: E('#select-preview-html-ems'),
cbLineNumbersWrap: E('#cb-line-numbers'),
cbAutoPreview: E('#cb-preview-autoupdate > input[type=checkbox]'),
cbIsExe: E('input[type=checkbox][name=exec_bit]'),
fsFileVersionDetails: E('#file-version-details'),
tabs:{
content: E('#fileedit-tab-content'),
preview: E('#fileedit-tab-preview'),
diff: E('#fileedit-tab-diff'),
commit: E('#fileedit-tab-commit')
}
};
|
| ︙ | ︙ | |||
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
}
s.value = c;
this.e.taComment = s;
D.addClass(h, 'hidden');
D.removeClass(s, 'hidden');
console.debug(s,h);
};
/**
updateVersion() updates the filename and version in various UI
elements...
Returns this object.
*/
P.updateVersion = function(file,rev){
| > > > > > > > > > > > > > > > > | > | < < | < < < < < < > | | > > | | > > | | > > > > > > | | > < < < < < | | | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
}
s.value = c;
this.e.taComment = s;
D.addClass(h, 'hidden');
D.removeClass(s, 'hidden');
console.debug(s,h);
};
/**
Returns true if fossil.page.finfo is set, indicating that a file
has been loaded, else it reports an error and returns false.
*/
const affirmHasFile = function(){
if(!P.finfo) F.error("No file is loaded.");
return !!P.finfo;
};
/**
updateVersion() updates the filename and version in various UI
elements...
Returns this object.
*/
P.updateVersion = function(file,rev){
if(1===arguments.length){/*assume object*/
this.finfo = arguments[0];
file = this.finfo.filename;
rev = this.finfo.checkin;
}else if(0===arguments.length){
if(!affirmHasFile()) return this;
}else{
this.finfo = {filename:file,checkin:rev};
}
const eTgt = this.e.fsFileVersionDetails.querySelector('div'),
rHuman = F.hashDigits(rev),
rUrl = F.hashDigits(rev,true);
D.clearElement(eTgt);
D.append(
eTgt, "File: ",
D.append(D.code(),
D.a(F.repoUrl('finfo',{name:file, m:rUrl}), file)),
D.br()
);
D.append(
eTgt, "Checkin Version: ",
D.append(D.code(), D.a(F.repoUrl('info/'+rUrl), rHuman)),
" [",D.a(F.repoUrl('timeline',{m:rUrl}), "timeline"),"]",
D.br()
);
D.append(
eTgt, "Mimetype: ",
D.append(D.code(), this.finfo.mimetype||'???'),
D.br()
);
const purlArgs = F.encodeUrlArgs({
filename: this.finfo.filename,
checkin: rUrl
},false,true);
const purl = F.repoUrl('fileedit',purlArgs);
D.append(
eTgt,
"Permalink: ",
D.append(D.code(),D.a(purl,true))
);
return this;
};
/**
loadFile() loads (file,checkinVersion) and updates the relevant
UI elements to reflect the loaded state. If passed no arguments
then it re-uses the values from the currently-loaded file, reloading
it (emitting an error message if no file is loaded).
Returns this object, noting that the load is async. After loading
it triggers a 'fileedit-file-loaded' event, passing it
this.finfo.
*/
P.loadFile = function(file,rev){
if(0===arguments.length){
|
| ︙ | ︙ | |||
490 491 492 493 494 495 496 |
ajax: 'content',
filename:file,
checkin:rev
},
responseHeaders: ['x-fileedit-file-perm', 'content-type'],
onload:(r,headers)=>{
F.message('Loaded content.');
| | > > | | > | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 |
ajax: 'content',
filename:file,
checkin:rev
},
responseHeaders: ['x-fileedit-file-perm', 'content-type'],
onload:(r,headers)=>{
F.message('Loaded content.');
self.updateVersion({
filename: file,
checkin: rev,
isExe: ('x'===headers['x-fileedit-file-perm']),
mimetype: headers['content-type'].split(';').shift()
});
self.tabs.switchToTab(self.e.tabs.content);
self.e.cbIsExe.checked = self.finfo.isExe;
self.value(r);
self.dispatchEvent('fileedit-file-loaded', self.finfo);
}
});
return this;
|
| ︙ | ︙ | |||
633 634 635 636 637 638 639 |
c.dryRun ? '(dry run)' : '',
'[', F.hashDigits(c.uuid) ,'].'
];
if(!c.dryRun){
msg.push('Re-activating dry-run mode.');
self.e.taComment.value = '';
cbDryRun.checked = true;
| > > | | | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 |
c.dryRun ? '(dry run)' : '',
'[', F.hashDigits(c.uuid) ,'].'
];
if(!c.dryRun){
msg.push('Re-activating dry-run mode.');
self.e.taComment.value = '';
cbDryRun.checked = true;
self.finfo.filename = filename;
self.finfo.checkin = c.uuid;
self.updateVersion();
self.fileSelector.loadLeaves();
}
F.message.apply(F, msg);
self.tabs.switchToTab(self.e.tabs.commit);
};
}
if(!content){
f.updateView('');
return this;
}
|
| ︙ | ︙ |