Compare commits

..

2 Commits

Author SHA1 Message Date
zsviczian
3fbed6f753 Update variables.module.scss 2024-09-24 19:53:54 +02:00
zsviczian
64a997edc4 Update variables.module.scss 2024-09-24 19:48:49 +02:00
3 changed files with 8 additions and 52 deletions

View File

@@ -3857,21 +3857,17 @@ class App extends React.Component<AppProps, AppState> {
public getEditorUIOffsets = (): Offsets => { public getEditorUIOffsets = (): Offsets => {
const toolbarBottom = const toolbarBottom =
(this.excalidrawContainerRef?.current this.excalidrawContainerRef?.current
?.querySelector(".App-toolbar") ?.querySelector(".App-toolbar")
?.getBoundingClientRect()?.bottom ?? 0) - this.state.offsetTop; ?.getBoundingClientRect()?.bottom ?? 0;
const sidebarRect = this.excalidrawContainerRef?.current const sidebarRect = this.excalidrawContainerRef?.current
?.querySelector(".sidebar") ?.querySelector(".sidebar")
?.getBoundingClientRect(); ?.getBoundingClientRect();
const propertiesPanelRect = this.excalidrawContainerRef?.current const propertiesPanelRect = this.excalidrawContainerRef?.current
?.querySelector(".App-menu__left") ?.querySelector(".App-menu__left")
?.getBoundingClientRect(); ?.getBoundingClientRect();
const PADDING = 16;
const adjustRectValueForOffset = ( const PADDING = 16;
value: number | undefined,
fallback: number,
) => (value ?? fallback + this.state.offsetLeft) - this.state.offsetLeft;
return getLanguage().rtl return getLanguage().rtl
? { ? {
@@ -3879,31 +3875,22 @@ class App extends React.Component<AppProps, AppState> {
right: right:
Math.max( Math.max(
this.state.width - this.state.width -
adjustRectValueForOffset( (propertiesPanelRect?.left ?? this.state.width),
propertiesPanelRect?.left,
this.state.width,
),
0, 0,
) + PADDING, ) + PADDING,
bottom: PADDING, bottom: PADDING,
left: left: Math.max(sidebarRect?.right ?? 0, 0) + PADDING,
Math.max(adjustRectValueForOffset(sidebarRect?.right, 0), 0) +
PADDING,
} }
: { : {
top: toolbarBottom + PADDING, top: toolbarBottom + PADDING,
right: Math.max( right: Math.max(
this.state.width - this.state.width -
adjustRectValueForOffset(sidebarRect?.left, this.state.width) + (sidebarRect?.left ?? this.state.width) +
PADDING, PADDING,
0, 0,
), ),
bottom: PADDING, bottom: PADDING,
left: left: Math.max(propertiesPanelRect?.right ?? 0, 0) + PADDING,
Math.max(
adjustRectValueForOffset(propertiesPanelRect?.right, 0),
0,
) + PADDING,
}; };
}; };

View File

@@ -190,7 +190,7 @@
} }
$theme-filter: "invert(93%) hue-rotate(180deg)"; $theme-filter: "invert(93%) hue-rotate(180deg)";
$right-sidebar-width: "302px"; $right-sidebar-width: "19rem";
:export { :export {
themeFilter: unquote($theme-filter); themeFilter: unquote($theme-filter);

View File

@@ -45,12 +45,6 @@ const RE_GENERIC_EMBED =
const RE_GIPHY = const RE_GIPHY =
/giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/; /giphy.com\/(?:clips|embed|gifs)\/[a-zA-Z0-9]*?-?([a-zA-Z0-9]+)(?:[^a-zA-Z0-9]|$)/;
const RE_REDDIT =
/^(?:http(?:s)?:\/\/)?(?:www\.)?reddit\.com\/r\/([a-zA-Z0-9_]+)\/comments\/([a-zA-Z0-9_]+)\/([a-zA-Z0-9_]+)\/?(?:\?[^#\s]*)?(?:#[^\s]*)?$/;
const RE_REDDIT_EMBED =
/^<blockquote[\s\S]*?\shref=["'](https?:\/\/(?:www\.)?reddit\.com\/[^"']*)/i;
const ALLOWED_DOMAINS = new Set([ const ALLOWED_DOMAINS = new Set([
"youtube.com", "youtube.com",
"youtu.be", "youtu.be",
@@ -65,7 +59,6 @@ const ALLOWED_DOMAINS = new Set([
"stackblitz.com", "stackblitz.com",
"val.town", "val.town",
"giphy.com", "giphy.com",
"reddit.com",
]); ]);
const ALLOW_SAME_ORIGIN = new Set([ const ALLOW_SAME_ORIGIN = new Set([
@@ -78,7 +71,6 @@ const ALLOW_SAME_ORIGIN = new Set([
"x.com", "x.com",
"*.simplepdf.eu", "*.simplepdf.eu",
"stackblitz.com", "stackblitz.com",
"reddit.com",
]); ]);
export const createSrcDoc = (body: string) => { export const createSrcDoc = (body: string) => {
@@ -226,24 +218,6 @@ export const getEmbedLink = (
return ret; return ret;
} }
if (RE_REDDIT.test(link)) {
const [, page, postId, title] = link.match(RE_REDDIT)!;
const safeURL = sanitizeHTMLAttribute(
`https://reddit.com/r/${page}/comments/${postId}/${title}`,
);
const ret: IframeDataWithSandbox = {
type: "document",
srcdoc: (theme: string) =>
createSrcDoc(
`<blockquote class="reddit-embed-bq" data-embed-theme="${theme}"><a href="${safeURL}"></a><br></blockquote><script async="" src="https://embed.reddit.com/widgets.js" charset="UTF-8"></script>`,
),
intrinsicSize: { w: 480, h: 480 },
sandbox: { allowSameOrigin },
};
embeddedLinkCache.set(originalLink, ret);
return ret;
}
if (RE_GH_GIST.test(link)) { if (RE_GH_GIST.test(link)) {
const [, user, gistId] = link.match(RE_GH_GIST)!; const [, user, gistId] = link.match(RE_GH_GIST)!;
const safeURL = sanitizeHTMLAttribute( const safeURL = sanitizeHTMLAttribute(
@@ -387,11 +361,6 @@ export const maybeParseEmbedSrc = (str: string): string => {
return twitterMatch[1]; return twitterMatch[1];
} }
const redditMatch = str.match(RE_REDDIT_EMBED);
if (redditMatch && redditMatch.length === 2) {
return redditMatch[1];
}
const gistMatch = str.match(RE_GH_GIST_EMBED); const gistMatch = str.match(RE_GH_GIST_EMBED);
if (gistMatch && gistMatch.length === 2) { if (gistMatch && gistMatch.length === 2) {
return gistMatch[1]; return gistMatch[1];