-
Notifications
You must be signed in to change notification settings - Fork 35
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
proposed changes #37
Comments
Thanks for the comments @joeypedicini92 :) I think there are multiple things to discuss here:
|
Thanks for the reply @zoehneto I completely understand v1 isn't supported anymore, I was mainly voicing a suggestion that this library could be used as a node module (it was easier to do that against v1 which is why I went that route) and the changes I made to use it in that way. We are running this on a browser, but as part of an Ember SPA, so it makes more sense to follow the pattern of importing modules in our js files than loading scripts on our index page. I think that's a more common pattern and something that should be supported by the library. As far as providing a sample RTF I can't do that since they contain personal data. But the RTF source is version 1...but that code is expecting the parser.version to be null, so when it comes in as 1 it throws an error...can you explain how that works? |
I'll have to think about getting the import to work without ugly hacks. As far as the version check is concerned I was thinking of the wrong piece of code. The part you removed checks that no rtf version was previously specified. The reason is, that the RtfDestination has to be the first destination in the file (\rtf) and it may only be specified once. The rtf destination has the version parameter which sets the parser version. So if the RtfDestination is called and a parser version is all ready specified, you probably have multiple rtf destinations which according to the spec is invalid. |
I just pushed the branch 'module-import' which should allow you to load rtf.js with require (at the moment this means you will also get wmf.js and emf.js, optionality is currently not implemented). Could you please test whether that solves your issue? |
I have now also added the jQuery require so rendering documents without images should work if you require rtf.js . I still have to add support for jquery-svg. |
Great thanks for the quick turnaround! I should have sometime today to test I'll let you know how it goes |
Great, I have now also fixed the jquery-svg issue. I now provide that with a UMD header in the dist folder. As long as you keep everything in the dist folder together wherever you are copying it, requiring should work. I have tested it in an angular project (which uses webpack through the angular cli) and it works for me with the following code (using ES 6 imports, but require should work aswell):
|
I had to create an index.js file, and remove the
index.js:
there's probably a better way using typescript... |
I have added an index.js and corrected the It would be great if you could test it in your setup, then I can merge |
I have just merged the branch and published the current state to npm, which should make working with the library a lot easier. |
Hey guys, first off great work on this, has been a huge help. However, I tried pulling down version 2.0 and the current master and I was having issues with EMFJS and WMFJS being undefined modules.
Because I didn't want to deal with that at the time I just pulled v1.0 (pre-typescript) and that was a bit more promising, but I did need to make the following changes to get it working:
Just letting you guys know if you want to merge the changes in. Making logging more easily configurable would be a great change. And just adding module.exports to the rtf.js made it "requireable" as a module. And that
parser.version
check doesn't really make sense to me. Obviously I'm not as familiar with the code, but I'm not quite sure what the point of that is. It would throw an error on every RTF file I tried, and simply removing it seemed to parse the RTFs just fine.Anyway feel free to reach out to discuss.
Best
The text was updated successfully, but these errors were encountered: