forked from FOSS/BangleApps
Add argument to not escape html (in case of markdown->html for README
parent
44fff4a855
commit
65078cffef
|
@ -26,7 +26,8 @@ function showChangeLog(appid) {
|
|||
function showReadme(appid) {
|
||||
var app = appNameToApp(appid);
|
||||
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"));
|
||||
}
|
||||
|
|
6
js/ui.js
6
js/ui.js
|
@ -97,8 +97,10 @@ function showToast(message, type) {
|
|||
}
|
||||
|
||||
/// Show a yes/no prompt
|
||||
function showPrompt(title, text, buttons) {
|
||||
function showPrompt(title, text, buttons, shouldEscapeHtml) {
|
||||
if (!buttons) buttons={yes:1,no:1};
|
||||
if (!shouldEscapeHtml) shouldEscapeHtml = true;
|
||||
|
||||
return new Promise((resolve,reject) => {
|
||||
var modal = htmlElement(`<div class="modal active">
|
||||
<!--<a href="#close" class="modal-overlay" aria-label="Close"></a>-->
|
||||
|
@ -109,7 +111,7 @@ function showPrompt(title, text, buttons) {
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="content">
|
||||
${escapeHtml(text).replace(/\n/g,'<br/>')}
|
||||
${(shouldEscapeHtml) ? escapeHtml(text).replace(/\n/g,'<br/>') : text}
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
|
|
Loading…
Reference in New Issue