-
Notifications
You must be signed in to change notification settings - Fork 334
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
displays with Firefox and getFile .content #204
Comments
I'm not sure off the top of my head, but I will look into it. I believe highlight.js actually adds those in their code and I'm not sure the sequence of events that happen. However, are you using the textarea option I just added? And does this happen without highlight.js but just manually typing in:
? Also, it'd be awesome if you could upload a testcase or put something on JSBin :) |
I am using the textarea option you just added. It happens without highlight.js too. http://jsbin.com/udaboy/1/edit |
Perfect! Thanks man, I'll take a look at it tonight or tomorrow. This helps a lot. |
That's strange. Hmmm... Have you looked at the JSBin I provided? That reproduces the issue as far as text goes. Would the browser I'm using make any difference? Using the latest Firefox. |
That could be it. I tried chrome. The screenshot is from your JSBin. From: declandewetmailto:notifications@github.com That's strange. Hmmm... Have you looked at the JSBin I provided? That reproduces the issue as far as text goes. Would the browser I'm using make any difference? Using the latest Firefox. Reply to this email directly or view it on GitHub: |
Hardly recognized it (the image) because the basePath I added didn't affect the style of the editor div on my end, which I thought was just a JSBin thing, heh. I'm downloading Chrome now to see if it's any different to Firefox on my end. If it is then I guess we've nailed what's causing the issue... |
Yeah, Firefox and chrome handle content editable differently. Hopefully that's it. I'm not near a computer but will try Firefox as well when I can. |
It works on Chrome, so this issue only applies to Firefox - but I suspect it can become a quick nuisance to websites that allow every user to add new content using EpicEditor and then storing that data in a DB... everyone using Firefox would become incredibly annoying, lol. |
Yeah, totally. I'll fix it for sure and add tests :) |
Just an update, I was able to repro it, added a failing test, but struggling to actually fix it. This will for sure be fixed soon tho and will be in the 0.2.1 release. |
@tylermolamphy what?! haha |
Mhm I've been trying to come up with a fix for this myself - though I'm not a seasoned JS developer... No luck yet though. |
So, thanks to @lamplightdev your problem will be patched when you pull develop next, but I changed your ticket name. He fixed it by changing the method to get the content. exportFile goes through some cleansing before displaying it whereas getFile does not. However, |
Note to self: getFiles doesn't have any documentation in the code. Update this as well. |
So to clarify, this bug is now just that the text obtained via getFiles is not sanitized? Could you just tweak the structure of the files so that .content is just a getter method that runs the text sanitization? |
Of the files? The files are stringified so they can't be functions. |
Right, so when you call getFiles, after you've loaded them in, move all the .contents to ._content and make .content a getter that sanitizes ._content. Or always keep content in ._content so you don't need to move stuff around when you load stuff in. |
Sure, whatever works :) Just make sure whatever method you use that it keeps all the whitespace and also wraps correctly and that on reload the content doesn't shift and works across the browsers the same. So, make sure:
keeps the right whitespace. Also make sure stuff like
Doesn't get turned into:
Which would prevent the text from wrapping. |
I'm having trouble reproducing the issue described, are there precise repro steps and/or a failing unit test written somewhere? |
No unit tests for this case yet, but in Firefox:
Type something like that. Then:
notice that the content contains |
So I've noticed that, at least in my version of the develop branch, editor.exportFile(); seems to strip the \n's from the text in Firefox but not Chrome. Is this correct behaviour? It means your sample gets crushed to
in firefox if you just paste it and refresh |
Not happening for me on Firefox :\ checked against master and develop. I can send a screencast too if you want. |
Ah, never mind, it was just an emergent property of #100. |
…fixing firefox whitespace bug
getFiles includes content by default again getFiles has a flag to exclude content now exportFiles has a 'raw' option exportFiles plaintext escape is now abstracted to a private function updated docs and tests to reflect this
Excited to say this is closed and 0.2.1 is ready for QAing and to have the release notes written up. Thanks a lot @gankro!!!!! |
Playing around with 0.2.1 along with syncing with a
<textarea>
and syntax highlighting via highlight.js, saving content to a MongoDB database, I find that within code tags, any indentation via spaces is outputted as
for each space except the last, that one outputs fine.I've tried breaking things a little by removing the
's from.replace()
in lines 183, 1377 and 1380 of epiceditor.js, but I still see that on output even if I create a new document after the changes... Is really doing my head in. I've also tried looking at highlight.js but there's not even a mention of
there that I can find with Sublime Text.This only happens in code tags, nowhere else... Any thoughts?
The text was updated successfully, but these errors were encountered: