Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mergeMap(([action, blocks]) => {
blocks.subscribe();
return new SaveEnd({
holder: action.payload.holder,
data: {
time: Date.now(),
version: EditorJS.version,
blocks: blocks
}
});
})
);
/**
* The method to call when the editor makes a change
*/
onChange?: (holder?: string) => void;
/**
* The method to call with an editor is ready
*/
onReady?: (holder?: string) => void;
}
/**
* Default values for each internal map
*/
export const MAP_DEFAULTS = [
['lastChangeMap', { time: 0, blocks: [], version: typeof EditorJS !== 'undefined' && EditorJS.version || ''}],
['isReadyMap', false],
['hasSavedMap', false]
];
/**
* Injection token for the EditorJS class
*/
export const EDITORJS_MODULE_IMPORT = new InjectionToken('EDITORJS_MODULE_IMPORT');
/**
* The EditorJS class injector
*/
export const EditorJSInstance = new InjectionToken('EditorJSInstance');
/**
* Options for a Injector method
this.zone.runOutsideAngular(() => {
editor.blocks.render({
time: Date.now(),
version: EditorJS.version,
blocks
});
this.zone.run(() => {
this.blocksMap[holder].next(blocks);
this.changeMap[holder].next(Date.now());
});
});
}
private createConfig(): EditorConfig {
const config: EditorConfig = createEditorJSConfig({
holder: this.id,
autofocus: this.autofocus,
hideToolbar: this.hideToolbar,
initialBlock: this.initialBlock,
placeholder: this.blockPlaceholder,
minHeight: this.minHeight,
sanitizer: this.sanitizer
});
if (this.blocks && this.blocks.length > 0) {
config.data = {
time: Date.now(),
version: typeof EditorJS !== 'undefined' && EditorJS.version || '',
blocks: this.blocks
};
}
return config;
}
}