Skip to content

Commit

Permalink
fix: rename .markdown-body to .page-content
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Mar 28, 2019
1 parent cb16903 commit 8fcccec
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/css/injected-components.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
}

&[data-position="main:start"] {
&[data-position="content:start"] {
margin-bottom: 35px;

&>*:first-child {
Expand All @@ -20,7 +20,7 @@
}
}

&[data-position="main:end"] {
&[data-position="content:end"] {
margin-top: 30px;
}

Expand Down
2 changes: 1 addition & 1 deletion src/css/markdown.css → src/css/page-content.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.markdown-body {
.page-content {
& > *:first-child {
margin-top: 0;
}
Expand Down
10 changes: 8 additions & 2 deletions src/plugins/banner-footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ export default {
extend(api) {
const {banner, footer} = api.store.getters.config
if (banner) {
api.registerComponent('main:start', getComponent(banner, 'docute-banner'))
api.registerComponent(
'content:start',
getComponent(banner, 'docute-banner')
)
}
if (footer) {
api.registerComponent('main:end', getComponent(footer, 'docute-footer'))
api.registerComponent(
'content:end',
getComponent(footer, 'docute-footer')
)
}
}
}
18 changes: 8 additions & 10 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@
</content-loader>
</div>
<div class="Content" v-else>
<InjectedComponents position="main:start" />
<InjectedComponents position="content:start" />
<component v-if="pageTitle" :is="MarkdownTitle" class="page-title" />
<component
:class="{'has-page-title': pageTitle}"
:is="MarkdownBody"
/>
<component :class="{'has-page-title': pageTitle}" :is="PageContent" />
<EditLink />
<PrevNextLinks />
<InjectedComponents position="main:end" />
<InjectedComponents position="content:end" />
</div>
</div>
</div>
Expand Down Expand Up @@ -106,7 +103,7 @@ export default {
}
},
MarkdownBody() {
PageContent() {
const {env} = this.$store.state
const {componentMixins = []} = this.$store.getters.config
const component = {
Expand All @@ -118,8 +115,8 @@ export default {
return fn(Vue)
})
],
name: 'MarkdownBody',
template: `<div class="markdown-body">${
name: 'PageContent',
template: `<div class="page-content">${
this.$store.state.page.content
}</div>`
}
Expand Down Expand Up @@ -169,7 +166,8 @@ export default {
}
</script>

<style src="../css/prism.css"></style> <style src="../css/markdown.css"></style>
<style src="../css/prism.css"></style>
<style src="../css/page-content.css"></style>

<style scoped>
.Main {
Expand Down
4 changes: 2 additions & 2 deletions website/docs/plugin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ Register a component at specific position:

- `sidebar:start`: The start of sidebar.
- `sidebar:end`: The end of sidebar.
- `main:start`: The start of main area of the page.
- `main:end`: The end of main area of the page.
- `content:start`: The start of page content.
- `content:end`: The end of page content.
- `header-right:start`: The start of right nav in site header.
- `header-right:end`: The end of right nav in site header.

Expand Down
4 changes: 2 additions & 2 deletions website/docs/zh/plugin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ Register a component at specific position:

- `sidebar:start`: The start of sidebar.
- `sidebar:end`: The end of sidebar.
- `main:start`: The start of main area of the page.
- `main:end`: The end of main area of the page.
- `content:start`: The start of page content.
- `content:end`: The end of page content.
- `header-right:start`: The start of right nav in site header.
- `header-right:end`: The end of right nav in site header.

Expand Down

0 comments on commit 8fcccec

Please sign in to comment.