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
6 changes: 5 additions & 1 deletion sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ const typedocItems: SidebarItems = JSON.parse(
);

function findSidebarCategory(items: SidebarItems, label: string): SidebarCategory {
return items.find((item): item is SidebarCategory =>
const category = items.find((item): item is SidebarCategory =>
typeof item === 'object' &&
item.type === 'category' &&
item.label === label
);
if (!category) {
throw new Error(`Cannot find sidebar category "${label}"`);
}
return category;
}

const sidebars: SidebarsConfig = {
Expand Down
11 changes: 9 additions & 2 deletions src/examples/ExampleCommon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import { HashMap } from '@reactodia/hashmap';
import * as Reactodia from '@reactodia/workspace';
import { saveAs } from 'file-saver';

export function ExampleToolbarMenu() {
const {model, editor, overlay} = Reactodia.useWorkspace();
Expand Down Expand Up @@ -56,8 +55,16 @@ export function ExampleToolbarMenu() {
const diagramLayout = model.exportLayout();
const layoutString = JSON.stringify(diagramLayout);
const blob = new Blob([layoutString], {type: 'application/json'});
const blobUrl = URL.createObjectURL(blob);
const timestamp = new Date().toISOString().replaceAll(/[Z\s:-]/g, '');
saveAs(blob, `reactodia-diagram-${timestamp}.json`);
try {
const downloadLink = document.createElement('a');
downloadLink.href = blobUrl;
downloadLink.download = `reactodia-diagram-${timestamp}.json`;
downloadLink.click();
} finally {
URL.revokeObjectURL(blobUrl);
}
}}>
Save diagram to file
</Reactodia.ToolbarActionSave>
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/configure-webpack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export default async function importRawSource(context, opts) {

configureWebpack(config, isServer, utils) {
return {
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
enforce: "pre",
enforce: 'pre',
use: [
{
loader: 'source-map-loader',
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"compilerOptions": {
"target": "ES2022",
"lib": ["DOM", "ES2022"],
"baseUrl": "."
"baseUrl": ".",
"strict": true
},
"exclude": [
"./reactodia-workspace"
Expand Down