Custom UI for file attachments in Multi Tab

Hello, Is it possible to disable the file attachments modal in Multi Tab? My idea is to have my custom modal show when the user selects to add a new file, then use the addTab api to insert the file.

Thank you

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Was able to get my custom element to open outside the iframe with the following code.

  const viewer = useRef();
  const instance = useRef();
  const [openFileModal, setOpenFileModal] = useState(false);

  //Init Viewer
  useEffect(() => {
    WebViewer(
      {
        path: "/webviewer/lib",
        licenseKey: process.env.pdfjsExpressLicense,
        disabledElements: ["OpenFileModal"],
      },
      viewer.current
    ).then((inst) => {
      instance.current = inst;
      const { setTheme, enableFeatures, enableElements, Theme, iframeWindow } =
        inst.UI;

      setTheme(Theme.DARK);
      enableFeatures(["MultiTab", "ThumbnailReordering", "ThumbnailMerging"]);
      enableElements(["thumbnalsPanel", "thumbnailControl"]);

      iframeWindow.document.querySelector(
        ".TabsHeader .add-button > button:nth-child(1)"
      ).onclick = () => setOpenFileModal(true);
    });
  }, []);

Hello jrodriguez,

Thank you for sharing your code! however since it doesnt have the full context, I was not able to run it.
We have a custom modal function in our UI that could help:
https://pdfjs.express/api/UI.html#.setCustomModal__anchor

Let me know if that works for you!

Best regards,
Tyler Gordon
Web Development Support Engineer
PDFTron