···3232import { HorizontalRule } from "./HorizontalRule";
3333import { deepEquals } from "src/utils/deepEquals";
3434import { isTextBlock } from "src/utils/isTextBlock";
3535+import { focusPage } from "src/utils/focusPage";
35363637export type Block = {
3738 factID: string;
···6263 // Block handles all block level events like
6364 // mouse events, keyboard events and longPress, and setting AreYouSure state
6465 // and shared styling like padding and flex for list layouting
6565-6666+ let { rep } = useReplicache();
6667 let mouseHandlers = useBlockMouseHandlers(props);
6768 let handleDrop = useHandleDrop({
6869 parent: props.parent,
+12
components/Blocks/useBlockMouseHandlers.ts
···88import { getBlocksWithType } from "src/hooks/queries/useBlocks";
99import { focusBlock } from "src/utils/focusBlock";
1010import { useIsMobile } from "src/hooks/isMobile";
1111+import { scrollIntoViewIfNeeded } from "src/utils/scrollIntoViewIfNeeded";
1212+import { elementId } from "src/utils/elementId";
11131214let debounce: number | null = null;
1315export function useBlockMouseHandlers(props: Block) {
···3941 parent: props.parent,
4042 });
4143 useUIState.getState().setSelectedBlock(props);
4444+4545+ // scroll to the page containing the block, if offscreen
4646+ let parentPage = elementId.page(props.parent).container;
4747+ setTimeout(() => {
4848+ scrollIntoViewIfNeeded(
4949+ document.getElementById(parentPage),
5050+ false,
5151+ "smooth",
5252+ );
5353+ }, 50);
4254 }
4355 },
4456 [props, entity_set.permissions.write, isMobile],
+2-2
components/Canvas.tsx
···169169 if (!pub || !pub.publications) return null;
170170171171 let pubRecord = pub.publications.record as PubLeafletPublication.Record;
172172- let showComments = pubRecord.preferences?.showComments;
173173- let showMentions = pubRecord.preferences?.showMentions;
172172+ let showComments = pubRecord.preferences?.showComments !== false;
173173+ let showMentions = pubRecord.preferences?.showMentions !== false;
174174175175 return (
176176 <div className="flex flex-row gap-3 items-center absolute top-6 right-3 sm:top-4 sm:right-4 bg-bg-page border-border-light rounded-md px-2 py-1 h-fit z-20">
···134134 // pageBg should inherit from leafletBg
135135 const bgPage =
136136 !showPageBackground && !hasBackgroundImage ? bgLeaflet : bgPageProp;
137137- // set accent contrast to the accent color that has the highest contrast with the page background
137137+138138 let accentContrast;
139139-140140- //sorting the accents by contrast on background
141139 let sortedAccents = [accent1, accent2].sort((a, b) => {
140140+ // sort accents by contrast against the background
142141 return (
143142 getColorDifference(
144143 colorToString(b, "rgb"),
···150149 )
151150 );
152151 });
153153-154154- // if the contrast-y accent is too similar to the primary text color,
155155- // and the not contrast-y option is different from the backgrond,
156156- // then use the not contrasty option
157157-158152 if (
153153+ // if the contrast-y accent is too similar to text color
159154 getColorDifference(
160155 colorToString(sortedAccents[0], "rgb"),
161156 colorToString(primary, "rgb"),
162157 ) < 0.15 &&
158158+ // and if the other accent is different enough from the background
163159 getColorDifference(
164160 colorToString(sortedAccents[1], "rgb"),
165161 colorToString(showPageBackground ? bgPage : bgLeaflet, "rgb"),
166166- ) > 0.08
162162+ ) > 0.31
167163 ) {
164164+ //then choose the less contrast-y accent
168165 accentContrast = sortedAccents[1];
169169- } else accentContrast = sortedAccents[0];
166166+ } else {
167167+ // otherwise, choose the more contrast-y option
168168+ accentContrast = sortedAccents[0];
169169+ }
170170171171 useEffect(() => {
172172 if (local) return;