handle links in forms

pull/1/head
ansuz 3 years ago
parent e31ae08341
commit 4344f4410b

@ -986,6 +986,12 @@ define([
}); });
}); });
var linkClickHandler = function (ev) {
ev.preventDefault();
var href = ($(this).attr('href') || '').trim();
if (!href) { return; }
APP.common.openUnsafeURL(href);
};
var STATIC_TYPES = { var STATIC_TYPES = {
md: { md: {
@ -999,6 +1005,8 @@ define([
}, opts.text); }, opts.text);
var $tag = $(tag); var $tag = $(tag);
DiffMd.apply(DiffMd.render(opts.text || ''), $tag, APP.common); DiffMd.apply(DiffMd.render(opts.text || ''), $tag, APP.common);
$tag.find('a').click(linkClickHandler);
var cursorGetter; var cursorGetter;
return { return {
tag: tag, tag: tag,
@ -2904,6 +2912,7 @@ define([
if (content.answers.msg) { if (content.answers.msg) {
var $desc = $(description); var $desc = $(description);
DiffMd.apply(DiffMd.render(content.answers.msg), $desc, APP.common); DiffMd.apply(DiffMd.render(content.answers.msg), $desc, APP.common);
$desc.find('a').click(linkClickHandler);
} }
var actions = h('div.cp-form-submit-actions', [ var actions = h('div.cp-form-submit-actions', [

Loading…
Cancel
Save