@haklex/rich-ext-excalidraw 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +3 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/static.mjs +2 -2
- package/dist/{transformer-CS7y7oCa.js → transformer-V980vfl0.js} +4 -4
- package/dist/{useExcalidrawData-DAgaOBLz.js → useExcalidrawData-BPIFyK-H.js} +18 -1
- package/package.json +5 -5
package/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { ExcalidrawProps } from '@excalidraw/excalidraw/types';
|
|
1
|
+
import { ExcalidrawImperativeAPI, ExcalidrawProps } from '@excalidraw/excalidraw/types';
|
|
2
2
|
export declare const readonlyUIOptions: ExcalidrawProps['UIOptions'];
|
|
3
|
+
export declare const fitSceneToViewport: (api: ExcalidrawImperativeAPI) => void;
|
|
4
|
+
export declare const fitSceneOnReady: (api: ExcalidrawImperativeAPI) => void;
|
|
3
5
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE7F,eAAO,MAAM,iBAAiB,EAAE,eAAe,CAAC,WAAW,CAQ1D,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,KAAK,uBAAuB,SAC+B,CAAC;AAG/F,eAAO,MAAM,eAAe,GAAI,KAAK,uBAAuB,SAW3D,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ExcalidrawNode, c as ExcalidrawDisplayRenderer, i as $isExcalidrawNode, l as _defineProperty, n as ExcalidrawExpandShell, o as EXCALIDRAW_NODE_KEY, r as $createExcalidrawNode, s as ExcalidrawSSRRenderer, t as EXCALIDRAW_BLOCK_TRANSFORMER, u as __exportAll } from "./transformer-
|
|
2
|
-
import {
|
|
1
|
+
import { a as ExcalidrawNode, c as ExcalidrawDisplayRenderer, i as $isExcalidrawNode, l as _defineProperty, n as ExcalidrawExpandShell, o as EXCALIDRAW_NODE_KEY, r as $createExcalidrawNode, s as ExcalidrawSSRRenderer, t as EXCALIDRAW_BLOCK_TRANSFORMER, u as __exportAll } from "./transformer-V980vfl0.js";
|
|
2
|
+
import { C as excalidrawHeaderActions, M as ExcalidrawConfigProvider, N as useExcalidrawConfig, O as excalidrawStatusDot, S as excalidrawFullscreenPopup, T as excalidrawLoading, _ as excalidrawDialogTitle, b as excalidrawEditorContainer, d as excalidrawConfirmBtnDanger, f as excalidrawConfirmBtnPrimary, g as excalidrawDialogMeta, i as excalidrawActionBarBtn, j as readonlyUIOptions, k as fitSceneOnReady, l as excalidrawConfirmActions, m as excalidrawDialogHeader, n as parseSnapshot, p as excalidrawDialogCanvas, r as serializeSnapshot, t as useExcalidrawData, u as excalidrawConfirmBtn, v as excalidrawEditLabel, w as excalidrawHeaderClose, x as excalidrawError, y as excalidrawEditOverlay } from "./useExcalidrawData-BPIFyK-H.js";
|
|
3
3
|
import { Suspense, createElement, lazy, useCallback, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useColorScheme } from "@haklex/rich-editor/static";
|
|
@@ -534,7 +534,7 @@ var ExcalidrawEditRenderer = ({ snapshot, onSnapshotChange }) => {
|
|
|
534
534
|
theme,
|
|
535
535
|
excalidrawAPI: (api) => {
|
|
536
536
|
previewApiRef.current = api;
|
|
537
|
-
|
|
537
|
+
fitSceneOnReady(api);
|
|
538
538
|
}
|
|
539
539
|
}, previewKey), /* @__PURE__ */ jsx("button", {
|
|
540
540
|
className: excalidrawEditOverlay,
|
package/dist/static.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ExcalidrawNode, c as ExcalidrawDisplayRenderer, i as $isExcalidrawNode, n as ExcalidrawExpandShell, o as EXCALIDRAW_NODE_KEY, r as $createExcalidrawNode, s as ExcalidrawSSRRenderer, t as EXCALIDRAW_BLOCK_TRANSFORMER } from "./transformer-
|
|
2
|
-
import {
|
|
1
|
+
import { a as ExcalidrawNode, c as ExcalidrawDisplayRenderer, i as $isExcalidrawNode, n as ExcalidrawExpandShell, o as EXCALIDRAW_NODE_KEY, r as $createExcalidrawNode, s as ExcalidrawSSRRenderer, t as EXCALIDRAW_BLOCK_TRANSFORMER } from "./transformer-V980vfl0.js";
|
|
2
|
+
import { M as ExcalidrawConfigProvider, N as useExcalidrawConfig, S as excalidrawFullscreenPopup } from "./useExcalidrawData-BPIFyK-H.js";
|
|
3
3
|
export { $createExcalidrawNode, $isExcalidrawNode, EXCALIDRAW_BLOCK_TRANSFORMER, EXCALIDRAW_NODE_KEY, ExcalidrawConfigProvider, ExcalidrawDisplayRenderer, ExcalidrawDisplayRenderer as ExcalidrawRenderer, ExcalidrawDisplayRenderer as ExcalidrawStaticRenderer, ExcalidrawExpandShell, ExcalidrawNode, ExcalidrawSSRRenderer, excalidrawFullscreenPopup, useExcalidrawConfig };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as excalidrawStaticContainer, E as excalidrawPlaceholder, T as excalidrawLoading, _ as excalidrawDialogTitle, c as excalidrawActionGroup, h as excalidrawDialogHeaderTitle,
|
|
1
|
+
import { A as fitSceneToViewport, D as excalidrawStaticContainer, E as excalidrawPlaceholder, T as excalidrawLoading, _ as excalidrawDialogTitle, c as excalidrawActionGroup, h as excalidrawDialogHeaderTitle, j as readonlyUIOptions, k as fitSceneOnReady, m as excalidrawDialogHeader, p as excalidrawDialogCanvas, s as excalidrawActionButton, t as useExcalidrawData, w as excalidrawHeaderClose, x as excalidrawError } from "./useExcalidrawData-BPIFyK-H.js";
|
|
2
2
|
import { Component, Suspense, lazy, useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { createRendererDecoration, useColorScheme } from "@haklex/rich-editor/static";
|
|
@@ -91,7 +91,7 @@ var ExcalidrawStaticCanvas = ({ onExpand, snapshot, theme }) => {
|
|
|
91
91
|
initialData: data,
|
|
92
92
|
theme,
|
|
93
93
|
excalidrawAPI: (api) => {
|
|
94
|
-
|
|
94
|
+
fitSceneOnReady(api);
|
|
95
95
|
}
|
|
96
96
|
}),
|
|
97
97
|
target: e.currentTarget,
|
|
@@ -142,7 +142,7 @@ var ExcalidrawStaticCanvas = ({ onExpand, snapshot, theme }) => {
|
|
|
142
142
|
theme,
|
|
143
143
|
excalidrawAPI: (api) => {
|
|
144
144
|
apiRef.current = api;
|
|
145
|
-
|
|
145
|
+
fitSceneOnReady(api);
|
|
146
146
|
}
|
|
147
147
|
})
|
|
148
148
|
}), /* @__PURE__ */ jsxs("div", {
|
|
@@ -176,7 +176,7 @@ var ExcalidrawStaticCanvas = ({ onExpand, snapshot, theme }) => {
|
|
|
176
176
|
className: excalidrawActionButton,
|
|
177
177
|
title: "Fit to Content",
|
|
178
178
|
type: "button",
|
|
179
|
-
onClick: () => apiRef.current
|
|
179
|
+
onClick: () => apiRef.current && fitSceneToViewport(apiRef.current),
|
|
180
180
|
children: /* @__PURE__ */ jsx(ScanSearch, { size: 20 })
|
|
181
181
|
}),
|
|
182
182
|
Boolean(onExpand) && /* @__PURE__ */ jsx("button", {
|
|
@@ -24,6 +24,23 @@ var readonlyUIOptions = { canvasActions: {
|
|
|
24
24
|
loadScene: false,
|
|
25
25
|
changeViewBackgroundColor: false
|
|
26
26
|
} };
|
|
27
|
+
var fitSceneToViewport = (api) => api.scrollToContent(void 0, {
|
|
28
|
+
fitToViewport: true,
|
|
29
|
+
viewportZoomFactor: .9,
|
|
30
|
+
maxZoom: 1
|
|
31
|
+
});
|
|
32
|
+
var fitSceneOnReady = (api) => {
|
|
33
|
+
const isReady = () => api.getAppState().width > 0 && api.getSceneElements().length > 0;
|
|
34
|
+
if (isReady()) {
|
|
35
|
+
fitSceneToViewport(api);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const unsubscribe = api.onChange(() => {
|
|
39
|
+
if (!isReady()) return;
|
|
40
|
+
unsubscribe();
|
|
41
|
+
fitSceneToViewport(api);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
27
44
|
//#endregion
|
|
28
45
|
//#region src/styles.css.ts
|
|
29
46
|
var excalidrawStaticContainer = "_1c3wdzl0";
|
|
@@ -203,4 +220,4 @@ function useExcalidrawData(data) {
|
|
|
203
220
|
};
|
|
204
221
|
}
|
|
205
222
|
//#endregion
|
|
206
|
-
export {
|
|
223
|
+
export { fitSceneToViewport as A, excalidrawHeaderActions as C, excalidrawStaticContainer as D, excalidrawPlaceholder as E, ExcalidrawConfigProvider as M, useExcalidrawConfig as N, excalidrawStatusDot as O, excalidrawFullscreenPopup as S, excalidrawLoading as T, excalidrawDialogTitle as _, excalidrawActionBarSep as a, excalidrawEditorContainer as b, excalidrawActionGroup as c, excalidrawConfirmBtnDanger as d, excalidrawConfirmBtnPrimary as f, excalidrawDialogMeta as g, excalidrawDialogHeaderTitle as h, excalidrawActionBarBtn as i, readonlyUIOptions as j, fitSceneOnReady as k, excalidrawConfirmActions as l, excalidrawDialogHeader as m, parseSnapshot as n, excalidrawActionBarUrl as o, excalidrawDialogCanvas as p, serializeSnapshot as r, excalidrawActionButton as s, useExcalidrawData as t, excalidrawConfirmBtn as u, excalidrawEditLabel as v, excalidrawHeaderClose as w, excalidrawError as x, excalidrawEditOverlay as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-excalidraw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Excalidraw whiteboard extension",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"jsondiffpatch": "^0.7.6",
|
|
29
|
-
"@haklex/rich-headless": "0.
|
|
29
|
+
"@haklex/rich-headless": "0.45.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@excalidraw/excalidraw": "^0.18.1",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"lucide-react": "^1.0.0",
|
|
51
51
|
"react": ">=19",
|
|
52
52
|
"react-dom": ">=19",
|
|
53
|
-
"@haklex/rich-editor-ui": "^0.
|
|
54
|
-
"@haklex/rich-
|
|
55
|
-
"@haklex/rich-
|
|
53
|
+
"@haklex/rich-editor-ui": "^0.45.0",
|
|
54
|
+
"@haklex/rich-editor": "^0.45.0",
|
|
55
|
+
"@haklex/rich-style-token": "^0.45.0"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|