Skip to content

Commit

Permalink
fix(docx): not support images
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Dec 2, 2021
1 parent dac53c6 commit c54862d
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 22 deletions.
27 changes: 25 additions & 2 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Here will contain all the features that Better Write offers.

- ✅ - Deploy Website
- ✅ - Deploy Desktop
- ➖ - PWA
- ➖ - Unit Tests
- ❌ - e2e Tests
- ❌ - Logger for Developers
Expand All @@ -30,7 +31,6 @@ Here will contain all the features that Better Write offers.
- ➖ - Delete Project
- ✅ - Graph Aside Content
- ✅ - Graph Navigation
- ❌ - Delete Pages and Entity's With Graph
- ❌ - Customize Styles

### Pages
Expand Down Expand Up @@ -82,6 +82,30 @@ Here will contain all the features that Better Write offers.
- ✅ - Footer
- ✅ - Header

### DOCX

- ✅ - Page Defines
- ❌ - Preview
- ✅ - Generate

##### Configurations

- ❌ - Simple Cover
- ❌ - Image Cover
- ❌ - Simple Summary
- ❌ - Define Summary
- ❌ - Dynamic Summary
- ❌ - Background Image
- ✅ - Paragraph Default
- ❌ - Paragraph Colors
- ❌ - Paragraph Bold
- ❌ - Paragraph Italic
- ❌ - Paragraph Links
- ✅ - Heading's
- ❌ - Custom Entity
- ➖ - Footer
- ❌ - Header

### Externals

- ✅ - Google Fonts API Integration
Expand All @@ -100,7 +124,6 @@ Here will contain all the features that Better Write offers.
## Landing

- ✅ - Basic Content
- ➖ - Playground

## Support

Expand Down
4 changes: 3 additions & 1 deletion src/components/editor/header/EditorHeaderBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<template>
<div class="absolute rounded top-7 flex flex-col w-52 z-50">
<div
class="absolute rounded top-7 flex flex-col w-52 z-50 bg-theme-editor-header-list-background"
>
<slot />
</div>
</template>
2 changes: 1 addition & 1 deletion src/components/editor/header/EditorHeaderItem.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div
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"
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 hover:bg-theme-editor-header-list-background-hover active:bg-theme-editor-header-list-background-active"
@click.prevent.stop="emit('action')"
>
<div class="flex">
Expand Down
4 changes: 1 addition & 3 deletions src/components/editor/header/EditorHeaderItemDiv.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<template>
<div
class="mt-2 mb-1 h-1 w-full px-5 border-t border-theme-background-2 bg-theme-transparent"
/>
<div class="mt-2 mb-1 h-1 w-full px-5 border-t border-theme-background-2" />
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</EditorHeaderItem>
<EditorHeaderItemDiv />
<EditorHeaderItem
:text="t('editor.bar.pdf.generate')"
:text="t('editor.bar.docx.generate')"
@action="docx.generate()"
>
<template #icon>
Expand Down
3 changes: 3 additions & 0 deletions src/lang/br/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export default {
generate: 'Gerar',
configuration: 'Configurar',
},
docx: {
generate: 'Criar',
},
project: {
new: 'Novo',
configuration: 'Configurar',
Expand Down
3 changes: 3 additions & 0 deletions src/lang/en/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export default {
generate: 'Generate',
configuration: 'Configure',
},
docx: {
generate: 'Generate',
},
project: {
new: 'New',
configuration: 'Configure',
Expand Down
14 changes: 0 additions & 14 deletions src/use/docx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,13 @@ 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 @@ -182,9 +171,6 @@ 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 c54862d

Please sign in to comment.