fix: Disabling editor embeds should work with collaborative editing (#2968)

* fix: Disabling editor embeds should work with collaborative editing

* Design tweaks, fixed dragging
This commit is contained in:
Tom Moor
2022-01-28 18:27:27 -08:00
committed by GitHub
parent e7867e52e0
commit 1cd770e38d
11 changed files with 116 additions and 27 deletions

View File

@@ -104,7 +104,7 @@ function CollectionDescription({ collection }: Props) {
autoFocus={isEditing}
onBlur={handleStopEditing}
maxLength={1000}
disableEmbeds
embedsDisabled
readOnlyWriteCheckboxes
grow
/>

View File

@@ -1,7 +1,6 @@
import * as React from "react";
import { Optional } from "utility-types";
import embeds from "@shared/editor/embeds";
import { EmbedDescriptor } from "@shared/editor/types";
import ErrorBoundary from "~/components/ErrorBoundary";
import { Props as EditorProps } from "~/editor";
import useDictionary from "~/hooks/useDictionary";
@@ -19,14 +18,12 @@ const SharedEditor = React.lazy(
)
);
const EMPTY_ARRAY: EmbedDescriptor[] = [];
export type Props = Optional<
EditorProps,
"placeholder" | "defaultValue" | "onClickLink" | "embeds" | "dictionary"
> & {
shareId?: string | undefined;
disableEmbeds?: boolean;
embedsDisabled?: boolean;
grow?: boolean;
onSynced?: () => Promise<void>;
onPublish?: (event: React.MouseEvent) => any;
@@ -94,7 +91,7 @@ function Editor(props: Props, ref: React.Ref<any>) {
ref={ref}
uploadImage={onUploadImage}
onShowToast={onShowToast}
embeds={props.disableEmbeds ? EMPTY_ARRAY : embeds}
embeds={embeds}
dictionary={dictionary}
{...props}
onClickLink={onClickLink}

View File

@@ -37,7 +37,7 @@ function HoverPreviewDocument({ url, children }: Props) {
<Editor
key={document.id}
defaultValue={document.getSummary()}
disableEmbeds
embedsDisabled
readOnly
/>
</React.Suspense>