@carlonicora/nextjs-jsonapi 1.95.0 → 1.96.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.
@@ -8587,6 +8587,7 @@ function EditorSheet({
8587
8587
  onSuccess,
8588
8588
  onRevalidate,
8589
8589
  onNavigate,
8590
+ onSaved,
8590
8591
  size = "xl",
8591
8592
  disabled,
8592
8593
  hideSubmit,
@@ -8620,6 +8621,9 @@ function EditorSheet({
8620
8621
  try {
8621
8622
  const result = await onSubmit(values);
8622
8623
  setOpen(false);
8624
+ if (isEdit && result && onSaved) {
8625
+ onSaved(result, entityType);
8626
+ }
8623
8627
  if (onSuccess) {
8624
8628
  await onSuccess();
8625
8629
  } else if (result) {
@@ -8637,7 +8641,7 @@ function EditorSheet({
8637
8641
  });
8638
8642
  }
8639
8643
  },
8640
- [onSubmit, setOpen, onSuccess, onRevalidate, onNavigate, generateUrl, module, isEdit, propagateChanges, t]
8644
+ [onSubmit, setOpen, onSuccess, onSaved, onRevalidate, onNavigate, generateUrl, module, isEdit, propagateChanges, t]
8641
8645
  );
8642
8646
  return /* @__PURE__ */ jsxs39(Fragment9, { children: [
8643
8647
  /* @__PURE__ */ jsxs39(Sheet, { open, onOpenChange: handleOpenChange, children: [
@@ -9222,7 +9226,7 @@ import { useRef as useRef15 } from "react";
9222
9226
  import dynamic from "next/dynamic";
9223
9227
  import React14 from "react";
9224
9228
  import { jsx as jsx73 } from "react/jsx-runtime";
9225
- var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-G3EMXRKU.mjs"), {
9229
+ var BlockNoteEditor = dynamic(() => import("./BlockNoteEditor-VPTC7JY3.mjs"), {
9226
9230
  ssr: false
9227
9231
  });
9228
9232
  var BlockNoteEditorContainer = React14.memo(/* @__PURE__ */ __name(function EditorContainer(props) {
@@ -9249,7 +9253,9 @@ function FormBlockNote({
9249
9253
  mentionSearchFn,
9250
9254
  mentionSearchParams,
9251
9255
  mentionResolveFn,
9252
- suggestionMenuComponent
9256
+ suggestionMenuComponent,
9257
+ mentionNameResolver,
9258
+ onWarmMentions
9253
9259
  }) {
9254
9260
  const initialContentRef = useRef15(null);
9255
9261
  const lastEditorContentRef = useRef15(void 0);
@@ -9295,6 +9301,8 @@ function FormBlockNote({
9295
9301
  mentionSearchParams,
9296
9302
  mentionResolveFn,
9297
9303
  suggestionMenuComponent,
9304
+ mentionNameResolver,
9305
+ onWarmMentions,
9298
9306
  className: cn(stretch && "min-h-0 flex-1")
9299
9307
  }
9300
9308
  );
@@ -13722,26 +13730,36 @@ var mentionDataAttrs = /* @__PURE__ */ __name((p) => ({
13722
13730
  "data-mention-type": p.entityType,
13723
13731
  "data-mention-alias": p.alias
13724
13732
  }), "mentionDataAttrs");
13725
- var createMentionInlineContentSpec = /* @__PURE__ */ __name((resolveFn, disableMention) => {
13733
+ var createMentionInlineContentSpec = /* @__PURE__ */ __name((resolveFn, disableMention, nameResolver) => {
13726
13734
  const Mention = React21.memo(/* @__PURE__ */ __name(function Mention2(props) {
13735
+ const displayName = nameResolver?.(props.id, props.entityType, props.alias) ?? props.alias;
13727
13736
  if (disableMention) {
13728
- const resolved2 = resolveFn?.(props.id, props.entityType, props.alias);
13737
+ const resolved2 = resolveFn?.(props.id, props.entityType, displayName);
13729
13738
  return /* @__PURE__ */ jsxs90(Link3, { href: resolved2?.url ?? "#", className: "text-primary", children: [
13730
13739
  "@",
13731
- props.alias
13740
+ displayName
13732
13741
  ] });
13733
13742
  }
13734
- const resolved = resolveFn?.(props.id, props.entityType, props.alias);
13743
+ const resolved = resolveFn?.(props.id, props.entityType, displayName);
13735
13744
  if (resolved?.Inline) {
13736
13745
  const Custom = resolved.Inline;
13737
- return /* @__PURE__ */ jsx151(Custom, { ...props });
13746
+ return /* @__PURE__ */ jsx151(Custom, { ...props, alias: displayName });
13738
13747
  }
13739
13748
  const href = resolved?.url ?? "#";
13740
13749
  const handleClick = resolved?.onActivate ? (e) => resolved.onActivate(e, props) : void 0;
13741
- return /* @__PURE__ */ jsxs90(Link3, { href, className: "text-primary", onClick: handleClick, ...mentionDataAttrs(props), children: [
13742
- "@",
13743
- props.alias
13744
- ] });
13750
+ return /* @__PURE__ */ jsxs90(
13751
+ Link3,
13752
+ {
13753
+ href,
13754
+ className: "text-primary",
13755
+ onClick: handleClick,
13756
+ ...mentionDataAttrs({ ...props, alias: displayName }),
13757
+ children: [
13758
+ "@",
13759
+ displayName
13760
+ ]
13761
+ }
13762
+ );
13745
13763
  }, "Mention"));
13746
13764
  return createReactInlineContentSpec(
13747
13765
  {
@@ -22000,4 +22018,4 @@ export {
22000
22018
  useOAuthClients,
22001
22019
  useOAuthClient
22002
22020
  };
22003
- //# sourceMappingURL=chunk-B742NQJF.mjs.map
22021
+ //# sourceMappingURL=chunk-QH4QZLBS.mjs.map