-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.ts
87 lines (78 loc) · 2.89 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import {
TLDefaultColorStyle,
TLDefaultSizeStyle,
TLDefaultDashStyle,
TLDefaultFillStyle,
TLDefaultFontStyle,
TLDefaultHorizontalAlignStyle,
TLDefaultVerticalAlignStyle,
DefaultColorStyle,
DefaultSizeStyle,
DefaultDashStyle,
DefaultFillStyle,
DefaultFontStyle,
DefaultHorizontalAlignStyle,
DefaultVerticalAlignStyle
} from "tldraw"
import { Api as RevealApi } from "reveal.js"
export const defaultStyleProps = {
color: DefaultColorStyle,
size: DefaultSizeStyle,
dash: DefaultDashStyle,
fill: DefaultFillStyle,
font: DefaultFontStyle,
horizontalAlign: DefaultHorizontalAlignStyle,
verticalAlign: DefaultVerticalAlignStyle
}
export interface TldrevealConfig {
/// Configure the default drawing styles for tldraw, used when the editor is
/// first started.
defaultStyles: {
color?: TLDefaultColorStyle
size?: TLDefaultSizeStyle
dash?: TLDefaultDashStyle
fill?: TLDefaultFillStyle
font?: TLDefaultFontStyle
horizontalAlign?: TLDefaultHorizontalAlignStyle
verticalAlign?: TLDefaultVerticalAlignStyle
}
/// Show a warning when the `disableLayout` option is enabled. Set to
/// `false` to silence the warning when you have provided your own style
/// overrides. Defaults to `true`.
disableLayoutWarning: boolean
/// Whether the tldraw UI is rendered in dark mode by default. Set to
/// `false` if you use a light theme for Reveal.js, defaults to `true`.
isDarkMode: boolean
/// Allow automatic switching between dark and light mode for slides with a
/// custom data-background attribute. Defaults to `true`.
automaticDarkMode: boolean
/// Use localStorage to store drawing state in the browser. Requires an `id`
/// or `data-tlid` attribute on the .reveal or .slides element to determine
/// the identity of the slide deck. Defaults to `true`, if that id is found.
useLocalStorage: boolean
/// Load drawing state from a URL. Set to `false` to disable this option,
/// set to `"auto"` to automatically determine the URL from the deck URL or
/// set to `{ url: "/path/to/saved.tldrev" }` to supply a custom location.
/// The automatic mode replaces `.html` or `.html` in the slide path with
/// `.tldrev` if the path ends with one of those extensions. Else it appends
/// `/index.tldrev`.
snapshotUrl: false | "auto" | { url: string }
}
declare global {
namespace Reveal {
interface Options {
tldreveal?: Partial<TldrevealConfig>
}
}
}
export const defaultTldrevealConfig: TldrevealConfig = {
defaultStyles: {},
disableLayoutWarning: true,
isDarkMode: true,
automaticDarkMode: true,
useLocalStorage: true,
snapshotUrl: false
}
export function getTldrevealConfig(reveal: RevealApi) {
return { ...defaultTldrevealConfig, ...reveal.getConfig().tldreveal }
}