mirror of
https://github.com/codex-team/editor.js
synced 2024-05-20 15:26:48 +02:00
Fix for unconfigured toolbox
This commit is contained in:
parent
59c6a5f471
commit
dff1df2304
|
@ -87,10 +87,10 @@ export default class BlockTool extends BaseTool<IBlockTool> {
|
||||||
const userToolboxSettings = this.config[UserSettings.Toolbox];
|
const userToolboxSettings = this.config[UserSettings.Toolbox];
|
||||||
|
|
||||||
if (_.isEmpty(toolToolboxSettings)) {
|
if (_.isEmpty(toolToolboxSettings)) {
|
||||||
return;
|
return [];
|
||||||
}
|
}
|
||||||
if (userToolboxSettings === false) {
|
if (userToolboxSettings === false) {
|
||||||
return;
|
return [];
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Return tool's toolbox settings if user settings are not defined
|
* Return tool's toolbox settings if user settings are not defined
|
||||||
|
|
|
@ -255,17 +255,14 @@ export default class Toolbox extends EventsDispatcher<ToolboxEvent> {
|
||||||
.from(this.tools.values())
|
.from(this.tools.values())
|
||||||
.reduce((result, tool) => {
|
.reduce((result, tool) => {
|
||||||
const toolToolboxSettings = tool.toolbox;
|
const toolToolboxSettings = tool.toolbox;
|
||||||
|
const validToolboxSettings = toolToolboxSettings.filter(item => {
|
||||||
|
return this.areToolboxSettingsValid(item, tool.name);
|
||||||
|
});
|
||||||
|
|
||||||
if (toolToolboxSettings) {
|
result.push({
|
||||||
const validToolboxSettings = toolToolboxSettings.filter(item => {
|
...tool,
|
||||||
return this.areToolboxSettingsValid(item, tool.name);
|
toolbox: validToolboxSettings,
|
||||||
});
|
});
|
||||||
|
|
||||||
result.push({
|
|
||||||
...tool,
|
|
||||||
toolbox: validToolboxSettings,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
Loading…
Reference in a new issue