diff --git a/source/website/index.js b/source/website/index.js index f416fe6..ceb0f47 100644 --- a/source/website/index.js +++ b/source/website/index.js @@ -2,15 +2,31 @@ import { SetExternalLibLocation } from '../engine/io/externallibs.js'; import { Embed } from './embed.js'; import { Website } from './website.js'; import { SetEventHandler } from './eventhandler.js'; - import { PluginType, RegisterPlugin } from './pluginregistry.js'; -export { PluginType, RegisterPlugin }; + +import * as Engine from '../engine/main.js'; +export { Engine }; + +import { ButtonDialog } from './dialog.js'; +export const UI = { + ButtonDialog +}; export function SetWebsiteEventHandler (eventHandler) { SetEventHandler (eventHandler ); } +export function RegisterHeaderPlugin (plugin) +{ + RegisterPlugin (PluginType.Header, plugin); +} + +export function RegisterToolbarPlugin (plugin) +{ + RegisterPlugin (PluginType.Toolbar, plugin); +} + export function StartWebsite (externalLibLocation) { SetExternalLibLocation (externalLibLocation); diff --git a/source/website/pluginregistry.js b/source/website/pluginregistry.js index 84f5d9f..5a88618 100644 --- a/source/website/pluginregistry.js +++ b/source/website/pluginregistry.js @@ -2,7 +2,8 @@ let plugins = new Map (); export const PluginType = { - Header : 1 + Header : 1, + Toolbar : 2 }; export function RegisterPlugin (type, plugin) diff --git a/source/website/website.js b/source/website/website.js index bb64ae4..efc4f9d 100644 --- a/source/website/website.js +++ b/source/website/website.js @@ -594,6 +594,20 @@ export class Website ShowSharingDialog (importer.GetFileList (), this.settings, this.viewer); }); + EnumeratePlugins (PluginType.Toolbar, (plugin) => { + plugin.registerButtons ({ + createSeparator : (icon, title, classNames) => { + AddSeparator (this.toolbar, icon, title, classNames); + }, + createButton : (icon, title, classNames, onClick) => { + AddButton (this.toolbar, icon, title, classNames, onClick); + }, + getModel : () => { + return this.model; + } + }); + }); + this.parameters.fileInput.addEventListener ('change', (ev) => { if (ev.target.files.length > 0) { HandleEvent ('model_load_started', 'open_file');