1
0
Fork 0

Add argument to not escape html (in case of markdown->html for README

master
Paul Cockrell 2020-04-06 16:49:42 +01:00
parent 44fff4a855
commit 65078cffef
2 changed files with 6 additions and 3 deletions

View File

@ -26,7 +26,8 @@ function showChangeLog(appid) {
function showReadme(appid) { function showReadme(appid) {
var app = appNameToApp(appid); var app = appNameToApp(appid);
function show(contents) { function show(contents) {
showPrompt(app.name + " README", marked(contents), {ok: true}).catch(() => {}); if (!contents) return;
showPrompt(app.name + " README", marked(contents), {ok: true}, false).catch(() => {});
} }
httpGet(`apps/${appid}/README.md`).then(show).catch(()=>show("No README available")); httpGet(`apps/${appid}/README.md`).then(show).catch(()=>show("No README available"));
} }

View File

@ -97,8 +97,10 @@ function showToast(message, type) {
} }
/// Show a yes/no prompt /// Show a yes/no prompt
function showPrompt(title, text, buttons) { function showPrompt(title, text, buttons, shouldEscapeHtml) {
if (!buttons) buttons={yes:1,no:1}; if (!buttons) buttons={yes:1,no:1};
if (!shouldEscapeHtml) shouldEscapeHtml = true;
return new Promise((resolve,reject) => { return new Promise((resolve,reject) => {
var modal = htmlElement(`<div class="modal active"> var modal = htmlElement(`<div class="modal active">
<!--<a href="#close" class="modal-overlay" aria-label="Close"></a>--> <!--<a href="#close" class="modal-overlay" aria-label="Close"></a>-->
@ -109,7 +111,7 @@ function showPrompt(title, text, buttons) {
</div> </div>
<div class="modal-body"> <div class="modal-body">
<div class="content"> <div class="content">
${escapeHtml(text).replace(/\n/g,'<br/>')} ${(shouldEscapeHtml) ? escapeHtml(text).replace(/\n/g,'<br/>') : text}
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">