mirror of
https://github.com/codex-team/editor.js
synced 2024-05-06 08:33:20 +02:00
63eeec0f3b
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com> Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com> Co-authored-by: tasuku-s <tasuku@freemind.co.jp> Co-authored-by: Athul Anil Kumar <athul7744@outlook.com> Co-authored-by: Taly <vitalik7tv@yandex.ru> Co-authored-by: flaming-cl <51183663+flaming-cl@users.noreply.github.com> Co-authored-by: Nguyen Ngoc Son <sonnn.se@gmail.com> Co-authored-by: Sisir Das K <37764463+sis-dk@users.noreply.github.com> Co-authored-by: Sisir <sisir@hellosivi.com>
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import { EditorModules } from '../types-internal/editor-modules';
|
|
import { EditorConfig } from '../../types';
|
|
import { ModuleConfig } from '../types-internal/module-config';
|
|
|
|
/**
|
|
* @abstract
|
|
* @class Module
|
|
* @classdesc All modules inherits from this class.
|
|
*
|
|
* @typedef {Module} Module
|
|
* @property {object} config - Editor user settings
|
|
* @property {EditorModules} Editor - List of Editor modules
|
|
*/
|
|
export default class Module {
|
|
/**
|
|
* Editor modules list
|
|
*
|
|
* @type {EditorModules}
|
|
*/
|
|
protected Editor: EditorModules;
|
|
|
|
/**
|
|
* Editor configuration object
|
|
*
|
|
* @type {EditorConfig}
|
|
*/
|
|
protected config: EditorConfig;
|
|
|
|
/**
|
|
* @class
|
|
* @param {EditorConfig} config - Editor's config
|
|
*/
|
|
constructor({ config }: ModuleConfig) {
|
|
if (new.target === Module) {
|
|
throw new TypeError('Constructors for abstract class Module are not allowed.');
|
|
}
|
|
|
|
this.config = config;
|
|
}
|
|
|
|
/**
|
|
* Editor modules setter
|
|
*
|
|
* @param {EditorModules} Editor - Editor's Modules
|
|
*/
|
|
public set state(Editor: EditorModules) {
|
|
this.Editor = Editor;
|
|
}
|
|
}
|