Merge fixes (#541)

* Merge fixes

* add type

* source map
This commit is contained in:
Murod Khaydarov 2018-11-30 21:57:30 +03:00 committed by GitHub
parent 4511194bb9
commit 185eed8cb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 96 additions and 89 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "codex.editor",
"version": "2.6.1",
"version": "2.6.2",
"description": "Codex Editor. Native JS, based on API and Open Source",
"main": "build/codex-editor.js",
"types": "./types/index.d.ts",

View file

@ -153,8 +153,14 @@ export default class Block {
* Get Block's JSON data
* @return {Object}
*/
get data(): object {
return this.save();
get data(): BlockToolData {
return this.save().then((savedObject) => {
if (savedObject && !_.isEmpty(savedObject.data)) {
return savedObject.data;
} else {
return {};
}
});
}
/**

View file

@ -243,7 +243,9 @@ export default class BlockManager extends Module {
const blockToMergeData = await blockToMerge.data;
await targetBlock.mergeWith(blockToMergeData);
if (!_.isEmpty(blockToMergeData)) {
await targetBlock.mergeWith(blockToMergeData);
}
this.removeBlock(blockToMergeIndex);
this.currentBlockIndex = this._blocks.indexOf(targetBlock);

View file

@ -182,9 +182,8 @@ export default class Sanitizer extends Module {
*/
public getInlineToolsConfig(name: string): SanitizerConfig {
const {Tools} = this.Editor;
const toolsConfig = Tools.getToolSettings(name),
enableInlineTools = toolsConfig.inlineToolbar || [];
const toolsConfig = Tools.getToolSettings(name);
const enableInlineTools = toolsConfig.inlineToolbar || [];
let config = {} as SanitizerConfig;

View file

@ -27,12 +27,12 @@ export default class Saver extends Module {
chainData = [];
blocks.forEach((block) => {
chainData.push(block.data);
chainData.push(block.save());
});
const extractedData = await Promise.all(chainData);
const sanitizedData = await this.Editor.Sanitizer.sanitizeBlocks(extractedData);
return this.makeOutput(sanitizedData);
}