-
-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: odt export #1331
base: main
Are you sure you want to change the base?
Feature: odt export #1331
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
ae02405
to
4ab6ef7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some early comments. Besides that, I found the following with the example:
- example exported document doesn't open in Word for Mac
- on libreoffice, "Numbered List Item Nested funky center" doesn't have the blue font color as in the example
- Tables always seem to be full width. Also (probably related), column width is not taken into account (see "wide cell" in testDocument.ts)
- The images have an extra border around them, can we get rid of this?
- the first two colored bg paragraphs have a white space between them. On docx / pdf this does not happen, and also not with the red numbered lists. Not sure if possible to fix, but would be nice
- Could you also fix the CI build?
public async toODTDocument( | ||
blocks: Block<B, I, S>[], | ||
options?: { | ||
header?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to be able to use more than a string as header / footer. Can you compare with the other exporters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, other exporters offer more customizability by using underlying libraries.
In this case, I wasn't sure about exposing the XML/JSX syntax to the end-user - it's a bit unusual and might be confusing for some.
We can export certain elements as JSX components and allow users to use them for more customization, but it'll likely still be just a subset of what's possible;
); | ||
const editorWidth = 623; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what kind of unit is this / where does this number come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Width of the BN editor in px
.
I needed to somehow get a %
value from previewWidth
, which seems to be a px
value.
Not sure how else to get it, other than by using editorWidth
- let me know if you have any suggestions.
@@ -0,0 +1,75 @@ | |||
import { BlockNoteSchema, defaultBlockSpecs, PageBreak } from "@blocknote/core"; | |||
import { testDocument } from "@shared/testDocument.js"; | |||
import { BlobReader, TextWriter, ZipReader } from "@zip.js/zip.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mentioned admzip didn't work for you. Curious what was the exact case, but if zip.js works better, let's also move the other exporter(s) to zip.js so that the codebase remains consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only other place adm-zip
is used is in DOCX exporter tests, which run server-side. Client-side, in the browser, adm-zip
didn't work well. Tried to patch process
to fix it (cthackers/adm-zip#529) but other Node-dependency-related issues popped up.
The ODT file can now be opened in Word, but there seem to be some compatibility issues. |
This PR adds an ODT exporter, with support for a customizable header & footer.