Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor Instance config Interface #285

Merged
merged 7 commits into from
Jul 17, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/components/__module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import IEditorConfig from './interfaces/editor-config';

/**
* @abstract
* @class Module
Expand All @@ -17,16 +19,13 @@ export default class Module {

/**
* Editor configuration object
* @type {EditorConfig}
*/
protected config: any = {};
protected config: IEditorConfig = {};

/**
* @constructor
*
* @param {EditorConfig} config
*/
constructor({config}) {
constructor({config}: IEditorConfig) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тип надо указать у config


if (new.target === Module) {
throw new TypeError('Constructors for abstract class Module are not allowed.');
Expand Down
44 changes: 44 additions & 0 deletions src/components/interfaces/editor-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Editor Instance config
*/
export default interface IEditorConfig {
/**
* Element to append Editor
*/
holderId: string;

/**
* Blocks list in JSON-format
*/
data: array;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

указать тип элементов массива


/**
* Map for used Tools in format { name : Class, ... }
*/
tools: object;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
string: () => {}
}


/**
* tools configuration {@link tools#ToolConfig}
*/
toolsConfig: object;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

описать интерфейс ToolsConfig. и тут передается объект {tool: config}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

описать тип объекта, указать что ключ должен соответствовать ключу из tools


/**
* This Tool will be added by default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

указать, что строка должна соответствовать одному из ключей tools

*/
initialBlock: string;

/**
* First Block placeholder
*/
placeholder: string;

/**
* Define tags not to be cutted off while pasting { p: true, b: true, a: true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

описать интерфейс SanitizerConfig, подключить его в модуле Sanitizer

*/
sanitizer: object;

/**
* Do not show toolbar
*/
hideToolbar: boolean;
}