@select-org/select-post-builder 1.1.6 → 1.1.8
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 +32 -211
- package/dist/post-builder.css +0 -9
- package/dist/post-builder.js +32 -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
|
);
|
|
@@ -21311,6 +21270,7 @@ function useEditorTracking({
|
|
|
21311
21270
|
if (!hasFocusedOnce.current) {
|
|
21312
21271
|
analytics.trackEditorFocus(sessionId);
|
|
21313
21272
|
hasFocusedOnce.current = true;
|
|
21273
|
+
checkContentThreshold();
|
|
21314
21274
|
}
|
|
21315
21275
|
resetIdleTimer();
|
|
21316
21276
|
};
|
|
@@ -21652,11 +21612,9 @@ var Progress$1 = React__namespace.forwardRef(
|
|
|
21652
21612
|
...progressProps
|
|
21653
21613
|
} = props;
|
|
21654
21614
|
if ((maxProp || maxProp === 0) && !isValidMaxNumber(maxProp)) {
|
|
21655
|
-
console.error(getInvalidMaxError(`${maxProp}`, "Progress"));
|
|
21656
21615
|
}
|
|
21657
21616
|
const max2 = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
21658
21617
|
if (valueProp !== null && !isValidValueNumber(valueProp, max2)) {
|
|
21659
|
-
console.error(getInvalidValueError(`${valueProp}`, "Progress"));
|
|
21660
21618
|
}
|
|
21661
21619
|
const value = isValidValueNumber(valueProp, max2) ? valueProp : null;
|
|
21662
21620
|
const valueLabel = isNumber(value) ? getValueLabel(value, max2) : void 0;
|
|
@@ -21982,13 +21940,7 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21982
21940
|
state: state2,
|
|
21983
21941
|
dispatch
|
|
21984
21942
|
}) => {
|
|
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
21943
|
if (!dispatch) {
|
|
21991
|
-
console.log("No dispatch, returning false");
|
|
21992
21944
|
return false;
|
|
21993
21945
|
}
|
|
21994
21946
|
const { doc, schema } = state2;
|
|
@@ -21998,13 +21950,6 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21998
21950
|
doc.descendants((node, pos) => {
|
|
21999
21951
|
if (node.isText && node.marks?.length) {
|
|
22000
21952
|
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
21953
|
if (mark.type.name === markName && mark.attrs.uid === uid) {
|
|
22009
21954
|
positions.push({
|
|
22010
21955
|
from: pos,
|
|
@@ -22012,33 +21957,21 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
22012
21957
|
mark
|
|
22013
21958
|
});
|
|
22014
21959
|
found2 = true;
|
|
22015
|
-
console.log("Found matching mark at:", { from: pos, to: pos + node.nodeSize });
|
|
22016
21960
|
}
|
|
22017
21961
|
});
|
|
22018
21962
|
}
|
|
22019
21963
|
});
|
|
22020
|
-
console.log("Total positions found:", positions.length);
|
|
22021
|
-
console.log("Positions:", positions);
|
|
22022
21964
|
if (found2) {
|
|
22023
21965
|
positions.forEach(({ from, to, mark }) => {
|
|
22024
21966
|
const newAttrs = { ...mark.attrs, ...attrs };
|
|
22025
21967
|
const markType = schema.marks[markName];
|
|
22026
|
-
console.log("Applying update:", { from, to, oldAttrs: mark.attrs, newAttrs });
|
|
22027
21968
|
if (markType) {
|
|
22028
|
-
console.log("Before removeMark - tr.doc:", tr.doc.toJSON());
|
|
22029
21969
|
tr = tr.removeMark(from, to, markType);
|
|
22030
|
-
console.log("After removeMark - tr.doc:", tr.doc.toJSON());
|
|
22031
21970
|
tr = tr.addMark(from, to, markType.create(newAttrs));
|
|
22032
|
-
console.log("After addMark - tr.doc:", tr.doc.toJSON());
|
|
22033
21971
|
}
|
|
22034
21972
|
});
|
|
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
21973
|
dispatch(tr);
|
|
22039
|
-
console.log("Transaction dispatched successfully");
|
|
22040
21974
|
}
|
|
22041
|
-
console.log("=== UPDATE MARK COMMAND END ===");
|
|
22042
21975
|
return found2;
|
|
22043
21976
|
};
|
|
22044
21977
|
};
|
|
@@ -23056,7 +22989,6 @@ let warnedAboutTextSelection = false;
|
|
|
23056
22989
|
function checkTextSelection($pos) {
|
|
23057
22990
|
if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
|
|
23058
22991
|
warnedAboutTextSelection = true;
|
|
23059
|
-
console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
|
|
23060
22992
|
}
|
|
23061
22993
|
}
|
|
23062
22994
|
class TextSelection extends Selection {
|
|
@@ -23801,7 +23733,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23801
23733
|
});
|
|
23802
23734
|
return createPollMediaOption(result, startIndex + index2);
|
|
23803
23735
|
} catch (error) {
|
|
23804
|
-
console.error("Upload failed for", file.name, error);
|
|
23805
23736
|
trackMediaUploadFailed({
|
|
23806
23737
|
editorType: EditorTypes.Poll,
|
|
23807
23738
|
mediaType: file.type.startsWith("video/") ? "video" : "image",
|
|
@@ -23836,7 +23767,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23836
23767
|
return final;
|
|
23837
23768
|
});
|
|
23838
23769
|
} catch (error) {
|
|
23839
|
-
console.error("Unexpected error during file upload:", error);
|
|
23840
23770
|
setInternalChoices((current) => {
|
|
23841
23771
|
const withoutPlaceholders = current.filter((c) => !isPlaceholder(c));
|
|
23842
23772
|
setTimeout(() => {
|
|
@@ -23881,7 +23811,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23881
23811
|
return updated;
|
|
23882
23812
|
});
|
|
23883
23813
|
} catch (error) {
|
|
23884
|
-
console.error("URL upload failed:", error);
|
|
23885
23814
|
trackMediaUploadFailed({
|
|
23886
23815
|
editorType: EditorTypes.Poll,
|
|
23887
23816
|
mediaType: searchFrom === ImageSearchFrom.Gif ? "gif" : "image",
|
|
@@ -24436,7 +24365,6 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
24436
24365
|
};
|
|
24437
24366
|
const handleUpdateLink = (link, text2, uid, previewPayload) => {
|
|
24438
24367
|
if (!editor.view) return;
|
|
24439
|
-
console.log("UPDATE LINK IN VIEW::", { text: text2 });
|
|
24440
24368
|
const newText = mark?.attrs?.isLinkMode ? link : text2 || link;
|
|
24441
24369
|
if (uid) {
|
|
24442
24370
|
editor.commands.updateLink(uid, { href: link, text: newText, previewPayload });
|
|
@@ -24513,7 +24441,6 @@ function doesPreviewExist(editor, uid) {
|
|
|
24513
24441
|
});
|
|
24514
24442
|
return exists;
|
|
24515
24443
|
} catch (err) {
|
|
24516
|
-
console.error("❌ Error in doesPreviewExist:", err);
|
|
24517
24444
|
return false;
|
|
24518
24445
|
}
|
|
24519
24446
|
}
|
|
@@ -24531,13 +24458,11 @@ function findExistingPreview(editor) {
|
|
|
24531
24458
|
});
|
|
24532
24459
|
return result;
|
|
24533
24460
|
} catch (err) {
|
|
24534
|
-
console.error("❌ Error in findExistingPreview:", err);
|
|
24535
24461
|
return null;
|
|
24536
24462
|
}
|
|
24537
24463
|
}
|
|
24538
24464
|
function removePreviewByUid(editor, uid) {
|
|
24539
24465
|
if (!editor || !uid) {
|
|
24540
|
-
console.warn("⚠️ Cannot remove preview: missing editor or uid");
|
|
24541
24466
|
return;
|
|
24542
24467
|
}
|
|
24543
24468
|
try {
|
|
@@ -24555,11 +24480,9 @@ function removePreviewByUid(editor, uid) {
|
|
|
24555
24480
|
if (tr) {
|
|
24556
24481
|
tr.delete(previewPos, Number(previewPos) + previewSize);
|
|
24557
24482
|
editor.view.dispatch(tr);
|
|
24558
|
-
console.log("🗑️ Removed preview for UID:", uid);
|
|
24559
24483
|
}
|
|
24560
24484
|
}
|
|
24561
24485
|
} catch (err) {
|
|
24562
|
-
console.error("❌ Error in removePreviewByUid:", err);
|
|
24563
24486
|
}
|
|
24564
24487
|
}
|
|
24565
24488
|
function extractBestImage(metadata) {
|
|
@@ -24587,7 +24510,6 @@ function collectAllLinkMarks(state2, linkMark) {
|
|
|
24587
24510
|
}
|
|
24588
24511
|
function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, pluginState) {
|
|
24589
24512
|
if (!newState || !linkMark || !editor || !pluginState) {
|
|
24590
|
-
console.warn("⚠️ Missing required parameters for syncLinkHrefWithText");
|
|
24591
24513
|
return null;
|
|
24592
24514
|
}
|
|
24593
24515
|
let tr = null;
|
|
@@ -24601,17 +24523,11 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24601
24523
|
const currentText = node.text || "";
|
|
24602
24524
|
const currentHref = mark.attrs.href || "";
|
|
24603
24525
|
if (currentText !== currentHref) {
|
|
24604
|
-
console.log("🔄 Text-href mismatch detected:", {
|
|
24605
|
-
uid: mark.attrs.uid,
|
|
24606
|
-
text: currentText,
|
|
24607
|
-
href: currentHref
|
|
24608
|
-
});
|
|
24609
24526
|
const isValidUrl2 = isValidUrlFormat(currentText);
|
|
24610
24527
|
if (!tr) {
|
|
24611
24528
|
tr = newState.tr;
|
|
24612
24529
|
}
|
|
24613
24530
|
if (!tr) {
|
|
24614
|
-
console.warn("⚠️ Failed to create transaction");
|
|
24615
24531
|
return;
|
|
24616
24532
|
}
|
|
24617
24533
|
if (isValidUrl2) {
|
|
@@ -24620,44 +24536,32 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24620
24536
|
href: normalizeUrl(currentText)
|
|
24621
24537
|
});
|
|
24622
24538
|
if (!newMark) {
|
|
24623
|
-
console.warn("⚠️ Failed to create new mark");
|
|
24624
24539
|
return;
|
|
24625
24540
|
}
|
|
24626
24541
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24627
24542
|
tr = tr.addMark(pos, pos + node.nodeSize, newMark);
|
|
24628
24543
|
hasChanges = true;
|
|
24629
|
-
console.log("✏️ Updated href to match text:", currentText);
|
|
24630
24544
|
pluginState.processedLinks.delete(mark.attrs.uid);
|
|
24631
24545
|
if (singlePreviewMode) {
|
|
24632
|
-
console.log("🔄 [SINGLE MODE] Queueing preview removal for re-resolution");
|
|
24633
24546
|
queueMicrotask(() => {
|
|
24634
24547
|
try {
|
|
24635
24548
|
const existingPreview = findExistingPreview(editor);
|
|
24636
24549
|
if (existingPreview && mark.attrs?.uid) {
|
|
24637
|
-
console.log(
|
|
24638
|
-
"🗑️ [SINGLE MODE - VALID URL] Removing preview to re-resolve [turned off currently]"
|
|
24639
|
-
);
|
|
24640
24550
|
}
|
|
24641
24551
|
} catch (err) {
|
|
24642
|
-
console.error("❌ Error removing preview in single mode:", err);
|
|
24643
24552
|
}
|
|
24644
24553
|
});
|
|
24645
24554
|
} else {
|
|
24646
|
-
console.log("🔄 [MULTI MODE] Link Auto Resolve Does Nothing");
|
|
24647
24555
|
}
|
|
24648
24556
|
} else {
|
|
24649
24557
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24650
24558
|
hasChanges = true;
|
|
24651
|
-
console.log("❌ Text no longer valid URL, removing link mark");
|
|
24652
|
-
console.log("🔄 [INVALID URL] Queueing preview removal");
|
|
24653
24559
|
queueMicrotask(() => {
|
|
24654
24560
|
try {
|
|
24655
24561
|
if (mark.attrs?.uid) {
|
|
24656
|
-
console.log("🗑️ [INVALID URL] Removing preview due to invalid URL");
|
|
24657
24562
|
removePreviewByUid(editor, mark.attrs.uid);
|
|
24658
24563
|
}
|
|
24659
24564
|
} catch (err) {
|
|
24660
|
-
console.error("❌ Error removing preview:", err);
|
|
24661
24565
|
}
|
|
24662
24566
|
});
|
|
24663
24567
|
if (mark.attrs?.uid) {
|
|
@@ -24670,7 +24574,6 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24670
24574
|
});
|
|
24671
24575
|
});
|
|
24672
24576
|
} catch (err) {
|
|
24673
|
-
console.error("❌ Error in syncLinkHrefWithText:", err);
|
|
24674
24577
|
return null;
|
|
24675
24578
|
}
|
|
24676
24579
|
return hasChanges ? tr : null;
|
|
@@ -24684,11 +24587,6 @@ function assignUidsToLinks(newState, linkMark, editor) {
|
|
|
24684
24587
|
node.marks.forEach((mark) => {
|
|
24685
24588
|
if (mark.type === linkMark && mark.attrs?.href && !mark.attrs.uid) {
|
|
24686
24589
|
const newUid = v4();
|
|
24687
|
-
console.log("🔧 Assigning UID to autolinked URL:", {
|
|
24688
|
-
href: mark.attrs.href,
|
|
24689
|
-
uid: newUid,
|
|
24690
|
-
pos
|
|
24691
|
-
});
|
|
24692
24590
|
if (editor) {
|
|
24693
24591
|
const analytics = getAnalyticsStore();
|
|
24694
24592
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id");
|
|
@@ -24725,25 +24623,14 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24725
24623
|
const { api, editor } = options;
|
|
24726
24624
|
const mediaGroup = findByType(editor?.getJSON(), "mediaGroup");
|
|
24727
24625
|
if (!api) {
|
|
24728
|
-
console.warn("⚠️ No API provided to resolve link");
|
|
24729
24626
|
return;
|
|
24730
24627
|
}
|
|
24731
24628
|
if (singlePreviewMode && mediaGroup.length >= 1) return;
|
|
24732
24629
|
pluginState.resolvingLinks.add(link.uid);
|
|
24733
|
-
console.log("🌐 Resolving link metadata:", {
|
|
24734
|
-
uid: link.uid,
|
|
24735
|
-
href: link.href,
|
|
24736
|
-
singlePreviewMode
|
|
24737
|
-
});
|
|
24738
24630
|
api.resolveUrl(normalizeUrl(link.href)).then((metadata) => {
|
|
24739
24631
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24740
24632
|
pluginState.processedLinks.add(link.uid);
|
|
24741
|
-
console.log("✅ Link metadata resolved:", {
|
|
24742
|
-
uid: link.uid,
|
|
24743
|
-
metadata
|
|
24744
|
-
});
|
|
24745
24633
|
if (!metadata) {
|
|
24746
|
-
console.warn("⚠️ No metadata returned for:", link.href);
|
|
24747
24634
|
return;
|
|
24748
24635
|
}
|
|
24749
24636
|
const previewData = {
|
|
@@ -24758,13 +24645,11 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24758
24645
|
if (singlePreviewMode) {
|
|
24759
24646
|
const existingPreview = findExistingPreview(editor);
|
|
24760
24647
|
if (existingPreview) {
|
|
24761
|
-
console.log("🔄 Updating existing preview in single mode");
|
|
24762
24648
|
const { pos } = existingPreview;
|
|
24763
24649
|
const tr = editor.state.tr;
|
|
24764
24650
|
tr.setNodeMarkup(pos, void 0, previewData);
|
|
24765
24651
|
editor.view.dispatch(tr);
|
|
24766
24652
|
} else {
|
|
24767
|
-
console.log("➕ Creating first preview in single mode");
|
|
24768
24653
|
editor.commands.setLinkPreview(previewData);
|
|
24769
24654
|
}
|
|
24770
24655
|
editor.commands.updateLinkByUid(link.uid, {
|
|
@@ -24772,16 +24657,12 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24772
24657
|
});
|
|
24773
24658
|
} else {
|
|
24774
24659
|
if (!doesPreviewExist(editor, link.uid)) {
|
|
24775
|
-
console.log("➕ Creating new preview in multi mode");
|
|
24776
24660
|
editor.chain().updateLinkByUid(link.uid, {
|
|
24777
24661
|
previewPayload: convertLinkMetaToPreviewItem(metadata)
|
|
24778
24662
|
}).setLinkPreview(previewData).run();
|
|
24779
|
-
} else {
|
|
24780
|
-
console.log("⏭️ Preview already exists, skipping");
|
|
24781
24663
|
}
|
|
24782
24664
|
}
|
|
24783
24665
|
}).catch((err) => {
|
|
24784
|
-
console.error("❌ Failed to resolve link:", err);
|
|
24785
24666
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24786
24667
|
if (!editor?.view?.dom) return;
|
|
24787
24668
|
const analytics = getAnalyticsStore();
|
|
@@ -24799,10 +24680,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24799
24680
|
key: pluginKey,
|
|
24800
24681
|
state: {
|
|
24801
24682
|
init() {
|
|
24802
|
-
console.log("🔌 LinkAutoResolve plugin initialized", {
|
|
24803
|
-
singlePreviewMode,
|
|
24804
|
-
hasApi: !!options.api
|
|
24805
|
-
});
|
|
24806
24683
|
return {
|
|
24807
24684
|
resolvingLinks: /* @__PURE__ */ new Set(),
|
|
24808
24685
|
processedLinks: /* @__PURE__ */ new Set()
|
|
@@ -24832,33 +24709,23 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24832
24709
|
appendTransaction: (transactions, oldState, newState) => {
|
|
24833
24710
|
const linkMark = newState.schema.marks["customLink"];
|
|
24834
24711
|
if (!linkMark) {
|
|
24835
|
-
console.warn("⚠️ customLink mark not found in schema");
|
|
24836
24712
|
return null;
|
|
24837
24713
|
}
|
|
24838
24714
|
if (!transactions.some((tr) => tr.docChanged)) {
|
|
24839
24715
|
return null;
|
|
24840
24716
|
}
|
|
24841
|
-
console.log("📝 Document changed, checking for changes...");
|
|
24842
24717
|
const pluginState = pluginKey.getState(newState);
|
|
24843
24718
|
if (!pluginState) {
|
|
24844
|
-
console.warn("⚠️ Plugin state not found");
|
|
24845
24719
|
return null;
|
|
24846
24720
|
}
|
|
24847
24721
|
const syncTr = singlePreviewMode ? syncLinkHrefWithText(newState, linkMark, options.editor, singlePreviewMode, pluginState) : null;
|
|
24848
24722
|
const oldLinks = collectAllLinkMarks(oldState, linkMark);
|
|
24849
24723
|
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
24724
|
const editor = options?.editor;
|
|
24857
24725
|
const { tr: uidTr, newUids } = assignUidsToLinks(newState, linkMark, editor);
|
|
24858
24726
|
const linksToResolve = [];
|
|
24859
24727
|
newUids.forEach((linkData) => {
|
|
24860
24728
|
if (!pluginState.processedLinks.has(linkData.uid) && !pluginState.resolvingLinks.has(linkData.uid)) {
|
|
24861
|
-
console.log("🆕 New autolinked URL detected:", linkData);
|
|
24862
24729
|
linksToResolve.push(linkData);
|
|
24863
24730
|
}
|
|
24864
24731
|
});
|
|
@@ -24871,19 +24738,15 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24871
24738
|
return;
|
|
24872
24739
|
}
|
|
24873
24740
|
if (!oldLinks.has(uid)) {
|
|
24874
|
-
console.log("🆕 New link detected (with UID):", linkData);
|
|
24875
24741
|
linksToResolve.push(linkData);
|
|
24876
24742
|
}
|
|
24877
24743
|
});
|
|
24878
24744
|
if (linksToResolve.length > 0) {
|
|
24879
|
-
console.log("🚀 Processing", linksToResolve.length, "new link(s)");
|
|
24880
24745
|
queueMicrotask(() => {
|
|
24881
24746
|
linksToResolve.forEach((link) => {
|
|
24882
24747
|
resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginState);
|
|
24883
24748
|
});
|
|
24884
24749
|
});
|
|
24885
|
-
} else {
|
|
24886
|
-
console.log("✓ No new links to process");
|
|
24887
24750
|
}
|
|
24888
24751
|
if (syncTr && uidTr) {
|
|
24889
24752
|
try {
|
|
@@ -24898,7 +24761,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24898
24761
|
});
|
|
24899
24762
|
return syncTr;
|
|
24900
24763
|
} catch (err) {
|
|
24901
|
-
console.error("❌ Error combining transactions:", err);
|
|
24902
24764
|
return syncTr;
|
|
24903
24765
|
}
|
|
24904
24766
|
}
|
|
@@ -25002,7 +24864,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25002
24864
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
25003
24865
|
if (metadata) {
|
|
25004
24866
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
25005
|
-
console.log({ href, text: text2 });
|
|
25006
24867
|
editor?.chain()?.updateLinkByUid(uid, { href, text: text2, previewPayload })?.updateLinkPreviewByUid(uid, {
|
|
25007
24868
|
// Now using correct UID
|
|
25008
24869
|
loading: false,
|
|
@@ -25018,7 +24879,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25018
24879
|
})?.catch((err) => {
|
|
25019
24880
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
25020
24881
|
analytics?.trackLinkUnfurlFailed(sessionId, { editorType });
|
|
25021
|
-
console.error("LINK UPDATE ERR::", { err });
|
|
25022
24882
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
25023
24883
|
});
|
|
25024
24884
|
return true;
|
|
@@ -25066,7 +24926,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25066
24926
|
if (attrs.href) {
|
|
25067
24927
|
queueMicrotask(() => {
|
|
25068
24928
|
this.options.api?.resolveUrl(normalizeUrl(attrs.href))?.then((metadata) => {
|
|
25069
|
-
console.log({ metadata });
|
|
25070
24929
|
if (metadata) {
|
|
25071
24930
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
25072
24931
|
let linkPreviewExists = false;
|
|
@@ -25095,7 +24954,6 @@ const CustomLink = Link__default.default.extend({
|
|
|
25095
24954
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
25096
24955
|
}
|
|
25097
24956
|
}).catch((err) => {
|
|
25098
|
-
console.log("LINK UPDATE ERR::", { err });
|
|
25099
24957
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id") ?? "";
|
|
25100
24958
|
const editorType = editor?.view?.dom?.getAttribute(
|
|
25101
24959
|
"data-editor-type"
|
|
@@ -25181,7 +25039,6 @@ const IframeView = ({
|
|
|
25181
25039
|
setPreviewData(previewPayload);
|
|
25182
25040
|
updateAttributes({ previewPayload });
|
|
25183
25041
|
}).catch((error) => {
|
|
25184
|
-
console.error("Failed to fetch preview:", error);
|
|
25185
25042
|
}).finally(() => {
|
|
25186
25043
|
});
|
|
25187
25044
|
}
|
|
@@ -25426,7 +25283,6 @@ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTyp
|
|
|
25426
25283
|
}
|
|
25427
25284
|
});
|
|
25428
25285
|
} catch (_) {
|
|
25429
|
-
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
25430
25286
|
return null;
|
|
25431
25287
|
}
|
|
25432
25288
|
};
|
|
@@ -26263,7 +26119,6 @@ const configureDOMPurify = () => {
|
|
|
26263
26119
|
const element = node;
|
|
26264
26120
|
const src = element.getAttribute("src") || "";
|
|
26265
26121
|
if (!isAllowedDomain(src)) {
|
|
26266
|
-
console.warn("🚨 Blocked iframe from non-allowed domain:", src);
|
|
26267
26122
|
node.parentNode?.removeChild(node);
|
|
26268
26123
|
}
|
|
26269
26124
|
}
|
|
@@ -26275,7 +26130,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26275
26130
|
const config = configureDOMPurify();
|
|
26276
26131
|
const cleaned = purify.sanitize(html2, config);
|
|
26277
26132
|
if (!cleaned.includes("<iframe")) {
|
|
26278
|
-
console.warn("⚠️ No valid iframe found after sanitization");
|
|
26279
26133
|
return null;
|
|
26280
26134
|
}
|
|
26281
26135
|
const match = cleaned.match(/<iframe[^>]*src=["']([^"']+)["']/i);
|
|
@@ -26287,7 +26141,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26287
26141
|
}
|
|
26288
26142
|
return match[1];
|
|
26289
26143
|
} catch (error) {
|
|
26290
|
-
console.error("🚨 Error sanitizing iframe:", error);
|
|
26291
26144
|
return null;
|
|
26292
26145
|
} finally {
|
|
26293
26146
|
purify.removeAllHooks();
|
|
@@ -26325,7 +26178,6 @@ const createFinder = (regex) => {
|
|
|
26325
26178
|
match
|
|
26326
26179
|
});
|
|
26327
26180
|
}
|
|
26328
|
-
console.log({ match, matches });
|
|
26329
26181
|
return matches.length > 0 ? matches : null;
|
|
26330
26182
|
};
|
|
26331
26183
|
};
|
|
@@ -26377,11 +26229,9 @@ const Iframe = core.Node.create({
|
|
|
26377
26229
|
const iframeHTML = match[0];
|
|
26378
26230
|
const safeSrc = sanitizeIframeHTML(iframeHTML);
|
|
26379
26231
|
if (!safeSrc) {
|
|
26380
|
-
console.warn("🚨 Blocked unsafe iframe paste");
|
|
26381
26232
|
toast.error("🚨 Your pasted iframe is not safe to render");
|
|
26382
26233
|
return;
|
|
26383
26234
|
}
|
|
26384
|
-
console.log("✅ Safe iframe URL validated:", safeSrc);
|
|
26385
26235
|
const node = this.type.create({ src: safeSrc, previewPayload: null });
|
|
26386
26236
|
state2.tr.replaceRangeWith(range.from, range.to, node);
|
|
26387
26237
|
}
|
|
@@ -26392,7 +26242,6 @@ const Iframe = core.Node.create({
|
|
|
26392
26242
|
handler: ({ state: state2, range, match }) => {
|
|
26393
26243
|
const fullUrl = match[0];
|
|
26394
26244
|
const embedUrl = getEmbedUrl(fullUrl);
|
|
26395
|
-
console.log({ match, fullUrl, embedUrl });
|
|
26396
26245
|
if (!embedUrl) return;
|
|
26397
26246
|
const node = this.type.create({ src: embedUrl });
|
|
26398
26247
|
state2.tr.replaceRangeWith(range.from, range.to, node);
|
|
@@ -26438,10 +26287,9 @@ const handleUrlWithoutSelection = (editor, url, event, autoDetectMedia) => {
|
|
|
26438
26287
|
mediaType: MediaItemType.MEDIA_ITEM
|
|
26439
26288
|
});
|
|
26440
26289
|
}).catch(
|
|
26441
|
-
(e) =>
|
|
26290
|
+
(e) => void 0
|
|
26442
26291
|
);
|
|
26443
26292
|
}
|
|
26444
|
-
console.log("[SmartLinkPaste] Inserting as link node");
|
|
26445
26293
|
editor.chain().focus().insertLink({ href: normalizedUrl, text: url }).run();
|
|
26446
26294
|
return true;
|
|
26447
26295
|
};
|
|
@@ -26463,7 +26311,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26463
26311
|
return false;
|
|
26464
26312
|
}
|
|
26465
26313
|
const trimmedText = pasteText.trim();
|
|
26466
|
-
console.log("[SmartLinkPaste] Valid URL detected:", isEmbeddableUrl(trimmedText));
|
|
26467
26314
|
if (isEmbeddableUrl(trimmedText) && options?.autoEmbed) {
|
|
26468
26315
|
event.preventDefault();
|
|
26469
26316
|
return false;
|
|
@@ -26480,7 +26327,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26480
26327
|
options?.autoDetectMedia ?? true
|
|
26481
26328
|
);
|
|
26482
26329
|
} catch (error) {
|
|
26483
|
-
console.error("[SmartLinkPaste] Error:", error);
|
|
26484
26330
|
return false;
|
|
26485
26331
|
}
|
|
26486
26332
|
};
|
|
@@ -26492,10 +26338,8 @@ const createTransformHandler = (editor) => {
|
|
|
26492
26338
|
return slice;
|
|
26493
26339
|
}
|
|
26494
26340
|
try {
|
|
26495
|
-
console.log("[SmartLinkPaste] Transforming inline URLs in pasted content");
|
|
26496
26341
|
return transformUrlsInSlice(editor, slice);
|
|
26497
26342
|
} catch (error) {
|
|
26498
|
-
console.error("[SmartLinkPaste] Transform error:", error);
|
|
26499
26343
|
return slice;
|
|
26500
26344
|
}
|
|
26501
26345
|
};
|
|
@@ -26602,7 +26446,6 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26602
26446
|
const uid = v4();
|
|
26603
26447
|
const options = this.options;
|
|
26604
26448
|
if (!options.api) {
|
|
26605
|
-
console.error("API instance not provided to SmartMediaUpload");
|
|
26606
26449
|
return false;
|
|
26607
26450
|
}
|
|
26608
26451
|
let uploadSource = "local";
|
|
@@ -26617,7 +26460,6 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26617
26460
|
options.allowedFileTypes
|
|
26618
26461
|
);
|
|
26619
26462
|
if (!validation.valid) {
|
|
26620
|
-
console.error("File validation failed:", validation.error);
|
|
26621
26463
|
options.onUploadError?.(uid, new Error(validation.error));
|
|
26622
26464
|
const { sessionId, editorType } = this.storage.getAnalyticsContext(editor);
|
|
26623
26465
|
if (sessionId && editorType) {
|
|
@@ -26743,7 +26585,6 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26743
26585
|
}
|
|
26744
26586
|
}
|
|
26745
26587
|
} catch (error) {
|
|
26746
|
-
console.error("Upload failed:", error);
|
|
26747
26588
|
const blobUrl = this.storage.blobUrls.get(item.uid);
|
|
26748
26589
|
if (blobUrl) {
|
|
26749
26590
|
URL.revokeObjectURL(blobUrl);
|
|
@@ -26778,7 +26619,7 @@ const SmartMediaUpload = core.Extension.create({
|
|
|
26778
26619
|
this.storage.activeUploads--;
|
|
26779
26620
|
this.storage.processUploadQueue(editor);
|
|
26780
26621
|
}
|
|
26781
|
-
})().catch((err) =>
|
|
26622
|
+
})().catch((err) => void 0);
|
|
26782
26623
|
if (this.storage.uploadQueue.length > 0) {
|
|
26783
26624
|
this.storage.processUploadQueue(editor);
|
|
26784
26625
|
}
|
|
@@ -29478,7 +29319,6 @@ function getSuggestionOptions({
|
|
|
29478
29319
|
const text2 = editor.getText();
|
|
29479
29320
|
const trimmed = text2?.replace(WHITESPACE_REGEX, " ")?.trim();
|
|
29480
29321
|
const matchStartPosition = trimmed?.lastIndexOf(char);
|
|
29481
|
-
console.log({ matchStartPosition });
|
|
29482
29322
|
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
29483
29323
|
const overrideSpace = nodeAfter?.text?.startsWith(" ");
|
|
29484
29324
|
if (overrideSpace) {
|
|
@@ -29592,7 +29432,6 @@ const Mention = core.Node.create({
|
|
|
29592
29432
|
renderHTML({ node, HTMLAttributes }) {
|
|
29593
29433
|
const suggestion2 = getSuggestionFromChar(this, node.attrs.mentionSuggestionChar);
|
|
29594
29434
|
if (this.options.renderLabel !== void 0) {
|
|
29595
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29596
29435
|
return [
|
|
29597
29436
|
"span",
|
|
29598
29437
|
core.mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
@@ -29632,7 +29471,6 @@ const Mention = core.Node.create({
|
|
|
29632
29471
|
suggestion: getSuggestionFromChar(this, node.attrs.mentionSuggestionChar)
|
|
29633
29472
|
};
|
|
29634
29473
|
if (this.options.renderLabel !== void 0) {
|
|
29635
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29636
29474
|
return this.options.renderLabel(args);
|
|
29637
29475
|
}
|
|
29638
29476
|
return this.options.renderText(args);
|
|
@@ -30594,11 +30432,9 @@ const mentionService = (api, mfs, store) => {
|
|
|
30594
30432
|
const fetchMentions = async () => {
|
|
30595
30433
|
const params = store.getState().getMentionParams();
|
|
30596
30434
|
if (!params) {
|
|
30597
|
-
console.error("DEBUG MENTION SERVICE::", "No group id or post id has been provided");
|
|
30598
30435
|
return [];
|
|
30599
30436
|
}
|
|
30600
30437
|
const { groupId, postId } = params;
|
|
30601
|
-
console.log({ groupId, postId });
|
|
30602
30438
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
30603
30439
|
return response.entries?.filter((item) => Boolean(item?.user_data))?.map(
|
|
30604
30440
|
(item) => ({
|
|
@@ -30617,7 +30453,6 @@ const mentionService = (api, mfs, store) => {
|
|
|
30617
30453
|
const { selectedGroupId, groupId } = store.getState();
|
|
30618
30454
|
const activeGroupId = selectedGroupId ?? groupId;
|
|
30619
30455
|
if (!activeGroupId) {
|
|
30620
|
-
console.warn("DEBUG HASHTAG SERVICE::", "No active group selected or provided");
|
|
30621
30456
|
return [];
|
|
30622
30457
|
}
|
|
30623
30458
|
const response = await api.fetchGroupConversations(999, 0);
|
|
@@ -30991,7 +30826,6 @@ const LinkPreview = core.Node.create({
|
|
|
30991
30826
|
},
|
|
30992
30827
|
renderHTML({ node }) {
|
|
30993
30828
|
const { href, uid, title, description, image, domain } = node.attrs;
|
|
30994
|
-
console.log("INSIDE RENDER HTML::", { href, image });
|
|
30995
30829
|
if (!href) return ["div", {}];
|
|
30996
30830
|
const content = [
|
|
30997
30831
|
// Link overlay
|
|
@@ -31234,14 +31068,12 @@ const createMediaModePlugin = () => {
|
|
|
31234
31068
|
child.marks.forEach((mark) => {
|
|
31235
31069
|
if (mark.type.name === "customLink" && mark.attrs.previewPayload) {
|
|
31236
31070
|
lastLinkPreviewData = mark.attrs.previewPayload;
|
|
31237
|
-
console.log("Found link with previewPayload:", lastLinkPreviewData);
|
|
31238
31071
|
}
|
|
31239
31072
|
});
|
|
31240
31073
|
}
|
|
31241
31074
|
});
|
|
31242
31075
|
}
|
|
31243
31076
|
});
|
|
31244
|
-
console.log("Cleanup check:", { modified, hasMediaGroup, lastLinkPreviewData });
|
|
31245
31077
|
if (modified && hasMediaGroup && lastLinkPreviewData) {
|
|
31246
31078
|
let hasLinkPreview = false;
|
|
31247
31079
|
tr.doc.forEach((node) => {
|
|
@@ -31249,10 +31081,6 @@ const createMediaModePlugin = () => {
|
|
|
31249
31081
|
hasLinkPreview = true;
|
|
31250
31082
|
}
|
|
31251
31083
|
});
|
|
31252
|
-
console.log("Creating linkPreview:", {
|
|
31253
|
-
hasLinkPreview,
|
|
31254
|
-
schemaHasLinkPreview: !!newState.schema.nodes.linkPreview
|
|
31255
|
-
});
|
|
31256
31084
|
if (!hasLinkPreview && newState.schema.nodes.linkPreview) {
|
|
31257
31085
|
const preview = lastLinkPreviewData;
|
|
31258
31086
|
const linkPreviewNode = newState.schema.nodes.linkPreview.create({
|
|
@@ -31263,7 +31091,6 @@ const createMediaModePlugin = () => {
|
|
|
31263
31091
|
image: preview.linkImage?.url ?? "",
|
|
31264
31092
|
variant: LinkPreviewType.Extended
|
|
31265
31093
|
});
|
|
31266
|
-
console.log("Inserting linkPreview node:", { lastLinkPreviewData, linkPreviewNode });
|
|
31267
31094
|
tr.insert(tr.doc.content.size, linkPreviewNode);
|
|
31268
31095
|
modified = true;
|
|
31269
31096
|
}
|
|
@@ -31323,7 +31150,6 @@ const createMediaModePlugin = () => {
|
|
|
31323
31150
|
}
|
|
31324
31151
|
const mediaNodes = updatedTopLevelMedia.map((m) => m.node);
|
|
31325
31152
|
if (mediaNodes.some((n) => !n || n.type.name !== "media")) {
|
|
31326
|
-
console.warn("Invalid media nodes detected, skipping group creation");
|
|
31327
31153
|
return null;
|
|
31328
31154
|
}
|
|
31329
31155
|
const mediaGroup = newState.schema.nodes.mediaGroup.create({}, mediaNodes);
|
|
@@ -31341,7 +31167,6 @@ const createMediaModePlugin = () => {
|
|
|
31341
31167
|
const $pos = tr.doc.resolve(endPos);
|
|
31342
31168
|
tr.setSelection(state.TextSelection.near($pos));
|
|
31343
31169
|
} catch (e) {
|
|
31344
|
-
console.warn("Could not set selection:", e);
|
|
31345
31170
|
}
|
|
31346
31171
|
}
|
|
31347
31172
|
tr.setMeta("addToHistory", false);
|
|
@@ -31349,7 +31174,6 @@ const createMediaModePlugin = () => {
|
|
|
31349
31174
|
}
|
|
31350
31175
|
return modified ? tr : null;
|
|
31351
31176
|
} catch (error) {
|
|
31352
|
-
console.error("MediaMode plugin error:", error);
|
|
31353
31177
|
return null;
|
|
31354
31178
|
} finally {
|
|
31355
31179
|
isProcessing = false;
|
|
@@ -31635,7 +31459,6 @@ const isLinkMarkWithPayload = (node) => isLinkMark(node) && Boolean(node?.attrs?
|
|
|
31635
31459
|
const getLinkItemsPayload = (json) => {
|
|
31636
31460
|
const links = find(json, (node) => isLinkMarkWithPayload(node));
|
|
31637
31461
|
const items = links?.at(-1);
|
|
31638
|
-
console.log("Link Items Payload::", { items });
|
|
31639
31462
|
return { items };
|
|
31640
31463
|
};
|
|
31641
31464
|
const getPollItemsPayload = (json) => {
|
|
@@ -31722,7 +31545,6 @@ const generatePollPostPayload = ({
|
|
|
31722
31545
|
option_id: index2 === 0 ? item.option_id : v4(),
|
|
31723
31546
|
option_color: OPTION_COLORS[index2 % OPTION_COLORS.length]
|
|
31724
31547
|
})) : items;
|
|
31725
|
-
console.log({ polls });
|
|
31726
31548
|
return {
|
|
31727
31549
|
...commons,
|
|
31728
31550
|
type: NewPostType.NEW_POST_POLL,
|
|
@@ -31779,7 +31601,6 @@ const PostBuilderEditorInstance = ({
|
|
|
31779
31601
|
const json = editor?.getJSON();
|
|
31780
31602
|
const text2 = editor?.getText();
|
|
31781
31603
|
const payload = generateCreatePostPayload(editorTab, { editor, sendCrossMention });
|
|
31782
|
-
console.log({ json });
|
|
31783
31604
|
const isPollType = payload?.type === NewPostType.NEW_POST_POLL;
|
|
31784
31605
|
if (payload?.error) {
|
|
31785
31606
|
toast.error(payload.error);
|