mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: save description_html as well
This commit is contained in:
parent
d131939dfd
commit
f4faa1e0b2
@ -178,6 +178,10 @@ export const useEditor = ({
|
|||||||
const markdownOutput = editorRef.current?.storage.markdown.getMarkdown();
|
const markdownOutput = editorRef.current?.storage.markdown.getMarkdown();
|
||||||
return markdownOutput;
|
return markdownOutput;
|
||||||
},
|
},
|
||||||
|
getHTML: (): string => {
|
||||||
|
const htmlOutput = editorRef.current?.getHTML() ?? "<p></p>";
|
||||||
|
return htmlOutput;
|
||||||
|
},
|
||||||
scrollSummary: (marking: IMarking): void => {
|
scrollSummary: (marking: IMarking): void => {
|
||||||
if (!editorRef.current) return;
|
if (!editorRef.current) return;
|
||||||
scrollSummary(editorRef.current, marking);
|
scrollSummary(editorRef.current, marking);
|
||||||
|
@ -68,6 +68,10 @@ export const useReadOnlyEditor = ({
|
|||||||
const markdownOutput = editorRef.current?.storage.markdown.getMarkdown();
|
const markdownOutput = editorRef.current?.storage.markdown.getMarkdown();
|
||||||
return markdownOutput;
|
return markdownOutput;
|
||||||
},
|
},
|
||||||
|
getHTML: (): string => {
|
||||||
|
const htmlOutput = editorRef.current?.getHTML() ?? "<p></p>";
|
||||||
|
return htmlOutput;
|
||||||
|
},
|
||||||
scrollSummary: (marking: IMarking): void => {
|
scrollSummary: (marking: IMarking): void => {
|
||||||
if (!editorRef.current) return;
|
if (!editorRef.current) return;
|
||||||
scrollSummary(editorRef.current, marking);
|
scrollSummary(editorRef.current, marking);
|
||||||
|
@ -3,6 +3,7 @@ import { EditorMenuItemNames } from "src/ui/menus/menu-items";
|
|||||||
|
|
||||||
export type EditorReadOnlyRefApi = {
|
export type EditorReadOnlyRefApi = {
|
||||||
getMarkDown: () => string;
|
getMarkDown: () => string;
|
||||||
|
getHTML: () => string;
|
||||||
clearEditor: () => void;
|
clearEditor: () => void;
|
||||||
setEditorValue: (content: string) => void;
|
setEditorValue: (content: string) => void;
|
||||||
scrollSummary: (marking: IMarking) => void;
|
scrollSummary: (marking: IMarking) => void;
|
||||||
|
@ -14,7 +14,7 @@ type DocumentEditorProps = {
|
|||||||
fileHandler: TFileHandler;
|
fileHandler: TFileHandler;
|
||||||
value: Uint8Array;
|
value: Uint8Array;
|
||||||
editorClassName: string;
|
editorClassName: string;
|
||||||
onChange: (binaryString: string, html: string) => void;
|
onChange: (binaryString: string) => void;
|
||||||
extensions?: any;
|
extensions?: any;
|
||||||
editorProps?: EditorProps;
|
editorProps?: EditorProps;
|
||||||
forwardedRef?: React.MutableRefObject<EditorRefApi | null>;
|
forwardedRef?: React.MutableRefObject<EditorRefApi | null>;
|
||||||
@ -53,7 +53,7 @@ export const useDocumentEditor = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const yDoc = useMemo(() => {
|
const yDoc = useMemo(() => {
|
||||||
if (value.byteLength !== 0) Y.applyUpdate(provider.document, value);
|
if (value.byteLength > 0) Y.applyUpdate(provider.document, value);
|
||||||
return provider.document;
|
return provider.document;
|
||||||
}, [value, provider.document]);
|
}, [value, provider.document]);
|
||||||
console.log("yDoc", yDoc);
|
console.log("yDoc", yDoc);
|
||||||
|
@ -12,7 +12,7 @@ export interface CompleteCollaboratorProviderConfiguration {
|
|||||||
/**
|
/**
|
||||||
* onChange callback
|
* onChange callback
|
||||||
*/
|
*/
|
||||||
onChange: (binaryString: string, html: string) => void;
|
onChange: (binaryString: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CollaborationProviderConfiguration = Required<Pick<CompleteCollaboratorProviderConfiguration, "name">> &
|
export type CollaborationProviderConfiguration = Required<Pick<CompleteCollaboratorProviderConfiguration, "name">> &
|
||||||
@ -60,7 +60,7 @@ export class CollaborationProvider {
|
|||||||
const base64Doc = Buffer.from(docAsUint8Array).toString("base64");
|
const base64Doc = Buffer.from(docAsUint8Array).toString("base64");
|
||||||
// const base64Doc = Buffer.from(update).toString("base64");
|
// const base64Doc = Buffer.from(update).toString("base64");
|
||||||
|
|
||||||
this.configuration.onChange?.(base64Doc, "<p></p>");
|
this.configuration.onChange?.(base64Doc);
|
||||||
this.timeoutId = null;
|
this.timeoutId = null;
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ interface IDocumentEditor {
|
|||||||
handleEditorReady?: (value: boolean) => void;
|
handleEditorReady?: (value: boolean) => void;
|
||||||
containerClassName?: string;
|
containerClassName?: string;
|
||||||
editorClassName?: string;
|
editorClassName?: string;
|
||||||
onChange: (binaryString: string, html: string) => void;
|
onChange: (binaryString: string) => void;
|
||||||
forwardedRef?: React.MutableRefObject<EditorRefApi | null>;
|
forwardedRef?: React.MutableRefObject<EditorRefApi | null>;
|
||||||
mentionHandler: {
|
mentionHandler: {
|
||||||
highlights: () => Promise<IMentionHighlight[]>;
|
highlights: () => Promise<IMentionHighlight[]>;
|
||||||
@ -46,7 +46,6 @@ const DocumentEditor = (props: IDocumentEditor) => {
|
|||||||
} = props;
|
} = props;
|
||||||
// states
|
// states
|
||||||
const [hideDragHandleOnMouseLeave, setHideDragHandleOnMouseLeave] = useState<() => void>(() => {});
|
const [hideDragHandleOnMouseLeave, setHideDragHandleOnMouseLeave] = useState<() => void>(() => {});
|
||||||
|
|
||||||
// this essentially sets the hideDragHandle function from the DragAndDrop extension as the Plugin
|
// this essentially sets the hideDragHandle function from the DragAndDrop extension as the Plugin
|
||||||
// loads such that we can invoke it from react when the cursor leaves the container
|
// loads such that we can invoke it from react when the cursor leaves the container
|
||||||
const setHideDragHandleFunction = (hideDragHandlerFromDragDrop: () => void) => {
|
const setHideDragHandleFunction = (hideDragHandlerFromDragDrop: () => void) => {
|
||||||
|
@ -32,7 +32,7 @@ const fileService = new FileService();
|
|||||||
type Props = {
|
type Props = {
|
||||||
editorRef: React.RefObject<EditorRefApi>;
|
editorRef: React.RefObject<EditorRefApi>;
|
||||||
readOnlyEditorRef: React.RefObject<EditorReadOnlyRefApi>;
|
readOnlyEditorRef: React.RefObject<EditorReadOnlyRefApi>;
|
||||||
handleDescriptionUpdate: (binaryString: string, descriptionHTML: string) => Promise<void>;
|
handleDescriptionUpdate: (binaryString: string) => Promise<void>;
|
||||||
markings: IMarking[];
|
markings: IMarking[];
|
||||||
pageStore: IPageStore;
|
pageStore: IPageStore;
|
||||||
sidePeekVisible: boolean;
|
sidePeekVisible: boolean;
|
||||||
@ -98,7 +98,7 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {
|
|||||||
updateMarkings(description_html ?? "<p></p>");
|
updateMarkings(description_html ?? "<p></p>");
|
||||||
}, [description_html, updateMarkings]);
|
}, [description_html, updateMarkings]);
|
||||||
|
|
||||||
if (pageDescription === undefined || pageId === undefined || !pageDescriptionYJS) return <PageContentLoader />;
|
if (pageId === undefined || !descriptionYJS || !pageDescriptionYJS) return <PageContentLoader />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center h-full w-full overflow-y-auto">
|
<div className="flex items-center h-full w-full overflow-y-auto">
|
||||||
|
@ -52,8 +52,9 @@ const PageDetailsPage: NextPageWithLayout = observer(() => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleDescriptionChange = useCallback(
|
const handleDescriptionChange = useCallback(
|
||||||
async (binaryString: string, descriptionHTML: string) => {
|
async (binaryString: string) => {
|
||||||
setIsSubmitting("submitting");
|
setIsSubmitting("submitting");
|
||||||
|
const descriptionHTML = editorRef.current?.getHTML() ?? "<p></p>";
|
||||||
await updateDescription(binaryString, descriptionHTML).finally(() => setIsSubmitting("saved"));
|
await updateDescription(binaryString, descriptionHTML).finally(() => setIsSubmitting("saved"));
|
||||||
},
|
},
|
||||||
[setIsSubmitting, updateDescription]
|
[setIsSubmitting, updateDescription]
|
||||||
|
Loading…
Reference in New Issue
Block a user