CodeFlask icon indicating copy to clipboard operation
CodeFlask copied to clipboard

Horizontal scrolling on mobile

Open mpz opened this issue 7 years ago • 6 comments
trafficstars

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 avatar May 21 '18 08:05 mpz

Seems issue is not reproduce on pure prismjs.

mpz avatar May 22 '18 05:05 mpz

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.

mpargar avatar May 22 '18 07:05 mpargar

Fix works for me too without line numbers.

mpz avatar May 22 '18 07:05 mpz

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

pfgithub avatar May 18 '19 16:05 pfgithub

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"
      }
    })

Zumbala avatar Feb 21 '22 10:02 Zumbala

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

acarl005 avatar Mar 26 '22 14:03 acarl005