I created a custom markup following the example: https://forge.autodesk.com/blog/implementing-custom-markups
The markup is created, highlighted and edited. We save and send information about the markup on the document to the server. When you open a document, the native markup is perfectly restored - edited, highlighted. But there is a problem with custom markup - they are displayed on the document, but they cannot be edited. They are not markups for viewer. It seems to me that this is due to the fact that viewer does not know about the type of custom markup (in the example this.type = 'smiley';)
How can this be fixed? Thanks!
We restore the markup in this way:
forgeRef.viewer.loadExtension('Autodesk.Viewing.MarkupsCore').then((m: any) => {
setMarkup(m)
const currentMarkup = allMarkupElements.find(item => item.page === activePage)
if (currentMarkup) {
m.show()
m.loadMarkups(currentMarkup.data, 'Layer1')
m.viewer.restoreState(currentMarkup.viewerState, undefined, true)
if (!m.enterEditMode('Layer1')) {
console.error('enter edit mode returns false') // eslint-disable-line
}
} else if (!m.enterEditMode()) {
console.error('enter edit mode returns false') // eslint-disable-line
}
m.allowNavigation(true)
})