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

Horizontal scrolling on mobile #69

Open
mpz opened this issue May 21, 2018 · 6 comments
Open

Horizontal scrolling on mobile #69

mpz opened this issue May 21, 2018 · 6 comments
Labels

Comments

@mpz
Copy link

mpz commented May 21, 2018

I have such view:

If page width is small:

Horizontal scrolling to rigth with cursor:

Same code is hidden now!

After selection i see it:

How to fix this?
The problem is most important on mobile devices.

@mpz mpz changed the title Horizontal scrolling Horizontal scrolling on mobile May 21, 2018
@kazzkiq kazzkiq added the bug label May 21, 2018
@mpz
Copy link
Author

mpz commented May 22, 2018

Seems issue is not reproduce on pure prismjs.

@mpargar
Copy link

mpargar commented May 22, 2018

Hi, i have the same problem here.
image

You can partially fix the problem by adding the following line to your css file:
.codeflask__flatten { white-space: pre-wrap; }

image

But if you are using lines numbers they get bugs:
image

Sorry if my english isn't good enough.

@mpz
Copy link
Author

mpz commented May 22, 2018

Fix works for me too without line numbers.

@pfgithub
Copy link

Adding wrap="off" to the textarea seems to fix it

@Zumbala
Copy link

Zumbala commented Feb 21, 2022

This is the area where the problem lies, when replacing with below code it should work with line-numbers also

this.elTextarea.addEventListener('scroll', (e) => {
      this.elPre.style.transform = `translate3d(-${e.target.scrollLeft}px, -${e.target.scrollTop}px, 0)`
      if (this.elLineNumbers) {
        this.elLineNumbers.style.transform = `translate3d(0, -${e.target.scrollTop}px, 0)`
        // missing width change when moving the viewport left
        this.elPre.style.width = this.elPre.clientWidth + e.target.scrollLeft + "px"
      }
    })

@acarl005
Copy link

I fixed it on my fork. See acarl005/CodeFlask@c4b5603 for how I did it.

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

No branches or pull requests

6 participants