2017-07-13 06:10:51 +08:00
|
|
|
export function setup(helper) {
|
2017-11-13 14:52:15 +08:00
|
|
|
|
|
|
|
helper.registerPlugin(md => {
|
|
|
|
|
|
|
|
md.renderer.rules.table_open = function(){
|
2017-11-13 15:09:24 +08:00
|
|
|
return '<div class="md-table">\n<table>\n';
|
2017-11-13 14:52:15 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
md.renderer.rules.table_close = function(){
|
|
|
|
return '</table>\n</div>';
|
|
|
|
};
|
|
|
|
});
|
2017-07-12 20:13:33 +08:00
|
|
|
|
2017-07-14 20:27:28 +08:00
|
|
|
// we need a custom callback for style handling
|
|
|
|
helper.whiteList({
|
|
|
|
custom: function(tag,attr,val) {
|
|
|
|
if (tag !== 'th' && tag !== 'td') {
|
|
|
|
return false;
|
|
|
|
}
|
2017-07-13 06:10:51 +08:00
|
|
|
|
2017-07-14 20:27:28 +08:00
|
|
|
if (attr !== 'style') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (val === 'text-align:right' || val === 'text-align:left' || val === 'text-align:center');
|
2016-06-15 02:31:51 +08:00
|
|
|
}
|
|
|
|
});
|
2017-07-14 20:27:28 +08:00
|
|
|
|
|
|
|
helper.whiteList([
|
|
|
|
'table',
|
|
|
|
'tbody',
|
|
|
|
'thead',
|
|
|
|
'tr',
|
|
|
|
'th',
|
|
|
|
'td',
|
2017-11-13 14:52:15 +08:00
|
|
|
'div.md-table'
|
2017-07-14 20:27:28 +08:00
|
|
|
]);
|
2016-06-15 02:31:51 +08:00
|
|
|
}
|