Skip to content

Commit

Permalink
fix prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
teenoh committed Apr 14, 2022
1 parent 6ce3d8e commit a6d09c6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export const BlockContextMenuItem = forwardRef<
number | undefined
>();
const localRef = useRef<HTMLLIElement>(null);
// @todo this doesn't handle when ref is a function and can break when trying to
// access offsetTop in the useLayoutEffect. Consider using an library to handle merging refs
// @see https://github.com/gregberge/react-merge-refs, or better still, use the
// @todo this doesn't handle when ref is a function and can break when trying to
// access offsetTop in the useLayoutEffect. Consider using an library to handle merging refs
// @see https://github.com/gregberge/react-merge-refs, or better still, use the
// useForkRef exported by MUI
const menuItemRef = (ref ?? localRef) as RefObject<HTMLLIElement>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import {
} from "@mui/material";
import { PopupState } from "material-ui-popup-state/core";
import { useRef, useState, VFC } from "react";
import {
BlockSuggesterProps
} from "../createSuggester/BlockSuggester";
import { BlockSuggesterProps } from "../createSuggester/BlockSuggester";
import { useFilteredBlocks } from "../createSuggester/useFilteredBlocks";
import { useUserBlocks } from "../../userBlocks";
import { FontAwesomeIcon } from "../../../shared/icons";
Expand All @@ -32,20 +30,19 @@ export const BlockListMenuContent: VFC<BlockListMenuContentProps> = ({
const { value: userBlocks } = useUserBlocks();
const blocks = useFilteredBlocks(searchQuery, userBlocks);


// The essence of this is to autoFocus the input when
// the blocklist menu comes up. We have a listener for
// character "/". Once that is clicked the MenuItem that has this submenu
// is focused and as a result the submenu becomes visible.
// Currently this flow introduces a bug where it is difficult to switch to certain blocks
// e.g Embed;
// @see https://github.com/hashintel/hash/pull/480#discussion_r849594184
// Commenting this out till a fix is made
// useEffect(() => {
// if (popupState?.isOpen) {
// searchInputRef.current?.focus();
// }
// }, [popupState]);
// The essence of this is to autoFocus the input when
// the blocklist menu comes up. We have a listener for
// character "/". Once that is clicked the MenuItem that has this submenu
// is focused and as a result the submenu becomes visible.
// Currently this flow introduces a bug where it is difficult to switch to certain blocks
// e.g Embed;
// @see https://github.com/hashintel/hash/pull/480#discussion_r849594184
// Commenting this out till a fix is made
// useEffect(() => {
// if (popupState?.isOpen) {
// searchInputRef.current?.focus();
// }
// }, [popupState]);

return (
<MenuList>
Expand Down Expand Up @@ -88,7 +85,7 @@ export const BlockListMenuContent: VFC<BlockListMenuContentProps> = ({
<MenuItem
onClick={() => {
blockSuggesterProps.onChange(option.variant, option.meta);
popupState?.close()
popupState?.close();
}}
key={`${option.meta.name}/${option.variant.name}`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const LoadEntityMenuContent: VFC<LoadEntityMenuContentProps> = ({
// This depends on state external to react without subscribing to it
// and this can cause some bugs.
// @todo make this a subscription
const entityStore = entityStorePluginState(blockView.view.state).store
const entityStore = entityStorePluginState(blockView.view.state).store;
const blockData = entityId ? entityStore.saved[entityId] : null;
const searchInputRef = useRef<HTMLInputElement>(null);
const { data: entities, loading } = useAccountEntities({
Expand Down
4 changes: 2 additions & 2 deletions packages/hash/shared/src/ProsemirrorSchemaManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class ProsemirrorSchemaManager {
* This assumes the block info has been fetched and the
* entities (block entity and child entity)
* @todo this only works for non-text blocks,
* It should be updated to handle text blocks when
* It should be updated to handle text blocks when
* https://github.com/hashintel/hash/pull/490 is in
*/
createLocalBlock({
Expand Down Expand Up @@ -347,7 +347,7 @@ export class ProsemirrorSchemaManager {
* 3. [Outermost] The block node (rendered by BlockView) which
* provides the surrounding UI
*/
return this.schema.nodes.block!.create({}, [
return this.schema.nodes.block!.create({}, [
this.schema.nodes.entity!.create({ draftId: draftBlockId }, [
this.schema.nodes.entity!.create(
{
Expand Down

0 comments on commit a6d09c6

Please sign in to comment.