Skip to content

Commit

Permalink
fix: editorInterface methods do not reset custom sidebar anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Suevalov committed Mar 27, 2019
1 parent 2728f82 commit 76b0b7d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/lib/entities/content-type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { APIContentType, Field, APIEditorInterfaceControl, APIEditorInterfaces, APIEditorInterfaceSettings } from '../interfaces/content-type'
import { APIContentType, Field, APIEditorInterfaceControl, APIEditorInterfaces, APIEditorInterfaceSettings, APIEditorInterfaceSidebar } from '../interfaces/content-type'
import { cloneDeep, find, filter, findIndex, pull, forEach } from 'lodash'

class Fields {
Expand Down Expand Up @@ -81,10 +81,12 @@ class Fields {
class EditorInterfaces {
private _version: number
private _controls: APIEditorInterfaceControl[]
private _sidebar?: APIEditorInterfaceSidebar[]

constructor (apiEditorInterfaces: APIEditorInterfaces) {
this._version = apiEditorInterfaces.sys.version
this._controls = apiEditorInterfaces.controls
this._sidebar = apiEditorInterfaces.sidebar
}

get version () {
Expand Down Expand Up @@ -147,7 +149,8 @@ class EditorInterfaces {
})
})
return {
controls: result
controls: result,
sidebar: this._sidebar
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions src/lib/interfaces/content-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,24 @@ interface APIEditorInterfaceSettings {

interface APIEditorInterfaceControl {
fieldId: string,
widgetId: string,
widgetId?: string,
widgetNamespace?: 'builtin' | 'extension',
settings?: APIEditorInterfaceSettings
}

interface APIEditorInterfaceSidebar {
widgetId: string,
widgetNamespace: 'builtin' | 'extension',
disabled?: boolean,
settings?: { [key: string]: any }
}

interface APIEditorInterfaces {
sys: {
version: number
}
controls: APIEditorInterfaceControl[]
sidebar?: APIEditorInterfaceSidebar[]
}

export {
Expand All @@ -57,5 +66,6 @@ export {
Field,
APIEditorInterfaces,
APIEditorInterfaceControl,
APIEditorInterfaceSettings
APIEditorInterfaceSettings,
APIEditorInterfaceSidebar
}

0 comments on commit 76b0b7d

Please sign in to comment.