WebViewer Version: 11.4.0
Do you have an issue with a specific file(s)? No
Can you reproduce using one of our samples or online demos? No
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? No
Is your issue related to a front-end framework? Yes
Is your issue related to annotations? Yes
Please give a brief summary of your issue:
(Think of this as an email subject)
I can’t add some buttons when migrating to Modular UI.
Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)
I update webviewer from v10.12.1 to v11.4.0 and i migrate to Modular UI with migrate guid.
I can’t add some buttons on Modular UI .
Can you tell me how to add some buttons?
(Each issues are below )
- I can’t add dividers.
I want to add dividers, but I have the error “Divider is not a constructor” .
My code is below.
const dividerItem1 = new this.viewerInstance.UI.Components.Divider({
dataElement: 'test-divider',
});
defaultHeader.setItems([
...defaultHeader.getItems(),
dividerItem1,
]);
- I can’t add some buttons to main menu.
I want to add some custom buttons to main menu, but i don’t find them and i have no error.
My code is below.
const downloadButton = {
type: 'customButton',
dataElement: 'downloadButton',
className: 'row',
img: Svg.Download,
onClick: () => {
this.clickDownload();
return;
},
label: "download",
role: 'option',
};
const mainMenuFlyout =
this.viewerInstance.UI.Flyouts.getFlyout('MainMenuFlyout');
mainMenuFlyout.setItems([downloadButton, ...mainMenuFlyout.items]);
- I can’t add custom button to grouped item with data-element “annotateToolsGroupedItems”
I have an custom annotation and want to add its tools button to “annotateToolsGroupedItems”.
When I add my custom annotation tools button with alone , i find its button.
But when I add my custom annotation tools button with other default button , i can’t find its button.
class CustomFileAttachmentAnnotationCreateTool extends this.viewerInstance
.Core.Tools.GenericAnnotationCreateTool {
constructor(documentViewer) {
// CustomFileAttachmentAnnotation is the class (function) for our annotation we defined previously
super(documentViewer, <any>CustomFileAttachmentAnnotation);
}
}
const createTool = new CustomFileAttachmentAnnotationCreateTool(
this.viewerInstance.Core.documentViewer,
);
this.viewerInstance.UI.registerTool(
{
toolName: 'AnnotationCreateCustomFileAttachment',
toolObject: createTool as Core.Tools.Tool,
buttonImage: Svg.AttachmentFile,
buttonName: 'customFileAttachmentButton',
tooltip: 'attachmentFile',
),
},
<any>CustomFileAttachmentAnnotation,
);
const customFileAttachmentToolButton =
new this.viewerInstance.UI.Components.ToolButton({
dataElement: 'calloutToolGroupButton',
toolName: 'AnnotationCreateCustomFileAttachment',
});
const toolHeader = this.viewerInstance.UI.getModularHeader('tools-header');
const groupedItemInToolHeader = toolHeader.getItems(
'groupedItems',
)[0] as UI.Components.GroupedItems;
const annotationTools = groupedItemInToolHeader
.items[0] as UI.Components.GroupedItems;
// This is OK
annotationTools.setItems([
customFileAttachmentToolButton,
]);
// This is NG
annotationTools.setItems([
highlightToolButton,
underlineToolButton,
strikeoutToolButton,
freeTextToolButton,
stickyToolButton,
rectangleToolButton,
freeHandToolButton,
ellipseToolButton,
polygonToolButton,
lineToolButton,
arrowToolButton,
calloutToolButton,
markInsertTextToolButton,
markReplaceTextToolButton,
customFileAttachmentToolButton,
]);
Thank you and best regards.