@ixo/editor 1.23.0 → 1.24.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.
@@ -13251,9 +13251,11 @@ import { Box as Box23, Button as Button33, Group as Group46 } from "@mantine/cor
13251
13251
  function CoverImage({ coverImageUrl, logoUrl }) {
13252
13252
  const { editor, handlers, editable } = useBlocknoteContext();
13253
13253
  const [isHovering, setIsHovering] = useState48(false);
13254
+ const [isLogoHovering, setIsLogoHovering] = useState48(false);
13254
13255
  const [isRepositioning, setIsRepositioning] = useState48(false);
13255
13256
  const [coverPosition, setCoverPosition] = useState48(50);
13256
- const fileInputRef = useRef5(null);
13257
+ const coverFileInputRef = useRef5(null);
13258
+ const logoFileInputRef = useRef5(null);
13257
13259
  const [coverImageData, setCoverImageData] = useState48(editor?.getCoverImage?.());
13258
13260
  const [logoData, setLogoData] = useState48(editor?.getLogo?.());
13259
13261
  useEffect38(() => {
@@ -13280,6 +13282,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13280
13282
  const coverUrl = coverImageData?.url || coverImageUrl;
13281
13283
  const logoSrc = logoData?.url || logoUrl;
13282
13284
  const hasCover = !!coverUrl;
13285
+ const hasLogo = !!logoSrc;
13283
13286
  console.log("CoverImage: Render state", {
13284
13287
  coverImageData,
13285
13288
  logoData,
@@ -13310,10 +13313,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13310
13313
  }
13311
13314
  };
13312
13315
  const handleAddCover = () => {
13313
- fileInputRef.current?.click();
13316
+ coverFileInputRef.current?.click();
13314
13317
  };
13315
13318
  const handleChangeCover = () => {
13316
- fileInputRef.current?.click();
13319
+ coverFileInputRef.current?.click();
13317
13320
  };
13318
13321
  const handleReposition = () => {
13319
13322
  setIsRepositioning(!isRepositioning);
@@ -13323,6 +13326,17 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13323
13326
  console.log("CoverImage: Removing cover image...");
13324
13327
  editor.setCoverImage?.(void 0);
13325
13328
  };
13329
+ const handleAddLogo = () => {
13330
+ logoFileInputRef.current?.click();
13331
+ };
13332
+ const handleChangeLogo = () => {
13333
+ logoFileInputRef.current?.click();
13334
+ };
13335
+ const handleRemoveLogo = () => {
13336
+ if (!editor) return;
13337
+ console.log("CoverImage: Removing logo...");
13338
+ editor.setLogo?.(void 0);
13339
+ };
13326
13340
  const handleMouseMove = (e) => {
13327
13341
  if (!isRepositioning) return;
13328
13342
  const rect = e.currentTarget.getBoundingClientRect();
@@ -13330,7 +13344,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13330
13344
  const percentage = y / rect.height * 100;
13331
13345
  setCoverPosition(Math.max(0, Math.min(100, percentage)));
13332
13346
  };
13333
- if (!editable && !hasCover) {
13347
+ if (!editable && !hasCover && !hasLogo) {
13334
13348
  return null;
13335
13349
  }
13336
13350
  if (!hasCover) {
@@ -13340,13 +13354,15 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13340
13354
  style: {
13341
13355
  position: "relative",
13342
13356
  width: "100%",
13343
- height: "60px",
13344
- backgroundColor: "#1f1f1f"
13357
+ minHeight: hasLogo ? "100px" : "60px",
13358
+ backgroundColor: "#1f1f1f",
13359
+ marginBottom: hasLogo ? "70px" : "0"
13345
13360
  },
13346
13361
  onMouseEnter: () => editable && setIsHovering(true),
13347
13362
  onMouseLeave: () => editable && setIsHovering(false)
13348
13363
  },
13349
- /* @__PURE__ */ React140.createElement("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
13364
+ /* @__PURE__ */ React140.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
13365
+ /* @__PURE__ */ React140.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }),
13350
13366
  editable && isHovering && /* @__PURE__ */ React140.createElement(
13351
13367
  Button33,
13352
13368
  {
@@ -13367,6 +13383,122 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13367
13383
  }
13368
13384
  },
13369
13385
  "Add cover"
13386
+ ),
13387
+ /* @__PURE__ */ React140.createElement(
13388
+ Box23,
13389
+ {
13390
+ style: {
13391
+ position: "absolute",
13392
+ bottom: "-60px",
13393
+ insetInlineStart: "96px",
13394
+ width: "120px",
13395
+ height: "120px",
13396
+ zIndex: 11
13397
+ },
13398
+ onMouseEnter: () => editable && setIsLogoHovering(true),
13399
+ onMouseLeave: () => editable && setIsLogoHovering(false)
13400
+ },
13401
+ logoSrc && /* @__PURE__ */ React140.createElement(
13402
+ "img",
13403
+ {
13404
+ src: logoSrc,
13405
+ alt: "Logo",
13406
+ style: {
13407
+ width: "100%",
13408
+ height: "100%",
13409
+ borderRadius: "100%",
13410
+ boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
13411
+ backgroundColor: "white",
13412
+ objectFit: "cover"
13413
+ }
13414
+ }
13415
+ ),
13416
+ editable && isHovering && /* @__PURE__ */ React140.createElement(React140.Fragment, null, logoSrc ? (
13417
+ // Logo exists: Show Change/Remove buttons when hovering anywhere
13418
+ /* @__PURE__ */ React140.createElement(
13419
+ Group46,
13420
+ {
13421
+ gap: "xs",
13422
+ style: {
13423
+ position: "absolute",
13424
+ top: "0",
13425
+ left: "130px",
13426
+ zIndex: 12
13427
+ }
13428
+ },
13429
+ /* @__PURE__ */ React140.createElement(
13430
+ Button33,
13431
+ {
13432
+ variant: "filled",
13433
+ size: "xs",
13434
+ onClick: handleChangeLogo,
13435
+ style: {
13436
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
13437
+ color: "#37352f",
13438
+ fontSize: "12px",
13439
+ fontWeight: 500,
13440
+ padding: "4px 8px",
13441
+ height: "auto"
13442
+ }
13443
+ },
13444
+ "Change"
13445
+ ),
13446
+ /* @__PURE__ */ React140.createElement(
13447
+ Button33,
13448
+ {
13449
+ variant: "filled",
13450
+ size: "xs",
13451
+ onClick: handleRemoveLogo,
13452
+ style: {
13453
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
13454
+ color: "#37352f",
13455
+ fontSize: "12px",
13456
+ fontWeight: 500,
13457
+ padding: "4px 8px",
13458
+ height: "auto"
13459
+ }
13460
+ },
13461
+ "Remove"
13462
+ )
13463
+ )
13464
+ ) : (
13465
+ // No logo: Show "Add icon" button
13466
+ /* @__PURE__ */ React140.createElement(
13467
+ Button33,
13468
+ {
13469
+ variant: "filled",
13470
+ size: "xs",
13471
+ onClick: handleAddLogo,
13472
+ style: {
13473
+ position: "absolute",
13474
+ top: "50%",
13475
+ left: "50%",
13476
+ transform: "translate(-50%, -50%)",
13477
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
13478
+ color: "#37352f",
13479
+ fontSize: "12px",
13480
+ fontWeight: 500,
13481
+ padding: "4px 8px",
13482
+ height: "auto",
13483
+ zIndex: 12
13484
+ }
13485
+ },
13486
+ "Add icon"
13487
+ )
13488
+ )),
13489
+ !logoSrc && /* @__PURE__ */ React140.createElement(
13490
+ Box23,
13491
+ {
13492
+ style: {
13493
+ width: "100%",
13494
+ height: "100%",
13495
+ borderRadius: "100%",
13496
+ border: editable && isLogoHovering ? "2px dashed rgba(255, 255, 255, 0.3)" : "none",
13497
+ backgroundColor: editable && isLogoHovering ? "rgba(255, 255, 255, 0.05)" : "transparent",
13498
+ transition: "all 0.2s ease"
13499
+ }
13500
+ }
13501
+ )
13370
13502
  )
13371
13503
  );
13372
13504
  }
