Cartographer App User and Technical Documentation
Home
User Docs
Technical Docs
Home
User Docs
Technical Docs
  • User Documentation
    • Introduction
    • Getting Started
    • User Interface
    • Actions
  • Technical Documentation
    • GitHub Authentication
    • Components

      • AppFooter Component
      • AppHeader Component
      • AppSidebar Component
      • ContentPreviewMdiv Component
      • Content Preview Measure
      • Content Preview Pane
      • ImageMismatchModal Component
      • ImageSelection Modal
      • LoadGitModal Component
      • LoadIIIFModal Component
      • LoadLocalImage Component
      • LoadXMLModal Component
      • MainMenu Component
      • MeasureModal Component
      • MdivModal Component
      • OsdComponent Component
      • PageImportModal Component
      • PagesListEntry Component
      • PagesModal Component
      • Vuex Store (src/store/index.js)
    • Store
      • Vuex Store (src/store/index.js)
    • Tools
      • IIIF Tools (src/tools/iiif.js)
      • MEI Mapping Tools (src/tools/meiMappings.js)

LoadXMLModal Component

Displays a modal dialog for loading an MEI/XML file from the local file system.


Overview

The LoadXMLModal component:

  • Shows a modal dialog for loading an MEI/XML file from disk.
  • Provides a "Load test data" button that fetches a bundled test file (testfile.xml).
  • Parses the selected file as MEI and loads it into the store.
  • Detects local (non-HTTP) image references in the MEI and, when present, switches to a folder-selection step so the user can pick the images folder.
  • Matches the folder's images to the MEI targets (by full path or basename), converts them to pages, and preserves the original MEI zones.
  • Modal can be closed with the Cancel button or overlay.
  • Uses Vuex store for state management and actions.

Layout

  • Header: Modal title — "Load XML" normally, or "Select Images Folder" during the folder-selection step.
  • Body:
    • Default view: a "Load test data" button and a file input accepting .xml/.mei files.
    • Folder-selection view: a message explaining the MEI references local images and a prompt to select the images folder.
    • A hidden folder input (webkitdirectory) used to pick the images folder.
  • Footer:
    • Default view: Cancel and Load buttons.
    • Folder-selection view: Cancel and Select Folder buttons.

Props

None


Data

NameTypeDescription
currentMeiObject | nullParsed MEI document held while awaiting image-folder selection
localImageTargetsArrayLocal (non-HTTP) image target paths found in the MEI
showSelectFolderModalBooleanWhether the image-folder selection step is currently shown
loadedPagesArrayReferences to converted pages, kept to prevent blob URLs from being garbage collected

testUri (the bundled testfile.xml path) and parser (a DOMParser) are module-level constants, not component data.


Computed Properties

None


Lifecycle

HookDescription
mountedAttaches a change handler to the hidden folder input that calls loadImagesFromFolder

Methods

NameDescription
testDataFetches the bundled test file, parses it as MEI, dispatches setData, and closes the modal
mainReads the chosen .xml/.mei file and parses it as MEI. If local image <graphic> targets are found, switches to the folder-selection step; otherwise dispatches setData and closes the modal
selectImagesFolderOpens the system folder picker via the hidden folder input
cancelSelectFolderCancels the folder-selection step and resets its state (keeps loadedPages)
loadImagesFromFolderFilters image files, matches them to the MEI targets, converts them to pages, commits SET_LOCAL_IMAGE_PAGES, dispatches addLocalImagePages with the pages and original MEI, then closes the modal
closeModalResets folder-selection state, clears the file input, and dispatches toggleLoadXMLModal

Example

<LoadXMLModal />
Prev
LoadLocalImage Component
Next
MainMenu Component