A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
editor: fix jumping text/bg color popup (#2306)
Muhammad Alid99ccbc24386
diff --git a/packages/editor/src/toolbar/tools/colors.tsx b/packages/editor/src/toolbar/tools/colors.tsxindex 42dc59a2d..e9e891f41 100644--- a/packages/editor/src/toolbar/tools/colors.tsx+++ b/packages/editor/src/toolbar/tools/colors.tsx@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-import { useEffect, useState } from "react";+import { useEffect, useMemo, useState } from "react";import tinycolor from "tinycolor2";import { PopupWrapper } from "../../components/popup-presenter";import { config } from "../../utils/config";@@ -26,6 +26,7 @@ import { ColorPicker, DEFAULT_COLORS } from "../popups/color-picker";import { useToolbarLocation } from "../stores/toolbar-store";import { ToolProps } from "../types";import { getToolbarElement } from "../utils/dom";+import { PositionOptions } from "../../utils/position";type ColorToolProps = ToolProps & {onColorChange: (color?: string) => void;@@ -49,6 +50,15 @@ export function ColorTool(props: ColorToolProps) {const [colors, setColors] = useState(config.get<string[]>(`custom_${cacheKey}`, []) || []);+ const position: PositionOptions = useMemo(() => {+ return {+ isTargetAbsolute: true,+ target: getToolbarElement(),+ align: isBottom ? "center" : "end",+ location: isBottom ? "top" : "below",+ yOffset: 10+ };+ }, [isBottom]);useEffect(() => {config.set(`custom_${cacheKey}`, colors);@@ -73,13 +83,7 @@ export function ColorTool(props: ColorToolProps) {isOpen={isOpen}id={props.icon}group={"color"}- position={{- isTargetAbsolute: true,- target: getToolbarElement(),- align: isBottom ? "center" : "end",- location: isBottom ? "top" : "below",- yOffset: 10- }}+ position={position}focusOnRender={false}blocking={false}>