Skip to content

Commit 6b3c3b8

Browse files
committed
Added extra types for chromeless/lightbox support
1 parent 048e0a0 commit 6b3c3b8

File tree

5 files changed

+77
-3
lines changed

5 files changed

+77
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# 1.0.1
2+
- Added more types for chromeless/lightbox support
3+
14
# 1.0.0
25
About time to make this package a 1.0.0 version!
36

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-drawio",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"type": "module",
55
"description": "React component for integrating the Diagrams (draw.io) embed iframe",
66
"main": "index.js",

src/types.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export type DrawIoEmbedProps = {
4040

4141
export type DrawIoEmbedRef = ReturnType<typeof useActions>;
4242

43+
/**
44+
* Part of the URL parameters based on https://www.drawio.com/doc/faq/supported-url-parameters
45+
*/
4346
export type UrlParameters = {
4447
/**
4548
* Theme of the editor
@@ -91,6 +94,55 @@ export type UrlParameters = {
9194
* @default false
9295
*/
9396
noExitBtn?: boolean;
97+
/**
98+
* Uses the lightbox in chromeless mode (larger zoom, no page visible, chromeless
99+
*
100+
* @default false
101+
*/
102+
lightbox?: boolean;
103+
/**
104+
* Uses the chromeless read-only viewer.
105+
*
106+
* @default false
107+
*/
108+
chrome?: boolean;
109+
/**
110+
* Opens links in the same window or frame or in a blank window in chromeless mode (auto is the default which opens relative links and anchors in the same window in chromeless mode, and all links in a new window in editing mode)
111+
*
112+
* @options auto|self|frame|blank
113+
* @default auto
114+
*/
115+
target?: string;
116+
/**
117+
* Adds a link for the Edit button in chromeless mode (use `edit=_blank` to edit the diagram as a new copy).
118+
*/
119+
edit?: string;
120+
/**
121+
* Sets the default grid enabled to true.
122+
*
123+
* @default false
124+
*/
125+
grid?: boolean;
126+
/**
127+
* Enables folding in chromeless mode.
128+
*
129+
* @default false
130+
*/
131+
nav?: boolean;
132+
/**
133+
* Adds layer control in chromeless mode
134+
*
135+
* @default false
136+
*/
137+
layers?: boolean;
138+
/**
139+
* Space-separated list of layer IDs to show. If not specified, all layers are shown.
140+
*/
141+
"layer-ids"?: string;
142+
/**
143+
* Shows the Close button in chromeless mode which closes the window when selected.
144+
*/
145+
close?: boolean;
94146
};
95147

96148
type ExportFormats = 'html' | 'html2' | 'svg' | 'xmlsvg' | 'png' | 'xmlpng';

stories/DiagramsEmbed.stories.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,22 @@ html .gePrimaryBtn { background: #528a79 !important; }
395395
}
396396
}
397397
};
398+
399+
export const ReadOnly: Story = {
400+
args: {
401+
urlParameters: {
402+
lightbox: true
403+
}
404+
},
405+
decorators: [
406+
(Story, context) => {
407+
const { inputXml, urlToBase64 } = useRemoteFile();
408+
409+
useEffect(() => {
410+
urlToBase64('/mydrawio.png');
411+
}, []);
412+
413+
return <Story args={{ ...context.args, xml: inputXml }} />;
414+
}
415+
]
416+
};

0 commit comments

Comments
 (0)