1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

add attributes to fence blocks

This commit is contained in:
Baptiste Augrain
2018-09-13 11:07:19 +02:00
parent e2957192d0
commit 189b245b1d
5 changed files with 207 additions and 45 deletions

View File

@@ -738,10 +738,17 @@ export default class MarkdownPreview extends React.Component {
try {
const chartConfig = JSON.parse(el.innerHTML)
el.innerHTML = ''
var canvas = document.createElement('canvas')
const canvas = document.createElement('canvas')
el.appendChild(canvas)
/* eslint-disable no-new */
new Chart(canvas, chartConfig)
const height = el.attributes.getNamedItem('data-height')
if (height && height.value !== 'undefined') {
el.style.height = height.value + 'vh'
canvas.height = height.value + 'vh'
}
const chart = new Chart(canvas, chartConfig)
} catch (e) {
console.error(e)
el.className = 'chart-error'