Skip to content

Commit

Permalink
fix(ui): display article text when no HTML content
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarlier committed May 14, 2019
1 parent 56018fe commit 1fb5b3d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/src/articles/components/ArticleContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default ({ article }: Props) => {
let doc = ifrm.contentWindow ? ifrm.contentWindow.document : ifrm.contentDocument
if (doc) {
doc.open()
doc.write(article.html)
doc.write(article.html || article.text)
doc.head.appendChild(cssLink)
doc.head.appendChild(script)
// Keyboard events have to propagate outside the iframe
Expand Down
1 change: 1 addition & 0 deletions ui/src/articles/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const GetArticle = gql`
article(id: $id) {
id
title
text
html
url
status
Expand Down
4 changes: 2 additions & 2 deletions ui/src/hooks/useKeyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ export type KeyHandler = (e: ExtendedKeyboardEvent, combo: string) => void
export default (key: string | string[], handler: KeyHandler, enable = true) => {
useEffect(() => {
if (enable) {
console.log('bind', key)
// console.log('bind', key)
mousetrap.unbind(key)
setTimeout(() => {
mousetrap.bind(key, handler)
}, 200)
return () => {
console.log('unbind', key)
// console.log('unbind', key)
mousetrap.unbind(key)
}
}
Expand Down

0 comments on commit 1fb5b3d

Please sign in to comment.