Add link support

pull/1/head
yflory 5 years ago
parent f316c6b85a
commit 8bc8a6b08f

@ -541,6 +541,15 @@ define([
}).click(function (e) { e.stopPropagation(); });
};
var openLink = function (href) {
if (/^\/[^\/]/.test(href)) {
var privateData = framework._.cpNfInner.metadataMgr.getPrivateData();
href = privateData.origin + href;
}
framework._.sfCommon.openUnsafeURL(href);
};
var kanban = new window.jKanban({
element: '#cp-app-kanban-content',
gutter: '5px',
@ -736,6 +745,7 @@ define([
addItemButton: true,
getTextColor: getTextColor,
getAvatar: getAvatar,
openLink: openLink,
cursors: remoteCursors,
boards: boards
});

@ -57,6 +57,7 @@
list: []
},
getAvatar: function () {},
openLink: function () {},
getTextColor: function () { return '#000'; },
cursors: {},
tags: [],
@ -395,6 +396,12 @@
var html = self.renderMd(element.body);
var nodeBody = document.createElement('div');
nodeBody.classList.add('kanban-item-body');
$(nodeBody).on('click', 'a', function (e) {
e.preventDefault();
var a = e.target;
if (!a.href) { return; }
self.options.openLink(a.href);
});
nodeBody.onclick = function (e) {
e.preventDefault();
};

Loading…
Cancel
Save