Skip to content

Long text renders incorrectly #87

Open

Description

@zheeeng

Current behaviour

long text is wrapped to new line

Expected behaviour

content is horiztonal scrollable.

Code sample

Screenshots (if applicable)

The situation text is not overflowing frame:

image

The situation text is over the width of frame:

image

What have you tried

set white-space: pre !important' on pre element, this visual effect is correct but the editing is broken.

Your Environment

software version
react-simple-code-editor
react
npm or yarn
node
browser

Activity

  1. delphin92 commented on Jun 18, 2021

    @delphin92

    I have same issue and solve it by setting break-all:

    .ant-input textarea, .ant-input pre {
      word-break: break-all !important;
    }

    In this case words wraps at arbitrary place, but it works same at both textrarea and pre. Maybe it help.

  2. afvieira commented on Jul 8, 2021

    @afvieira

    any news about this?

  3. zirkelc commented on Jul 25, 2021

    @zirkelc

    any news about this?

    I was able to get horizontal scrolling working, see this PR and my comment: #36

  4. mmswi commented on Dec 22, 2023

    @mmswi

    What I did, was the following

    import { OverlayScrollbarsComponent } from 'overlayscrollbars-react'

    <div
        className={cx(
          'prism-editor-wrap',
          'w-full h-full px-4 overflow-y-auto',
          readOnly ? 'read-only' : ''
        )}
      >
        <OverlayScrollbarsComponent
          options={{
            scrollbars: { autoHide: 'leave' },
            overflowBehavior: {
              x: 'scroll',
              y: isVerticalScrollDisabled ? 'hidden' : 'scroll', // I needed cases when I wanted the editor to grow with the content, but usually it's in custom height boxes and needs to scroll
            },
          }}
          className={cx('flex flex-col max-h-full h-full min-h-[36px]')}
        >
          <Editor
            ...
            style={{
              overflow: 'visible', // important
              ...styles,
            }}
          />
        </OverlayScrollbarsComponent>
      </div>
    

    and the css

         .prism-editor-wrap.read-only pre {
              @apply !whitespace-pre;
              @apply !block; // this is needed for growing the code editor's height
           }
    

    Mind you that this applies only to the readonly mode, as writing in the editor was very buggy if I tried to change the styles

    This way, I have dissappearing scrollbars on the public version of the website and horizontal scroll.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions