UNPKG

@jupyterlab/docmanager

Version:
66 lines (65 loc) 2.39 kB
import { DocumentRegistry } from '@jupyterlab/docregistry'; import { Contents } from '@jupyterlab/services'; import { ITranslator } from '@jupyterlab/translation'; import { JSONObject } from '@lumino/coreutils'; import { IDocumentManager, IDocumentManagerDialogs } from './'; /** * A stripped-down interface for a file container. */ export interface IFileContainer extends JSONObject { /** * The list of item names in the current working directory. */ items: string[]; /** * The current working directory of the file container. */ path: string; } /** * Namespace for DocumentManagerDialogs. */ export declare namespace DocumentManagerDialogs { interface IOptions { translator?: ITranslator; } } /** * Default implementation of IDocumentManagerDialogs. */ export declare class DocumentManagerDialogs implements IDocumentManagerDialogs { constructor(options?: DocumentManagerDialogs.IOptions); /** * Show a dialog to rename a file. */ rename(context: DocumentRegistry.Context): Promise<void | null>; /** * Show a dialog asking whether to close a document. */ confirmClose(options: IDocumentManagerDialogs.ConfirmClose.IOptions): Promise<IDocumentManagerDialogs.ConfirmClose.IResult>; /** * Show a dialog asking whether to save before closing a dirty document. */ saveBeforeClose(options: IDocumentManagerDialogs.SaveBeforeClose.IOptions): Promise<IDocumentManagerDialogs.SaveBeforeClose.IResult>; private _translator; } /** * Rename a file with a dialog. * * @deprecated You should use {@link DocumentManagerDialogs.rename} */ export declare function renameDialog(manager: IDocumentManager, context: DocumentRegistry.Context, translator?: ITranslator, dialogs?: IDocumentManagerDialogs): Promise<void | null>; /** * Rename a file, asking for confirmation if it is overwriting another. */ export declare function renameFile(manager: IDocumentManager, oldPath: string, newPath: string): Promise<Contents.IModel | null>; /** * Ask the user whether to overwrite a file. */ export declare function shouldOverwrite(path: string, translator?: ITranslator): Promise<boolean>; /** * Test whether a name is a valid file name * * Disallows "/", "\", and ":" in file names, as well as names with zero length. */ export declare function isValidFileName(name: string): boolean;