@@ -13376,9 +13508,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13376
13508
  style: {
13377
13509
  position: "relative",
13378
13510
  width: "100%",
13379
- marginBottom: logoSrc ? "48px" : "0",
13380
- // Space for logo overlap only if logo exists
13381
- cursor: isRepositioning ? "ns-resize" : "default"
13511
+ paddingBottom: "70px",
13512
+ // Space for logo area (increased for 120px logo)
13513
+ cursor: isRepositioning ? "ns-resize" : "default",
13514
+ backgroundColor: "#1f1f1f"
13382
13515
  },
13383
13516
  onMouseEnter: () => editable && setIsHovering(true),
13384
13517
  onMouseLeave: () => {
@@ -13471,29 +13604,111 @@ function CoverImage({ coverImageUrl, logoUrl }) {
13471
13604
  "Remove"
13472
13605
  )
13473
13606
  ),
13474
- logoSrc && /* @__PURE__ */ React140.createElement(
13475
- "img",
13607
+ /* @__PURE__ */ React140.createElement(
13608
+ Box23,
13476
13609
  {
13477
- src: logoSrc,
13478
- alt: "Logo",
13479
13610
  style: {
13480
13611
  position: "absolute",
13481
- bottom: "-39px",
13482
- // Half of logo height to create overlap effect
13612
+ bottom: "4px",
13483
13613
  insetInlineStart: "96px",
13484
- // Left padding similar to Notion
13485
- opacity: 1,
13486
- width: "78px",
13487
- height: "78px",
13488
- transition: "opacity 100ms ease-in",
13489
- borderRadius: "3px",
13490
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
13491
- backgroundColor: "white",
13492
- objectFit: "cover"
13614
+ width: "120px",
13615
+ height: "120px",
13616
+ zIndex: 11
13617
+ },
13618
+ onMouseEnter: () => editable && setIsLogoHovering(true),
13619
+ onMouseLeave: () => editable && setIsLogoHovering(false)
13620
+ },
13621
+ logoSrc && /* @__PURE__ */ React140.createElement(
13622
+ "img",
13623
+ {
13624
+ src: logoSrc,
13625
+ alt: "Logo",
13626
+ style: {
13627
+ width: "100%",
13628
+ height: "100%",
13629
+ borderRadius: "100%",
13630
+ boxShadow: "0 1px 2px rgba(0, 0, 0, 0.1)",
13631
+ backgroundColor: "white",
13632
+ objectFit: "cover"
13633
+ }
13493
13634
  }
13494
- }
13635
+ ),
13636
+ editable && isHovering && /* @__PURE__ */ React140.createElement(React140.Fragment, null, logoSrc ? (
13637
+ // Logo exists: Show Change/Remove buttons when hovering on cover
13638
+ /* @__PURE__ */ React140.createElement(
13639
+ Group46,
13640
+ {
13641
+ gap: "xs",
13642
+ style: {
13643
+ position: "absolute",
13644
+ top: "0",
13645
+ left: "130px",
13646
+ zIndex: 12
13647
+ }
13648
+ },
13649
+ /* @__PURE__ */ React140.createElement(
13650
+ Button33,
13651
+ {
13652
+ variant: "filled",
13653
+ size: "xs",
13654
+ onClick: handleChangeLogo,
13655
+ style: {
13656
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
13657
+ color: "#37352f",
13658
+ fontSize: "12px",
13659
+ fontWeight: 500,
13660
+ padding: "4px 8px",
13661
+ height: "auto"
13662
+ }
13663
+ },
13664
+ "Change"
13665
+ ),
13666
+ /* @__PURE__ */ React140.createElement(
13667
+ Button33,
13668
+ {
13669
+ variant: "filled",
13670
+ size: "xs",
13671
+ onClick: handleRemoveLogo,
13672
+ style: {
13673
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
13674
+ color: "#37352f",
13675
+ fontSize: "12px",
13676
+ fontWeight: 500,
13677
+ padding: "4px 8px",
13678
+ height: "auto"
13679
+ }
13680
+ },
13681
+ "Remove"
13682
+ )
13683
+ )
13684
+ ) : (
13685
+ // No logo: Show "Add icon" button when hovering anywhere on cover
13686
+ /* @__PURE__ */ React140.createElement(
13687
+ Button33,
13688
+ {
13689
+ variant: "filled",
13690
+ size: "xs",
13691
+ onClick: handleAddLogo,
13692
+ style: {
13693
+ position: "absolute",
13694
+ top: "50%",
13695
+ left: "50%",
13696
+ transform: "translate(-50%, -50%)",
13697
+ backgroundColor: "rgba(255, 255, 255, 0.9)",
13698
+ color: "#37352f",
13699
+ fontSize: "12px",
13700
+ fontWeight: 500,
13701
+ padding: "4px 8px",
13702
+ height: "auto",
13703
+ zIndex: 12
13704
+ }
13705
+ },
13706
+ "Add icon"
13707
+ )
13708
+ ))
13495
13709
  ),
13496
- /* @__PURE__ */ React140.createElement("input", { ref: fileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") })
13710
+ /* @__PURE__ */ React140.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }),
13711
+ /* @__PURE__ */ React140.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") })
13497
13712
  );
13498
13713
  }
13499
13714
 
@@ -13724,4 +13939,4 @@ export {
13724
13939
  ixoGraphQLClient,
13725
13940
  getEntity
13726
13941
  };
13727
- //# sourceMappingURL=chunk-22UP3RB4.mjs.map
13942
+ //# sourceMappingURL=chunk-OHIKNFEH.mjs.map