@signiphi/pdf-compose 0.1.0-beta.4 → 0.1.0-beta.5

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/index.js CHANGED
@@ -5957,6 +5957,7 @@ function DocumentGeneratorInner({
5957
5957
  const editorWrapperRef = React12.useRef(null);
5958
5958
  const [editorCollapsed, setEditorCollapsed] = React12.useState(false);
5959
5959
  const [mdExportError, setMdExportError] = React12.useState(null);
5960
+ const [isSaving, setIsSaving] = React12.useState(false);
5960
5961
  const [exportSuccess, setExportSuccess] = React12.useState(null);
5961
5962
  React12.useEffect(() => {
5962
5963
  const handler = (e) => {
@@ -6028,7 +6029,7 @@ function DocumentGeneratorInner({
6028
6029
  setExportSuccess("Document exported successfully");
6029
6030
  }
6030
6031
  }, [exportDocument, onExport]);
6031
- const handleSaveTemplate = React12.useCallback(() => {
6032
+ const handleSaveTemplate = React12.useCallback(async () => {
6032
6033
  const md = exportMarkdown();
6033
6034
  if (!md.trim()) {
6034
6035
  setMdExportError("Editor content is empty");
@@ -6040,8 +6041,14 @@ function DocumentGeneratorInner({
6040
6041
  return;
6041
6042
  }
6042
6043
  setMdExportError(null);
6043
- onSaveTemplate?.(md);
6044
- setExportSuccess("Template saved");
6044
+ setIsSaving(true);
6045
+ try {
6046
+ await onSaveTemplate?.(md);
6047
+ setExportSuccess("Template saved");
6048
+ } catch {
6049
+ } finally {
6050
+ setIsSaving(false);
6051
+ }
6045
6052
  }, [exportMarkdown, onSaveTemplate]);
6046
6053
  const handleExportMarkdown = React12.useCallback(() => {
6047
6054
  const md = exportMarkdown();
@@ -6181,11 +6188,11 @@ function DocumentGeneratorInner({
6181
6188
  Button,
6182
6189
  {
6183
6190
  onClick: handleSaveTemplate,
6184
- disabled: !editor || !markdown.trim(),
6191
+ disabled: isSaving || !editor || !markdown.trim(),
6185
6192
  className: "h-10 px-4 font-semibold bg-primary hover:bg-primary/90 text-primary-foreground shadow-sm hover:shadow-md transition-all duration-200 text-sm",
6186
6193
  children: [
6187
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { size: 16 }),
6188
- exportButtonText || "Save Template"
6194
+ isSaving ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 16, className: "animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { size: 16 }),
6195
+ isSaving ? "Saving..." : exportButtonText || "Save Template"
6189
6196
  ]
6190
6197
  }
6191
6198
  ) : /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [