Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add temporary part to inject components below the editor #148

Merged
merged 2 commits into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/@sanity/desk-tool/sanity.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
{
"implements": "part:@sanity/base/tool",
"path": "index.js"
},

{
"name": "part:@sanity/desk-tool/after-editor-component",
"description": "[DEPRECATED] Components to render directly after the editor form. Will be removed in future release."
}
]
}
11 changes: 8 additions & 3 deletions packages/@sanity/desk-tool/src/pane/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ import VisibilityOffIcon from 'part:@sanity/base/visibility-off-icon'
import BinaryIcon from 'part:@sanity/base/binary-icon'
import styles from './styles/Editor.css'
import copyDocument from '../utils/copyDocument'
import IconMoreVert from 'part:@sanity/base/more-vert-icon'
import Menu from 'part:@sanity/components/menus/default'
import ContentCopyIcon from 'part:@sanity/base/content-copy-icon'
import documentStore from 'part:@sanity/base/datastore/document'
import {debounce, truncate, capitalize, startCase} from 'lodash'
import {debounce} from 'lodash'
import {getPublishedId, newDraftFrom} from '../utils/draftUtils'
import TimeAgo from '../components/TimeAgo'
import {PreviewFields} from 'part:@sanity/base/preview'
import Pane from 'part:@sanity/components/panes/default'
import afterEditorComponents from 'all:part:@sanity/desk-tool/after-editor-component'

const preventDefault = ev => ev.preventDefault()

Expand Down Expand Up @@ -98,7 +98,6 @@ const INITIAL_STATE = {
}

function getToggleKeyState(event) {

if (event.ctrlKey
&& event.code === 'KeyI'
&& event.altKey
Expand All @@ -112,6 +111,8 @@ function getToggleKeyState(event) {
&& !event.shiftKey) {
return 'showConfirmPublish'
}

return undefined
}

export default withRouterHOC(class Editor extends React.PureComponent {
Expand Down Expand Up @@ -416,6 +417,10 @@ export default withRouterHOC(class Editor extends React.PureComponent {
/>
</form>

{afterEditorComponents.map((AfterEditorComponent, i) =>
<AfterEditorComponent key={i} documentId={published._id} />
)}

{inspect && (
<InspectView
value={value}
Expand Down