Add a button to upload images into comments (#6092)
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
import { Decoration, EditorView, NodeViewConstructor } from "prosemirror-view";
|
||||
import * as React from "react";
|
||||
import styled, { css, DefaultTheme, ThemeProps } from "styled-components";
|
||||
import insertFiles from "@shared/editor/commands/insertFiles";
|
||||
import Styles from "@shared/editor/components/Styles";
|
||||
import { EmbedDescriptor } from "@shared/editor/embeds";
|
||||
import Extension, { CommandFactory } from "@shared/editor/lib/Extension";
|
||||
@@ -584,6 +585,25 @@ export class Editor extends React.PureComponent<
|
||||
window?.getSelection()?.removeAllRanges();
|
||||
};
|
||||
|
||||
/**
|
||||
* Insert files at the current selection.
|
||||
* =
|
||||
* @param event The source event
|
||||
* @param files The files to insert
|
||||
* @returns True if the files were inserted
|
||||
*/
|
||||
public insertFiles = (
|
||||
event: React.ChangeEvent<HTMLInputElement>,
|
||||
files: File[]
|
||||
) =>
|
||||
insertFiles(
|
||||
this.view,
|
||||
event,
|
||||
this.view.state.selection.to,
|
||||
files,
|
||||
this.props
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns true if the trimmed content of the editor is an empty string.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user