Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions examples/workspace/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<perspective-workspace id="workspace">
<perspective-viewer slot="One" name="Test Widget One" table="superstore"></perspective-viewer>
<perspective-viewer slot="Two" name="Test Widget Two" table="superstore"></perspective-viewer>
<perspective-viewer slot="Three" name="Test Widget Three" table="superstore"></perspective-viewer>
</perspective-workspace>
</body>
</html>
11 changes: 1 addition & 10 deletions examples/workspace/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
*/

import perspective from "@finos/perspective";
import "@finos/perspective-workspace";

import "@finos/perspective-viewer-hypergrid";
import "@finos/perspective-viewer-d3fc";
import "@finos/perspective-workspace";

import "./index.less";

Expand All @@ -23,14 +22,6 @@ const datasource = async () => {
return worker.table(buffer);
};

document.body.innerHTML = `
<perspective-workspace id="workspace">
<perspective-viewer slot="One" name="Test Widget One" table="superstore"></perspective-viewer>
<perspective-viewer slot="Two" name="Test Widget Two" table="superstore"></perspective-viewer>
<perspective-viewer slot="Three" name="Test Widget Three" table="superstore"></perspective-viewer>
</perspective-workspace>
`;

window.addEventListener("load", () => {
window.workspace.tables.set("superstore", datasource());

Expand Down
3 changes: 2 additions & 1 deletion examples/workspace/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ module.exports = {
},
plugins: [
new HtmlWebPackPlugin({
title: "Workspace Example"
title: "Workspace Example",
template: "./src/index.html"
}),
new PerspectivePlugin({})
],
Expand Down
12 changes: 3 additions & 9 deletions packages/perspective-workspace/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ class PerspectiveWorkspaceElement extends HTMLElement {
this._register_light_dom_listener();

// TODO: check we only insert one of these
this._injectStyle = injectStyles("workspace-injected-stylesheet", injectedStyles);
this._injectStyle = document.createElement("style");
this._injectStyle.innerHTML = injectedStyles;
document.head.appendChild(this._injectStyle);

MessageLoop.sendMessage(this.workspace, Widget.Msg.BeforeAttach);
container.insertBefore(this.workspace.node, null);
Expand All @@ -217,11 +219,3 @@ class PerspectiveWorkspaceElement extends HTMLElement {
document.head.removeChild(this._injectStyle);
}
}

const injectStyles = (name, style) => {
const node = document.createElement("style");
node.id = name;
node.innerHTML = style;
document.head.appendChild(node);
return node;
};