@ixo/editor 2.1.0 → 2.2.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.
|
@@ -12387,44 +12387,6 @@ var getExtraSlashMenuItems = (editor) => {
|
|
|
12387
12387
|
group: "Basics",
|
|
12388
12388
|
subtext: "Make HTTP requests and handle responses"
|
|
12389
12389
|
},
|
|
12390
|
-
{
|
|
12391
|
-
title: "Notification",
|
|
12392
|
-
onItemClick: () => {
|
|
12393
|
-
editor.insertBlocks(
|
|
12394
|
-
[
|
|
12395
|
-
{
|
|
12396
|
-
type: "notify",
|
|
12397
|
-
props: {
|
|
12398
|
-
title: "",
|
|
12399
|
-
description: "",
|
|
12400
|
-
icon: "bell",
|
|
12401
|
-
channel: "email",
|
|
12402
|
-
to: "[]",
|
|
12403
|
-
cc: "[]",
|
|
12404
|
-
bcc: "[]",
|
|
12405
|
-
subject: "",
|
|
12406
|
-
body: "",
|
|
12407
|
-
bodyType: "text",
|
|
12408
|
-
from: "",
|
|
12409
|
-
replyTo: "",
|
|
12410
|
-
templateId: "",
|
|
12411
|
-
templateVariables: "{}",
|
|
12412
|
-
status: "idle",
|
|
12413
|
-
messageId: "",
|
|
12414
|
-
sentAt: "",
|
|
12415
|
-
errorMessage: "",
|
|
12416
|
-
conditions: ""
|
|
12417
|
-
}
|
|
12418
|
-
}
|
|
12419
|
-
],
|
|
12420
|
-
editor.getTextCursorPosition().block,
|
|
12421
|
-
"after"
|
|
12422
|
-
);
|
|
12423
|
-
},
|
|
12424
|
-
aliases: ["notify", "notification", "email", "alert", "message", "bird"],
|
|
12425
|
-
group: "Basics",
|
|
12426
|
-
subtext: "Send notifications via Email, SMS, or WhatsApp"
|
|
12427
|
-
},
|
|
12428
12390
|
{
|
|
12429
12391
|
title: "Claim",
|
|
12430
12392
|
onItemClick: () => {
|
|
@@ -12719,25 +12681,25 @@ var MatrixMetadataManager = class {
|
|
|
12719
12681
|
}
|
|
12720
12682
|
try {
|
|
12721
12683
|
const promises = [];
|
|
12722
|
-
if (
|
|
12684
|
+
if ("cover" in metadata) {
|
|
12723
12685
|
promises.push(
|
|
12724
12686
|
this.matrixClient.sendStateEvent(
|
|
12725
12687
|
this.roomId,
|
|
12726
12688
|
COVER_IMAGE_EVENT_TYPE,
|
|
12727
12689
|
{ url: metadata.cover || null },
|
|
12728
|
-
// Wrap in object -
|
|
12690
|
+
// Wrap in object - null means removed
|
|
12729
12691
|
""
|
|
12730
12692
|
// Empty state key
|
|
12731
12693
|
)
|
|
12732
12694
|
);
|
|
12733
12695
|
}
|
|
12734
|
-
if (
|
|
12696
|
+
if ("icon" in metadata) {
|
|
12735
12697
|
promises.push(
|
|
12736
12698
|
this.matrixClient.sendStateEvent(
|
|
12737
12699
|
this.roomId,
|
|
12738
12700
|
COVER_ICON_EVENT_TYPE,
|
|
12739
12701
|
{ url: metadata.icon || null },
|
|
12740
|
-
// Wrap in object -
|
|
12702
|
+
// Wrap in object - null means removed
|
|
12741
12703
|
""
|
|
12742
12704
|
// Empty state key
|
|
12743
12705
|
)
|
|
@@ -13041,6 +13003,138 @@ function useCreateCollaborativeIxoEditor(options) {
|
|
|
13041
13003
|
// src/mantine/components/CoverImage.tsx
|
|
13042
13004
|
import React149, { useState as useState48, useRef as useRef8, useEffect as useEffect38 } from "react";
|
|
13043
13005
|
import { Box as Box24, Button as Button32, Group as Group44 } from "@mantine/core";
|
|
13006
|
+
|
|
13007
|
+
// src/core/lib/imageTransform.ts
|
|
13008
|
+
var CLOUDFLARE_CDN_BASE = "https://www.ixo.earth/cdn-cgi/image";
|
|
13009
|
+
var ImagePresets = {
|
|
13010
|
+
/**
|
|
13011
|
+
* Cover image preset (Notion-style)
|
|
13012
|
+
* Wide banner images that fill the width of the page
|
|
13013
|
+
*/
|
|
13014
|
+
cover: {
|
|
13015
|
+
desktop: {
|
|
13016
|
+
width: 1920,
|
|
13017
|
+
fit: "cover",
|
|
13018
|
+
quality: 80,
|
|
13019
|
+
format: "auto",
|
|
13020
|
+
metadata: "none"
|
|
13021
|
+
},
|
|
13022
|
+
tablet: {
|
|
13023
|
+
width: 960,
|
|
13024
|
+
fit: "cover",
|
|
13025
|
+
quality: 80,
|
|
13026
|
+
format: "auto",
|
|
13027
|
+
metadata: "none"
|
|
13028
|
+
},
|
|
13029
|
+
mobile: {
|
|
13030
|
+
width: 640,
|
|
13031
|
+
fit: "cover",
|
|
13032
|
+
quality: 80,
|
|
13033
|
+
format: "auto",
|
|
13034
|
+
metadata: "none"
|
|
13035
|
+
}
|
|
13036
|
+
},
|
|
13037
|
+
/**
|
|
13038
|
+
* Icon/Logo preset (Notion-style)
|
|
13039
|
+
* Small, square profile/icon images
|
|
13040
|
+
*/
|
|
13041
|
+
icon: {
|
|
13042
|
+
default: {
|
|
13043
|
+
width: 240,
|
|
13044
|
+
// 2x for retina (120px display size)
|
|
13045
|
+
height: 240,
|
|
13046
|
+
fit: "cover",
|
|
13047
|
+
gravity: "auto",
|
|
13048
|
+
// Focus on faces for profile pictures
|
|
13049
|
+
quality: 85,
|
|
13050
|
+
format: "auto",
|
|
13051
|
+
metadata: "none"
|
|
13052
|
+
},
|
|
13053
|
+
thumbnail: {
|
|
13054
|
+
width: 120,
|
|
13055
|
+
height: 120,
|
|
13056
|
+
fit: "cover",
|
|
13057
|
+
gravity: "auto",
|
|
13058
|
+
quality: 85,
|
|
13059
|
+
format: "auto",
|
|
13060
|
+
metadata: "none"
|
|
13061
|
+
}
|
|
13062
|
+
}
|
|
13063
|
+
};
|
|
13064
|
+
function buildOptionsString(options) {
|
|
13065
|
+
const parts = [];
|
|
13066
|
+
if (options.width !== void 0) {
|
|
13067
|
+
parts.push(`width=${options.width}`);
|
|
13068
|
+
}
|
|
13069
|
+
if (options.height !== void 0) {
|
|
13070
|
+
parts.push(`height=${options.height}`);
|
|
13071
|
+
}
|
|
13072
|
+
if (options.fit) {
|
|
13073
|
+
parts.push(`fit=${options.fit}`);
|
|
13074
|
+
}
|
|
13075
|
+
if (options.gravity) {
|
|
13076
|
+
parts.push(`gravity=${options.gravity}`);
|
|
13077
|
+
}
|
|
13078
|
+
if (options.quality !== void 0) {
|
|
13079
|
+
parts.push(`quality=${options.quality}`);
|
|
13080
|
+
}
|
|
13081
|
+
if (options.format) {
|
|
13082
|
+
parts.push(`format=${options.format}`);
|
|
13083
|
+
}
|
|
13084
|
+
if (options.dpr !== void 0) {
|
|
13085
|
+
parts.push(`dpr=${options.dpr}`);
|
|
13086
|
+
}
|
|
13087
|
+
if (options.sharpen !== void 0) {
|
|
13088
|
+
parts.push(`sharpen=${options.sharpen}`);
|
|
13089
|
+
}
|
|
13090
|
+
if (options.blur !== void 0) {
|
|
13091
|
+
parts.push(`blur=${options.blur}`);
|
|
13092
|
+
}
|
|
13093
|
+
if (options.brightness !== void 0) {
|
|
13094
|
+
parts.push(`brightness=${options.brightness}`);
|
|
13095
|
+
}
|
|
13096
|
+
if (options.metadata) {
|
|
13097
|
+
parts.push(`metadata=${options.metadata}`);
|
|
13098
|
+
}
|
|
13099
|
+
if (options.anim !== void 0) {
|
|
13100
|
+
parts.push(`anim=${options.anim}`);
|
|
13101
|
+
}
|
|
13102
|
+
return parts.join(",");
|
|
13103
|
+
}
|
|
13104
|
+
function isAllowedOrigin(url) {
|
|
13105
|
+
const allowedOrigins = ["ipfs.gateway.ixo.world", "mx.ixo.earth", "testmx.ixo.earth", "devmx.ixo.earth"];
|
|
13106
|
+
try {
|
|
13107
|
+
const urlObj = new URL(url);
|
|
13108
|
+
return allowedOrigins.some((origin) => urlObj.hostname.includes(origin));
|
|
13109
|
+
} catch {
|
|
13110
|
+
return false;
|
|
13111
|
+
}
|
|
13112
|
+
}
|
|
13113
|
+
function transformImage(sourceUrl, options) {
|
|
13114
|
+
if (!sourceUrl) {
|
|
13115
|
+
return sourceUrl;
|
|
13116
|
+
}
|
|
13117
|
+
if (sourceUrl.includes("/cdn-cgi/image/")) {
|
|
13118
|
+
return sourceUrl;
|
|
13119
|
+
}
|
|
13120
|
+
if (!isAllowedOrigin(sourceUrl)) {
|
|
13121
|
+
return sourceUrl;
|
|
13122
|
+
}
|
|
13123
|
+
const optionsString = buildOptionsString(options);
|
|
13124
|
+
return `${CLOUDFLARE_CDN_BASE}/${optionsString}/${sourceUrl}`;
|
|
13125
|
+
}
|
|
13126
|
+
function transformCoverImage(sourceUrl, deviceType = "desktop", customOptions) {
|
|
13127
|
+
const preset = ImagePresets.cover[deviceType];
|
|
13128
|
+
const options = { ...preset, ...customOptions };
|
|
13129
|
+
return transformImage(sourceUrl, options);
|
|
13130
|
+
}
|
|
13131
|
+
function transformIconImage(sourceUrl, size = "default", customOptions) {
|
|
13132
|
+
const preset = ImagePresets.icon[size];
|
|
13133
|
+
const options = { ...preset, ...customOptions };
|
|
13134
|
+
return transformImage(sourceUrl, options);
|
|
13135
|
+
}
|
|
13136
|
+
|
|
13137
|
+
// src/mantine/components/CoverImage.tsx
|
|
13044
13138
|
function CoverImage({ coverImageUrl, logoUrl }) {
|
|
13045
13139
|
const { editor, handlers, editable } = useBlocknoteContext();
|
|
13046
13140
|
const [isHovering, setIsHovering] = useState48(false);
|
|
@@ -13060,8 +13154,10 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13060
13154
|
});
|
|
13061
13155
|
return unsubscribe;
|
|
13062
13156
|
}, [editor]);
|
|
13063
|
-
const
|
|
13064
|
-
const
|
|
13157
|
+
const rawCoverUrl = metadata?.cover || coverImageUrl;
|
|
13158
|
+
const rawLogoUrl = metadata?.icon || logoUrl;
|
|
13159
|
+
const coverUrl = rawCoverUrl ? transformCoverImage(rawCoverUrl, "desktop") : void 0;
|
|
13160
|
+
const logoSrc = rawLogoUrl ? transformIconImage(rawLogoUrl, "default") : void 0;
|
|
13065
13161
|
const hasCover = !!coverUrl;
|
|
13066
13162
|
const hasLogo = !!logoSrc;
|
|
13067
13163
|
const handleFileSelect = async (event, type) => {
|
|
@@ -13302,7 +13398,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
13302
13398
|
paddingBottom: "70px",
|
|
13303
13399
|
// Space for logo area (increased for 120px logo)
|
|
13304
13400
|
cursor: isRepositioning ? "ns-resize" : "default",
|
|
13305
|
-
backgroundColor: "
|
|
13401
|
+
backgroundColor: "transparent"
|
|
13306
13402
|
},
|
|
13307
13403
|
onMouseEnter: () => editable && setIsHovering(true),
|
|
13308
13404
|
onMouseLeave: () => {
|
|
@@ -13745,4 +13841,4 @@ export {
|
|
|
13745
13841
|
ixoGraphQLClient,
|
|
13746
13842
|
getEntity
|
|
13747
13843
|
};
|
|
13748
|
-
//# sourceMappingURL=chunk-
|
|
13844
|
+
//# sourceMappingURL=chunk-YXM4UH6C.mjs.map
|