Remove random color on document icons, closes #7181
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
|
import last from "lodash/last";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { mergeRefs } from "react-merge-refs";
|
import { mergeRefs } from "react-merge-refs";
|
||||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
import { useHistory, useRouteMatch } from "react-router-dom";
|
||||||
import { richExtensions, withComments } from "@shared/editor/nodes";
|
import { richExtensions, withComments } from "@shared/editor/nodes";
|
||||||
import { randomElement } from "@shared/random";
|
|
||||||
import { TeamPreference } from "@shared/types";
|
import { TeamPreference } from "@shared/types";
|
||||||
import { colorPalette } from "@shared/utils/collections";
|
import { colorPalette } from "@shared/utils/collections";
|
||||||
import Comment from "~/models/Comment";
|
import Comment from "~/models/Comment";
|
||||||
@@ -93,10 +93,7 @@ function DocumentEditor(props: Props, ref: React.RefObject<any>) {
|
|||||||
} = props;
|
} = props;
|
||||||
const can = usePolicy(document);
|
const can = usePolicy(document);
|
||||||
|
|
||||||
const iconColor = React.useMemo(
|
const iconColor = document.color ?? last(colorPalette);
|
||||||
() => document.color ?? randomElement(colorPalette),
|
|
||||||
[document.color]
|
|
||||||
);
|
|
||||||
const childRef = React.useRef<HTMLDivElement>(null);
|
const childRef = React.useRef<HTMLDivElement>(null);
|
||||||
const focusAtStart = React.useCallback(() => {
|
const focusAtStart = React.useCallback(() => {
|
||||||
if (ref.current) {
|
if (ref.current) {
|
||||||
|
|||||||
Reference in New Issue
Block a user