Skip to content

Commit

Permalink
fix(docx): small typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Dec 2, 2021
1 parent 1493a5a commit dac53c6
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"devDependencies": {
"@intlify/vite-plugin-vue-i18n": "3.2.1",
"@types/file-saver": "^2.0.4",
"@types/file-saver": "2.0.4",
"@types/jest": "27.0.3",
"@types/jsdom": "16.2.13",
"@types/pdfmake": "0.1.19",
Expand Down
6 changes: 4 additions & 2 deletions src/components/editor/header/EditorHeaderItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
class="flex px-2 justify-between items-center w-full cursor-pointer text-theme-editor-header-list-text hover:text-theme-editor-header-list-text-hover active:text-theme-editor-header-list-text-active bg-theme-editor-header-list-background hover:bg-theme-editor-header-list-background-hover active:bg-theme-editor-header-list-background-active"
@click.prevent.stop="emit('action')"
>
<slot name="icon"></slot>
<p class="text-sm">{{ props.text }}</p>
<div class="flex">
<slot name="icon"></slot>
<p class="text-sm ml-2">{{ props.text }}</p>
</div>
<p
class="font-tiny rounded-full px-1 text-3xs bg-theme-editor-header-list-shortcuts-background hover:bg-theme-editor-header-list-shortcuts-background-hover active:bg-theme-editor-header-list-shortcuts-background-active"
>
Expand Down
9 changes: 5 additions & 4 deletions src/components/editor/header/items/EditorBaseHeaderCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
class="ml-0.5"
aria-hidden="true"
role="img"
width="24"
height="24"
width="20"
height="20"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 1024 1024"
viewBox="0 0 512 512"
>
<path
d="M854.6 288.7c6 6 9.4 14.1 9.4 22.6V928c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V96c0-17.7 14.3-32 32-32h424.7c8.5 0 16.7 3.4 22.7 9.4l215.2 215.3zM790.2 326L602 137.8V326h188.2zM512 566.1l52.81 197a12 12 0 0 0 11.6 8.9h31.77a12 12 0 0 0 11.6-8.88l74.37-276a12 12 0 0 0 .4-3.12a12 12 0 0 0-12-12h-35.57a12 12 0 0 0-11.7 9.31l-45.78 199.1l-49.76-199.32A12 12 0 0 0 528.1 472h-32.2a12 12 0 0 0-11.64 9.1L434.6 680.01L388.5 481.3a12 12 0 0 0-11.68-9.29h-35.39a12 12 0 0 0-3.11.41a12 12 0 0 0-8.47 14.7l74.17 276A12 12 0 0 0 415.6 772h31.99a12 12 0 0 0 11.59-8.9l52.81-197z"
d="M488.877 52.447H302.306V5.92h-34.779L0 52.563v406.99l265.957 46.527h36.349v-46.353h174.59c9.887-.465 20.879.291 29.37-5.757c6.804-10.41 5.06-23.438 5.641-35.186V75.012c1.221-13.26-9.77-23.903-23.03-22.565zm-294.862 282.59c-9.712 5.06-24.252-.233-35.767.581c-7.735-38.5-16.75-76.768-23.67-115.443c-6.805 37.57-15.645 74.79-23.438 112.128c-11.166-.581-22.39-1.28-33.615-2.035c-9.655-51.18-20.995-102.01-30.01-153.305c9.945-.465 19.948-.872 29.893-1.221c5.99 37.047 12.795 73.919 18.03 111.024c8.2-38.036 16.574-76.071 24.717-114.106c11.05-.64 22.1-1.105 33.15-1.687c7.735 39.257 15.644 78.455 24.019 117.537c6.572-40.361 13.841-80.607 20.879-120.91c11.631-.407 23.263-1.047 34.836-1.745c-13.143 56.355-24.659 113.176-39.024 169.182zm290.212 97.069H302.306v-36.527h151.21v-23.263h-151.21v-29.079h151.21v-23.263h-151.21v-29.08h151.21v-23.262h-151.21v-29.08h151.21V215.29h-151.21V186.21h151.21v-23.263h-151.21v-29.079h151.21v-23.263h-151.21v-30.71h181.921v352.21z"
fill="currentColor"
></path>
</svg>
Expand Down
24 changes: 22 additions & 2 deletions src/use/docx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ export const useDocx = () => {
const { isLoading } = useNProgress()

const create = () => {
const properties = () => {
const properties = (): docx.ISectionPropertiesOptions => {
return {
page: {
pageNumbers: {
start: 1,
formatType: docx.NumberFormat.DECIMAL,
},
},
type: docx.SectionType.NEXT_PAGE,
}
}
Expand Down Expand Up @@ -116,7 +122,7 @@ export const useDocx = () => {

const pageBreak = () => {
return new docx.Paragraph({
text: '',
text: '\t', // force detect valid paragraph
pageBreakBefore: true,
})
}
Expand All @@ -131,13 +137,24 @@ export const useDocx = () => {
})
}

const image = (entity: Entity) => {
return new docx.ImageRun({
data: entity.raw,
transformation: {
width: entity.external?.image?.size.width as number,
height: entity.external?.image?.size.height as number,
},
})
}

return {
paragraph,
headingOne,
headingTwo,
headingThree,
pageBreak,
lineBreak,
image,
}
}

Expand Down Expand Up @@ -165,6 +182,9 @@ export const useDocx = () => {
case 'line-break':
arr.push(entities().lineBreak())
break
case 'image':
arr.push(entities().image(entity))
break
}
})
})
Expand Down

0 comments on commit dac53c6

Please sign in to comment.