extension-file
package @remirror/extension-file
class DataUrlFileUploader
Signature:
export declare class DataUrlFileUploader implements FileUploader<FileAttributes>
Implements: FileUploader<FileAttributes>
DataUrlFileUploader.(constructor)
Constructs a new instance of the DataUrlFileUploader
class
Signature:
constructor();
method abort
Signature:
abort(): void;
Returns:
void
method insert
Signature:
insert(file: File): FileAttributes;
Parameters:
Parameter | Type | Description |
---|---|---|
file | File |
Returns:
method upload
Signature:
upload(): Promise<FileAttributes>;
Returns:
Promise<FileAttributes>
class FileExtension
Add a file
node to the editor.
Signature:
export declare class FileExtension extends NodeExtension<FileOptions>
Extends: NodeExtension<FileOptions>
(Some inherited members may not be shown because they are not represented in the documentation.)
property name
Signature:
get name(): "file";
property ReactComponent
Signature:
ReactComponent: ComponentType<NodeViewComponentProps>;
method backspaceShortcut
Signature:
backspaceShortcut(props: KeyBindingProps): boolean;
Parameters:
Parameter | Type | Description |
---|---|---|
props | KeyBindingProps |
Returns:
boolean
method createNodeSpec
Signature:
createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): NodeExtensionSpec;
Parameters:
Parameter | Type | Description |
---|---|---|
extra | ApplySchemaAttributes | |
override | NodeSpecOverride |
Returns:
method createPasteRules
Signature:
createPasteRules(): PasteRule[];
Returns:
method createTags
Signature:
createTags(): "block"[];
Returns:
"block"[]
method deleteFile
Signature:
deleteFile(pos: number): CommandFunction;
Parameters:
Parameter | Type | Description |
---|---|---|
pos | number |
Returns:
CommandFunction
method insertFile
Signature:
insertFile(attributes: FileAttributes, selection?: PrimitiveSelection): CommandFunction;
Parameters:
Parameter | Type | Description |
---|---|---|
attributes | FileAttributes | |
selection | PrimitiveSelection | (Optional) |
Returns:
CommandFunction
method renameFile
Signature:
renameFile(pos: number, fileName: string): CommandFunction;
Parameters:
Parameter | Type | Description |
---|---|---|
pos | number | |
fileName | string |
Returns:
CommandFunction
method updateFile
Signature:
updateFile(pos: number, attrs: FileAttributes): CommandFunction;
Parameters:
Parameter | Type | Description |
---|---|---|
pos | number | |
attrs | FileAttributes |
Returns:
CommandFunction
method uploadFiles
Signature:
uploadFiles(files: File[]): CommandFunction;
Parameters:
Parameter | Type | Description |
---|---|---|
files | File[] |
Returns:
CommandFunction
function createBaseuploadFileUploader()
Signature:
export declare function createBaseuploadFileUploader(): FileUploader<FileAttributes>;
Returns:
FileUploader<FileAttributes>
function createDataUrlFileUploader()
Signature:
export declare function createDataUrlFileUploader(): DataUrlFileUploader;
Returns:
function createObjectUrlFileUploader()
Signature:
export declare function createObjectUrlFileUploader(): FileUploader<FileAttributes>;
Returns:
FileUploader<FileAttributes>
function createSlowFileUploader()
Mock implementation of a FileUploader to test slow file uploads
Signature:
export declare function createSlowFileUploader(): FileUploader<FileAttributes>;
Returns:
FileUploader<FileAttributes>
function getDefaultFileAttrs()
Signature:
export declare function getDefaultFileAttrs(file: File): FileAttributes;
Parameters:
Parameter | Type | Description |
---|---|---|
file | File |
Returns:
interface FileAttributes
Signature:
export interface FileAttributes
property error
Error state for the file, e.g. upload failed
Signature:
error?: string | null;
property fileName
Name of the file
Signature:
fileName?: string;
property fileSize
File size in bytes
Signature:
fileSize?: number;
property fileType
Mime type of the file, e.g. "image/jpeg"
Signature:
fileType?: string;
property id
Unique identifier for a file During the file uploading process, this is a temporary unique ID
Signature:
id?: unknown;
property url
URL where the file is stored
Signature:
url?: string;
interface FileOptions
Signature:
export interface FileOptions
property onDeleteFile
Called after the commands.deleteFile
has been called.
Signature:
onDeleteFile?: Handler<(props: {
tr: Transaction;
pos: number;
node: ProsemirrorNode;
}) => void>;
property pasteRuleRegexp
A regex test for the file type when users paste files.
Signature:
pasteRuleRegexp?: RegExp;
property render
Signature:
render?: (props: FileComponentProps) => React.ReactElement<HTMLElement> | null;
property uploadFileHandler
A function returns a FileUploader
which will handle the upload process.
Signature:
uploadFileHandler?: UploadFileHandler<FileAttributes>;