@ixo/editor 3.0.0-beta.15 → 3.0.0-beta.16

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.
@@ -1,4 +1,4 @@
1
- import { r as FlowNode, F as FlowNodeAuthzExtension, p as FlowNodeRuntimeState, J as IxoEditorType, S as SignedCapability, B as CreateRootDelegationParams, t as StoredDelegation, G as CreateDelegationParams, H as CreateInvocationParams, w as InvocationResult, x as ExecutionWithInvocationResult, s as UcanCapability, y as DelegationChainValidationResult, z as FindProofsResult, M as MigrationReport, U as UcanDelegationStore, l as InvocationStore, E as EvaluationStatus, C as Capability, a as CapabilityValidationResult } from './index-tyLe-Ge8.mjs';
1
+ import { r as FlowNode, F as FlowNodeAuthzExtension, p as FlowNodeRuntimeState, J as IxoEditorType, S as SignedCapability, B as CreateRootDelegationParams, t as StoredDelegation, G as CreateDelegationParams, H as CreateInvocationParams, w as InvocationResult, x as ExecutionWithInvocationResult, s as UcanCapability, y as DelegationChainValidationResult, z as FindProofsResult, M as MigrationReport, U as UcanDelegationStore, l as InvocationStore, E as EvaluationStatus, C as Capability, a as CapabilityValidationResult } from './index-C5pBDzcw.mjs';
2
2
  import { Delegation } from '@ixo/ucan';
3
3
  import { Doc, Map } from 'yjs';
4
4
 
@@ -29843,13 +29843,19 @@ var MatrixMetadataManager = class {
29843
29843
  }
