mirror of
https://github.com/purocean/yn.git
synced 2026-09-24 15:46:02 +08:00
fix(mindmap): fix layout change on input
This commit is contained in:
@@ -129,6 +129,19 @@ function newMinder () {
|
||||
return icon
|
||||
}
|
||||
|
||||
const importJson = km.importJson.bind(km)
|
||||
km.importJson = function (json: any) {
|
||||
if (json) {
|
||||
// hack for avoid auto set template
|
||||
km.setTemplate = () => 0
|
||||
km.disableAnimation()
|
||||
importJson(json)
|
||||
km.enableAnimation()
|
||||
// recover setTemplate
|
||||
km.setTemplate = km._setTemplate
|
||||
}
|
||||
}
|
||||
|
||||
return km
|
||||
}
|
||||
|
||||
@@ -300,15 +313,7 @@ const render = async (km: any, content: string) => {
|
||||
const code = (content || '').trim()
|
||||
|
||||
try {
|
||||
// hack for avoid auto set template
|
||||
km.setTemplate = () => 0
|
||||
|
||||
km.disableAnimation()
|
||||
await km.importData('text', code)
|
||||
km.enableAnimation()
|
||||
|
||||
// recover setTemplate
|
||||
km.setTemplate = km._setTemplate
|
||||
} catch (error) {
|
||||
await km.importData('text', t('mind-map.convert-error'))
|
||||
km.execCommand('camera')
|
||||
|
||||
Reference in New Issue
Block a user