Skip to content
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

Text input bug on mac chrome #891

Open
cstdenis opened this issue Jun 14, 2022 · 6 comments
Open

Text input bug on mac chrome #891

cstdenis opened this issue Jun 14, 2022 · 6 comments

Comments

@cstdenis
Copy link

I have a mac chrome user who when entering text into the editor it appears to disappear (see attached video).
https://user-images.githubusercontent.com/1218445/173471977-69859a05-a0dc-4eaf-875d-6e934985e301.mp4

When view is switched to editor view it shows one letter per line
image

Changing the text alignment to anything other than left seems to work around it.

@samclarke
Copy link
Owner

Thanks for reporting! I've just tested and so far I haven't been able to reproduce this.

Are there any changes to the default styles and do you know if the issue happen with the editor on sceditor.com? Alternatively, can you share a link to the page with the issue?

@cstdenis
Copy link
Author

This seems to be a really weird one.

https://www.hentai-foundry.com/site/TestEditor <-- blank
https://www.hentai-foundry.com/site/TestEditor2 <-- with text pre-entered

Here is what was reported with further testing

[2:10 PM] Joseph: Test editor passed good.
[2:11 PM] Joseph: Test editor 2 also passed

[4:24 PM] Joseph: Weird, I tried #1 again and it now does not work 
[4:25 PM] Joseph: Same for #2
[4:25 PM] Joseph: hmm
[4:25 PM] Joseph: Oh man, that's weird
[4:26 PM] Joseph: So I closed chrome, and then clinked the link, it opened chrome, and it works fine
[4:26 PM] Joseph: But if I open chrome first, and then click the link, it does not
[4:27 PM] Joseph: Hmm
[4:27 PM] Joseph: I'm seeing a difference
[4:28 PM] Joseph: When it opens and works, when I begin typing the text drops down a tiny bit, but when it does not work the text does not move down
[4:31 PM] Joseph: Here's an example    (see video)
Screen_Recording_2022-06-17_at_7.29.39_PM.mp4

The editor on sceditor.com does not seem to be affected.

I'm using it in BBcode mode with some BBCode modifications: https://img.hentai-foundry.com/themes/default/js/editor.js

@samclarke
Copy link
Owner

Thanks for the detailed information! That is very strange, especially as it changes behavior depending on if Chrome is already open.

One thing I did notice is the code is including the sceditor/minified/themes/default.min.css file as the style for the content:

<script type="text/javascript">
/*<![CDATA[*/
jQuery(window).on('load',function() {
sceditor.create(document.getElementById('testEditor'), jQuery.extend({}, defaultOptions, {'style':'//img.hentai-foundry.com/themes/default/js/sceditor/minified/themes/default.min.css'}));
});
/*]]>*/
</script>

The content style should be sceditor/minified/themes/content/default.min.css. Could you try it with this content style? Should be something like:

<script type="text/javascript">
/*<![CDATA[*/
jQuery(window).on('load',function() {
sceditor.create(document.getElementById('testEditor'), jQuery.extend({}, defaultOptions, {'style':'//img.hentai-foundry.com/themes/default/js/sceditor/minified/themes/content/default.min.css'}));
});
/*]]>*/
</script>

That might fix the problem. The content style includes a fix for an iOS issue and it's possible it's somehow also fixing a bug in Chrome too. If it is I don't know what the bug is as that bug hasn't been an issue before.

If that doesn't fix it let me know and I'll try a bit more to see if I can manage to reproduce the issue.

@cstdenis
Copy link
Author

Thanks. I've made the change and the bug seems unaffected.

@samclarke
Copy link
Owner

Sorry for the very slow response. I downloaded the files locally and have tried to reproduce this a few times but still no luck.

I've just been testing again and I noticed are a few differences with your sceditor.min.js file. For example, the regular expression: "(^|\\s| | | | |$)", has been changed to: "(^|\\s| | | | |$)",

It looks like your sceditor.min.js file might be corrupt from some kind of encoding issue. I've made a gist to show the diff here (I've beautified the minified code to make it a bit easier to read).

I don't know if that's what's causing this issue but it's a strong possibility.

If you replace:

<script type="text/javascript" src="//img.hentai-foundry.com/themes/default/js/sceditor/minified/sceditor.min.js"></script>
<script type="text/javascript" src="//img.hentai-foundry.com/themes/default/js/sceditor/minified/formats/bbcode.js"></script>

with:

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sceditor@3.1.1/minified/sceditor.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sceditor@3.1.1/minified/formats/bbcode.js"></script>

does that fix the issue?

@samclarke
Copy link
Owner

Thinking about it some more, the differences are from the lack of character encoding header and it defaulting to something other than UTF-8.

That shouldn't be the issue as the page specifies UTF-8 and I think the browser will fallback to the page encoding for those files.

It would be worth checking though as I can't think of anything else it could be and I haven't been able to reproduce it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants