@jirkasa/code-box
Version:
Showcase code samples on the web with a container that lets users select and display different samples.
53 lines (52 loc) • 2.3 kB
TypeScript
import CodeView from "../../code-view/CodeView";
import CodeBox, { CodeBoxItemInfo } from "../CodeBox";
import CodeBoxCodeView from "../CodeBoxCodeView";
import CodeBoxFile from "../CodeBoxFile";
import CodeBoxMemento from "../CodeBoxMemento";
import CodeBoxOptions from "../CodeBoxOptions";
/** Virtual code box. */
declare class VirtualCodeBox extends CodeBox {
/** Memento created after initialization of code box. */
private initialMemento;
/** Code view entries stored by identifiers. */
private codeViewEntries;
/** File entries stored by identifiers. */
private fileEntries;
/** Currently active code box code view. */
private activeCodeBoxCodeView;
/**
* Creates new virtual code box.
* @param element Code box root element.
* @param options Code box options.
*/
constructor(element: HTMLElement, options?: CodeBoxOptions);
addCodeView(identifier: string, codeView: CodeView): boolean;
/**
* Adds new code view to code box without making copy of code view.
* @param identifier Identifier under which the code view should be added to code box.
* @param codeView Code view.
* @returns Indicates whether code view has been successfully added.
*/
private _addCodeView;
getCodeViews(): CodeBoxCodeView[];
getCodeView(identifier: string): CodeBoxCodeView | null;
removeCodeView(identifier: string): boolean;
removeAllCodeViews(): void;
changeCodeViewIdentifier(identifier: string, newIdentifier: string): boolean;
setActiveCodeView(identifier: string): boolean;
setNoActiveCodeView(): void;
getActiveCodeView(): CodeBoxCodeView | null;
addFile(identifier: string, downloadLink?: string | null): boolean;
getFiles(): CodeBoxFile[];
getFile(identifier: string): CodeBoxFile | null;
removeFile(identifier: string): boolean;
removeAllFiles(): void;
changeFileIdentifier(identifier: string, newIdentifier: string): boolean;
changeFileDownloadLink(identifier: string, newDownloadLink: string | null): boolean;
reset(): void;
createMemento(): CodeBoxMemento;
applyMemento(memento: CodeBoxMemento): void;
protected onInit(codeBoxItemInfos: CodeBoxItemInfo[]): void;
protected onAfterInit(): void;
}
export default VirtualCodeBox;