securingsincity / react-ace

React Ace Component
http://securingsincity.github.io/react-ace/
MIT License
4.04k stars 604 forks source link

text is not getting copied correctly in ace editor. #1825

Closed vidyakore closed 1 year ago

vidyakore commented 1 year ago

Please Note: This is for internal consumption of SAP

Problem

we are using ace editor to show response we get from API like showed following

image

and this text is ReadOnly, when we try to copy paste the complete text in it it gets pasted correctly. But if we copy the text partially and paste it some characters will be missing.

for ex. if I copy the following text

image

it will be pasted like this

image

Detail the problem here, including any possible solutions.

here is the configurations we have written for ace editor

      <AceEditor
        placeholder=""
        style={jsonViewerStyles}
        mode="javascript"
        theme="xcode"
        name={id}
        readOnly={true}
        fontSize={14}
        showPrintMargin={true}
        showGutter={true}
        highlightActiveLine={true}
        wrapEnabled={enableWrap}
        value={data ? JSON.stringify(data, undefined, 2) : localizeStrings('TEST_PREVIEW.NO_DATA_PLACEHOLDER.TEXT')}
        setOptions={{
            enableBasicAutocompletion: false,
            enableLiveAutocompletion: false,
            enableSnippets: false,
            showLineNumbers: true,
            tabSize: 2,
            vScrollBarAlwaysVisible: true,
            hScrollBarAlwaysVisible: true,
            showPrintMargin: false,
            displayIndentGuides: false,
            highlightActiveLine: false,
        }}
    />

Version Info

React version 18.2.0

OS Windows

vidyakore commented 1 year ago

Removing fontFamily from this code solved My issue.

const jsonViewerStyles = {
                fontFamily:'Menlo',
        fontStyle: 'normal',
        fontWeight: isHorizonTheme()? '700': '400',
        fontSize: '14px',
        lineHeight: '20px',
        width: '100%',
        height: '100%',
    };