@select-org/select-post-builder 1.1.6 → 1.1.7
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/post-builder.cjs.js +31 -211
- package/dist/post-builder.css +0 -9
- package/dist/post-builder.js +31 -211
- package/package.json +1 -1
package/dist/post-builder.cjs.js
CHANGED
|
@@ -2083,19 +2083,12 @@ validators$1.transitional = function transitional(validator2, version, message)
|
|
|
2083
2083
|
}
|
|
2084
2084
|
if (version && !deprecatedWarnings[opt]) {
|
|
2085
2085
|
deprecatedWarnings[opt] = true;
|
|
2086
|
-
console.warn(
|
|
2087
|
-
formatMessage(
|
|
2088
|
-
opt,
|
|
2089
|
-
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
2090
|
-
)
|
|
2091
|
-
);
|
|
2092
2086
|
}
|
|
2093
2087
|
return validator2 ? validator2(value, opt, opts) : true;
|
|
2094
2088
|
};
|
|
2095
2089
|
};
|
|
2096
2090
|
validators$1.spelling = function spelling(correctSpelling) {
|
|
2097
2091
|
return (value, opt) => {
|
|
2098
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
2099
2092
|
return true;
|
|
2100
2093
|
};
|
|
2101
2094
|
};
|
|
@@ -3970,7 +3963,6 @@ const Toaster$1 = /* @__PURE__ */ React__namespace.default.forwardRef(function T
|
|
|
3970
3963
|
setActualTheme("light");
|
|
3971
3964
|
}
|
|
3972
3965
|
} catch (e) {
|
|
3973
|
-
console.error(e);
|
|
3974
3966
|
}
|
|
3975
3967
|
});
|
|
3976
3968
|
}
|
|
@@ -4977,9 +4969,6 @@ function useControllableState({
|
|
|
4977
4969
|
if (wasControlled !== isControlled) {
|
|
4978
4970
|
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
4979
4971
|
const to = isControlled ? "controlled" : "uncontrolled";
|
|
4980
|
-
console.warn(
|
|
4981
|
-
`${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
|
|
4982
|
-
);
|
|
4983
4972
|
}
|
|
4984
4973
|
isControlledRef.current = isControlled;
|
|
4985
4974
|
}, [isControlled, caller]);
|
|
@@ -8757,26 +8746,6 @@ const createStoreImpl = (createState) => {
|
|
|
8757
8746
|
return api;
|
|
8758
8747
|
};
|
|
8759
8748
|
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
8760
|
-
const FEATURE_NAME_MAP = {
|
|
8761
|
-
// Tiptap Marks (inline formatting)
|
|
8762
|
-
undo: "undo",
|
|
8763
|
-
redo: "redo",
|
|
8764
|
-
paragraph: "paragraph",
|
|
8765
|
-
bold: "bold",
|
|
8766
|
-
italic: "italic",
|
|
8767
|
-
strike: "strikethrough",
|
|
8768
|
-
code: "code",
|
|
8769
|
-
customLink: "customLink",
|
|
8770
|
-
// Default heading mapping
|
|
8771
|
-
bulletList: "bullet_list",
|
|
8772
|
-
orderedList: "ordered_list",
|
|
8773
|
-
blockquote: "blockquote",
|
|
8774
|
-
codeBlock: "code_block",
|
|
8775
|
-
// Default media type
|
|
8776
|
-
image: "image",
|
|
8777
|
-
video: "video",
|
|
8778
|
-
audio: "audio"
|
|
8779
|
-
};
|
|
8780
8749
|
const ANALYTICS_EVENTS = {
|
|
8781
8750
|
// Session events
|
|
8782
8751
|
SESSION: {
|
|
@@ -8831,6 +8800,26 @@ const ANALYTICS_EVENTS = {
|
|
|
8831
8800
|
// NEW
|
|
8832
8801
|
}
|
|
8833
8802
|
};
|
|
8803
|
+
const FEATURE_NAME_MAP = {
|
|
8804
|
+
// Tiptap Marks (inline formatting)
|
|
8805
|
+
undo: "undo",
|
|
8806
|
+
redo: "redo",
|
|
8807
|
+
paragraph: "paragraph",
|
|
8808
|
+
bold: "bold",
|
|
8809
|
+
italic: "italic",
|
|
8810
|
+
strike: "strikethrough",
|
|
8811
|
+
code: "code",
|
|
8812
|
+
customLink: "customLink",
|
|
8813
|
+
// Default heading mapping
|
|
8814
|
+
bulletList: "bullet_list",
|
|
8815
|
+
orderedList: "ordered_list",
|
|
8816
|
+
blockquote: "blockquote",
|
|
8817
|
+
codeBlock: "code_block",
|
|
8818
|
+
// Default media type
|
|
8819
|
+
image: "image",
|
|
8820
|
+
video: "video",
|
|
8821
|
+
audio: "audio"
|
|
8822
|
+
};
|
|
8834
8823
|
const HEADING_FEATURE_MAP = {
|
|
8835
8824
|
1: "heading_1",
|
|
8836
8825
|
2: "heading_2",
|
|
@@ -10469,9 +10458,7 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10469
10458
|
enabled: config.enabled ?? false,
|
|
10470
10459
|
debug: config.debug ?? false
|
|
10471
10460
|
});
|
|
10472
|
-
if (config.debug)
|
|
10473
|
-
console.log("[Analytics] Initialized", { enabled: config.enabled, debug: config.debug });
|
|
10474
|
-
}
|
|
10461
|
+
if (config.debug) ;
|
|
10475
10462
|
},
|
|
10476
10463
|
createSession: (editorType, placement) => {
|
|
10477
10464
|
const { sessionManager, logEventFn, enabled, debug } = get2();
|
|
@@ -10485,9 +10472,6 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10485
10472
|
// NEW
|
|
10486
10473
|
};
|
|
10487
10474
|
logEventFn(ANALYTICS_EVENTS.SESSION.STARTED, props);
|
|
10488
|
-
if (debug) {
|
|
10489
|
-
console.log("[Analytics]", ANALYTICS_EVENTS.SESSION.STARTED, props);
|
|
10490
|
-
}
|
|
10491
10475
|
}
|
|
10492
10476
|
return sessionId;
|
|
10493
10477
|
},
|
|
@@ -10506,9 +10490,6 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10506
10490
|
if (!enabled || !logEventFn) return;
|
|
10507
10491
|
const session = sessionManager.getSession(sessionId);
|
|
10508
10492
|
if (!session) {
|
|
10509
|
-
if (debug) {
|
|
10510
|
-
console.warn(`[Analytics] Cannot track '${eventName}' - session not found: ${sessionId}`);
|
|
10511
|
-
}
|
|
10512
10493
|
return;
|
|
10513
10494
|
}
|
|
10514
10495
|
const enrichedProps = {
|
|
@@ -10520,7 +10501,6 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10520
10501
|
};
|
|
10521
10502
|
const cleanProps = pickBy(enrichedProps, (v) => v != null);
|
|
10522
10503
|
logEventFn(eventName, cleanProps);
|
|
10523
|
-
if (debug) console.log(`[Analytics] ${eventName}`, cleanProps);
|
|
10524
10504
|
},
|
|
10525
10505
|
trackPublish: (sessionId, params) => {
|
|
10526
10506
|
const { trackEvent, sessionManager } = get2();
|
|
@@ -13473,7 +13453,6 @@ var correctTargets = function(parent2, targets) {
|
|
|
13473
13453
|
if (correctedTarget && parent2.contains(correctedTarget)) {
|
|
13474
13454
|
return correctedTarget;
|
|
13475
13455
|
}
|
|
13476
|
-
console.error("aria-hidden", target, "in not contained inside", parent2, ". Doing nothing");
|
|
13477
13456
|
return null;
|
|
13478
13457
|
}).filter(function(x2) {
|
|
13479
13458
|
return Boolean(x2);
|
|
@@ -13522,7 +13501,6 @@ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, co
|
|
|
13522
13501
|
node.setAttribute(controlAttribute, "true");
|
|
13523
13502
|
}
|
|
13524
13503
|
} catch (e) {
|
|
13525
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
13526
13504
|
}
|
|
13527
13505
|
}
|
|
13528
13506
|
});
|
|
@@ -16160,15 +16138,11 @@ function requireUseSyncExternalStoreShim_development() {
|
|
|
16160
16138
|
return x2 === y && (0 !== x2 || 1 / x2 === 1 / y) || x2 !== x2 && y !== y;
|
|
16161
16139
|
}
|
|
16162
16140
|
function useSyncExternalStore$2(subscribe2, getSnapshot) {
|
|
16163
|
-
didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true,
|
|
16164
|
-
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
16165
|
-
));
|
|
16141
|
+
didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, void 0);
|
|
16166
16142
|
var value = getSnapshot();
|
|
16167
16143
|
if (!didWarnUncachedGetSnapshot) {
|
|
16168
16144
|
var cachedValue = getSnapshot();
|
|
16169
|
-
objectIs(value, cachedValue) || (
|
|
16170
|
-
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
16171
|
-
), didWarnUncachedGetSnapshot = true);
|
|
16145
|
+
objectIs(value, cachedValue) || (void 0, didWarnUncachedGetSnapshot = true);
|
|
16172
16146
|
}
|
|
16173
16147
|
cachedValue = useState({
|
|
16174
16148
|
inst: { value, getSnapshot }
|
|
@@ -16400,9 +16374,6 @@ const GroupSelector = ({ store }) => {
|
|
|
16400
16374
|
setGroups(response.entries ?? []);
|
|
16401
16375
|
}
|
|
16402
16376
|
} catch (error) {
|
|
16403
|
-
if (!cancelled) {
|
|
16404
|
-
console.error("Failed to fetch groups:", error);
|
|
16405
|
-
}
|
|
16406
16377
|
} finally {
|
|
16407
16378
|
if (!cancelled) {
|
|
16408
16379
|
setIsLoading(false);
|
|
@@ -17356,7 +17327,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17356
17327
|
React__namespace.useEffect(() => {
|
|
17357
17328
|
if (titleId) {
|
|
17358
17329
|
const hasTitle = document.getElementById(titleId);
|
|
17359
|
-
if (!hasTitle)
|
|
17330
|
+
if (!hasTitle) ;
|
|
17360
17331
|
}
|
|
17361
17332
|
}, [MESSAGE, titleId]);
|
|
17362
17333
|
return null;
|
|
@@ -17369,7 +17340,7 @@ var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
|
17369
17340
|
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
17370
17341
|
if (descriptionId && describedById) {
|
|
17371
17342
|
const hasDescription = document.getElementById(descriptionId);
|
|
17372
|
-
if (!hasDescription)
|
|
17343
|
+
if (!hasDescription) ;
|
|
17373
17344
|
}
|
|
17374
17345
|
}, [MESSAGE, contentRef, descriptionId]);
|
|
17375
17346
|
return null;
|
|
@@ -17755,7 +17726,6 @@ const InputGroupText = React.forwardRef(
|
|
|
17755
17726
|
InputGroupText.displayName = "InputGroupText";
|
|
17756
17727
|
const InputGroupInput = React.forwardRef(
|
|
17757
17728
|
({ className, ref: legacyRef, ...props }, ref) => {
|
|
17758
|
-
console.log({ legacyRef });
|
|
17759
17729
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17760
17730
|
Input,
|
|
17761
17731
|
{
|
|
@@ -18376,7 +18346,6 @@ const resolveUrlType = async (url) => {
|
|
|
18376
18346
|
if (mime?.startsWith("video/")) return { type: MediaNodeTypes.Video, src: url };
|
|
18377
18347
|
if (mime?.startsWith("audio/")) return { type: MediaNodeTypes.Audio, src: url };
|
|
18378
18348
|
} catch (error) {
|
|
18379
|
-
console.warn("HEAD request failed, falling back to mime detection:", error);
|
|
18380
18349
|
}
|
|
18381
18350
|
const ext = url.split(".").pop()?.toLowerCase();
|
|
18382
18351
|
if (ext) {
|
|
@@ -18516,11 +18485,9 @@ const LinkDecoratorModal = ({
|
|
|
18516
18485
|
setIsValid(isValid2);
|
|
18517
18486
|
};
|
|
18518
18487
|
const handleInsertLink = (link2, text22, uid2) => {
|
|
18519
|
-
console.log("HANDLE INSERT LINK::", { link: link2, text: text22 });
|
|
18520
18488
|
setIsLoading(true);
|
|
18521
18489
|
let metadata;
|
|
18522
|
-
core2?.resolveUrl(link2)?.then((res) => metadata = res)?.catch((err) =>
|
|
18523
|
-
console.log({ metadata });
|
|
18490
|
+
core2?.resolveUrl(link2)?.then((res) => metadata = res)?.catch((err) => void 0)?.finally(() => {
|
|
18524
18491
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
18525
18492
|
setIsLoading(false);
|
|
18526
18493
|
onInsertLink(link2, text22, uid2, previewPayload);
|
|
@@ -18532,12 +18499,10 @@ const LinkDecoratorModal = ({
|
|
|
18532
18499
|
e.preventDefault();
|
|
18533
18500
|
const isTextInput = textInputRef.current === e.target;
|
|
18534
18501
|
if (isTextInput || hideTextInput) return handleInsertLink(link, text2, uid ?? void 0);
|
|
18535
|
-
console.log("Enter", isTextInput);
|
|
18536
18502
|
textInputRef?.current?.focus();
|
|
18537
18503
|
}
|
|
18538
18504
|
};
|
|
18539
18505
|
React.useEffect(() => {
|
|
18540
|
-
console.log({ defaultValues });
|
|
18541
18506
|
if (!defaultValues?.link) return;
|
|
18542
18507
|
const isValid2 = isValidUrl(defaultValues?.link);
|
|
18543
18508
|
setIsValid(isValid2);
|
|
@@ -18546,7 +18511,6 @@ const LinkDecoratorModal = ({
|
|
|
18546
18511
|
setLink(defaultValues?.link ?? "");
|
|
18547
18512
|
setText(defaultValues?.text || "");
|
|
18548
18513
|
}, [defaultValues]);
|
|
18549
|
-
console.log("TEXT INSIDE LINK DECORATOR::", { isValid, text: text2 });
|
|
18550
18514
|
return /* @__PURE__ */ jsxRuntime.jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
18551
18515
|
children ? /* @__PURE__ */ jsxRuntime.jsx(DialogTrigger, { asChild: true, children }) : null,
|
|
18552
18516
|
/* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "-translate-1/2", children: [
|
|
@@ -18732,10 +18696,8 @@ function parseThreshold(scrollThreshold) {
|
|
|
18732
18696
|
value: parseFloat(scrollThreshold)
|
|
18733
18697
|
};
|
|
18734
18698
|
}
|
|
18735
|
-
console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...');
|
|
18736
18699
|
return defaultThreshold;
|
|
18737
18700
|
}
|
|
18738
|
-
console.warn("scrollThreshold should be string or number");
|
|
18739
18701
|
return defaultThreshold;
|
|
18740
18702
|
}
|
|
18741
18703
|
var InfiniteScroll = (
|
|
@@ -18757,7 +18719,6 @@ var InfiniteScroll = (
|
|
|
18757
18719
|
return document.getElementById(_this.props.scrollableTarget);
|
|
18758
18720
|
}
|
|
18759
18721
|
if (_this.props.scrollableTarget === null) {
|
|
18760
|
-
console.warn("You are trying to pass scrollableTarget but it is null. This might\n happen because the element may not have been added to DOM yet.\n See https://github.com/ankeetmaini/react-infinite-scroll-component/issues/59 for more info.\n ");
|
|
18761
18722
|
}
|
|
18762
18723
|
return null;
|
|
18763
18724
|
};
|
|
@@ -19002,7 +18963,6 @@ function useMediaSearch(type) {
|
|
|
19002
18963
|
setItems((prev) => reset2 ? data : [...prev, ...data]);
|
|
19003
18964
|
}
|
|
19004
18965
|
} catch (error) {
|
|
19005
|
-
console.error("Error fetching images:", error);
|
|
19006
18966
|
pagination.setHasMore(false);
|
|
19007
18967
|
} finally {
|
|
19008
18968
|
pagination.setLoading(false);
|
|
@@ -19021,7 +18981,6 @@ function useMediaSearch(type) {
|
|
|
19021
18981
|
setItems((prev) => reset2 ? data : [...prev, ...data]);
|
|
19022
18982
|
}
|
|
19023
18983
|
} catch (error) {
|
|
19024
|
-
console.error("Error fetching gifs:", error);
|
|
19025
18984
|
pagination.setHasMore(false);
|
|
19026
18985
|
} finally {
|
|
19027
18986
|
pagination.setLoading(false);
|
|
@@ -19079,8 +19038,8 @@ function ImageSearchModal({
|
|
|
19079
19038
|
setSearchQuery("");
|
|
19080
19039
|
return;
|
|
19081
19040
|
}
|
|
19082
|
-
gifSearch.fetch(withInitialQuery).catch((err) =>
|
|
19083
|
-
imageSearch.fetch(withInitialQuery).catch((err) =>
|
|
19041
|
+
gifSearch.fetch(withInitialQuery).catch((err) => void 0);
|
|
19042
|
+
imageSearch.fetch(withInitialQuery).catch((err) => void 0);
|
|
19084
19043
|
};
|
|
19085
19044
|
const debouncedSearch = React.useMemo(
|
|
19086
19045
|
() => debounce$2(async (query) => {
|
|
@@ -19098,7 +19057,7 @@ function ImageSearchModal({
|
|
|
19098
19057
|
const handleSearch = React.useCallback(
|
|
19099
19058
|
(query) => {
|
|
19100
19059
|
setSearchQuery(query);
|
|
19101
|
-
debouncedSearch(query)?.catch((err) =>
|
|
19060
|
+
debouncedSearch(query)?.catch((err) => void 0);
|
|
19102
19061
|
},
|
|
19103
19062
|
[debouncedSearch]
|
|
19104
19063
|
);
|
|
@@ -21652,11 +21611,9 @@ var Progress$1 = React__namespace.forwardRef(
|
|
|
21652
21611
|
...progressProps
|
|
21653
21612
|
} = props;
|
|
21654
21613
|
if ((maxProp || maxProp === 0) && !isValidMaxNumber(maxProp)) {
|
|
21655
|
-
console.error(getInvalidMaxError(`${maxProp}`, "Progress"));
|
|
21656
21614
|
}
|
|
21657
21615
|
const max2 = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
21658
21616
|
if (valueProp !== null && !isValidValueNumber(valueProp, max2)) {
|
|
21659
|
-
console.error(getInvalidValueError(`${valueProp}`, "Progress"));
|
|
21660
21617
|
}
|
|
21661
21618
|
const value = isValidValueNumber(valueProp, max2) ? valueProp : null;
|
|
21662
21619
|
const valueLabel = isNumber(value) ? getValueLabel(value, max2) : void 0;
|
|
@@ -21982,13 +21939,7 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21982
21939
|
state: state2,
|
|
21983
21940
|
dispatch
|
|
21984
21941
|
}) => {
|
|
21985
|
-
console.log("=== UPDATE MARK COMMAND START ===");
|
|
21986
|
-
console.log("markName:", markName);
|
|
21987
|
-
console.log("uid:", uid);
|
|
21988
|
-
console.log("attrs:", attrs);
|
|
21989
|
-
console.log("state.doc:", state2.doc.toJSON());
|
|
21990
21942
|
if (!dispatch) {
|
|
21991
|
-
console.log("No dispatch, returning false");
|
|
21992
21943
|
return false;
|
|
21993
21944
|
}
|
|
21994
21945
|
const { doc, schema } = state2;
|
|
@@ -21998,13 +21949,6 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21998
21949
|
doc.descendants((node, pos) => {
|
|
21999
21950
|
if (node.isText && node.marks?.length) {
|
|
22000
21951
|
node.marks.forEach((mark) => {
|
|
22001
|
-
console.log("Checking mark:", {
|
|
22002
|
-
markType: mark.type.name,
|
|
22003
|
-
markUid: mark.attrs.uid,
|
|
22004
|
-
targetMarkName: markName,
|
|
22005
|
-
targetUid: uid,
|
|
22006
|
-
matches: mark.type.name === markName && mark.attrs.uid === uid
|
|
22007
|
-
});
|
|
22008
21952
|
if (mark.type.name === markName && mark.attrs.uid === uid) {
|
|
22009
21953
|
positions.push({
|
|
22010
21954
|
from: pos,
|
|
@@ -22012,33 +21956,21 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
22012
21956
|
mark
|
|
22013
21957
|
});
|
|
22014
21958
|
found2 = true;
|
|
22015
|
-
console.log("Found matching mark at:", { from: pos, to: pos + node.nodeSize });
|
|
22016
21959
|
}
|
|
22017
21960
|
});
|
|
22018
21961
|
}
|
|
22019
21962
|
});
|
|
22020
|
-
console.log("Total positions found:", positions.length);
|
|
22021
|
-
console.log("Positions:", positions);
|
|
22022
21963
|
if (found2) {
|
|
22023
21964
|
positions.forEach(({ from, to, mark }) => {
|
|
22024
21965
|
const newAttrs = { ...mark.attrs, ...attrs };
|
|
22025
21966
|
const markType = schema.marks[markName];
|
|
22026
|
-
console.log("Applying update:", { from, to, oldAttrs: mark.attrs, newAttrs });
|
|
22027
21967
|
if (markType) {
|
|
22028
|
-
console.log("Before removeMark - tr.doc:", tr.doc.toJSON());
|
|
22029
21968
|
tr = tr.removeMark(from, to, markType);
|
|
22030
|
-
console.log("After removeMark - tr.doc:", tr.doc.toJSON());
|
|
22031
21969
|
tr = tr.addMark(from, to, markType.create(newAttrs));
|
|
22032
|
-
console.log("After addMark - tr.doc:", tr.doc.toJSON());
|
|
22033
21970
|
}
|
|
22034
21971
|
});
|
|
22035
|
-
console.log("About to dispatch transaction");
|
|
22036
|
-
console.log("Final tr.doc:", tr.doc.toJSON());
|
|
22037
|
-
console.log("Original state.doc:", state2.doc.toJSON());
|
|
22038
21972
|
dispatch(tr);
|
|
22039
|
-
console.log("Transaction dispatched successfully");
|
|
22040
21973
|
}
|
|
22041
|
-
console.log("=== UPDATE MARK COMMAND END ===");
|
|
22042
21974
|
return found2;
|
|
22043
21975
|
};
|
|
22044
21976
|
};
|
|
@@ -23056,7 +22988,6 @@ let warnedAboutTextSelection = false;
|
|
|
23056
22988
|
function checkTextSelection($pos) {
|
|
23057
22989
|
if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
|
|
23058
22990
|
warnedAboutTextSelection = true;
|
|
23059
|
-
console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
|
|
23060
22991
|
}
|
|
23061
22992
|
}
|
|
23062
22993
|
class TextSelection extends Selection {
|
|
@@ -23801,7 +23732,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23801
23732
|
});
|
|
23802
23733
|
return createPollMediaOption(result, startIndex + index2);
|
|
23803
23734
|
} catch (error) {
|
|
23804
|
-
console.error("Upload failed for", file.name, error);
|
|
23805
23735
|
trackMediaUploadFailed({
|
|
23806
23736
|
editorType: EditorTypes.Poll,
|
|
23807
23737
|
mediaType: file.type.startsWith("video/") ? "video" : "image",
|
|
@@ -23836,7 +23766,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23836
23766
|
return final;
|
|
23837
23767
|
});
|
|
23838
23768
|
} catch (error) {
|
|
23839
|
-
console.error("Unexpected error during file upload:", error);
|
|
23840
23769
|
setInternalChoices((current) => {
|
|
23841
23770
|
const withoutPlaceholders = current.filter((c) => !isPlaceholder(c));
|
|
23842
23771
|
setTimeout(() => {
|
|
@@ -23881,7 +23810,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23881
23810
|
return updated;
|
|
23882
23811
|
});
|
|
23883
23812
|
} catch (error) {
|
|
23884
|
-
console.error("URL upload failed:", error);
|
|
23885
23813
|
trackMediaUploadFailed({
|
|
23886
23814
|
editorType: EditorTypes.Poll,
|
|
23887
23815
|
mediaType: searchFrom === ImageSearchFrom.Gif ? "gif" : "image",
|
|
@@ -24436,7 +24364,6 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
24436
24364
|
};
|
|
24437
24365
|
const handleUpdateLink = (link, text2, uid, previewPayload) => {
|
|
24438
24366
|
if (!editor.view) return;
|
|
24439
|
-
console.log("UPDATE LINK IN VIEW::", { text: text2 });
|
|
24440
24367
|
const newText = mark?.attrs?.isLinkMode ? link : text2 || link;
|
|
24441
24368
|
if (uid) {
|
|
24442
24369
|
editor.commands.updateLink(uid, { href: link, text: newText, previewPayload });
|
|
@@ -24513,7 +24440,6 @@ function doesPreviewExist(editor, uid) {
|
|
|
24513
24440
|
});
|
|
24514
24441
|
return exists;
|
|
24515
24442
|
} catch (err) {
|
|
24516
|
-
console.error("❌ Error in doesPreviewExist:", err);
|
|
24517
24443
|
return false;
|
|
24518
24444
|
}
|
|
24519
24445
|
}
|
|
@@ -24531,13 +24457,11 @@ function findExistingPreview(editor) {
|
|
|
24531
24457
|
});
|
|
24532
24458
|
return result;
|
|
24533
24459
|
} catch (err) {
|
|
24534
|
-
console.error("❌ Error in findExistingPreview:", err);
|
|
24535
24460
|
return null;
|
|
24536
24461
|
}
|
|
24537
24462
|
}
|
|
24538
24463
|
function removePreviewByUid(editor, uid) {
|
|
24539
24464
|
if (!editor || !uid) {
|
|
24540
|
-
console.warn("⚠️ Cannot remove preview: missing editor or uid");
|
|
24541
24465
|
return;
|
|
24542
24466
|
}
|
|
24543
24467
|
try {
|
|
@@ -24555,11 +24479,9 @@ function removePreviewByUid(editor, uid) {
|
|
|
24555
24479
|
if (tr) {
|
|
24556
24480
|
tr.delete(previewPos, Number(previewPos) + previewSize);
|
|
24557
24481
|
editor.view.dispatch(tr);
|
|
24558
|
-
console.log("🗑️ Removed preview for UID:", uid);
|
|
24559
24482
|
}
|
|
24560
24483
|
}
|
|
24561
24484
|
} catch (err) {
|
|
24562
|
-
console.error("❌ Error in removePreviewByUid:", err);
|
|
24563
24485
|
}
|
|
24564
24486
|
}
|
|
24565
24487
|
function extractBestImage(metadata) {
|
|
@@ -24587,7 +24509,6 @@ function collectAllLinkMarks(state2, linkMark) {
|
|
|
24587
24509
|
}
|
|
24588
24510
|
function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, pluginState) {
|
|
24589
24511
|
if (!newState || !linkMark || !editor || !pluginState) {
|
|
24590
|
-
console.warn("⚠️ Missing required parameters for syncLinkHrefWithText");
|
|
24591
24512
|
return null;
|
|
24592
24513
|
}
|
|
24593
24514
|
let tr = null;
|
|
@@ -24601,17 +24522,11 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24601
24522
|
const currentText = node.text || "";
|
|
24602
24523
|
const currentHref = mark.attrs.href || "";
|
|
24603
24524
|
if (currentText !== currentHref) {
|
|
24604
|
-
console.log("🔄 Text-href mismatch detected:", {
|
|
24605
|
-
uid: mark.attrs.uid,
|
|
24606
|
-
text: currentText,
|
|
24607
|
-
href: currentHref
|
|
24608
|
-
});
|
|
24609
24525
|
const isValidUrl2 = isValidUrlFormat(currentText);
|
|
24610
24526
|
if (!tr) {
|
|
24611
24527
|
tr = newState.tr;
|
|
24612
24528
|
}
|
|
24613
24529
|
if (!tr) {
|
|
24614
|
-
console.warn("⚠️ Failed to create transaction");
|
|
24615
24530
|
return;
|
|
24616
24531
|
}
|
|
24617
24532
|
if (isValidUrl2) {
|
|
@@ -24620,44 +24535,32 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24620
24535
|
href: normalizeUrl(currentText)
|
|
24621
24536
|
});
|
|
24622
24537
|
if (!newMark) {
|
|
24623
|
-
console.warn("⚠️ Failed to create new mark");
|
|
24624
24538
|
return;
|
|
24625
24539
|
}
|
|
24626
24540
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24627
24541
|
tr = tr.addMark(pos, pos + node.nodeSize, newMark);
|
|
24628
24542
|
hasChanges = true;
|
|
24629
|
-
console.log("✏️ Updated href to match text:", currentText);
|
|
24630
24543
|
pluginState.processedLinks.delete(mark.attrs.uid);
|
|
24631
24544
|
if (singlePreviewMode) {
|
|
24632
|
-
console.log("🔄 [SINGLE MODE] Queueing preview removal for re-resolution");
|
|
24633
24545
|
queueMicrotask(() => {
|
|
24634
24546
|
try {
|
|
24635
24547
|
const existingPreview = findExistingPreview(editor);
|
|
24636
24548
|
if (existingPreview && mark.attrs?.uid) {
|
|
24637
|
-
console.log(
|
|
24638
|
-
"🗑️ [SINGLE MODE - VALID URL] Removing preview to re-resolve [turned off currently]"
|
|
24639
|
-
);
|
|
24640
24549
|
}
|
|
24641
24550
|
} catch (err) {
|
|
24642
|
-
console.error("❌ Error removing preview in single mode:", err);
|
|
24643
24551
|
}
|
|
24644
24552
|
});
|
|
24645
24553
|
} else {
|
|
24646
|
-
console.log("🔄 [MULTI MODE] Link Auto Resolve Does Nothing");
|
|
24647
24554
|
}
|
|
24648
24555
|
} else {
|
|
24649
24556
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24650
24557
|
hasChanges = true;
|
|
24651
|
-
console.log("❌ Text no longer valid URL, removing link mark");
|
|
24652
|
-
console.log("🔄 [INVALID URL] Queueing preview removal");
|
|
24653
24558
|
queueMicrotask(() => {
|
|
24654
24559
|
try {
|
|
24655
24560
|
if (mark.attrs?.uid) {
|
|
24656
|
-
console.log("🗑️ [INVALID URL] Removing preview due to invalid URL");
|
|
24657
24561
|
removePreviewByUid(editor, mark.attrs.uid);
|
|
24658
24562
|
}
|
|
24659
24563
|
} catch (err) {
|
|
24660
|
-
console.error("❌ Error removing preview:", err);
|
|
24661
24564
|
}
|
|
24662
24565
|
});
|
|
24663
24566
|
if (mark.attrs?.uid) {
|
|
@@ -24670,7 +24573,6 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24670
24573
|
});
|
|
24671
24574
|
});
|
|
24672
24575
|
} catch (err) {
|
|
24673
|
-
console.error("❌ Error in syncLinkHrefWithText:", err);
|
|
24674
24576
|
return null;
|
|
24675
24577
|
}
|
|
24676
24578
|
return hasChanges ? tr : null;
|
|
@@ -24684,11 +24586,6 @@ function assignUidsToLinks(newState, linkMark, editor) {
|
|
|
24684
24586
|
node.marks.forEach((mark) => {
|
|
24685
24587
|
if (mark.type === linkMark && mark.attrs?.href && !mark.attrs.uid) {
|
|
24686
24588
|
const newUid = v4();
|
|
24687
|
-
console.log("🔧 Assigning UID to autolinked URL:", {
|
|
24688
|
-
href: mark.attrs.href,
|
|
24689
|
-
uid: newUid,
|
|
24690
|
-
pos
|
|
24691
|
-
});
|
|
24692
24589
|
if (editor) {
|
|
24693
24590
|
const analytics = getAnalyticsStore();
|
|
24694
24591
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id");
|
|
@@ -24725,25 +24622,14 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24725
24622
|
const { api, editor } = options;
|
|
24726
24623
|
const mediaGroup = findByType(editor?.getJSON(), "mediaGroup");
|
|
24727
24624
|
if (!api) {
|
|
24728
|
-
console.warn("⚠️ No API provided to resolve link");
|
|
24729
24625
|
return;
|
|
24730
24626
|
}
|
|
24731
24627
|
if (singlePreviewMode && mediaGroup.length >= 1) return;
|
|
24732
24628
|
pluginState.resolvingLinks.add(link.uid);
|
|
24733
|
-
console.log("🌐 Resolving link metadata:", {
|
|
24734
|
-
uid: link.uid,
|
|
24735
|
-
href: link.href,
|
|
24736
|
-
singlePreviewMode
|
|
24737
|
-
});
|
|
24738
24629
|
api.resolveUrl(normalizeUrl(link.href)).then((metadata) => {
|
|
24739
24630
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24740
24631
|
pluginState.processedLinks.add(link.uid);
|
|
24741
|
-
console.log("✅ Link metadata resolved:", {
|
|
24742
|
-
uid: link.uid,
|
|
24743
|
-
metadata
|
|
24744
|
-
});
|
|
24745
24632
|
if (!metadata) {
|
|
24746
|
-
console.warn("⚠️ No metadata returned for:", link.href);
|
|
24747
24633
|
return;
|
|
24748
24634
|
}
|
|
24749
24635
|
const previewData = {
|
|
@@ -24758,13 +24644,11 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24758
24644
|
if (singlePreviewMode) {
|
|
24759
24645
|
const existingPreview = findExistingPreview(editor);
|
|
24760
24646
|
if (existingPreview) {
|
|
24761
|
-
console.log("🔄 Updating existing preview in single mode");
|
|
24762
24647
|
const { pos } = existingPreview;
|
|
24763
24648
|
const tr = editor.state.tr;
|
|
24764
24649
|
tr.setNodeMarkup(pos, void 0, previewData);
|
|
24765
24650
|
editor.view.dispatch(tr);
|
|
24766
24651
|
} else {
|
|
24767
|
-
console.log("➕ Creating first preview in single mode");
|
|
24768
24652
|
editor.commands.setLinkPreview(previewData);
|
|
24769
24653
|
}
|
|
24770
24654
|
editor.commands.updateLinkByUid(link.uid, {
|
|
@@ -24772,16 +24656,12 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24772
24656
|
});
|
|
24773
24657
|
} else {
|
|
24774
24658
|
if (!doesPreviewExist(editor, link.uid)) {
|
|
24775
|
-
console.log("➕ Creating new preview in multi mode");
|
|
24776
24659
|
editor.chain().updateLinkByUid(link.uid, {
|
|
24777
24660
|
previewPayload: convertLinkMetaToPreviewItem(metadata)
|
|
24778
24661
|
}).setLinkPreview(previewData).run();
|
|
24779
|
-
} else {
|
|
24780
|
-
console.log("⏭️ Preview already exists, skipping");
|
|
24781
24662
|
}
|
|
24782
24663
|
}
|
|
24783
24664
|
}).catch((err) => {
|
|
24784
|
-
console.error("❌ Failed to resolve link:", err);
|
|
24785
24665
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24786
24666
|
if (!editor?.view?.dom) return;
|
|
24787
24667
|
const analytics = getAnalyticsStore();
|
|
@@ -24799,10 +24679,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24799
24679
|
key: pluginKey,
|
|
24800
24680
|
state: {
|
|
24801
24681
|
init() {
|
|
24802
|
-
console.log("🔌 LinkAutoResolve plugin initialized", {
|
|
24803
|
-
singlePreviewMode,
|
|
24804
|
-
hasApi: !!options.api
|
|
24805
|
-
});
|
|
24806
24682
|
return {
|
|
24807
24683
|
resolvingLinks: /* @__PURE__ */ new Set(),
|
|
24808
24684
|
processedLinks: /* @__PURE__ */ new Set()
|
|
@@ -24832,33 +24708,23 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24832
24708
|
appendTransaction: (transactions, oldState, newState) => {
|
|
24833
24709
|
const linkMark = newState.schema.marks["customLink"];
|
|
24834
24710
|
if (!linkMark) {
|
|
24835
|
-
console.warn("⚠️ customLink mark not found in schema");
|
|
24836
24711
|
return null;
|
|
24837
24712
|
}
|
|
24838
24713
|
if (!transactions.some((tr) => tr.docChanged)) {
|
|
24839
24714
|
return null;
|
|
24840
24715
|
}
|
|
24841
|
-
console.log("📝 Document changed, checking for changes...");
|
|
24842
24716
|
const pluginState = pluginKey.getState(newState);
|
|
24843
24717
|
if (!pluginState) {
|
|
24844
|
-
console.warn("⚠️ Plugin state not found");
|
|
24845
24718
|
return null;
|
|
24846
24719
|
}
|
|
24847
24720
|
const syncTr = singlePreviewMode ? syncLinkHrefWithText(newState, linkMark, options.editor, singlePreviewMode, pluginState) : null;
|
|
24848
24721
|
const oldLinks = collectAllLinkMarks(oldState, linkMark);
|
|
24849
24722
|
const newLinks = collectAllLinkMarks(newState, linkMark);
|
|
24850
|
-
console.log("📊 Link count:", {
|
|
24851
|
-
old: oldLinks.size,
|
|
24852
|
-
new: newLinks.size,
|
|
24853
|
-
processed: pluginState.processedLinks.size,
|
|
24854
|
-
resolving: pluginState.resolvingLinks.size
|
|
24855
|
-
});
|
|
24856
24723
|
const editor = options?.editor;
|
|
24857
24724
|
const { tr: uidTr, newUids } = assignUidsToLinks(newState, linkMark, editor);
|
|
24858
24725
|
const linksToResolve = [];
|
|
24859
24726
|
newUids.forEach((linkData) => {
|
|
24860
24727
|
if (!pluginState.processedLinks.has(linkData.uid) && !pluginState.resolvingLinks.has(linkData.uid)) {
|
|
24861
|
-
console.log("🆕 New autolinked URL detected:", linkData);
|
|
24862
24728
|
linksToResolve.push(linkData);
|
|
24863
24729
|
}
|
|
24864
24730
|
});
|
|
@@ -24871,19 +24737,15 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24871
24737
|
return;
|
|
24872
24738
|
}
|
|
24873
24739
|
if (!oldLinks.has(uid)) {
|
|
24874
|
-
console.log("🆕 New link detected (with UID):", linkData);
|
|
24875
24740
|
linksToResolve.push(linkData);
|
|
24876
24741
|
}
|
|
24877
24742
|
});
|
|
24878
24743
|
if (linksToResolve.length > 0) {
|
|
24879
|
-
console.log("🚀 Processing", linksToResolve.length, "new link(s)");
|
|
24880
24744
|
queueMicrotask(() => {
|
|
24881
24745
|
linksToResolve.forEach((link) => {
|
|
24882
24746
|
resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginState);
|
|
24883
24747
|
});
|
|
24884
24748
|
});
|
|
24885
|
-
} else {
|
|
24886
|
-
console.log("✓ No new links to process");
|
|
24887
24749
|
}
|
|
24888
24750
|
if (syncTr && uidTr) {
|
|
24889
24751
|
try {
|
|
@@ -24898,7 +24760,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24898
24760
|
});
|
|
24899
24761
|
return syncTr;
|
|
24900
24762
|
} catch (err) {
|
|
24901
|
-
console.error("❌ Error combining transactions:", err);
|
|
24902
24763
|
return syncTr;
|
|
24903
24764
|
}
|
|
24904
24765
|
}
|
|
@@ -25002,7 +24863,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25002
24863
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
25003
24864
|
if (metadata) {
|
|
25004
24865
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
25005
|
-
console.log({ href, text: text2 });
|
|
25006
24866
|
editor?.chain()?.updateLinkByUid(uid, { href, text: text2, previewPayload })?.updateLinkPreviewByUid(uid, {
|
|
25007
24867
|
// Now using correct UID
|
|
25008
24868
|
loading: false,
|
|
@@ -25018,7 +24878,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25018
24878
|
})?.catch((err) => {
|
|
25019
24879
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
25020
24880
|
analytics?.trackLinkUnfurlFailed(sessionId, { editorType });
|
|
25021
|
-
console.error("LINK UPDATE ERR::", { err });
|
|
25022
24881
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
25023
24882
|
});
|
|
25024
24883
|
return true;
|
|
@@ -25066,7 +24925,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25066
24925
|
if (attrs.href) {
|
|
25067
24926
|
queueMicrotask(() => {
|
|
25068
24927
|
this.options.api?.resolveUrl(normalizeUrl(attrs.href))?.then((metadata) => {
|
|
25069
|
-
console.log({ metadata });
|
|
25070
24928
|
if (metadata) {
|
|
25071
24929
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
25072
24930
|
let linkPreviewExists = false;
|
|
@@ -25095,7 +24953,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25095
24953
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
25096
24954
|
}
|
|
25097
24955
|
}).catch((err) => {
|
|
25098
|
-
console.log("LINK UPDATE ERR::", { err });
|
|
25099
24956
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id") ?? "";
|
|
25100
24957
|
const editorType = editor?.view?.dom?.getAttribute(
|
|
25101
24958
|
"data-editor-type"
|
|
@@ -25181,7 +25038,6 @@ const IframeView = ({
|
|
|
25181
25038
|
setPreviewData(previewPayload);
|
|
25182
25039
|
updateAttributes({ previewPayload });
|
|
25183
25040
|
}).catch((error) => {
|
|
25184
|
-
console.error("Failed to fetch preview:", error);
|
|
25185
25041
|
}).finally(() => {
|
|
25186
25042
|
});
|
|
25187
25043
|
}
|
|
@@ -25426,7 +25282,6 @@ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTyp
|
|
|
25426
25282
|
}
|
|
25427
25283
|
});
|
|
25428
25284
|
} catch (_) {
|
|
25429
|
-
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
25430
25285
|
return null;
|
|
25431
25286
|
}
|
|
25432
25287
|
};
|
|
@@ -26263,7 +26118,6 @@ const configureDOMPurify = () => {
|
|
|
26263
26118
|
const element = node;
|
|
26264
26119
|
const src = element.getAttribute("src") || "";
|
|
26265
26120
|
if (!isAllowedDomain(src)) {
|
|
26266
|
-
console.warn("🚨 Blocked iframe from non-allowed domain:", src);
|
|
26267
26121
|
node.parentNode?.removeChild(node);
|
|
26268
26122
|
}
|
|
26269
26123
|
}
|
|
@@ -26275,7 +26129,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26275
26129
|
const config = configureDOMPurify();
|
|
26276
26130
|
const cleaned = purify.sanitize(html2, config);
|
|
26277
26131
|
if (!cleaned.includes("<iframe")) {
|
|
26278
|
-
console.warn("⚠️ No valid iframe found after sanitization");
|
|
26279
26132
|
return null;
|
|
26280
26133
|
}
|
|
26281
26134
|
const match = cleaned.match(/<iframe[^>]*src=["']([^"']+)["']/i);
|
|
@@ -26287,7 +26140,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26287
26140
|
}
|
|
26288
26141
|
return match[1];
|
|
26289
26142
|
} catch (error) {
|
|
26290
|
-
console.error("🚨 Error sanitizing iframe:", error);
|
|
26291
26143
|
return null;
|
|
26292
26144
|
} finally {
|
|
26293
26145
|
purify.removeAllHooks();
|
|
@@ -26325,7 +26177,6 @@ const createFinder = (regex) => {
|
|
|
26325
26177
|
match
|
|
26326
26178
|
});
|
|
26327
26179
|
}
|
|
26328
|
-
console.log({ match, matches });
|
|
26329
26180
|
return matches.length > 0 ? matches : null;
|
|
26330
26181
|
};
|
|
26331
26182
|
};
|
|
@@ -26377,11 +26228,9 @@ const Iframe = core.Node.create({
|
|
|
26377
26228
|
const iframeHTML = match[0];
|
|
26378
26229
|
const safeSrc = sanitizeIframeHTML(iframeHTML);
|
|
26379
26230
|
if (!safeSrc) {
|
|
26380
|
-
console.warn("🚨 Blocked unsafe iframe paste");
|
|
26381
26231
|
toast.error("🚨 Your pasted iframe is not safe to render");
|
|
26382
26232
|
return;
|
|
26383
26233
|
}
|
|
26384
|
-
console.log("✅ Safe iframe URL validated:", safeSrc);
|
|
26385
26234
|
const node = this.type.create({ src: safeSrc, previewPayload: null });
|
|
26386
26235
|
state2.tr.replaceRangeWith(range.from, range.to, node);
|
|
26387
26236
|
}
|
|
@@ -26392,7 +26241,6 @@ const Iframe = core.Node.create({
|
|
|
26392
26241
|
handler: ({ state: state2, range, match }) => {
|
|
26393
26242
|
const fullUrl = match[0];
|
|
26394
26243
|
const embedUrl = getEmbedUrl(fullUrl);
|
|
26395
|
-
console.log({ match, fullUrl, embedUrl });
|
|
26396
26244
|
if (!embedUrl) return;
|
|
26397
26245
|
const node = this.type.create({ src: embedUrl });
|
|
26398
26246
|
state2.tr.replaceRangeWith(range.from, range.to, node);
|
|
@@ -26438,10 +26286,9 @@ const handleUrlWithoutSelection = (editor, url, event, autoDetectMedia) => {
|
|
|
26438
26286
|
mediaType: MediaItemType.MEDIA_ITEM
|
|
26439
26287
|
});
|
|
26440
26288
|
}).catch(
|
|
26441
|
-
(e) =>
|
|
26289
|
+
(e) => void 0
|
|
26442
26290
|
);
|
|
26443
26291
|
}
|
|
26444
|
-
console.log("[SmartLinkPaste] Inserting as link node");
|
|
26445
26292
|
editor.chain().focus().insertLink({ href: normalizedUrl, text: url }).run();
|
|
26446
26293
|
return true;
|
|
26447
26294
|
};
|
|
@@ -26463,7 +26310,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26463
26310
|
return false;
|
|
26464
26311
|
}
|
|
26465
26312
|
const trimmedText = pasteText.trim();
|
|
26466
|
-
console.log("[SmartLinkPaste] Valid URL detected:", isEmbeddableUrl(trimmedText));
|
|
26467
26313
|
if (isEmbeddableUrl(trimmedText) && options?.autoEmbed) {
|
|
26468
26314
|
event.preventDefault();
|
|
26469
26315
|
return false;
|
|
@@ -26480,7 +26326,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26480
26326
|
options?.autoDetectMedia ?? true
|
|
26481
26327
|
);
|
|
26482
26328
|
} catch (error) {
|
|
26483
|
-
console.error("[SmartLinkPaste] Error:", error);
|
|
26484
26329
|
return false;
|
|
26485
26330
|
}
|
|
26486
26331
|
};
|
|
@@ -26492,10 +26337,8 @@ const createTransformHandler = (editor) => {
|
|
|
26492
26337
|
return slice;
|
|
26493
26338
|
}
|
|
26494
26339
|
try {
|
|
26495
|
-
console.log("[SmartLinkPaste] Transforming inline URLs in pasted content");
|
|
26496
26340
|
return transformUrlsInSlice(editor, slice);
|
|
26497
26341
|
} catch (error) {
|
|
26498
|
-
console.error("[SmartLinkPaste] Transform error:", error);
|
|
26499
26342
|
return slice;
|
|
26500
26343
|
}
|
|
26501
26344
|
};
|
|
@@ -26602,7 +26445,6 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26602
26445
|
const uid = v4();
|
|
26603
26446
|
const options = this.options;
|
|
26604
26447
|
if (!options.api) {
|
|
26605
|
-
console.error("API instance not provided to SmartMediaUpload");
|
|
26606
26448
|
return false;
|
|
26607
26449
|
}
|
|
26608
26450
|
let uploadSource = "local";
|
|
@@ -26617,7 +26459,6 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26617
26459
|
options.allowedFileTypes
|
|
26618
26460
|
);
|
|
26619
26461
|
if (!validation.valid) {
|
|
26620
|
-
console.error("File validation failed:", validation.error);
|
|
26621
26462
|
options.onUploadError?.(uid, new Error(validation.error));
|
|
26622
26463
|
const { sessionId, editorType } = this.storage.getAnalyticsContext(editor);
|
|
26623
26464
|
if (sessionId && editorType) {
|
|
@@ -26743,7 +26584,6 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26743
26584
|
}
|
|
26744
26585
|
}
|
|
26745
26586
|
} catch (error) {
|
|
26746
|
-
console.error("Upload failed:", error);
|
|
26747
26587
|
const blobUrl = this.storage.blobUrls.get(item.uid);
|
|
26748
26588
|
if (blobUrl) {
|
|
26749
26589
|
URL.revokeObjectURL(blobUrl);
|
|
@@ -26778,7 +26618,7 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26778
26618
|
this.storage.activeUploads--;
|
|
26779
26619
|
this.storage.processUploadQueue(editor);
|
|
26780
26620
|
}
|
|
26781
|
-
})().catch((err) =>
|
|
26621
|
+
})().catch((err) => void 0);
|
|
26782
26622
|
if (this.storage.uploadQueue.length > 0) {
|
|
26783
26623
|
this.storage.processUploadQueue(editor);
|
|
26784
26624
|
}
|
|
@@ -29478,7 +29318,6 @@ function getSuggestionOptions({
|
|
|
29478
29318
|
const text2 = editor.getText();
|
|
29479
29319
|
const trimmed = text2?.replace(WHITESPACE_REGEX, " ")?.trim();
|
|
29480
29320
|
const matchStartPosition = trimmed?.lastIndexOf(char);
|
|
29481
|
-
console.log({ matchStartPosition });
|
|
29482
29321
|
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
29483
29322
|
const overrideSpace = nodeAfter?.text?.startsWith(" ");
|
|
29484
29323
|
if (overrideSpace) {
|
|
@@ -29592,7 +29431,6 @@ const Mention = core.Node.create({
|
|
|
29592
29431
|
renderHTML({ node, HTMLAttributes }) {
|
|
29593
29432
|
const suggestion2 = getSuggestionFromChar(this, node.attrs.mentionSuggestionChar);
|
|
29594
29433
|
if (this.options.renderLabel !== void 0) {
|
|
29595
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29596
29434
|
return [
|
|
29597
29435
|
"span",
|
|
29598
29436
|
core.mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
@@ -29632,7 +29470,6 @@ const Mention = core.Node.create({
|
|
|
29632
29470
|
suggestion: getSuggestionFromChar(this, node.attrs.mentionSuggestionChar)
|
|
29633
29471
|
};
|
|
29634
29472
|
if (this.options.renderLabel !== void 0) {
|
|
29635
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29636
29473
|
return this.options.renderLabel(args);
|
|
29637
29474
|
}
|
|
29638
29475
|
return this.options.renderText(args);
|
|
@@ -30594,11 +30431,9 @@ const mentionService = (api, mfs, store) => {
|
|
|
30594
30431
|
const fetchMentions = async () => {
|
|
30595
30432
|
const params = store.getState().getMentionParams();
|
|
30596
30433
|
if (!params) {
|
|
30597
|
-
console.error("DEBUG MENTION SERVICE::", "No group id or post id has been provided");
|
|
30598
30434
|
return [];
|
|
30599
30435
|
}
|
|
30600
30436
|
const { groupId, postId } = params;
|
|
30601
|
-
console.log({ groupId, postId });
|
|
30602
30437
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
30603
30438
|
return response.entries?.filter((item) => Boolean(item?.user_data))?.map(
|
|
30604
30439
|
(item) => ({
|
|
@@ -30617,7 +30452,6 @@ const mentionService = (api, mfs, store) => {
|
|
|
30617
30452
|
const { selectedGroupId, groupId } = store.getState();
|
|
30618
30453
|
const activeGroupId = selectedGroupId ?? groupId;
|
|
30619
30454
|
if (!activeGroupId) {
|
|
30620
|
-
console.warn("DEBUG HASHTAG SERVICE::", "No active group selected or provided");
|
|
30621
30455
|
return [];
|
|
30622
30456
|
}
|
|
30623
30457
|
const response = await api.fetchGroupConversations(999, 0);
|
|
@@ -30991,7 +30825,6 @@ const LinkPreview = core.Node.create({
|
|
|
30991
30825
|
},
|
|
30992
30826
|
renderHTML({ node }) {
|
|
30993
30827
|
const { href, uid, title, description, image, domain } = node.attrs;
|
|
30994
|
-
console.log("INSIDE RENDER HTML::", { href, image });
|
|
30995
30828
|
if (!href) return ["div", {}];
|
|
30996
30829
|
const content = [
|
|
30997
30830
|
// Link overlay
|
|
@@ -31234,14 +31067,12 @@ const createMediaModePlugin = () => {
|
|
|
31234
31067
|
child.marks.forEach((mark) => {
|
|
31235
31068
|
if (mark.type.name === "customLink" && mark.attrs.previewPayload) {
|
|
31236
31069
|
lastLinkPreviewData = mark.attrs.previewPayload;
|
|
31237
|
-
console.log("Found link with previewPayload:", lastLinkPreviewData);
|
|
31238
31070
|
}
|
|
31239
31071
|
});
|
|
31240
31072
|
}
|
|
31241
31073
|
});
|
|
31242
31074
|
}
|
|
31243
31075
|
});
|
|
31244
|
-
console.log("Cleanup check:", { modified, hasMediaGroup, lastLinkPreviewData });
|
|
31245
31076
|
if (modified && hasMediaGroup && lastLinkPreviewData) {
|
|
31246
31077
|
let hasLinkPreview = false;
|
|
31247
31078
|
tr.doc.forEach((node) => {
|
|
@@ -31249,10 +31080,6 @@ const createMediaModePlugin = () => {
|
|
|
31249
31080
|
hasLinkPreview = true;
|
|
31250
31081
|
}
|
|
31251
31082
|
});
|
|
31252
|
-
console.log("Creating linkPreview:", {
|
|
31253
|
-
hasLinkPreview,
|
|
31254
|
-
schemaHasLinkPreview: !!newState.schema.nodes.linkPreview
|
|
31255
|
-
});
|
|
31256
31083
|
if (!hasLinkPreview && newState.schema.nodes.linkPreview) {
|
|
31257
31084
|
const preview = lastLinkPreviewData;
|
|
31258
31085
|
const linkPreviewNode = newState.schema.nodes.linkPreview.create({
|
|
@@ -31263,7 +31090,6 @@ const createMediaModePlugin = () => {
|
|
|
31263
31090
|
image: preview.linkImage?.url ?? "",
|
|
31264
31091
|
variant: LinkPreviewType.Extended
|
|
31265
31092
|
});
|
|
31266
|
-
console.log("Inserting linkPreview node:", { lastLinkPreviewData, linkPreviewNode });
|
|
31267
31093
|
tr.insert(tr.doc.content.size, linkPreviewNode);
|
|
31268
31094
|
modified = true;
|
|
31269
31095
|
}
|
|
@@ -31323,7 +31149,6 @@ const createMediaModePlugin = () => {
|
|
|
31323
31149
|
}
|
|
31324
31150
|
const mediaNodes = updatedTopLevelMedia.map((m) => m.node);
|
|
31325
31151
|
if (mediaNodes.some((n) => !n || n.type.name !== "media")) {
|
|
31326
|
-
console.warn("Invalid media nodes detected, skipping group creation");
|
|
31327
31152
|
return null;
|
|
31328
31153
|
}
|
|
31329
31154
|
const mediaGroup = newState.schema.nodes.mediaGroup.create({}, mediaNodes);
|
|
@@ -31341,7 +31166,6 @@ const createMediaModePlugin = () => {
|
|
|
31341
31166
|
const $pos = tr.doc.resolve(endPos);
|
|
31342
31167
|
tr.setSelection(state.TextSelection.near($pos));
|
|
31343
31168
|
} catch (e) {
|
|
31344
|
-
console.warn("Could not set selection:", e);
|
|
31345
31169
|
}
|
|
31346
31170
|
}
|
|
31347
31171
|
tr.setMeta("addToHistory", false);
|
|
@@ -31349,7 +31173,6 @@ const createMediaModePlugin = () => {
|
|
|
31349
31173
|
}
|
|
31350
31174
|
return modified ? tr : null;
|
|
31351
31175
|
} catch (error) {
|
|
31352
|
-
console.error("MediaMode plugin error:", error);
|
|
31353
31176
|
return null;
|
|
31354
31177
|
} finally {
|
|
31355
31178
|
isProcessing = false;
|
|
@@ -31635,7 +31458,6 @@ const isLinkMarkWithPayload = (node) => isLinkMark(node) && Boolean(node?.attrs?
|
|
|
31635
31458
|
const getLinkItemsPayload = (json) => {
|
|
31636
31459
|
const links = find(json, (node) => isLinkMarkWithPayload(node));
|
|
31637
31460
|
const items = links?.at(-1);
|
|
31638
|
-
console.log("Link Items Payload::", { items });
|
|
31639
31461
|
return { items };
|
|
31640
31462
|
};
|
|
31641
31463
|
const getPollItemsPayload = (json) => {
|
|
@@ -31722,7 +31544,6 @@ const generatePollPostPayload = ({
|
|
|
31722
31544
|
option_id: index2 === 0 ? item.option_id : v4(),
|
|
31723
31545
|
option_color: OPTION_COLORS[index2 % OPTION_COLORS.length]
|
|
31724
31546
|
})) : items;
|
|
31725
|
-
console.log({ polls });
|
|
31726
31547
|
return {
|
|
31727
31548
|
...commons,
|
|
31728
31549
|
type: NewPostType.NEW_POST_POLL,
|
|
@@ -31779,7 +31600,6 @@ const PostBuilderEditorInstance = ({
|
|
|
31779
31600
|
const json = editor?.getJSON();
|
|
31780
31601
|
const text2 = editor?.getText();
|
|
31781
31602
|
const payload = generateCreatePostPayload(editorTab, { editor, sendCrossMention });
|
|
31782
|
-
console.log({ json });
|
|
31783
31603
|
const isPollType = payload?.type === NewPostType.NEW_POST_POLL;
|
|
31784
31604
|
if (payload?.error) {
|
|
31785
31605
|
toast.error(payload.error);
|