This project is a new MARVA editor.
via npm:
npm install
or Yarn:
yarn install
Create a JSON object with required data, then use it in such cases:
-
For development or using MARVA as a standalone application, in a browser's localstorage create a record with a key
okapi_config
and stringified JSON value (see "JSON config example"); -
For an embedded application: Use JSON in the
config
attribute, see Usage section.
{
"basePath": "YOUR_API_URI",
"tenant": "YOUR_TENANT",
"token": "YOUR_TOKEN",
// For embedded application only. Events also should be dispatched or listened in the root application.
"customEvents": {
"TRIGGER_MODAL": "triggermodal", // Root application can dispatch this event to open a prompt in MARVA which will inform a user about unsaved changes before leaving an Edit or Create page.
"PROCEED_NAVIGATION": "proceednavigation", // MARVA dispatches this event when a user clicks in the prompt "Save and continue" button or closes the prompt.
"BLOCK_NAVIGATION": "blocknavigation" // MARVA dispatches this event when user makes changes in a work form ("Create" or "Edit" page).
}
}
-
Rename
.env
file to.env.local
. -
In that file change
EDITOR_API_BASE_PATH
variable's value.
The following scripts are available:
npm run dev
: Starts the development server.npm run build
: Generates the build artifacts that can be deployed to a production environment as a standalone application.npm run build:lib
: Generates the build artifacts that can be deployed to a production environment as an embedded application.npm run lint:errors-only
: Runs ESLint on TypeScript source code, but only report errors. Does not report on style issues.npm run lint:full
: Runs ESLint on TypeScript source code. Will also report on style issues.npm run preview
: Preview a production build locally. Useful for ensuring that a production build operates as expected before deployment.npm run prettier:format:all
: Formats all applicable files using Prettier.npm run test:unit
: Runs unit tests using Jest.npm run test:unit:watch
: Similar tonpm run test:unit
, but runs in Jest's watch mode for test-driven development.npm run test:unit:coverage
: Similar tonpm run test:unit
, but also generates a code coverage report.
-
Run the code using
npm run dev
command. -
Open http://localhost:5173/ in a browser.
- Build the code as an embedded application using
npm run build:lib
command. The built code will be placed in./dist
folder. - Add the script on a page:
<script src="[PATH_TO_SCRIPT]/linked-data.es.js"></script>
-
Add a web component in the required HTML container on the page.
Use a config with a required API config for passing it in the MARVA application through the web component (see JSON config example in Installation section):
<div id="linked-data-container">
<linked-data config="{'basePath': 'YOUR_API_URI', 'tenant': 'YOUR_TENANT', ...}"></linked-data>
</div>
- Build the code as a standalone application using
npm run build
command. The built code will be placed in./dist
folder. - Deploy the built code or run it using a web server.