-
Notifications
You must be signed in to change notification settings - Fork 28
Conversation
Yay! We have needed new format support for a while. If it is easier to work with So, I tested, and encountered the following issues:
Again, thank you for working on this 👍 |
Well, it's not easier, no. The two main reasons are that 1) a consistent editor for all formats is nice and 2) on mobile, designMode currently works slightly better than WebODF.
Hmm, this should've done that, shouldn't it? Maybe FFOS doesn't know about
That's part of #246, which does throw a lot of errors in some cases, but those aren't errors. Are you able to load html files? |
It appears that Firefox OS does not work with odt files. I have filed a bug at: https://bugzilla.mozilla.org/show_bug.cgi?id=1111427. I am able to load HTML files. The ODF took a long time to load, so I jumped the gun a bit. |
Conversion from and to odt now works for very simple odt files. I'll make a list of as of yet unsupported features in #108, feel free to point out more. In case you ever want to add features, a little explanation: The most important thing about handling odt files is that we don't lose data or corrupt files. So while we will always attempt to display the file, we will only allow the user to edit it if we're going to generate a valid odt file, i.e., we check that odt -> html -> odt yields the original odt. Of course, this doesn't cover user-generated html. This means that while developing, that check will complain, a lot. But as Haskellers like to say, once it runs at all, it's also probably correct. |
@@ -5,30 +5,267 @@ | |||
|
|||
'use strict' | |||
|
|||
function initDocIO(doc, messageProxy, loadCallback) { | |||
var ODTDocument = function(odt) { |
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.
Could you put this function in a new odt.js
file in /scripts/parsers
?
Fantastic work @twiss. I just tested your patch on one of my research papers, and it displayed the ODT surprisingly well. One idea that I had: do you think that we should split the ODT parser into its own repository, and include it as a git submodule? I feel that it would be very useful to other app developers. |
var name = element.tagName; | ||
if(name === "SCRIPT" ? element.src : element.href) { | ||
var type = element.type; | ||
var url = new URI(name === "SCRIPT" ? element.src : element.href, new URI(location.href)).toString(); |
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 removed URI.js
in 89e14d8
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.
Yes, it won't be trivial to merge this as it is now. Though I'll split out these changes, they aren't needed for this anymore.
Hmm, my concern is that
That sounds like a very good approach. |
As an aside, I wonder if web components will be useful for developing editors. E.g. instead of converting an XML file to HTML to use designMode, we could just use the existing tags as custom elements. |
Do you have specific examples?
WebODF does that, sort of: they keep the odt tags as they are, and implement editing themselves on top of that. |
Pagination and annotations are two major features. |
is hard. It is possible with CSS Regions, but that's deprecated and only supported in Safari.
the tricky thing with annotations and footnotes is that they are a paragraph inside a span, which is not allowed in html. That's one advantage of WebODF's approach. Other than that, and figuring out how to correctly position them, I don't see fundamental problems.
Haven't looked into this much. There seems to be some kind of support for displaying an element on every printed page, don't know if all browsers support this though.
Worse, Chrome doesn't have any resize handles at all. Yeah, if you wanted, you could probably create something in js. |
d017d99
to
0d5364c
Compare
Once we merge this, I'd like to make a new release of Firetext. Does that sound good? |
Sounds good. It'll still take a while though, as html->odt is not far along yet. If you want to merge sooner rather than later, the easiest way to do that would be to disable (html) paste (and, for even sooner, the toolbar). |
Hmm, maybe we could implement a readonly mode and then activate it for ODT right now. |
Yep, also possible.
|
b0b8de1
to
99dc95f
Compare
What I do now is immediately undoing every change that we don't support. Is that ok with you? It's not very friendly, but it seems to work. Also,
Fixed. |
Hmm, could we alert the user about it and hide the toolbar item? |
You mean in addition to undoing? We could put an error message somewhere
|
Yup, in addition to undoing. Although, if the user cannot make any unsupported changes (the toolbar is hidden), a |
Well, they can, through copy and paste (and drag 'n drop, ctrl-b, and bugs
|
Ready to merge? |
WIP. This is an effort for editing odt files (#108) with designMode. I'm sending this PR early on in case you really dislike the approach re #204.
This is on top of #246, although that isn't really a requirement.