Skip to content

Commit

Permalink
fix: markmap api changes in 0.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukaii committed Dec 26, 2023
1 parent 3f7d202 commit e8806e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions public/js/extra.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import unescapeHTML from 'lodash/unescape'
import isURL from 'validator/lib/isURL'

import { transform } from 'markmap-lib/dist/transform'
import { markmap } from 'markmap-lib/dist/view'
import { Markmap } from 'markmap-lib/dist/view'

import { stripTags } from '../../utils/string'

Expand Down Expand Up @@ -561,11 +561,11 @@ export function finishView (view) {
const content = $value.text()
$value.unwrap()
try {
const data = transform(content)
const { root: data } = transform(content)
$elem.html('<div class="markmap-container"><svg></svg></div>')
markmap($elem.find('svg')[0], data, {
Markmap.create($elem.find('svg')[0], {
duration: 0
})
}, data)
} catch (err) {
$elem.html(`<div class="alert alert-warning">${escapeHTML(err)}</div>`)
console.warn(err)
Expand Down

0 comments on commit e8806e0

Please sign in to comment.