react-ace icon indicating copy to clipboard operation
react-ace copied to clipboard

PHP syntax is not working?

Open jonog94 opened this issue 6 years ago • 2 comments

Problem

I'm not getting any syntax highlighting with PHP mode + PHP worker at all

Sample code to reproduce your issue

import React from 'react'
import AceEditor from 'react-ace'
import 'ace-builds/src-min-noconflict/mode-php'
import 'ace-builds/src-min-noconflict/theme-textmate'
import ace from 'ace-builds/src-noconflict/ace'

ace.config.set(
    "basePath",
    "https://cdn.jsdelivr.net/npm/[email protected]/src-noconflict/"
)

const Editor = ({ onEditorChange, code }) => {
    return(
        <>
            <AceEditor
                value={code}
                style={{width: '100%', height: '100%'}}
                mode="php"
                theme="textmate"
                onChange={(val) => onEditorChange(val)}
                name="algoEditor"
                editorProps={{ $blockScrolling: true }}
            />
        </>
    )
}

export default Editor

jonog94 avatar Mar 09 '20 23:03 jonog94

I think it highlights only if you have <?php tags

cristeacosmin avatar May 05 '20 11:05 cristeacosmin

@cristeacosmin is right you would need to have valid php syntax for code to highlight

securingsincity avatar Jun 25 '20 02:06 securingsincity