@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.js
CHANGED
|
@@ -2053,19 +2053,12 @@ validators$1.transitional = function transitional(validator2, version, message)
|
|
|
2053
2053
|
}
|
|
2054
2054
|
if (version && !deprecatedWarnings[opt]) {
|
|
2055
2055
|
deprecatedWarnings[opt] = true;
|
|
2056
|
-
console.warn(
|
|
2057
|
-
formatMessage(
|
|
2058
|
-
opt,
|
|
2059
|
-
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
2060
|
-
)
|
|
2061
|
-
);
|
|
2062
2056
|
}
|
|
2063
2057
|
return validator2 ? validator2(value, opt, opts) : true;
|
|
2064
2058
|
};
|
|
2065
2059
|
};
|
|
2066
2060
|
validators$1.spelling = function spelling(correctSpelling) {
|
|
2067
2061
|
return (value, opt) => {
|
|
2068
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
2069
2062
|
return true;
|
|
2070
2063
|
};
|
|
2071
2064
|
};
|
|
@@ -3940,7 +3933,6 @@ const Toaster$1 = /* @__PURE__ */ React__default.forwardRef(function Toaster(pro
|
|
|
3940
3933
|
setActualTheme("light");
|
|
3941
3934
|
}
|
|
3942
3935
|
} catch (e) {
|
|
3943
|
-
console.error(e);
|
|
3944
3936
|
}
|
|
3945
3937
|
});
|
|
3946
3938
|
}
|
|
@@ -4947,9 +4939,6 @@ function useControllableState({
|
|
|
4947
4939
|
if (wasControlled !== isControlled) {
|
|
4948
4940
|
const from = wasControlled ? "controlled" : "uncontrolled";
|
|
4949
4941
|
const to = isControlled ? "controlled" : "uncontrolled";
|
|
4950
|
-
console.warn(
|
|
4951
|
-
`${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.`
|
|
4952
|
-
);
|
|
4953
4942
|
}
|
|
4954
4943
|
isControlledRef.current = isControlled;
|
|
4955
4944
|
}, [isControlled, caller]);
|
|
@@ -8727,26 +8716,6 @@ const createStoreImpl = (createState) => {
|
|
|
8727
8716
|
return api;
|
|
8728
8717
|
};
|
|
8729
8718
|
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
8730
|
-
const FEATURE_NAME_MAP = {
|
|
8731
|
-
// Tiptap Marks (inline formatting)
|
|
8732
|
-
undo: "undo",
|
|
8733
|
-
redo: "redo",
|
|
8734
|
-
paragraph: "paragraph",
|
|
8735
|
-
bold: "bold",
|
|
8736
|
-
italic: "italic",
|
|
8737
|
-
strike: "strikethrough",
|
|
8738
|
-
code: "code",
|
|
8739
|
-
customLink: "customLink",
|
|
8740
|
-
// Default heading mapping
|
|
8741
|
-
bulletList: "bullet_list",
|
|
8742
|
-
orderedList: "ordered_list",
|
|
8743
|
-
blockquote: "blockquote",
|
|
8744
|
-
codeBlock: "code_block",
|
|
8745
|
-
// Default media type
|
|
8746
|
-
image: "image",
|
|
8747
|
-
video: "video",
|
|
8748
|
-
audio: "audio"
|
|
8749
|
-
};
|
|
8750
8719
|
const ANALYTICS_EVENTS = {
|
|
8751
8720
|
// Session events
|
|
8752
8721
|
SESSION: {
|
|
@@ -8801,6 +8770,26 @@ const ANALYTICS_EVENTS = {
|
|
|
8801
8770
|
// NEW
|
|
8802
8771
|
}
|
|
8803
8772
|
};
|
|
8773
|
+
const FEATURE_NAME_MAP = {
|
|
8774
|
+
// Tiptap Marks (inline formatting)
|
|
8775
|
+
undo: "undo",
|
|
8776
|
+
redo: "redo",
|
|
8777
|
+
paragraph: "paragraph",
|
|
8778
|
+
bold: "bold",
|
|
8779
|
+
italic: "italic",
|
|
8780
|
+
strike: "strikethrough",
|
|
8781
|
+
code: "code",
|
|
8782
|
+
customLink: "customLink",
|
|
8783
|
+
// Default heading mapping
|
|
8784
|
+
bulletList: "bullet_list",
|
|
8785
|
+
orderedList: "ordered_list",
|
|
8786
|
+
blockquote: "blockquote",
|
|
8787
|
+
codeBlock: "code_block",
|
|
8788
|
+
// Default media type
|
|
8789
|
+
image: "image",
|
|
8790
|
+
video: "video",
|
|
8791
|
+
audio: "audio"
|
|
8792
|
+
};
|
|
8804
8793
|
const HEADING_FEATURE_MAP = {
|
|
8805
8794
|
1: "heading_1",
|
|
8806
8795
|
2: "heading_2",
|
|
@@ -10439,9 +10428,7 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10439
10428
|
enabled: config.enabled ?? false,
|
|
10440
10429
|
debug: config.debug ?? false
|
|
10441
10430
|
});
|
|
10442
|
-
if (config.debug)
|
|
10443
|
-
console.log("[Analytics] Initialized", { enabled: config.enabled, debug: config.debug });
|
|
10444
|
-
}
|
|
10431
|
+
if (config.debug) ;
|
|
10445
10432
|
},
|
|
10446
10433
|
createSession: (editorType, placement) => {
|
|
10447
10434
|
const { sessionManager, logEventFn, enabled, debug } = get2();
|
|
@@ -10455,9 +10442,6 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10455
10442
|
// NEW
|
|
10456
10443
|
};
|
|
10457
10444
|
logEventFn(ANALYTICS_EVENTS.SESSION.STARTED, props);
|
|
10458
|
-
if (debug) {
|
|
10459
|
-
console.log("[Analytics]", ANALYTICS_EVENTS.SESSION.STARTED, props);
|
|
10460
|
-
}
|
|
10461
10445
|
}
|
|
10462
10446
|
return sessionId;
|
|
10463
10447
|
},
|
|
@@ -10476,9 +10460,6 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10476
10460
|
if (!enabled || !logEventFn) return;
|
|
10477
10461
|
const session = sessionManager.getSession(sessionId);
|
|
10478
10462
|
if (!session) {
|
|
10479
|
-
if (debug) {
|
|
10480
|
-
console.warn(`[Analytics] Cannot track '${eventName}' - session not found: ${sessionId}`);
|
|
10481
|
-
}
|
|
10482
10463
|
return;
|
|
10483
10464
|
}
|
|
10484
10465
|
const enrichedProps = {
|
|
@@ -10490,7 +10471,6 @@ const analyticsStore = createStore((set, get2) => ({
|
|
|
10490
10471
|
};
|
|
10491
10472
|
const cleanProps = pickBy(enrichedProps, (v) => v != null);
|
|
10492
10473
|
logEventFn(eventName, cleanProps);
|
|
10493
|
-
if (debug) console.log(`[Analytics] ${eventName}`, cleanProps);
|
|
10494
10474
|
},
|
|
10495
10475
|
trackPublish: (sessionId, params) => {
|
|
10496
10476
|
const { trackEvent, sessionManager } = get2();
|
|
@@ -13443,7 +13423,6 @@ var correctTargets = function(parent2, targets) {
|
|
|
13443
13423
|
if (correctedTarget && parent2.contains(correctedTarget)) {
|
|
13444
13424
|
return correctedTarget;
|
|
13445
13425
|
}
|
|
13446
|
-
console.error("aria-hidden", target, "in not contained inside", parent2, ". Doing nothing");
|
|
13447
13426
|
return null;
|
|
13448
13427
|
}).filter(function(x2) {
|
|
13449
13428
|
return Boolean(x2);
|
|
@@ -13492,7 +13471,6 @@ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, co
|
|
|
13492
13471
|
node.setAttribute(controlAttribute, "true");
|
|
13493
13472
|
}
|
|
13494
13473
|
} catch (e) {
|
|
13495
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
13496
13474
|
}
|
|
13497
13475
|
}
|
|
13498
13476
|
});
|
|
@@ -16130,15 +16108,11 @@ function requireUseSyncExternalStoreShim_development() {
|
|
|
16130
16108
|
return x2 === y && (0 !== x2 || 1 / x2 === 1 / y) || x2 !== x2 && y !== y;
|
|
16131
16109
|
}
|
|
16132
16110
|
function useSyncExternalStore$2(subscribe2, getSnapshot) {
|
|
16133
|
-
didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true,
|
|
16134
|
-
"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."
|
|
16135
|
-
));
|
|
16111
|
+
didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, void 0);
|
|
16136
16112
|
var value = getSnapshot();
|
|
16137
16113
|
if (!didWarnUncachedGetSnapshot) {
|
|
16138
16114
|
var cachedValue = getSnapshot();
|
|
16139
|
-
objectIs(value, cachedValue) || (
|
|
16140
|
-
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
16141
|
-
), didWarnUncachedGetSnapshot = true);
|
|
16115
|
+
objectIs(value, cachedValue) || (void 0, didWarnUncachedGetSnapshot = true);
|
|
16142
16116
|
}
|
|
16143
16117
|
cachedValue = useState2({
|
|
16144
16118
|
inst: { value, getSnapshot }
|
|
@@ -16370,9 +16344,6 @@ const GroupSelector = ({ store }) => {
|
|
|
16370
16344
|
setGroups(response.entries ?? []);
|
|
16371
16345
|
}
|
|
16372
16346
|
} catch (error) {
|
|
16373
|
-
if (!cancelled) {
|
|
16374
|
-
console.error("Failed to fetch groups:", error);
|
|
16375
|
-
}
|
|
16376
16347
|
} finally {
|
|
16377
16348
|
if (!cancelled) {
|
|
16378
16349
|
setIsLoading(false);
|
|
@@ -17326,7 +17297,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17326
17297
|
React.useEffect(() => {
|
|
17327
17298
|
if (titleId) {
|
|
17328
17299
|
const hasTitle = document.getElementById(titleId);
|
|
17329
|
-
if (!hasTitle)
|
|
17300
|
+
if (!hasTitle) ;
|
|
17330
17301
|
}
|
|
17331
17302
|
}, [MESSAGE, titleId]);
|
|
17332
17303
|
return null;
|
|
@@ -17339,7 +17310,7 @@ var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
|
17339
17310
|
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
17340
17311
|
if (descriptionId && describedById) {
|
|
17341
17312
|
const hasDescription = document.getElementById(descriptionId);
|
|
17342
|
-
if (!hasDescription)
|
|
17313
|
+
if (!hasDescription) ;
|
|
17343
17314
|
}
|
|
17344
17315
|
}, [MESSAGE, contentRef, descriptionId]);
|
|
17345
17316
|
return null;
|
|
@@ -17725,7 +17696,6 @@ const InputGroupText = forwardRef(
|
|
|
17725
17696
|
InputGroupText.displayName = "InputGroupText";
|
|
17726
17697
|
const InputGroupInput = forwardRef(
|
|
17727
17698
|
({ className, ref: legacyRef, ...props }, ref) => {
|
|
17728
|
-
console.log({ legacyRef });
|
|
17729
17699
|
return /* @__PURE__ */ jsx(
|
|
17730
17700
|
Input,
|
|
17731
17701
|
{
|
|
@@ -18346,7 +18316,6 @@ const resolveUrlType = async (url) => {
|
|
|
18346
18316
|
if (mime?.startsWith("video/")) return { type: MediaNodeTypes.Video, src: url };
|
|
18347
18317
|
if (mime?.startsWith("audio/")) return { type: MediaNodeTypes.Audio, src: url };
|
|
18348
18318
|
} catch (error) {
|
|
18349
|
-
console.warn("HEAD request failed, falling back to mime detection:", error);
|
|
18350
18319
|
}
|
|
18351
18320
|
const ext = url.split(".").pop()?.toLowerCase();
|
|
18352
18321
|
if (ext) {
|
|
@@ -18486,11 +18455,9 @@ const LinkDecoratorModal = ({
|
|
|
18486
18455
|
setIsValid(isValid2);
|
|
18487
18456
|
};
|
|
18488
18457
|
const handleInsertLink = (link2, text22, uid2) => {
|
|
18489
|
-
console.log("HANDLE INSERT LINK::", { link: link2, text: text22 });
|
|
18490
18458
|
setIsLoading(true);
|
|
18491
18459
|
let metadata;
|
|
18492
|
-
core?.resolveUrl(link2)?.then((res) => metadata = res)?.catch((err) =>
|
|
18493
|
-
console.log({ metadata });
|
|
18460
|
+
core?.resolveUrl(link2)?.then((res) => metadata = res)?.catch((err) => void 0)?.finally(() => {
|
|
18494
18461
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
18495
18462
|
setIsLoading(false);
|
|
18496
18463
|
onInsertLink(link2, text22, uid2, previewPayload);
|
|
@@ -18502,12 +18469,10 @@ const LinkDecoratorModal = ({
|
|
|
18502
18469
|
e.preventDefault();
|
|
18503
18470
|
const isTextInput = textInputRef.current === e.target;
|
|
18504
18471
|
if (isTextInput || hideTextInput) return handleInsertLink(link, text2, uid ?? void 0);
|
|
18505
|
-
console.log("Enter", isTextInput);
|
|
18506
18472
|
textInputRef?.current?.focus();
|
|
18507
18473
|
}
|
|
18508
18474
|
};
|
|
18509
18475
|
useEffect(() => {
|
|
18510
|
-
console.log({ defaultValues });
|
|
18511
18476
|
if (!defaultValues?.link) return;
|
|
18512
18477
|
const isValid2 = isValidUrl(defaultValues?.link);
|
|
18513
18478
|
setIsValid(isValid2);
|
|
@@ -18516,7 +18481,6 @@ const LinkDecoratorModal = ({
|
|
|
18516
18481
|
setLink(defaultValues?.link ?? "");
|
|
18517
18482
|
setText(defaultValues?.text || "");
|
|
18518
18483
|
}, [defaultValues]);
|
|
18519
|
-
console.log("TEXT INSIDE LINK DECORATOR::", { isValid, text: text2 });
|
|
18520
18484
|
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange: handleOpenChange, children: [
|
|
18521
18485
|
children ? /* @__PURE__ */ jsx(DialogTrigger, { asChild: true, children }) : null,
|
|
18522
18486
|
/* @__PURE__ */ jsxs(DialogContent, { className: "-translate-1/2", children: [
|
|
@@ -18702,10 +18666,8 @@ function parseThreshold(scrollThreshold) {
|
|
|
18702
18666
|
value: parseFloat(scrollThreshold)
|
|
18703
18667
|
};
|
|
18704
18668
|
}
|
|
18705
|
-
console.warn('scrollThreshold format is invalid. Valid formats: "120px", "50%"...');
|
|
18706
18669
|
return defaultThreshold;
|
|
18707
18670
|
}
|
|
18708
|
-
console.warn("scrollThreshold should be string or number");
|
|
18709
18671
|
return defaultThreshold;
|
|
18710
18672
|
}
|
|
18711
18673
|
var InfiniteScroll = (
|
|
@@ -18727,7 +18689,6 @@ var InfiniteScroll = (
|
|
|
18727
18689
|
return document.getElementById(_this.props.scrollableTarget);
|
|
18728
18690
|
}
|
|
18729
18691
|
if (_this.props.scrollableTarget === null) {
|
|
18730
|
-
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 ");
|
|
18731
18692
|
}
|
|
18732
18693
|
return null;
|
|
18733
18694
|
};
|
|
@@ -18972,7 +18933,6 @@ function useMediaSearch(type) {
|
|
|
18972
18933
|
setItems((prev) => reset2 ? data : [...prev, ...data]);
|
|
18973
18934
|
}
|
|
18974
18935
|
} catch (error) {
|
|
18975
|
-
console.error("Error fetching images:", error);
|
|
18976
18936
|
pagination.setHasMore(false);
|
|
18977
18937
|
} finally {
|
|
18978
18938
|
pagination.setLoading(false);
|
|
@@ -18991,7 +18951,6 @@ function useMediaSearch(type) {
|
|
|
18991
18951
|
setItems((prev) => reset2 ? data : [...prev, ...data]);
|
|
18992
18952
|
}
|
|
18993
18953
|
} catch (error) {
|
|
18994
|
-
console.error("Error fetching gifs:", error);
|
|
18995
18954
|
pagination.setHasMore(false);
|
|
18996
18955
|
} finally {
|
|
18997
18956
|
pagination.setLoading(false);
|
|
@@ -19049,8 +19008,8 @@ function ImageSearchModal({
|
|
|
19049
19008
|
setSearchQuery("");
|
|
19050
19009
|
return;
|
|
19051
19010
|
}
|
|
19052
|
-
gifSearch.fetch(withInitialQuery).catch((err) =>
|
|
19053
|
-
imageSearch.fetch(withInitialQuery).catch((err) =>
|
|
19011
|
+
gifSearch.fetch(withInitialQuery).catch((err) => void 0);
|
|
19012
|
+
imageSearch.fetch(withInitialQuery).catch((err) => void 0);
|
|
19054
19013
|
};
|
|
19055
19014
|
const debouncedSearch = useMemo(
|
|
19056
19015
|
() => debounce$2(async (query) => {
|
|
@@ -19068,7 +19027,7 @@ function ImageSearchModal({
|
|
|
19068
19027
|
const handleSearch = useCallback(
|
|
19069
19028
|
(query) => {
|
|
19070
19029
|
setSearchQuery(query);
|
|
19071
|
-
debouncedSearch(query)?.catch((err) =>
|
|
19030
|
+
debouncedSearch(query)?.catch((err) => void 0);
|
|
19072
19031
|
},
|
|
19073
19032
|
[debouncedSearch]
|
|
19074
19033
|
);
|
|
@@ -21281,6 +21240,7 @@ function useEditorTracking({
|
|
|
21281
21240
|
if (!hasFocusedOnce.current) {
|
|
21282
21241
|
analytics.trackEditorFocus(sessionId);
|
|
21283
21242
|
hasFocusedOnce.current = true;
|
|
21243
|
+
checkContentThreshold();
|
|
21284
21244
|
}
|
|
21285
21245
|
resetIdleTimer();
|
|
21286
21246
|
};
|
|
@@ -21622,11 +21582,9 @@ var Progress$1 = React.forwardRef(
|
|
|
21622
21582
|
...progressProps
|
|
21623
21583
|
} = props;
|
|
21624
21584
|
if ((maxProp || maxProp === 0) && !isValidMaxNumber(maxProp)) {
|
|
21625
|
-
console.error(getInvalidMaxError(`${maxProp}`, "Progress"));
|
|
21626
21585
|
}
|
|
21627
21586
|
const max2 = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
21628
21587
|
if (valueProp !== null && !isValidValueNumber(valueProp, max2)) {
|
|
21629
|
-
console.error(getInvalidValueError(`${valueProp}`, "Progress"));
|
|
21630
21588
|
}
|
|
21631
21589
|
const value = isValidValueNumber(valueProp, max2) ? valueProp : null;
|
|
21632
21590
|
const valueLabel = isNumber(value) ? getValueLabel(value, max2) : void 0;
|
|
@@ -21952,13 +21910,7 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21952
21910
|
state,
|
|
21953
21911
|
dispatch
|
|
21954
21912
|
}) => {
|
|
21955
|
-
console.log("=== UPDATE MARK COMMAND START ===");
|
|
21956
|
-
console.log("markName:", markName);
|
|
21957
|
-
console.log("uid:", uid);
|
|
21958
|
-
console.log("attrs:", attrs);
|
|
21959
|
-
console.log("state.doc:", state.doc.toJSON());
|
|
21960
21913
|
if (!dispatch) {
|
|
21961
|
-
console.log("No dispatch, returning false");
|
|
21962
21914
|
return false;
|
|
21963
21915
|
}
|
|
21964
21916
|
const { doc, schema } = state;
|
|
@@ -21968,13 +21920,6 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21968
21920
|
doc.descendants((node, pos) => {
|
|
21969
21921
|
if (node.isText && node.marks?.length) {
|
|
21970
21922
|
node.marks.forEach((mark) => {
|
|
21971
|
-
console.log("Checking mark:", {
|
|
21972
|
-
markType: mark.type.name,
|
|
21973
|
-
markUid: mark.attrs.uid,
|
|
21974
|
-
targetMarkName: markName,
|
|
21975
|
-
targetUid: uid,
|
|
21976
|
-
matches: mark.type.name === markName && mark.attrs.uid === uid
|
|
21977
|
-
});
|
|
21978
21923
|
if (mark.type.name === markName && mark.attrs.uid === uid) {
|
|
21979
21924
|
positions.push({
|
|
21980
21925
|
from: pos,
|
|
@@ -21982,33 +21927,21 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21982
21927
|
mark
|
|
21983
21928
|
});
|
|
21984
21929
|
found2 = true;
|
|
21985
|
-
console.log("Found matching mark at:", { from: pos, to: pos + node.nodeSize });
|
|
21986
21930
|
}
|
|
21987
21931
|
});
|
|
21988
21932
|
}
|
|
21989
21933
|
});
|
|
21990
|
-
console.log("Total positions found:", positions.length);
|
|
21991
|
-
console.log("Positions:", positions);
|
|
21992
21934
|
if (found2) {
|
|
21993
21935
|
positions.forEach(({ from, to, mark }) => {
|
|
21994
21936
|
const newAttrs = { ...mark.attrs, ...attrs };
|
|
21995
21937
|
const markType = schema.marks[markName];
|
|
21996
|
-
console.log("Applying update:", { from, to, oldAttrs: mark.attrs, newAttrs });
|
|
21997
21938
|
if (markType) {
|
|
21998
|
-
console.log("Before removeMark - tr.doc:", tr.doc.toJSON());
|
|
21999
21939
|
tr = tr.removeMark(from, to, markType);
|
|
22000
|
-
console.log("After removeMark - tr.doc:", tr.doc.toJSON());
|
|
22001
21940
|
tr = tr.addMark(from, to, markType.create(newAttrs));
|
|
22002
|
-
console.log("After addMark - tr.doc:", tr.doc.toJSON());
|
|
22003
21941
|
}
|
|
22004
21942
|
});
|
|
22005
|
-
console.log("About to dispatch transaction");
|
|
22006
|
-
console.log("Final tr.doc:", tr.doc.toJSON());
|
|
22007
|
-
console.log("Original state.doc:", state.doc.toJSON());
|
|
22008
21943
|
dispatch(tr);
|
|
22009
|
-
console.log("Transaction dispatched successfully");
|
|
22010
21944
|
}
|
|
22011
|
-
console.log("=== UPDATE MARK COMMAND END ===");
|
|
22012
21945
|
return found2;
|
|
22013
21946
|
};
|
|
22014
21947
|
};
|
|
@@ -23026,7 +22959,6 @@ let warnedAboutTextSelection = false;
|
|
|
23026
22959
|
function checkTextSelection($pos) {
|
|
23027
22960
|
if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
|
|
23028
22961
|
warnedAboutTextSelection = true;
|
|
23029
|
-
console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
|
|
23030
22962
|
}
|
|
23031
22963
|
}
|
|
23032
22964
|
class TextSelection extends Selection {
|
|
@@ -23771,7 +23703,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23771
23703
|
});
|
|
23772
23704
|
return createPollMediaOption(result, startIndex + index2);
|
|
23773
23705
|
} catch (error) {
|
|
23774
|
-
console.error("Upload failed for", file.name, error);
|
|
23775
23706
|
trackMediaUploadFailed({
|
|
23776
23707
|
editorType: EditorTypes.Poll,
|
|
23777
23708
|
mediaType: file.type.startsWith("video/") ? "video" : "image",
|
|
@@ -23806,7 +23737,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23806
23737
|
return final;
|
|
23807
23738
|
});
|
|
23808
23739
|
} catch (error) {
|
|
23809
|
-
console.error("Unexpected error during file upload:", error);
|
|
23810
23740
|
setInternalChoices((current) => {
|
|
23811
23741
|
const withoutPlaceholders = current.filter((c) => !isPlaceholder(c));
|
|
23812
23742
|
setTimeout(() => {
|
|
@@ -23851,7 +23781,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23851
23781
|
return updated;
|
|
23852
23782
|
});
|
|
23853
23783
|
} catch (error) {
|
|
23854
|
-
console.error("URL upload failed:", error);
|
|
23855
23784
|
trackMediaUploadFailed({
|
|
23856
23785
|
editorType: EditorTypes.Poll,
|
|
23857
23786
|
mediaType: searchFrom === ImageSearchFrom.Gif ? "gif" : "image",
|
|
@@ -24406,7 +24335,6 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
24406
24335
|
};
|
|
24407
24336
|
const handleUpdateLink = (link, text2, uid, previewPayload) => {
|
|
24408
24337
|
if (!editor.view) return;
|
|
24409
|
-
console.log("UPDATE LINK IN VIEW::", { text: text2 });
|
|
24410
24338
|
const newText = mark?.attrs?.isLinkMode ? link : text2 || link;
|
|
24411
24339
|
if (uid) {
|
|
24412
24340
|
editor.commands.updateLink(uid, { href: link, text: newText, previewPayload });
|
|
@@ -24483,7 +24411,6 @@ function doesPreviewExist(editor, uid) {
|
|
|
24483
24411
|
});
|
|
24484
24412
|
return exists;
|
|
24485
24413
|
} catch (err) {
|
|
24486
|
-
console.error("❌ Error in doesPreviewExist:", err);
|
|
24487
24414
|
return false;
|
|
24488
24415
|
}
|
|
24489
24416
|
}
|
|
@@ -24501,13 +24428,11 @@ function findExistingPreview(editor) {
|
|
|
24501
24428
|
});
|
|
24502
24429
|
return result;
|
|
24503
24430
|
} catch (err) {
|
|
24504
|
-
console.error("❌ Error in findExistingPreview:", err);
|
|
24505
24431
|
return null;
|
|
24506
24432
|
}
|
|
24507
24433
|
}
|
|
24508
24434
|
function removePreviewByUid(editor, uid) {
|
|
24509
24435
|
if (!editor || !uid) {
|
|
24510
|
-
console.warn("⚠️ Cannot remove preview: missing editor or uid");
|
|
24511
24436
|
return;
|
|
24512
24437
|
}
|
|
24513
24438
|
try {
|
|
@@ -24525,11 +24450,9 @@ function removePreviewByUid(editor, uid) {
|
|
|
24525
24450
|
if (tr) {
|
|
24526
24451
|
tr.delete(previewPos, Number(previewPos) + previewSize);
|
|
24527
24452
|
editor.view.dispatch(tr);
|
|
24528
|
-
console.log("🗑️ Removed preview for UID:", uid);
|
|
24529
24453
|
}
|
|
24530
24454
|
}
|
|
24531
24455
|
} catch (err) {
|
|
24532
|
-
console.error("❌ Error in removePreviewByUid:", err);
|
|
24533
24456
|
}
|
|
24534
24457
|
}
|
|
24535
24458
|
function extractBestImage(metadata) {
|
|
@@ -24557,7 +24480,6 @@ function collectAllLinkMarks(state, linkMark) {
|
|
|
24557
24480
|
}
|
|
24558
24481
|
function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, pluginState) {
|
|
24559
24482
|
if (!newState || !linkMark || !editor || !pluginState) {
|
|
24560
|
-
console.warn("⚠️ Missing required parameters for syncLinkHrefWithText");
|
|
24561
24483
|
return null;
|
|
24562
24484
|
}
|
|
24563
24485
|
let tr = null;
|
|
@@ -24571,17 +24493,11 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24571
24493
|
const currentText = node.text || "";
|
|
24572
24494
|
const currentHref = mark.attrs.href || "";
|
|
24573
24495
|
if (currentText !== currentHref) {
|
|
24574
|
-
console.log("🔄 Text-href mismatch detected:", {
|
|
24575
|
-
uid: mark.attrs.uid,
|
|
24576
|
-
text: currentText,
|
|
24577
|
-
href: currentHref
|
|
24578
|
-
});
|
|
24579
24496
|
const isValidUrl2 = isValidUrlFormat(currentText);
|
|
24580
24497
|
if (!tr) {
|
|
24581
24498
|
tr = newState.tr;
|
|
24582
24499
|
}
|
|
24583
24500
|
if (!tr) {
|
|
24584
|
-
console.warn("⚠️ Failed to create transaction");
|
|
24585
24501
|
return;
|
|
24586
24502
|
}
|
|
24587
24503
|
if (isValidUrl2) {
|
|
@@ -24590,44 +24506,32 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24590
24506
|
href: normalizeUrl(currentText)
|
|
24591
24507
|
});
|
|
24592
24508
|
if (!newMark) {
|
|
24593
|
-
console.warn("⚠️ Failed to create new mark");
|
|
24594
24509
|
return;
|
|
24595
24510
|
}
|
|
24596
24511
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24597
24512
|
tr = tr.addMark(pos, pos + node.nodeSize, newMark);
|
|
24598
24513
|
hasChanges = true;
|
|
24599
|
-
console.log("✏️ Updated href to match text:", currentText);
|
|
24600
24514
|
pluginState.processedLinks.delete(mark.attrs.uid);
|
|
24601
24515
|
if (singlePreviewMode) {
|
|
24602
|
-
console.log("🔄 [SINGLE MODE] Queueing preview removal for re-resolution");
|
|
24603
24516
|
queueMicrotask(() => {
|
|
24604
24517
|
try {
|
|
24605
24518
|
const existingPreview = findExistingPreview(editor);
|
|
24606
24519
|
if (existingPreview && mark.attrs?.uid) {
|
|
24607
|
-
console.log(
|
|
24608
|
-
"🗑️ [SINGLE MODE - VALID URL] Removing preview to re-resolve [turned off currently]"
|
|
24609
|
-
);
|
|
24610
24520
|
}
|
|
24611
24521
|
} catch (err) {
|
|
24612
|
-
console.error("❌ Error removing preview in single mode:", err);
|
|
24613
24522
|
}
|
|
24614
24523
|
});
|
|
24615
24524
|
} else {
|
|
24616
|
-
console.log("🔄 [MULTI MODE] Link Auto Resolve Does Nothing");
|
|
24617
24525
|
}
|
|
24618
24526
|
} else {
|
|
24619
24527
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24620
24528
|
hasChanges = true;
|
|
24621
|
-
console.log("❌ Text no longer valid URL, removing link mark");
|
|
24622
|
-
console.log("🔄 [INVALID URL] Queueing preview removal");
|
|
24623
24529
|
queueMicrotask(() => {
|
|
24624
24530
|
try {
|
|
24625
24531
|
if (mark.attrs?.uid) {
|
|
24626
|
-
console.log("🗑️ [INVALID URL] Removing preview due to invalid URL");
|
|
24627
24532
|
removePreviewByUid(editor, mark.attrs.uid);
|
|
24628
24533
|
}
|
|
24629
24534
|
} catch (err) {
|
|
24630
|
-
console.error("❌ Error removing preview:", err);
|
|
24631
24535
|
}
|
|
24632
24536
|
});
|
|
24633
24537
|
if (mark.attrs?.uid) {
|
|
@@ -24640,7 +24544,6 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24640
24544
|
});
|
|
24641
24545
|
});
|
|
24642
24546
|
} catch (err) {
|
|
24643
|
-
console.error("❌ Error in syncLinkHrefWithText:", err);
|
|
24644
24547
|
return null;
|
|
24645
24548
|
}
|
|
24646
24549
|
return hasChanges ? tr : null;
|
|
@@ -24654,11 +24557,6 @@ function assignUidsToLinks(newState, linkMark, editor) {
|
|
|
24654
24557
|
node.marks.forEach((mark) => {
|
|
24655
24558
|
if (mark.type === linkMark && mark.attrs?.href && !mark.attrs.uid) {
|
|
24656
24559
|
const newUid = v4();
|
|
24657
|
-
console.log("🔧 Assigning UID to autolinked URL:", {
|
|
24658
|
-
href: mark.attrs.href,
|
|
24659
|
-
uid: newUid,
|
|
24660
|
-
pos
|
|
24661
|
-
});
|
|
24662
24560
|
if (editor) {
|
|
24663
24561
|
const analytics = getAnalyticsStore();
|
|
24664
24562
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id");
|
|
@@ -24695,25 +24593,14 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24695
24593
|
const { api, editor } = options;
|
|
24696
24594
|
const mediaGroup = findByType(editor?.getJSON(), "mediaGroup");
|
|
24697
24595
|
if (!api) {
|
|
24698
|
-
console.warn("⚠️ No API provided to resolve link");
|
|
24699
24596
|
return;
|
|
24700
24597
|
}
|
|
24701
24598
|
if (singlePreviewMode && mediaGroup.length >= 1) return;
|
|
24702
24599
|
pluginState.resolvingLinks.add(link.uid);
|
|
24703
|
-
console.log("🌐 Resolving link metadata:", {
|
|
24704
|
-
uid: link.uid,
|
|
24705
|
-
href: link.href,
|
|
24706
|
-
singlePreviewMode
|
|
24707
|
-
});
|
|
24708
24600
|
api.resolveUrl(normalizeUrl(link.href)).then((metadata) => {
|
|
24709
24601
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24710
24602
|
pluginState.processedLinks.add(link.uid);
|
|
24711
|
-
console.log("✅ Link metadata resolved:", {
|
|
24712
|
-
uid: link.uid,
|
|
24713
|
-
metadata
|
|
24714
|
-
});
|
|
24715
24603
|
if (!metadata) {
|
|
24716
|
-
console.warn("⚠️ No metadata returned for:", link.href);
|
|
24717
24604
|
return;
|
|
24718
24605
|
}
|
|
24719
24606
|
const previewData = {
|
|
@@ -24728,13 +24615,11 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24728
24615
|
if (singlePreviewMode) {
|
|
24729
24616
|
const existingPreview = findExistingPreview(editor);
|
|
24730
24617
|
if (existingPreview) {
|
|
24731
|
-
console.log("🔄 Updating existing preview in single mode");
|
|
24732
24618
|
const { pos } = existingPreview;
|
|
24733
24619
|
const tr = editor.state.tr;
|
|
24734
24620
|
tr.setNodeMarkup(pos, void 0, previewData);
|
|
24735
24621
|
editor.view.dispatch(tr);
|
|
24736
24622
|
} else {
|
|
24737
|
-
console.log("➕ Creating first preview in single mode");
|
|
24738
24623
|
editor.commands.setLinkPreview(previewData);
|
|
24739
24624
|
}
|
|
24740
24625
|
editor.commands.updateLinkByUid(link.uid, {
|
|
@@ -24742,16 +24627,12 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24742
24627
|
});
|
|
24743
24628
|
} else {
|
|
24744
24629
|
if (!doesPreviewExist(editor, link.uid)) {
|
|
24745
|
-
console.log("➕ Creating new preview in multi mode");
|
|
24746
24630
|
editor.chain().updateLinkByUid(link.uid, {
|
|
24747
24631
|
previewPayload: convertLinkMetaToPreviewItem(metadata)
|
|
24748
24632
|
}).setLinkPreview(previewData).run();
|
|
24749
|
-
} else {
|
|
24750
|
-
console.log("⏭️ Preview already exists, skipping");
|
|
24751
24633
|
}
|
|
24752
24634
|
}
|
|
24753
24635
|
}).catch((err) => {
|
|
24754
|
-
console.error("❌ Failed to resolve link:", err);
|
|
24755
24636
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24756
24637
|
if (!editor?.view?.dom) return;
|
|
24757
24638
|
const analytics = getAnalyticsStore();
|
|
@@ -24769,10 +24650,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24769
24650
|
key: pluginKey,
|
|
24770
24651
|
state: {
|
|
24771
24652
|
init() {
|
|
24772
|
-
console.log("🔌 LinkAutoResolve plugin initialized", {
|
|
24773
|
-
singlePreviewMode,
|
|
24774
|
-
hasApi: !!options.api
|
|
24775
|
-
});
|
|
24776
24653
|
return {
|
|
24777
24654
|
resolvingLinks: /* @__PURE__ */ new Set(),
|
|
24778
24655
|
processedLinks: /* @__PURE__ */ new Set()
|
|
@@ -24802,33 +24679,23 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24802
24679
|
appendTransaction: (transactions, oldState, newState) => {
|
|
24803
24680
|
const linkMark = newState.schema.marks["customLink"];
|
|
24804
24681
|
if (!linkMark) {
|
|
24805
|
-
console.warn("⚠️ customLink mark not found in schema");
|
|
24806
24682
|
return null;
|
|
24807
24683
|
}
|
|
24808
24684
|
if (!transactions.some((tr) => tr.docChanged)) {
|
|
24809
24685
|
return null;
|
|
24810
24686
|
}
|
|
24811
|
-
console.log("📝 Document changed, checking for changes...");
|
|
24812
24687
|
const pluginState = pluginKey.getState(newState);
|
|
24813
24688
|
if (!pluginState) {
|
|
24814
|
-
console.warn("⚠️ Plugin state not found");
|
|
24815
24689
|
return null;
|
|
24816
24690
|
}
|
|
24817
24691
|
const syncTr = singlePreviewMode ? syncLinkHrefWithText(newState, linkMark, options.editor, singlePreviewMode, pluginState) : null;
|
|
24818
24692
|
const oldLinks = collectAllLinkMarks(oldState, linkMark);
|
|
24819
24693
|
const newLinks = collectAllLinkMarks(newState, linkMark);
|
|
24820
|
-
console.log("📊 Link count:", {
|
|
24821
|
-
old: oldLinks.size,
|
|
24822
|
-
new: newLinks.size,
|
|
24823
|
-
processed: pluginState.processedLinks.size,
|
|
24824
|
-
resolving: pluginState.resolvingLinks.size
|
|
24825
|
-
});
|
|
24826
24694
|
const editor = options?.editor;
|
|
24827
24695
|
const { tr: uidTr, newUids } = assignUidsToLinks(newState, linkMark, editor);
|
|
24828
24696
|
const linksToResolve = [];
|
|
24829
24697
|
newUids.forEach((linkData) => {
|
|
24830
24698
|
if (!pluginState.processedLinks.has(linkData.uid) && !pluginState.resolvingLinks.has(linkData.uid)) {
|
|
24831
|
-
console.log("🆕 New autolinked URL detected:", linkData);
|
|
24832
24699
|
linksToResolve.push(linkData);
|
|
24833
24700
|
}
|
|
24834
24701
|
});
|
|
@@ -24841,19 +24708,15 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24841
24708
|
return;
|
|
24842
24709
|
}
|
|
24843
24710
|
if (!oldLinks.has(uid)) {
|
|
24844
|
-
console.log("🆕 New link detected (with UID):", linkData);
|
|
24845
24711
|
linksToResolve.push(linkData);
|
|
24846
24712
|
}
|
|
24847
24713
|
});
|
|
24848
24714
|
if (linksToResolve.length > 0) {
|
|
24849
|
-
console.log("🚀 Processing", linksToResolve.length, "new link(s)");
|
|
24850
24715
|
queueMicrotask(() => {
|
|
24851
24716
|
linksToResolve.forEach((link) => {
|
|
24852
24717
|
resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginState);
|
|
24853
24718
|
});
|
|
24854
24719
|
});
|
|
24855
|
-
} else {
|
|
24856
|
-
console.log("✓ No new links to process");
|
|
24857
24720
|
}
|
|
24858
24721
|
if (syncTr && uidTr) {
|
|
24859
24722
|
try {
|
|
@@ -24868,7 +24731,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24868
24731
|
});
|
|
24869
24732
|
return syncTr;
|
|
24870
24733
|
} catch (err) {
|
|
24871
|
-
console.error("❌ Error combining transactions:", err);
|
|
24872
24734
|
return syncTr;
|
|
24873
24735
|
}
|
|
24874
24736
|
}
|
|
@@ -24972,7 +24834,6 @@ const CustomLink = Link$1.extend({
|
|
|
24972
24834
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
24973
24835
|
if (metadata) {
|
|
24974
24836
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
24975
|
-
console.log({ href, text: text2 });
|
|
24976
24837
|
editor?.chain()?.updateLinkByUid(uid, { href, text: text2, previewPayload })?.updateLinkPreviewByUid(uid, {
|
|
24977
24838
|
// Now using correct UID
|
|
24978
24839
|
loading: false,
|
|
@@ -24988,7 +24849,6 @@ const CustomLink = Link$1.extend({
|
|
|
24988
24849
|
})?.catch((err) => {
|
|
24989
24850
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
24990
24851
|
analytics?.trackLinkUnfurlFailed(sessionId, { editorType });
|
|
24991
|
-
console.error("LINK UPDATE ERR::", { err });
|
|
24992
24852
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
24993
24853
|
});
|
|
24994
24854
|
return true;
|
|
@@ -25036,7 +24896,6 @@ const CustomLink = Link$1.extend({
|
|
|
25036
24896
|
if (attrs.href) {
|
|
25037
24897
|
queueMicrotask(() => {
|
|
25038
24898
|
this.options.api?.resolveUrl(normalizeUrl(attrs.href))?.then((metadata) => {
|
|
25039
|
-
console.log({ metadata });
|
|
25040
24899
|
if (metadata) {
|
|
25041
24900
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
25042
24901
|
let linkPreviewExists = false;
|
|
@@ -25065,7 +24924,6 @@ const CustomLink = Link$1.extend({
|
|
|
25065
24924
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
25066
24925
|
}
|
|
25067
24926
|
}).catch((err) => {
|
|
25068
|
-
console.log("LINK UPDATE ERR::", { err });
|
|
25069
24927
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id") ?? "";
|
|
25070
24928
|
const editorType = editor?.view?.dom?.getAttribute(
|
|
25071
24929
|
"data-editor-type"
|
|
@@ -25151,7 +25009,6 @@ const IframeView = ({
|
|
|
25151
25009
|
setPreviewData(previewPayload);
|
|
25152
25010
|
updateAttributes({ previewPayload });
|
|
25153
25011
|
}).catch((error) => {
|
|
25154
|
-
console.error("Failed to fetch preview:", error);
|
|
25155
25012
|
}).finally(() => {
|
|
25156
25013
|
});
|
|
25157
25014
|
}
|
|
@@ -25396,7 +25253,6 @@ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTyp
|
|
|
25396
25253
|
}
|
|
25397
25254
|
});
|
|
25398
25255
|
} catch (_) {
|
|
25399
|
-
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
25400
25256
|
return null;
|
|
25401
25257
|
}
|
|
25402
25258
|
};
|
|
@@ -26233,7 +26089,6 @@ const configureDOMPurify = () => {
|
|
|
26233
26089
|
const element = node;
|
|
26234
26090
|
const src = element.getAttribute("src") || "";
|
|
26235
26091
|
if (!isAllowedDomain(src)) {
|
|
26236
|
-
console.warn("🚨 Blocked iframe from non-allowed domain:", src);
|
|
26237
26092
|
node.parentNode?.removeChild(node);
|
|
26238
26093
|
}
|
|
26239
26094
|
}
|
|
@@ -26245,7 +26100,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26245
26100
|
const config = configureDOMPurify();
|
|
26246
26101
|
const cleaned = purify.sanitize(html2, config);
|
|
26247
26102
|
if (!cleaned.includes("<iframe")) {
|
|
26248
|
-
console.warn("⚠️ No valid iframe found after sanitization");
|
|
26249
26103
|
return null;
|
|
26250
26104
|
}
|
|
26251
26105
|
const match = cleaned.match(/<iframe[^>]*src=["']([^"']+)["']/i);
|
|
@@ -26257,7 +26111,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26257
26111
|
}
|
|
26258
26112
|
return match[1];
|
|
26259
26113
|
} catch (error) {
|
|
26260
|
-
console.error("🚨 Error sanitizing iframe:", error);
|
|
26261
26114
|
return null;
|
|
26262
26115
|
} finally {
|
|
26263
26116
|
purify.removeAllHooks();
|
|
@@ -26295,7 +26148,6 @@ const createFinder = (regex) => {
|
|
|
26295
26148
|
match
|
|
26296
26149
|
});
|
|
26297
26150
|
}
|
|
26298
|
-
console.log({ match, matches });
|
|
26299
26151
|
return matches.length > 0 ? matches : null;
|
|
26300
26152
|
};
|
|
26301
26153
|
};
|
|
@@ -26347,11 +26199,9 @@ const Iframe = Node$1.create({
|
|
|
26347
26199
|
const iframeHTML = match[0];
|
|
26348
26200
|
const safeSrc = sanitizeIframeHTML(iframeHTML);
|
|
26349
26201
|
if (!safeSrc) {
|
|
26350
|
-
console.warn("🚨 Blocked unsafe iframe paste");
|
|
26351
26202
|
toast.error("🚨 Your pasted iframe is not safe to render");
|
|
26352
26203
|
return;
|
|
26353
26204
|
}
|
|
26354
|
-
console.log("✅ Safe iframe URL validated:", safeSrc);
|
|
26355
26205
|
const node = this.type.create({ src: safeSrc, previewPayload: null });
|
|
26356
26206
|
state.tr.replaceRangeWith(range.from, range.to, node);
|
|
26357
26207
|
}
|
|
@@ -26362,7 +26212,6 @@ const Iframe = Node$1.create({
|
|
|
26362
26212
|
handler: ({ state, range, match }) => {
|
|
26363
26213
|
const fullUrl = match[0];
|
|
26364
26214
|
const embedUrl = getEmbedUrl(fullUrl);
|
|
26365
|
-
console.log({ match, fullUrl, embedUrl });
|
|
26366
26215
|
if (!embedUrl) return;
|
|
26367
26216
|
const node = this.type.create({ src: embedUrl });
|
|
26368
26217
|
state.tr.replaceRangeWith(range.from, range.to, node);
|
|
@@ -26408,10 +26257,9 @@ const handleUrlWithoutSelection = (editor, url, event, autoDetectMedia) => {
|
|
|
26408
26257
|
mediaType: MediaItemType.MEDIA_ITEM
|
|
26409
26258
|
});
|
|
26410
26259
|
}).catch(
|
|
26411
|
-
(e) =>
|
|
26260
|
+
(e) => void 0
|
|
26412
26261
|
);
|
|
26413
26262
|
}
|
|
26414
|
-
console.log("[SmartLinkPaste] Inserting as link node");
|
|
26415
26263
|
editor.chain().focus().insertLink({ href: normalizedUrl, text: url }).run();
|
|
26416
26264
|
return true;
|
|
26417
26265
|
};
|
|
@@ -26433,7 +26281,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26433
26281
|
return false;
|
|
26434
26282
|
}
|
|
26435
26283
|
const trimmedText = pasteText.trim();
|
|
26436
|
-
console.log("[SmartLinkPaste] Valid URL detected:", isEmbeddableUrl(trimmedText));
|
|
26437
26284
|
if (isEmbeddableUrl(trimmedText) && options?.autoEmbed) {
|
|
26438
26285
|
event.preventDefault();
|
|
26439
26286
|
return false;
|
|
@@ -26450,7 +26297,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26450
26297
|
options?.autoDetectMedia ?? true
|
|
26451
26298
|
);
|
|
26452
26299
|
} catch (error) {
|
|
26453
|
-
console.error("[SmartLinkPaste] Error:", error);
|
|
26454
26300
|
return false;
|
|
26455
26301
|
}
|
|
26456
26302
|
};
|
|
@@ -26462,10 +26308,8 @@ const createTransformHandler = (editor) => {
|
|
|
26462
26308
|
return slice;
|
|
26463
26309
|
}
|
|
26464
26310
|
try {
|
|
26465
|
-
console.log("[SmartLinkPaste] Transforming inline URLs in pasted content");
|
|
26466
26311
|
return transformUrlsInSlice(editor, slice);
|
|
26467
26312
|
} catch (error) {
|
|
26468
|
-
console.error("[SmartLinkPaste] Transform error:", error);
|
|
26469
26313
|
return slice;
|
|
26470
26314
|
}
|
|
26471
26315
|
};
|
|
@@ -26572,7 +26416,6 @@ const SmartMediaUpload = Extension.create({
|
|
|
26572
26416
|
const uid = v4();
|
|
26573
26417
|
const options = this.options;
|
|
26574
26418
|
if (!options.api) {
|
|
26575
|
-
console.error("API instance not provided to SmartMediaUpload");
|
|
26576
26419
|
return false;
|
|
26577
26420
|
}
|
|
26578
26421
|
let uploadSource = "local";
|
|
@@ -26587,7 +26430,6 @@ const SmartMediaUpload = Extension.create({
|
|
|
26587
26430
|
options.allowedFileTypes
|
|
26588
26431
|
);
|
|
26589
26432
|
if (!validation.valid) {
|
|
26590
|
-
console.error("File validation failed:", validation.error);
|
|
26591
26433
|
options.onUploadError?.(uid, new Error(validation.error));
|
|
26592
26434
|
const { sessionId, editorType } = this.storage.getAnalyticsContext(editor);
|
|
26593
26435
|
if (sessionId && editorType) {
|
|
@@ -26713,7 +26555,6 @@ const SmartMediaUpload = Extension.create({
|
|
|
26713
26555
|
}
|
|
26714
26556
|
}
|
|
26715
26557
|
} catch (error) {
|
|
26716
|
-
console.error("Upload failed:", error);
|
|
26717
26558
|
const blobUrl = this.storage.blobUrls.get(item.uid);
|
|
26718
26559
|
if (blobUrl) {
|
|
26719
26560
|
URL.revokeObjectURL(blobUrl);
|
|
@@ -26748,7 +26589,7 @@ const SmartMediaUpload = Extension.create({
|
|
|
26748
26589
|
this.storage.activeUploads--;
|
|
26749
26590
|
this.storage.processUploadQueue(editor);
|
|
26750
26591
|
}
|
|
26751
|
-
})().catch((err) =>
|
|
26592
|
+
})().catch((err) => void 0);
|
|
26752
26593
|
if (this.storage.uploadQueue.length > 0) {
|
|
26753
26594
|
this.storage.processUploadQueue(editor);
|
|
26754
26595
|
}
|
|
@@ -29448,7 +29289,6 @@ function getSuggestionOptions({
|
|
|
29448
29289
|
const text2 = editor.getText();
|
|
29449
29290
|
const trimmed = text2?.replace(WHITESPACE_REGEX, " ")?.trim();
|
|
29450
29291
|
const matchStartPosition = trimmed?.lastIndexOf(char);
|
|
29451
|
-
console.log({ matchStartPosition });
|
|
29452
29292
|
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
29453
29293
|
const overrideSpace = nodeAfter?.text?.startsWith(" ");
|
|
29454
29294
|
if (overrideSpace) {
|
|
@@ -29562,7 +29402,6 @@ const Mention = Node$1.create({
|
|
|
29562
29402
|
renderHTML({ node, HTMLAttributes }) {
|
|
29563
29403
|
const suggestion = getSuggestionFromChar(this, node.attrs.mentionSuggestionChar);
|
|
29564
29404
|
if (this.options.renderLabel !== void 0) {
|
|
29565
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29566
29405
|
return [
|
|
29567
29406
|
"span",
|
|
29568
29407
|
mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
@@ -29602,7 +29441,6 @@ const Mention = Node$1.create({
|
|
|
29602
29441
|
suggestion: getSuggestionFromChar(this, node.attrs.mentionSuggestionChar)
|
|
29603
29442
|
};
|
|
29604
29443
|
if (this.options.renderLabel !== void 0) {
|
|
29605
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29606
29444
|
return this.options.renderLabel(args);
|
|
29607
29445
|
}
|
|
29608
29446
|
return this.options.renderText(args);
|
|
@@ -30564,11 +30402,9 @@ const mentionService = (api, mfs, store) => {
|
|
|
30564
30402
|
const fetchMentions = async () => {
|
|
30565
30403
|
const params = store.getState().getMentionParams();
|
|
30566
30404
|
if (!params) {
|
|
30567
|
-
console.error("DEBUG MENTION SERVICE::", "No group id or post id has been provided");
|
|
30568
30405
|
return [];
|
|
30569
30406
|
}
|
|
30570
30407
|
const { groupId, postId } = params;
|
|
30571
|
-
console.log({ groupId, postId });
|
|
30572
30408
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
30573
30409
|
return response.entries?.filter((item) => Boolean(item?.user_data))?.map(
|
|
30574
30410
|
(item) => ({
|
|
@@ -30587,7 +30423,6 @@ const mentionService = (api, mfs, store) => {
|
|
|
30587
30423
|
const { selectedGroupId, groupId } = store.getState();
|
|
30588
30424
|
const activeGroupId = selectedGroupId ?? groupId;
|
|
30589
30425
|
if (!activeGroupId) {
|
|
30590
|
-
console.warn("DEBUG HASHTAG SERVICE::", "No active group selected or provided");
|
|
30591
30426
|
return [];
|
|
30592
30427
|
}
|
|
30593
30428
|
const response = await api.fetchGroupConversations(999, 0);
|
|
@@ -30961,7 +30796,6 @@ const LinkPreview = Node$1.create({
|
|
|
30961
30796
|
},
|
|
30962
30797
|
renderHTML({ node }) {
|
|
30963
30798
|
const { href, uid, title, description, image, domain } = node.attrs;
|
|
30964
|
-
console.log("INSIDE RENDER HTML::", { href, image });
|
|
30965
30799
|
if (!href) return ["div", {}];
|
|
30966
30800
|
const content = [
|
|
30967
30801
|
// Link overlay
|
|
@@ -31204,14 +31038,12 @@ const createMediaModePlugin = () => {
|
|
|
31204
31038
|
child.marks.forEach((mark) => {
|
|
31205
31039
|
if (mark.type.name === "customLink" && mark.attrs.previewPayload) {
|
|
31206
31040
|
lastLinkPreviewData = mark.attrs.previewPayload;
|
|
31207
|
-
console.log("Found link with previewPayload:", lastLinkPreviewData);
|
|
31208
31041
|
}
|
|
31209
31042
|
});
|
|
31210
31043
|
}
|
|
31211
31044
|
});
|
|
31212
31045
|
}
|
|
31213
31046
|
});
|
|
31214
|
-
console.log("Cleanup check:", { modified, hasMediaGroup, lastLinkPreviewData });
|
|
31215
31047
|
if (modified && hasMediaGroup && lastLinkPreviewData) {
|
|
31216
31048
|
let hasLinkPreview = false;
|
|
31217
31049
|
tr.doc.forEach((node) => {
|
|
@@ -31219,10 +31051,6 @@ const createMediaModePlugin = () => {
|
|
|
31219
31051
|
hasLinkPreview = true;
|
|
31220
31052
|
}
|
|
31221
31053
|
});
|
|
31222
|
-
console.log("Creating linkPreview:", {
|
|
31223
|
-
hasLinkPreview,
|
|
31224
|
-
schemaHasLinkPreview: !!newState.schema.nodes.linkPreview
|
|
31225
|
-
});
|
|
31226
31054
|
if (!hasLinkPreview && newState.schema.nodes.linkPreview) {
|
|
31227
31055
|
const preview = lastLinkPreviewData;
|
|
31228
31056
|
const linkPreviewNode = newState.schema.nodes.linkPreview.create({
|
|
@@ -31233,7 +31061,6 @@ const createMediaModePlugin = () => {
|
|
|
31233
31061
|
image: preview.linkImage?.url ?? "",
|
|
31234
31062
|
variant: LinkPreviewType.Extended
|
|
31235
31063
|
});
|
|
31236
|
-
console.log("Inserting linkPreview node:", { lastLinkPreviewData, linkPreviewNode });
|
|
31237
31064
|
tr.insert(tr.doc.content.size, linkPreviewNode);
|
|
31238
31065
|
modified = true;
|
|
31239
31066
|
}
|
|
@@ -31293,7 +31120,6 @@ const createMediaModePlugin = () => {
|
|
|
31293
31120
|
}
|
|
31294
31121
|
const mediaNodes = updatedTopLevelMedia.map((m) => m.node);
|
|
31295
31122
|
if (mediaNodes.some((n) => !n || n.type.name !== "media")) {
|
|
31296
|
-
console.warn("Invalid media nodes detected, skipping group creation");
|
|
31297
31123
|
return null;
|
|
31298
31124
|
}
|
|
31299
31125
|
const mediaGroup = newState.schema.nodes.mediaGroup.create({}, mediaNodes);
|
|
@@ -31311,7 +31137,6 @@ const createMediaModePlugin = () => {
|
|
|
31311
31137
|
const $pos = tr.doc.resolve(endPos);
|
|
31312
31138
|
tr.setSelection(TextSelection$1.near($pos));
|
|
31313
31139
|
} catch (e) {
|
|
31314
|
-
console.warn("Could not set selection:", e);
|
|
31315
31140
|
}
|
|
31316
31141
|
}
|
|
31317
31142
|
tr.setMeta("addToHistory", false);
|
|
@@ -31319,7 +31144,6 @@ const createMediaModePlugin = () => {
|
|
|
31319
31144
|
}
|
|
31320
31145
|
return modified ? tr : null;
|
|
31321
31146
|
} catch (error) {
|
|
31322
|
-
console.error("MediaMode plugin error:", error);
|
|
31323
31147
|
return null;
|
|
31324
31148
|
} finally {
|
|
31325
31149
|
isProcessing = false;
|
|
@@ -31605,7 +31429,6 @@ const isLinkMarkWithPayload = (node) => isLinkMark(node) && Boolean(node?.attrs?
|
|
|
31605
31429
|
const getLinkItemsPayload = (json) => {
|
|
31606
31430
|
const links = find(json, (node) => isLinkMarkWithPayload(node));
|
|
31607
31431
|
const items = links?.at(-1);
|
|
31608
|
-
console.log("Link Items Payload::", { items });
|
|
31609
31432
|
return { items };
|
|
31610
31433
|
};
|
|
31611
31434
|
const getPollItemsPayload = (json) => {
|
|
@@ -31692,7 +31515,6 @@ const generatePollPostPayload = ({
|
|
|
31692
31515
|
option_id: index2 === 0 ? item.option_id : v4(),
|
|
31693
31516
|
option_color: OPTION_COLORS[index2 % OPTION_COLORS.length]
|
|
31694
31517
|
})) : items;
|
|
31695
|
-
console.log({ polls });
|
|
31696
31518
|
return {
|
|
31697
31519
|
...commons,
|
|
31698
31520
|
type: NewPostType.NEW_POST_POLL,
|
|
@@ -31749,7 +31571,6 @@ const PostBuilderEditorInstance = ({
|
|
|
31749
31571
|
const json = editor?.getJSON();
|
|
31750
31572
|
const text2 = editor?.getText();
|
|
31751
31573
|
const payload = generateCreatePostPayload(editorTab, { editor, sendCrossMention });
|
|
31752
|
-
console.log({ json });
|
|
31753
31574
|
const isPollType = payload?.type === NewPostType.NEW_POST_POLL;
|
|
31754
31575
|
if (payload?.error) {
|
|
31755
31576
|
toast.error(payload.error);
|