Skip to content

EuiCodeEditor XML parse errors #4816

Closed as not planned
Closed as not planned
@asteriscos

Description

@asteriscos

Introduction

Elastic UI Code editor renders XML parsing errors:

  • when a user escapes < characters
  • The error line number is wrong

error

Investigation

After debugging the EuiCodeEditor Wazuh implementation, we realized this error is produced regardless of how the component is implemented. EuiCodeEditor wraps a react Ace editor:
https://github.com/elastic/eui/blob/v29.3.2/src/components/code_editor/code_editor.tsx#L22

We checked if we could replicate the issue in their code editor online demo. We could replicate both the XML escaped < character error and the issue indicating a wrong error line number.

Screenshot from 2022-11-07 16-40-51

Additional information

Elastic UI component library has already deprecated the EuiCodeEditor component in version 41.0.0. Not only is no longer supported, but also since Kibana 8.1.0 uses "@elastic/eui": "46.1.1" and we cannot be compatible as long as we use EuiCodeEditor.

Since the component is deprecated, Elastic UI uses Microsoft Monaco code editor and recommends using their implementation @kbn/monaco.
elastic/eui#4683

On the other hand, Opensearch Dashboard 2.3 uses their fork of the Elastic UI repository V34.0.0 which still has EuiCodeEditor.
https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.3.0/package.json#L111

Strategy

In order to be compatible with both platforms, it seems our own implementation of a code editor is the most logical path. Also, Elastic UI has already researched how to solve its code editor issues and made the choice to replace it with Microsoft Monaco editor. This makes Microsoft Monaco editor a good candidate to make our own implementations.

Pros: Compatible with all platforms regardless of the UI repository and version.
Cons: Possible new bugs and code to maintain.

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions