@select-org/select-post-builder 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/post-builder.cjs.js +31 -211
- package/dist/post-builder.css +0 -9
- package/dist/post-builder.js +31 -211
- package/package.json +1 -1
package/dist/post-builder.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
|
);
|
|
@@ -21622,11 +21581,9 @@ var Progress$1 = React.forwardRef(
|
|
|
21622
21581
|
...progressProps
|
|
21623
21582
|
} = props;
|
|
21624
21583
|
if ((maxProp || maxProp === 0) && !isValidMaxNumber(maxProp)) {
|
|
21625
|
-
console.error(getInvalidMaxError(`${maxProp}`, "Progress"));
|
|
21626
21584
|
}
|
|
21627
21585
|
const max2 = isValidMaxNumber(maxProp) ? maxProp : DEFAULT_MAX;
|
|
21628
21586
|
if (valueProp !== null && !isValidValueNumber(valueProp, max2)) {
|
|
21629
|
-
console.error(getInvalidValueError(`${valueProp}`, "Progress"));
|
|
21630
21587
|
}
|
|
21631
21588
|
const value = isValidValueNumber(valueProp, max2) ? valueProp : null;
|
|
21632
21589
|
const valueLabel = isNumber(value) ? getValueLabel(value, max2) : void 0;
|
|
@@ -21952,13 +21909,7 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21952
21909
|
state,
|
|
21953
21910
|
dispatch
|
|
21954
21911
|
}) => {
|
|
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
21912
|
if (!dispatch) {
|
|
21961
|
-
console.log("No dispatch, returning false");
|
|
21962
21913
|
return false;
|
|
21963
21914
|
}
|
|
21964
21915
|
const { doc, schema } = state;
|
|
@@ -21968,13 +21919,6 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21968
21919
|
doc.descendants((node, pos) => {
|
|
21969
21920
|
if (node.isText && node.marks?.length) {
|
|
21970
21921
|
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
21922
|
if (mark.type.name === markName && mark.attrs.uid === uid) {
|
|
21979
21923
|
positions.push({
|
|
21980
21924
|
from: pos,
|
|
@@ -21982,33 +21926,21 @@ const createUpdateMarkByUidCommand = (markName) => {
|
|
|
21982
21926
|
mark
|
|
21983
21927
|
});
|
|
21984
21928
|
found2 = true;
|
|
21985
|
-
console.log("Found matching mark at:", { from: pos, to: pos + node.nodeSize });
|
|
21986
21929
|
}
|
|
21987
21930
|
});
|
|
21988
21931
|
}
|
|
21989
21932
|
});
|
|
21990
|
-
console.log("Total positions found:", positions.length);
|
|
21991
|
-
console.log("Positions:", positions);
|
|
21992
21933
|
if (found2) {
|
|
21993
21934
|
positions.forEach(({ from, to, mark }) => {
|
|
21994
21935
|
const newAttrs = { ...mark.attrs, ...attrs };
|
|
21995
21936
|
const markType = schema.marks[markName];
|
|
21996
|
-
console.log("Applying update:", { from, to, oldAttrs: mark.attrs, newAttrs });
|
|
21997
21937
|
if (markType) {
|
|
21998
|
-
console.log("Before removeMark - tr.doc:", tr.doc.toJSON());
|
|
21999
21938
|
tr = tr.removeMark(from, to, markType);
|
|
22000
|
-
console.log("After removeMark - tr.doc:", tr.doc.toJSON());
|
|
22001
21939
|
tr = tr.addMark(from, to, markType.create(newAttrs));
|
|
22002
|
-
console.log("After addMark - tr.doc:", tr.doc.toJSON());
|
|
22003
21940
|
}
|
|
22004
21941
|
});
|
|
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
21942
|
dispatch(tr);
|
|
22009
|
-
console.log("Transaction dispatched successfully");
|
|
22010
21943
|
}
|
|
22011
|
-
console.log("=== UPDATE MARK COMMAND END ===");
|
|
22012
21944
|
return found2;
|
|
22013
21945
|
};
|
|
22014
21946
|
};
|
|
@@ -23026,7 +22958,6 @@ let warnedAboutTextSelection = false;
|
|
|
23026
22958
|
function checkTextSelection($pos) {
|
|
23027
22959
|
if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {
|
|
23028
22960
|
warnedAboutTextSelection = true;
|
|
23029
|
-
console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
|
|
23030
22961
|
}
|
|
23031
22962
|
}
|
|
23032
22963
|
class TextSelection extends Selection {
|
|
@@ -23771,7 +23702,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23771
23702
|
});
|
|
23772
23703
|
return createPollMediaOption(result, startIndex + index2);
|
|
23773
23704
|
} catch (error) {
|
|
23774
|
-
console.error("Upload failed for", file.name, error);
|
|
23775
23705
|
trackMediaUploadFailed({
|
|
23776
23706
|
editorType: EditorTypes.Poll,
|
|
23777
23707
|
mediaType: file.type.startsWith("video/") ? "video" : "image",
|
|
@@ -23806,7 +23736,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23806
23736
|
return final;
|
|
23807
23737
|
});
|
|
23808
23738
|
} catch (error) {
|
|
23809
|
-
console.error("Unexpected error during file upload:", error);
|
|
23810
23739
|
setInternalChoices((current) => {
|
|
23811
23740
|
const withoutPlaceholders = current.filter((c) => !isPlaceholder(c));
|
|
23812
23741
|
setTimeout(() => {
|
|
@@ -23851,7 +23780,6 @@ const PollCreator = ({ choices, onChange }) => {
|
|
|
23851
23780
|
return updated;
|
|
23852
23781
|
});
|
|
23853
23782
|
} catch (error) {
|
|
23854
|
-
console.error("URL upload failed:", error);
|
|
23855
23783
|
trackMediaUploadFailed({
|
|
23856
23784
|
editorType: EditorTypes.Poll,
|
|
23857
23785
|
mediaType: searchFrom === ImageSearchFrom.Gif ? "gif" : "image",
|
|
@@ -24406,7 +24334,6 @@ const LinkMarkView = ({ mark, editor }) => {
|
|
|
24406
24334
|
};
|
|
24407
24335
|
const handleUpdateLink = (link, text2, uid, previewPayload) => {
|
|
24408
24336
|
if (!editor.view) return;
|
|
24409
|
-
console.log("UPDATE LINK IN VIEW::", { text: text2 });
|
|
24410
24337
|
const newText = mark?.attrs?.isLinkMode ? link : text2 || link;
|
|
24411
24338
|
if (uid) {
|
|
24412
24339
|
editor.commands.updateLink(uid, { href: link, text: newText, previewPayload });
|
|
@@ -24483,7 +24410,6 @@ function doesPreviewExist(editor, uid) {
|
|
|
24483
24410
|
});
|
|
24484
24411
|
return exists;
|
|
24485
24412
|
} catch (err) {
|
|
24486
|
-
console.error("❌ Error in doesPreviewExist:", err);
|
|
24487
24413
|
return false;
|
|
24488
24414
|
}
|
|
24489
24415
|
}
|
|
@@ -24501,13 +24427,11 @@ function findExistingPreview(editor) {
|
|
|
24501
24427
|
});
|
|
24502
24428
|
return result;
|
|
24503
24429
|
} catch (err) {
|
|
24504
|
-
console.error("❌ Error in findExistingPreview:", err);
|
|
24505
24430
|
return null;
|
|
24506
24431
|
}
|
|
24507
24432
|
}
|
|
24508
24433
|
function removePreviewByUid(editor, uid) {
|
|
24509
24434
|
if (!editor || !uid) {
|
|
24510
|
-
console.warn("⚠️ Cannot remove preview: missing editor or uid");
|
|
24511
24435
|
return;
|
|
24512
24436
|
}
|
|
24513
24437
|
try {
|
|
@@ -24525,11 +24449,9 @@ function removePreviewByUid(editor, uid) {
|
|
|
24525
24449
|
if (tr) {
|
|
24526
24450
|
tr.delete(previewPos, Number(previewPos) + previewSize);
|
|
24527
24451
|
editor.view.dispatch(tr);
|
|
24528
|
-
console.log("🗑️ Removed preview for UID:", uid);
|
|
24529
24452
|
}
|
|
24530
24453
|
}
|
|
24531
24454
|
} catch (err) {
|
|
24532
|
-
console.error("❌ Error in removePreviewByUid:", err);
|
|
24533
24455
|
}
|
|
24534
24456
|
}
|
|
24535
24457
|
function extractBestImage(metadata) {
|
|
@@ -24557,7 +24479,6 @@ function collectAllLinkMarks(state, linkMark) {
|
|
|
24557
24479
|
}
|
|
24558
24480
|
function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, pluginState) {
|
|
24559
24481
|
if (!newState || !linkMark || !editor || !pluginState) {
|
|
24560
|
-
console.warn("⚠️ Missing required parameters for syncLinkHrefWithText");
|
|
24561
24482
|
return null;
|
|
24562
24483
|
}
|
|
24563
24484
|
let tr = null;
|
|
@@ -24571,17 +24492,11 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24571
24492
|
const currentText = node.text || "";
|
|
24572
24493
|
const currentHref = mark.attrs.href || "";
|
|
24573
24494
|
if (currentText !== currentHref) {
|
|
24574
|
-
console.log("🔄 Text-href mismatch detected:", {
|
|
24575
|
-
uid: mark.attrs.uid,
|
|
24576
|
-
text: currentText,
|
|
24577
|
-
href: currentHref
|
|
24578
|
-
});
|
|
24579
24495
|
const isValidUrl2 = isValidUrlFormat(currentText);
|
|
24580
24496
|
if (!tr) {
|
|
24581
24497
|
tr = newState.tr;
|
|
24582
24498
|
}
|
|
24583
24499
|
if (!tr) {
|
|
24584
|
-
console.warn("⚠️ Failed to create transaction");
|
|
24585
24500
|
return;
|
|
24586
24501
|
}
|
|
24587
24502
|
if (isValidUrl2) {
|
|
@@ -24590,44 +24505,32 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24590
24505
|
href: normalizeUrl(currentText)
|
|
24591
24506
|
});
|
|
24592
24507
|
if (!newMark) {
|
|
24593
|
-
console.warn("⚠️ Failed to create new mark");
|
|
24594
24508
|
return;
|
|
24595
24509
|
}
|
|
24596
24510
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24597
24511
|
tr = tr.addMark(pos, pos + node.nodeSize, newMark);
|
|
24598
24512
|
hasChanges = true;
|
|
24599
|
-
console.log("✏️ Updated href to match text:", currentText);
|
|
24600
24513
|
pluginState.processedLinks.delete(mark.attrs.uid);
|
|
24601
24514
|
if (singlePreviewMode) {
|
|
24602
|
-
console.log("🔄 [SINGLE MODE] Queueing preview removal for re-resolution");
|
|
24603
24515
|
queueMicrotask(() => {
|
|
24604
24516
|
try {
|
|
24605
24517
|
const existingPreview = findExistingPreview(editor);
|
|
24606
24518
|
if (existingPreview && mark.attrs?.uid) {
|
|
24607
|
-
console.log(
|
|
24608
|
-
"🗑️ [SINGLE MODE - VALID URL] Removing preview to re-resolve [turned off currently]"
|
|
24609
|
-
);
|
|
24610
24519
|
}
|
|
24611
24520
|
} catch (err) {
|
|
24612
|
-
console.error("❌ Error removing preview in single mode:", err);
|
|
24613
24521
|
}
|
|
24614
24522
|
});
|
|
24615
24523
|
} else {
|
|
24616
|
-
console.log("🔄 [MULTI MODE] Link Auto Resolve Does Nothing");
|
|
24617
24524
|
}
|
|
24618
24525
|
} else {
|
|
24619
24526
|
tr = tr.removeMark(pos, pos + node.nodeSize, linkMark);
|
|
24620
24527
|
hasChanges = true;
|
|
24621
|
-
console.log("❌ Text no longer valid URL, removing link mark");
|
|
24622
|
-
console.log("🔄 [INVALID URL] Queueing preview removal");
|
|
24623
24528
|
queueMicrotask(() => {
|
|
24624
24529
|
try {
|
|
24625
24530
|
if (mark.attrs?.uid) {
|
|
24626
|
-
console.log("🗑️ [INVALID URL] Removing preview due to invalid URL");
|
|
24627
24531
|
removePreviewByUid(editor, mark.attrs.uid);
|
|
24628
24532
|
}
|
|
24629
24533
|
} catch (err) {
|
|
24630
|
-
console.error("❌ Error removing preview:", err);
|
|
24631
24534
|
}
|
|
24632
24535
|
});
|
|
24633
24536
|
if (mark.attrs?.uid) {
|
|
@@ -24640,7 +24543,6 @@ function syncLinkHrefWithText(newState, linkMark, editor, singlePreviewMode, plu
|
|
|
24640
24543
|
});
|
|
24641
24544
|
});
|
|
24642
24545
|
} catch (err) {
|
|
24643
|
-
console.error("❌ Error in syncLinkHrefWithText:", err);
|
|
24644
24546
|
return null;
|
|
24645
24547
|
}
|
|
24646
24548
|
return hasChanges ? tr : null;
|
|
@@ -24654,11 +24556,6 @@ function assignUidsToLinks(newState, linkMark, editor) {
|
|
|
24654
24556
|
node.marks.forEach((mark) => {
|
|
24655
24557
|
if (mark.type === linkMark && mark.attrs?.href && !mark.attrs.uid) {
|
|
24656
24558
|
const newUid = v4();
|
|
24657
|
-
console.log("🔧 Assigning UID to autolinked URL:", {
|
|
24658
|
-
href: mark.attrs.href,
|
|
24659
|
-
uid: newUid,
|
|
24660
|
-
pos
|
|
24661
|
-
});
|
|
24662
24559
|
if (editor) {
|
|
24663
24560
|
const analytics = getAnalyticsStore();
|
|
24664
24561
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id");
|
|
@@ -24695,25 +24592,14 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24695
24592
|
const { api, editor } = options;
|
|
24696
24593
|
const mediaGroup = findByType(editor?.getJSON(), "mediaGroup");
|
|
24697
24594
|
if (!api) {
|
|
24698
|
-
console.warn("⚠️ No API provided to resolve link");
|
|
24699
24595
|
return;
|
|
24700
24596
|
}
|
|
24701
24597
|
if (singlePreviewMode && mediaGroup.length >= 1) return;
|
|
24702
24598
|
pluginState.resolvingLinks.add(link.uid);
|
|
24703
|
-
console.log("🌐 Resolving link metadata:", {
|
|
24704
|
-
uid: link.uid,
|
|
24705
|
-
href: link.href,
|
|
24706
|
-
singlePreviewMode
|
|
24707
|
-
});
|
|
24708
24599
|
api.resolveUrl(normalizeUrl(link.href)).then((metadata) => {
|
|
24709
24600
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24710
24601
|
pluginState.processedLinks.add(link.uid);
|
|
24711
|
-
console.log("✅ Link metadata resolved:", {
|
|
24712
|
-
uid: link.uid,
|
|
24713
|
-
metadata
|
|
24714
|
-
});
|
|
24715
24602
|
if (!metadata) {
|
|
24716
|
-
console.warn("⚠️ No metadata returned for:", link.href);
|
|
24717
24603
|
return;
|
|
24718
24604
|
}
|
|
24719
24605
|
const previewData = {
|
|
@@ -24728,13 +24614,11 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24728
24614
|
if (singlePreviewMode) {
|
|
24729
24615
|
const existingPreview = findExistingPreview(editor);
|
|
24730
24616
|
if (existingPreview) {
|
|
24731
|
-
console.log("🔄 Updating existing preview in single mode");
|
|
24732
24617
|
const { pos } = existingPreview;
|
|
24733
24618
|
const tr = editor.state.tr;
|
|
24734
24619
|
tr.setNodeMarkup(pos, void 0, previewData);
|
|
24735
24620
|
editor.view.dispatch(tr);
|
|
24736
24621
|
} else {
|
|
24737
|
-
console.log("➕ Creating first preview in single mode");
|
|
24738
24622
|
editor.commands.setLinkPreview(previewData);
|
|
24739
24623
|
}
|
|
24740
24624
|
editor.commands.updateLinkByUid(link.uid, {
|
|
@@ -24742,16 +24626,12 @@ function resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginSta
|
|
|
24742
24626
|
});
|
|
24743
24627
|
} else {
|
|
24744
24628
|
if (!doesPreviewExist(editor, link.uid)) {
|
|
24745
|
-
console.log("➕ Creating new preview in multi mode");
|
|
24746
24629
|
editor.chain().updateLinkByUid(link.uid, {
|
|
24747
24630
|
previewPayload: convertLinkMetaToPreviewItem(metadata)
|
|
24748
24631
|
}).setLinkPreview(previewData).run();
|
|
24749
|
-
} else {
|
|
24750
|
-
console.log("⏭️ Preview already exists, skipping");
|
|
24751
24632
|
}
|
|
24752
24633
|
}
|
|
24753
24634
|
}).catch((err) => {
|
|
24754
|
-
console.error("❌ Failed to resolve link:", err);
|
|
24755
24635
|
pluginState.resolvingLinks.delete(link.uid);
|
|
24756
24636
|
if (!editor?.view?.dom) return;
|
|
24757
24637
|
const analytics = getAnalyticsStore();
|
|
@@ -24769,10 +24649,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24769
24649
|
key: pluginKey,
|
|
24770
24650
|
state: {
|
|
24771
24651
|
init() {
|
|
24772
|
-
console.log("🔌 LinkAutoResolve plugin initialized", {
|
|
24773
|
-
singlePreviewMode,
|
|
24774
|
-
hasApi: !!options.api
|
|
24775
|
-
});
|
|
24776
24652
|
return {
|
|
24777
24653
|
resolvingLinks: /* @__PURE__ */ new Set(),
|
|
24778
24654
|
processedLinks: /* @__PURE__ */ new Set()
|
|
@@ -24802,33 +24678,23 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24802
24678
|
appendTransaction: (transactions, oldState, newState) => {
|
|
24803
24679
|
const linkMark = newState.schema.marks["customLink"];
|
|
24804
24680
|
if (!linkMark) {
|
|
24805
|
-
console.warn("⚠️ customLink mark not found in schema");
|
|
24806
24681
|
return null;
|
|
24807
24682
|
}
|
|
24808
24683
|
if (!transactions.some((tr) => tr.docChanged)) {
|
|
24809
24684
|
return null;
|
|
24810
24685
|
}
|
|
24811
|
-
console.log("📝 Document changed, checking for changes...");
|
|
24812
24686
|
const pluginState = pluginKey.getState(newState);
|
|
24813
24687
|
if (!pluginState) {
|
|
24814
|
-
console.warn("⚠️ Plugin state not found");
|
|
24815
24688
|
return null;
|
|
24816
24689
|
}
|
|
24817
24690
|
const syncTr = singlePreviewMode ? syncLinkHrefWithText(newState, linkMark, options.editor, singlePreviewMode, pluginState) : null;
|
|
24818
24691
|
const oldLinks = collectAllLinkMarks(oldState, linkMark);
|
|
24819
24692
|
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
24693
|
const editor = options?.editor;
|
|
24827
24694
|
const { tr: uidTr, newUids } = assignUidsToLinks(newState, linkMark, editor);
|
|
24828
24695
|
const linksToResolve = [];
|
|
24829
24696
|
newUids.forEach((linkData) => {
|
|
24830
24697
|
if (!pluginState.processedLinks.has(linkData.uid) && !pluginState.resolvingLinks.has(linkData.uid)) {
|
|
24831
|
-
console.log("🆕 New autolinked URL detected:", linkData);
|
|
24832
24698
|
linksToResolve.push(linkData);
|
|
24833
24699
|
}
|
|
24834
24700
|
});
|
|
@@ -24841,19 +24707,15 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24841
24707
|
return;
|
|
24842
24708
|
}
|
|
24843
24709
|
if (!oldLinks.has(uid)) {
|
|
24844
|
-
console.log("🆕 New link detected (with UID):", linkData);
|
|
24845
24710
|
linksToResolve.push(linkData);
|
|
24846
24711
|
}
|
|
24847
24712
|
});
|
|
24848
24713
|
if (linksToResolve.length > 0) {
|
|
24849
|
-
console.log("🚀 Processing", linksToResolve.length, "new link(s)");
|
|
24850
24714
|
queueMicrotask(() => {
|
|
24851
24715
|
linksToResolve.forEach((link) => {
|
|
24852
24716
|
resolveLinkAndHandlePreview(link, options, singlePreviewMode, pluginState);
|
|
24853
24717
|
});
|
|
24854
24718
|
});
|
|
24855
|
-
} else {
|
|
24856
|
-
console.log("✓ No new links to process");
|
|
24857
24719
|
}
|
|
24858
24720
|
if (syncTr && uidTr) {
|
|
24859
24721
|
try {
|
|
@@ -24868,7 +24730,6 @@ function createLinkAutoResolvePlugin(options, singlePreviewMode = false) {
|
|
|
24868
24730
|
});
|
|
24869
24731
|
return syncTr;
|
|
24870
24732
|
} catch (err) {
|
|
24871
|
-
console.error("❌ Error combining transactions:", err);
|
|
24872
24733
|
return syncTr;
|
|
24873
24734
|
}
|
|
24874
24735
|
}
|
|
@@ -24972,7 +24833,6 @@ const CustomLink = Link$1.extend({
|
|
|
24972
24833
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
24973
24834
|
if (metadata) {
|
|
24974
24835
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
24975
|
-
console.log({ href, text: text2 });
|
|
24976
24836
|
editor?.chain()?.updateLinkByUid(uid, { href, text: text2, previewPayload })?.updateLinkPreviewByUid(uid, {
|
|
24977
24837
|
// Now using correct UID
|
|
24978
24838
|
loading: false,
|
|
@@ -24988,7 +24848,6 @@ const CustomLink = Link$1.extend({
|
|
|
24988
24848
|
})?.catch((err) => {
|
|
24989
24849
|
analytics?.trackLinkAdded(sessionId, { editorType });
|
|
24990
24850
|
analytics?.trackLinkUnfurlFailed(sessionId, { editorType });
|
|
24991
|
-
console.error("LINK UPDATE ERR::", { err });
|
|
24992
24851
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
24993
24852
|
});
|
|
24994
24853
|
return true;
|
|
@@ -25036,7 +24895,6 @@ const CustomLink = Link$1.extend({
|
|
|
25036
24895
|
if (attrs.href) {
|
|
25037
24896
|
queueMicrotask(() => {
|
|
25038
24897
|
this.options.api?.resolveUrl(normalizeUrl(attrs.href))?.then((metadata) => {
|
|
25039
|
-
console.log({ metadata });
|
|
25040
24898
|
if (metadata) {
|
|
25041
24899
|
const previewPayload = convertLinkMetaToPreviewItem(metadata);
|
|
25042
24900
|
let linkPreviewExists = false;
|
|
@@ -25065,7 +24923,6 @@ const CustomLink = Link$1.extend({
|
|
|
25065
24923
|
editor.commands.deleteLinkPreviewByUid(uid);
|
|
25066
24924
|
}
|
|
25067
24925
|
}).catch((err) => {
|
|
25068
|
-
console.log("LINK UPDATE ERR::", { err });
|
|
25069
24926
|
const sessionId = editor?.view?.dom?.getAttribute("data-session-id") ?? "";
|
|
25070
24927
|
const editorType = editor?.view?.dom?.getAttribute(
|
|
25071
24928
|
"data-editor-type"
|
|
@@ -25151,7 +25008,6 @@ const IframeView = ({
|
|
|
25151
25008
|
setPreviewData(previewPayload);
|
|
25152
25009
|
updateAttributes({ previewPayload });
|
|
25153
25010
|
}).catch((error) => {
|
|
25154
|
-
console.error("Failed to fetch preview:", error);
|
|
25155
25011
|
}).finally(() => {
|
|
25156
25012
|
});
|
|
25157
25013
|
}
|
|
@@ -25396,7 +25252,6 @@ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTyp
|
|
|
25396
25252
|
}
|
|
25397
25253
|
});
|
|
25398
25254
|
} catch (_) {
|
|
25399
|
-
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
|
25400
25255
|
return null;
|
|
25401
25256
|
}
|
|
25402
25257
|
};
|
|
@@ -26233,7 +26088,6 @@ const configureDOMPurify = () => {
|
|
|
26233
26088
|
const element = node;
|
|
26234
26089
|
const src = element.getAttribute("src") || "";
|
|
26235
26090
|
if (!isAllowedDomain(src)) {
|
|
26236
|
-
console.warn("🚨 Blocked iframe from non-allowed domain:", src);
|
|
26237
26091
|
node.parentNode?.removeChild(node);
|
|
26238
26092
|
}
|
|
26239
26093
|
}
|
|
@@ -26245,7 +26099,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26245
26099
|
const config = configureDOMPurify();
|
|
26246
26100
|
const cleaned = purify.sanitize(html2, config);
|
|
26247
26101
|
if (!cleaned.includes("<iframe")) {
|
|
26248
|
-
console.warn("⚠️ No valid iframe found after sanitization");
|
|
26249
26102
|
return null;
|
|
26250
26103
|
}
|
|
26251
26104
|
const match = cleaned.match(/<iframe[^>]*src=["']([^"']+)["']/i);
|
|
@@ -26257,7 +26110,6 @@ function sanitizeIframeHTML(html2) {
|
|
|
26257
26110
|
}
|
|
26258
26111
|
return match[1];
|
|
26259
26112
|
} catch (error) {
|
|
26260
|
-
console.error("🚨 Error sanitizing iframe:", error);
|
|
26261
26113
|
return null;
|
|
26262
26114
|
} finally {
|
|
26263
26115
|
purify.removeAllHooks();
|
|
@@ -26295,7 +26147,6 @@ const createFinder = (regex) => {
|
|
|
26295
26147
|
match
|
|
26296
26148
|
});
|
|
26297
26149
|
}
|
|
26298
|
-
console.log({ match, matches });
|
|
26299
26150
|
return matches.length > 0 ? matches : null;
|
|
26300
26151
|
};
|
|
26301
26152
|
};
|
|
@@ -26347,11 +26198,9 @@ const Iframe = Node$1.create({
|
|
|
26347
26198
|
const iframeHTML = match[0];
|
|
26348
26199
|
const safeSrc = sanitizeIframeHTML(iframeHTML);
|
|
26349
26200
|
if (!safeSrc) {
|
|
26350
|
-
console.warn("🚨 Blocked unsafe iframe paste");
|
|
26351
26201
|
toast.error("🚨 Your pasted iframe is not safe to render");
|
|
26352
26202
|
return;
|
|
26353
26203
|
}
|
|
26354
|
-
console.log("✅ Safe iframe URL validated:", safeSrc);
|
|
26355
26204
|
const node = this.type.create({ src: safeSrc, previewPayload: null });
|
|
26356
26205
|
state.tr.replaceRangeWith(range.from, range.to, node);
|
|
26357
26206
|
}
|
|
@@ -26362,7 +26211,6 @@ const Iframe = Node$1.create({
|
|
|
26362
26211
|
handler: ({ state, range, match }) => {
|
|
26363
26212
|
const fullUrl = match[0];
|
|
26364
26213
|
const embedUrl = getEmbedUrl(fullUrl);
|
|
26365
|
-
console.log({ match, fullUrl, embedUrl });
|
|
26366
26214
|
if (!embedUrl) return;
|
|
26367
26215
|
const node = this.type.create({ src: embedUrl });
|
|
26368
26216
|
state.tr.replaceRangeWith(range.from, range.to, node);
|
|
@@ -26408,10 +26256,9 @@ const handleUrlWithoutSelection = (editor, url, event, autoDetectMedia) => {
|
|
|
26408
26256
|
mediaType: MediaItemType.MEDIA_ITEM
|
|
26409
26257
|
});
|
|
26410
26258
|
}).catch(
|
|
26411
|
-
(e) =>
|
|
26259
|
+
(e) => void 0
|
|
26412
26260
|
);
|
|
26413
26261
|
}
|
|
26414
|
-
console.log("[SmartLinkPaste] Inserting as link node");
|
|
26415
26262
|
editor.chain().focus().insertLink({ href: normalizedUrl, text: url }).run();
|
|
26416
26263
|
return true;
|
|
26417
26264
|
};
|
|
@@ -26433,7 +26280,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26433
26280
|
return false;
|
|
26434
26281
|
}
|
|
26435
26282
|
const trimmedText = pasteText.trim();
|
|
26436
|
-
console.log("[SmartLinkPaste] Valid URL detected:", isEmbeddableUrl(trimmedText));
|
|
26437
26283
|
if (isEmbeddableUrl(trimmedText) && options?.autoEmbed) {
|
|
26438
26284
|
event.preventDefault();
|
|
26439
26285
|
return false;
|
|
@@ -26450,7 +26296,6 @@ const createPasteHandler = (editor, options) => {
|
|
|
26450
26296
|
options?.autoDetectMedia ?? true
|
|
26451
26297
|
);
|
|
26452
26298
|
} catch (error) {
|
|
26453
|
-
console.error("[SmartLinkPaste] Error:", error);
|
|
26454
26299
|
return false;
|
|
26455
26300
|
}
|
|
26456
26301
|
};
|
|
@@ -26462,10 +26307,8 @@ const createTransformHandler = (editor) => {
|
|
|
26462
26307
|
return slice;
|
|
26463
26308
|
}
|
|
26464
26309
|
try {
|
|
26465
|
-
console.log("[SmartLinkPaste] Transforming inline URLs in pasted content");
|
|
26466
26310
|
return transformUrlsInSlice(editor, slice);
|
|
26467
26311
|
} catch (error) {
|
|
26468
|
-
console.error("[SmartLinkPaste] Transform error:", error);
|
|
26469
26312
|
return slice;
|
|
26470
26313
|
}
|
|
26471
26314
|
};
|
|
@@ -26572,7 +26415,6 @@ const SmartMediaUpload = Extension.create({
|
|
|
26572
26415
|
const uid = v4();
|
|
26573
26416
|
const options = this.options;
|
|
26574
26417
|
if (!options.api) {
|
|
26575
|
-
console.error("API instance not provided to SmartMediaUpload");
|
|
26576
26418
|
return false;
|
|
26577
26419
|
}
|
|
26578
26420
|
let uploadSource = "local";
|
|
@@ -26587,7 +26429,6 @@ const SmartMediaUpload = Extension.create({
|
|
|
26587
26429
|
options.allowedFileTypes
|
|
26588
26430
|
);
|
|
26589
26431
|
if (!validation.valid) {
|
|
26590
|
-
console.error("File validation failed:", validation.error);
|
|
26591
26432
|
options.onUploadError?.(uid, new Error(validation.error));
|
|
26592
26433
|
const { sessionId, editorType } = this.storage.getAnalyticsContext(editor);
|
|
26593
26434
|
if (sessionId && editorType) {
|
|
@@ -26713,7 +26554,6 @@ const SmartMediaUpload = Extension.create({
|
|
|
26713
26554
|
}
|
|
26714
26555
|
}
|
|
26715
26556
|
} catch (error) {
|
|
26716
|
-
console.error("Upload failed:", error);
|
|
26717
26557
|
const blobUrl = this.storage.blobUrls.get(item.uid);
|
|
26718
26558
|
if (blobUrl) {
|
|
26719
26559
|
URL.revokeObjectURL(blobUrl);
|
|
@@ -26748,7 +26588,7 @@ const SmartMediaUpload = Extension.create({
|
|
|
26748
26588
|
this.storage.activeUploads--;
|
|
26749
26589
|
this.storage.processUploadQueue(editor);
|
|
26750
26590
|
}
|
|
26751
|
-
})().catch((err) =>
|
|
26591
|
+
})().catch((err) => void 0);
|
|
26752
26592
|
if (this.storage.uploadQueue.length > 0) {
|
|
26753
26593
|
this.storage.processUploadQueue(editor);
|
|
26754
26594
|
}
|
|
@@ -29448,7 +29288,6 @@ function getSuggestionOptions({
|
|
|
29448
29288
|
const text2 = editor.getText();
|
|
29449
29289
|
const trimmed = text2?.replace(WHITESPACE_REGEX, " ")?.trim();
|
|
29450
29290
|
const matchStartPosition = trimmed?.lastIndexOf(char);
|
|
29451
|
-
console.log({ matchStartPosition });
|
|
29452
29291
|
const nodeAfter = editor.view.state.selection.$to.nodeAfter;
|
|
29453
29292
|
const overrideSpace = nodeAfter?.text?.startsWith(" ");
|
|
29454
29293
|
if (overrideSpace) {
|
|
@@ -29562,7 +29401,6 @@ const Mention = Node$1.create({
|
|
|
29562
29401
|
renderHTML({ node, HTMLAttributes }) {
|
|
29563
29402
|
const suggestion = getSuggestionFromChar(this, node.attrs.mentionSuggestionChar);
|
|
29564
29403
|
if (this.options.renderLabel !== void 0) {
|
|
29565
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29566
29404
|
return [
|
|
29567
29405
|
"span",
|
|
29568
29406
|
mergeAttributes({ "data-type": this.name }, this.options.HTMLAttributes, HTMLAttributes),
|
|
@@ -29602,7 +29440,6 @@ const Mention = Node$1.create({
|
|
|
29602
29440
|
suggestion: getSuggestionFromChar(this, node.attrs.mentionSuggestionChar)
|
|
29603
29441
|
};
|
|
29604
29442
|
if (this.options.renderLabel !== void 0) {
|
|
29605
|
-
console.warn("renderLabel is deprecated use renderText and renderHTML instead");
|
|
29606
29443
|
return this.options.renderLabel(args);
|
|
29607
29444
|
}
|
|
29608
29445
|
return this.options.renderText(args);
|
|
@@ -30564,11 +30401,9 @@ const mentionService = (api, mfs, store) => {
|
|
|
30564
30401
|
const fetchMentions = async () => {
|
|
30565
30402
|
const params = store.getState().getMentionParams();
|
|
30566
30403
|
if (!params) {
|
|
30567
|
-
console.error("DEBUG MENTION SERVICE::", "No group id or post id has been provided");
|
|
30568
30404
|
return [];
|
|
30569
30405
|
}
|
|
30570
30406
|
const { groupId, postId } = params;
|
|
30571
|
-
console.log({ groupId, postId });
|
|
30572
30407
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
30573
30408
|
return response.entries?.filter((item) => Boolean(item?.user_data))?.map(
|
|
30574
30409
|
(item) => ({
|
|
@@ -30587,7 +30422,6 @@ const mentionService = (api, mfs, store) => {
|
|
|
30587
30422
|
const { selectedGroupId, groupId } = store.getState();
|
|
30588
30423
|
const activeGroupId = selectedGroupId ?? groupId;
|
|
30589
30424
|
if (!activeGroupId) {
|
|
30590
|
-
console.warn("DEBUG HASHTAG SERVICE::", "No active group selected or provided");
|
|
30591
30425
|
return [];
|
|
30592
30426
|
}
|
|
30593
30427
|
const response = await api.fetchGroupConversations(999, 0);
|
|
@@ -30961,7 +30795,6 @@ const LinkPreview = Node$1.create({
|
|
|
30961
30795
|
},
|
|
30962
30796
|
renderHTML({ node }) {
|
|
30963
30797
|
const { href, uid, title, description, image, domain } = node.attrs;
|
|
30964
|
-
console.log("INSIDE RENDER HTML::", { href, image });
|
|
30965
30798
|
if (!href) return ["div", {}];
|
|
30966
30799
|
const content = [
|
|
30967
30800
|
// Link overlay
|
|
@@ -31204,14 +31037,12 @@ const createMediaModePlugin = () => {
|
|
|
31204
31037
|
child.marks.forEach((mark) => {
|
|
31205
31038
|
if (mark.type.name === "customLink" && mark.attrs.previewPayload) {
|
|
31206
31039
|
lastLinkPreviewData = mark.attrs.previewPayload;
|
|
31207
|
-
console.log("Found link with previewPayload:", lastLinkPreviewData);
|
|
31208
31040
|
}
|
|
31209
31041
|
});
|
|
31210
31042
|
}
|
|
31211
31043
|
});
|
|
31212
31044
|
}
|
|
31213
31045
|
});
|
|
31214
|
-
console.log("Cleanup check:", { modified, hasMediaGroup, lastLinkPreviewData });
|
|
31215
31046
|
if (modified && hasMediaGroup && lastLinkPreviewData) {
|
|
31216
31047
|
let hasLinkPreview = false;
|
|
31217
31048
|
tr.doc.forEach((node) => {
|
|
@@ -31219,10 +31050,6 @@ const createMediaModePlugin = () => {
|
|
|
31219
31050
|
hasLinkPreview = true;
|
|
31220
31051
|
}
|
|
31221
31052
|
});
|
|
31222
|
-
console.log("Creating linkPreview:", {
|
|
31223
|
-
hasLinkPreview,
|
|
31224
|
-
schemaHasLinkPreview: !!newState.schema.nodes.linkPreview
|
|
31225
|
-
});
|
|
31226
31053
|
if (!hasLinkPreview && newState.schema.nodes.linkPreview) {
|
|
31227
31054
|
const preview = lastLinkPreviewData;
|
|
31228
31055
|
const linkPreviewNode = newState.schema.nodes.linkPreview.create({
|
|
@@ -31233,7 +31060,6 @@ const createMediaModePlugin = () => {
|
|
|
31233
31060
|
image: preview.linkImage?.url ?? "",
|
|
31234
31061
|
variant: LinkPreviewType.Extended
|
|
31235
31062
|
});
|
|
31236
|
-
console.log("Inserting linkPreview node:", { lastLinkPreviewData, linkPreviewNode });
|
|
31237
31063
|
tr.insert(tr.doc.content.size, linkPreviewNode);
|
|
31238
31064
|
modified = true;
|
|
31239
31065
|
}
|
|
@@ -31293,7 +31119,6 @@ const createMediaModePlugin = () => {
|
|
|
31293
31119
|
}
|
|
31294
31120
|
const mediaNodes = updatedTopLevelMedia.map((m) => m.node);
|
|
31295
31121
|
if (mediaNodes.some((n) => !n || n.type.name !== "media")) {
|
|
31296
|
-
console.warn("Invalid media nodes detected, skipping group creation");
|
|
31297
31122
|
return null;
|
|
31298
31123
|
}
|
|
31299
31124
|
const mediaGroup = newState.schema.nodes.mediaGroup.create({}, mediaNodes);
|
|
@@ -31311,7 +31136,6 @@ const createMediaModePlugin = () => {
|
|
|
31311
31136
|
const $pos = tr.doc.resolve(endPos);
|
|
31312
31137
|
tr.setSelection(TextSelection$1.near($pos));
|
|
31313
31138
|
} catch (e) {
|
|
31314
|
-
console.warn("Could not set selection:", e);
|
|
31315
31139
|
}
|
|
31316
31140
|
}
|
|
31317
31141
|
tr.setMeta("addToHistory", false);
|
|
@@ -31319,7 +31143,6 @@ const createMediaModePlugin = () => {
|
|
|
31319
31143
|
}
|
|
31320
31144
|
return modified ? tr : null;
|
|
31321
31145
|
} catch (error) {
|
|
31322
|
-
console.error("MediaMode plugin error:", error);
|
|
31323
31146
|
return null;
|
|
31324
31147
|
} finally {
|
|
31325
31148
|
isProcessing = false;
|
|
@@ -31605,7 +31428,6 @@ const isLinkMarkWithPayload = (node) => isLinkMark(node) && Boolean(node?.attrs?
|
|
|
31605
31428
|
const getLinkItemsPayload = (json) => {
|
|
31606
31429
|
const links = find(json, (node) => isLinkMarkWithPayload(node));
|
|
31607
31430
|
const items = links?.at(-1);
|
|
31608
|
-
console.log("Link Items Payload::", { items });
|
|
31609
31431
|
return { items };
|
|
31610
31432
|
};
|
|
31611
31433
|
const getPollItemsPayload = (json) => {
|
|
@@ -31692,7 +31514,6 @@ const generatePollPostPayload = ({
|
|
|
31692
31514
|
option_id: index2 === 0 ? item.option_id : v4(),
|
|
31693
31515
|
option_color: OPTION_COLORS[index2 % OPTION_COLORS.length]
|
|
31694
31516
|
})) : items;
|
|
31695
|
-
console.log({ polls });
|
|
31696
31517
|
return {
|
|
31697
31518
|
...commons,
|
|
31698
31519
|
type: NewPostType.NEW_POST_POLL,
|
|
@@ -31749,7 +31570,6 @@ const PostBuilderEditorInstance = ({
|
|
|
31749
31570
|
const json = editor?.getJSON();
|
|
31750
31571
|
const text2 = editor?.getText();
|
|
31751
31572
|
const payload = generateCreatePostPayload(editorTab, { editor, sendCrossMention });
|
|
31752
|
-
console.log({ json });
|
|
31753
31573
|
const isPollType = payload?.type === NewPostType.NEW_POST_POLL;
|
|
31754
31574
|
if (payload?.error) {
|
|
31755
31575
|
toast.error(payload.error);
|