29844
29844
  try {
29845
29845
  const promises = [];
29846
- if ("cover" in metadata) {
29846
+ if ("cover" in metadata || "coverPosition" in metadata) {
29847
+ const room = this.matrixClient.getRoom(this.roomId);
29848
+ const existingEvent = room?.currentState.getStateEvents(COVER_IMAGE_EVENT_TYPE, "");
29849
+ const existingContent = existingEvent ? existingEvent.getContent() : {};
29850
+ const content = {
29851
+ url: "cover" in metadata ? metadata.cover || null : existingContent.url ?? null,
29852
+ position: "coverPosition" in metadata ? metadata.coverPosition ?? null : existingContent.position ?? null
29853
+ };
29847
29854
  promises.push(
29848
29855
  this.matrixClient.sendStateEvent(
29849
29856
  this.roomId,
29850
29857
  COVER_IMAGE_EVENT_TYPE,
29851
- { url: metadata.cover || null },
29852
- // Wrap in object - null means removed
29858
+ content,
29853
29859
  ""
29854
29860
  // Empty state key
29855
29861
  )
@@ -29892,6 +29898,7 @@ var MatrixMetadataManager = class {
29892
29898
  );
29893
29899
  const coverContent = coverEvent ? coverEvent.getContent() : null;
29894
29900
  const coverUrl = coverContent?.url || null;
29901
+ const coverPos = coverContent?.position ?? null;
29895
29902
  const iconEvent = room.currentState.getStateEvents(
29896
29903
  COVER_ICON_EVENT_TYPE,
29897
29904
  ""
@@ -29904,7 +29911,8 @@ var MatrixMetadataManager = class {
29904
29911
  }
29905
29912
  return {
29906
29913
  cover: coverUrl || void 0,
29907
- icon: iconUrl || void 0
29914
+ icon: iconUrl || void 0,
29915
+ coverPosition: coverPos ?? void 0
29908
29916
  };
29909
29917
  } catch (error) {
29910
29918
  console.error("Failed to get page metadata:", error);
@@ -30829,7 +30837,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
30829
30837
  const { editor, handlers, editable } = useBlocknoteContext();
30830
30838
  const [isHovering, setIsHovering] = useState127(false);
30831
30839
  const [isRepositioning, setIsRepositioning] = useState127(false);
30832
- const [coverPosition, setCoverPosition] = useState127(50);
30840
+ const [coverPosition, setCoverPosition] = useState127(() => editor?.getPageMetadata?.()?.coverPosition ?? 50);
30833
30841
  const coverFileInputRef = useRef27(null);
30834
30842
  const logoFileInputRef = useRef27(null);
30835
30843
  const [opened, { open, close }] = useDisclosure7(false);
@@ -30842,8 +30850,14 @@ function CoverImage({ coverImageUrl, logoUrl }) {
30842
30850
  }
30843
30851
  const initialMetadata = editor._metadataManager.getMetadata();
30844
30852
  setMetadata(initialMetadata);
30853
+ if (initialMetadata?.coverPosition != null) {
30854
+ setCoverPosition(initialMetadata.coverPosition);
30855
+ }
30845
30856
  const unsubscribe = editor._metadataManager.subscribe((newMetadata) => {
30846
30857
  setMetadata(newMetadata);
30858
+ if (newMetadata.coverPosition != null) {
30859
+ setCoverPosition(newMetadata.coverPosition);
30860
+ }
30847
30861
  });
30848
30862
  return unsubscribe;
30849
30863
  }, [editor]);
@@ -30911,7 +30925,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
30911
30925
  if (!isRepositioning) return;
30912
30926
  const rect = e.currentTarget.getBoundingClientRect();
30913
30927
  const y = e.clientY - rect.top;
30914
- const percentage = y / rect.height * 100;
30928
+ const percentage = Math.round(y / rect.height * 100);
30915
30929
  setCoverPosition(Math.max(0, Math.min(100, percentage)));
30916
30930
  };
30917
30931
  if (!editable && !hasCover && !hasLogo) {
@@ -31016,12 +31030,20 @@ function CoverImage({ coverImageUrl, logoUrl }) {
31016
31030
  onMouseEnter: () => editable && setIsHovering(true),
31017
31031
  onMouseLeave: () => {
31018
31032
  if (editable) {
31033
+ if (isRepositioning) {
31034
+ editor?.setPageMetadata?.({ coverPosition });
31035
+ }
31019
31036
  setIsHovering(false);
31020
31037
  setIsRepositioning(false);
31021
31038
  }
31022
31039
  },
31023
31040
  onMouseMove: handleMouseMove,
31024
- onClick: () => isRepositioning && setIsRepositioning(false)
31041
+ onClick: () => {
31042
+ if (isRepositioning) {
31043
+ setIsRepositioning(false);
31044
+ editor?.setPageMetadata?.({ coverPosition });
31045
+ }
31046
+ }
31025
31047
  },
31026
31048
  /* @__PURE__ */ React281.createElement(
31027
31049
  "img",
@@ -31053,11 +31075,23 @@ function CoverImage({ coverImageUrl, logoUrl }) {
31053
31075
  }
31054
31076
  },
31055
31077
  /* @__PURE__ */ React281.createElement(CoverImageButton, { onClick: () => coverFileInputRef.current?.click() }, "Change cover"),
31056
- /* @__PURE__ */ React281.createElement(CoverImageButton, { onClick: () => setIsRepositioning(!isRepositioning), isActive: isRepositioning }, isRepositioning ? "Done" : "Reposition"),
31078
+ /* @__PURE__ */ React281.createElement(
31079
+ CoverImageButton,
31080
+ {
31081
+ onClick: () => {
31082
+ if (isRepositioning) {
31083
+ editor?.setPageMetadata?.({ coverPosition });
31084
+ }
31085
+ setIsRepositioning(!isRepositioning);
31086
+ },
31087
+ isActive: isRepositioning
31088
+ },
31089
+ isRepositioning ? "Done" : "Reposition"
31090
+ ),
31057
31091
  /* @__PURE__ */ React281.createElement(CoverImageButton, { onClick: handleRemoveCover }, "Remove"),
31058
31092
  /* @__PURE__ */ React281.createElement(CoverImageButton, { onClick: openSettings }, "Settings")
31059
31093
  ),
31060
- /* @__PURE__ */ React281.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: -40, right: 0, height: "70px" } }, /* @__PURE__ */ React281.createElement(
31094
+ /* @__PURE__ */ React281.createElement("div", { style: { maxWidth: "900px", margin: "0 auto", position: "absolute", bottom: 0, left: 0, right: 0, height: "70px" } }, /* @__PURE__ */ React281.createElement(
31061
31095
  Box58,
31062
31096
  {
31063
31097
  style: {
@@ -31069,7 +31103,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
31069
31103
  zIndex: 11
31070
31104
  }
31071
31105
  },
31072
- logoSrc && /* @__PURE__ */ React281.createElement(PageIcon, { src: logoSrc, iconSize: 64 }),
31106
+ logoSrc && /* @__PURE__ */ React281.createElement(PageIcon, { src: logoSrc, useCenter: true, iconSize: 64 }),
31073
31107
  editable && isHovering && /* @__PURE__ */ React281.createElement(React281.Fragment, null, logoSrc ? /* @__PURE__ */ React281.createElement(
31074
31108
  Group104,
31075
31109
  {
@@ -32332,4 +32366,4 @@ export {
32332
32366
  getExtraSlashMenuItems,
32333
32367
  useCreateIxoEditor
32334
32368
  };
32335
- //# sourceMappingURL=chunk-XSMXAAJC.mjs.map
32369
+ //# sourceMappingURL=chunk-5GSAEIOW.mjs.map