Skip to content

Commit e7313e5

Browse files
committed
fix(FigureCode): Make figurecode components as functional
1 parent 2981578 commit e7313e5

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

global-components/FigureCode.vue renamed to components/FigureCode.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<template>
1+
<template functional>
22
<!-- eslint-disable vuejs-accessibility/no-redundant-roles -->
33

44
<!-- role="figure" for IE11 screen reader support -->
55
<!-- aria-label for macOS VoiceOver + Chrome -->
66
<!-- see more: https://www.scottohara.me/blog/2019/01/21/how-do-you-figure.html#wrapping-up -->
77
<figure
88
role="figure"
9-
:aria-label="caption"
9+
:aria-label="props.caption"
1010
class="figurecode teste-fig"
1111
>
1212
<slot name="content" />

global-components/FigureCodeCaption.vue renamed to components/FigureCodeCaption.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<template>
1+
<template functional>
22
<figcaption
33
class="figurecode__caption"
4-
v-html="caption"
4+
v-html="props.caption"
55
/>
66
</template>
77

config/plugins.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ module.exports = [
1919
if (tokens[idx].nesting === 1) {
2020
caption = m ? md.utils.escapeHtml(m[1]) : ''
2121
return `
22-
<figure-code caption="${caption}">
22+
<FigureCode caption="${caption}">
2323
<div slot="content">
2424
`
2525
} else {
2626
return `
2727
</div>
28-
<figure-code-caption
28+
<FigureCodeCaption
2929
slot="caption"
3030
caption="${caption}"
3131
/>
32-
</figure-code>
32+
</FigureCode>
3333
`
3434
}
3535
}

enhanceApp.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import VueDarkMode from '@vue-a11y/dark-mode'
33
import 'a11y-css-reset/combo.css'
44
import merge from 'deepmerge'
55
import VueSkipTo from 'vue-skip-to'
6+
import FigureCode from './components/FigureCode.vue'
7+
import FigureCodeCaption from './components/FigureCodeCaption.vue'
68
import WarningOpenLinkNewWindow from './components/WarningOpenLinkNewWindow.vue'
79
import { axe as axeDefaultConfig } from './config/defaultThemeConfig'
810
import { isObject } from './utils'
911

1012
export default ({ Vue, router, isServer, siteData }) => {
1113
// built-in components
1214
Vue.component('WarningOpenLinkNewWindow', WarningOpenLinkNewWindow)
15+
Vue.component('FigureCode', FigureCode)
16+
Vue.component('FigureCodeCaption', FigureCodeCaption)
1317

1418
// Development
1519
if (process.env.NODE_ENV === 'development') {

0 commit comments

Comments
 (0)