Skip to content

Commit 5bf646a

Browse files
rexxarsbjoerge
authored andcommitted
Add temporary part to inject components below the editor (#148)
* [desk-tool] Fix lint errors * [desk-tool] Add temporary part to inject components below the editor
1 parent 111cdcd commit 5bf646a

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

packages/@sanity/desk-tool/sanity.json

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
{
1414
"implements": "part:@sanity/base/tool",
1515
"path": "index.js"
16+
},
17+
18+
{
19+
"name": "part:@sanity/desk-tool/after-editor-component",
20+
"description": "[DEPRECATED] Components to render directly after the editor form. Will be removed in future release."
1621
}
1722
]
1823
}

packages/@sanity/desk-tool/src/pane/Editor.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ import VisibilityOffIcon from 'part:@sanity/base/visibility-off-icon'
1616
import BinaryIcon from 'part:@sanity/base/binary-icon'
1717
import styles from './styles/Editor.css'
1818
import copyDocument from '../utils/copyDocument'
19-
import IconMoreVert from 'part:@sanity/base/more-vert-icon'
2019
import Menu from 'part:@sanity/components/menus/default'
2120
import ContentCopyIcon from 'part:@sanity/base/content-copy-icon'
2221
import documentStore from 'part:@sanity/base/datastore/document'
23-
import {debounce, truncate, capitalize, startCase} from 'lodash'
22+
import {debounce} from 'lodash'
2423
import {getPublishedId, newDraftFrom} from '../utils/draftUtils'
2524
import TimeAgo from '../components/TimeAgo'
2625
import {PreviewFields} from 'part:@sanity/base/preview'
2726
import Pane from 'part:@sanity/components/panes/default'
27+
import afterEditorComponents from 'all:part:@sanity/desk-tool/after-editor-component'
2828

2929
const preventDefault = ev => ev.preventDefault()
3030

@@ -98,7 +98,6 @@ const INITIAL_STATE = {
9898
}
9999

100100
function getToggleKeyState(event) {
101-
102101
if (event.ctrlKey
103102
&& event.code === 'KeyI'
104103
&& event.altKey
@@ -112,6 +111,8 @@ function getToggleKeyState(event) {
112111
&& !event.shiftKey) {
113112
return 'showConfirmPublish'
114113
}
114+
115+
return undefined
115116
}
116117

117118
export default withRouterHOC(class Editor extends React.PureComponent {
@@ -416,6 +417,10 @@ export default withRouterHOC(class Editor extends React.PureComponent {
416417
/>
417418
</form>
418419

420+
{afterEditorComponents.map((AfterEditorComponent, i) =>
421+
<AfterEditorComponent key={i} documentId={published._id} />
422+
)}
423+
419424
{inspect && (
420425
<InspectView
421426
value={value}

0 commit comments

Comments
 (0)