Add link support
This commit is contained in:
parent
f316c6b85a
commit
8bc8a6b08f
@ -541,6 +541,15 @@ define([
|
|||||||
}).click(function (e) { e.stopPropagation(); });
|
}).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({
|
var kanban = new window.jKanban({
|
||||||
element: '#cp-app-kanban-content',
|
element: '#cp-app-kanban-content',
|
||||||
gutter: '5px',
|
gutter: '5px',
|
||||||
@ -736,6 +745,7 @@ define([
|
|||||||
addItemButton: true,
|
addItemButton: true,
|
||||||
getTextColor: getTextColor,
|
getTextColor: getTextColor,
|
||||||
getAvatar: getAvatar,
|
getAvatar: getAvatar,
|
||||||
|
openLink: openLink,
|
||||||
cursors: remoteCursors,
|
cursors: remoteCursors,
|
||||||
boards: boards
|
boards: boards
|
||||||
});
|
});
|
||||||
|
|||||||
@ -57,6 +57,7 @@
|
|||||||
list: []
|
list: []
|
||||||
},
|
},
|
||||||
getAvatar: function () {},
|
getAvatar: function () {},
|
||||||
|
openLink: function () {},
|
||||||
getTextColor: function () { return '#000'; },
|
getTextColor: function () { return '#000'; },
|
||||||
cursors: {},
|
cursors: {},
|
||||||
tags: [],
|
tags: [],
|
||||||
@ -395,6 +396,12 @@
|
|||||||
var html = self.renderMd(element.body);
|
var html = self.renderMd(element.body);
|
||||||
var nodeBody = document.createElement('div');
|
var nodeBody = document.createElement('div');
|
||||||
nodeBody.classList.add('kanban-item-body');
|
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) {
|
nodeBody.onclick = function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user