Skip to content

Conversation

@gordonbrander
Copy link
Contributor

@gordonbrander gordonbrander commented Oct 16, 2024

Available via <os-code-editor>

Fixes #189

Notes

Source code can be reset via source attribute.

Language highlighting is toggled via mime type on lang prop/attr. Supported languages:

  • css: "text/css"
  • html: "text/html"
  • javascript: "text/javascript"
  • jsx: "text/x.jsx"
  • typescript: "text/x.typescript"
  • json: "application/json"
  • markdown: "text/markdown"

Example

<os-code-editor lang="text/javascript" source="console.log('hello world');">
</os-code-editor>
<os-code-editor lang="text/x.typescript" source="function hello(text: string) {}">
</os-code-editor>
<os-code-editor lang="text/css" source=".foo { font-weight: bold; }">
</os-code-editor>

See https://discuss.codemirror.net/t/release-0-20-0/4302/5

There was an error breaking syntax highlighting:

```
CodeMirror plugin crashed: TypeError: tags3 is not iterable
```

Caused by mismatched dependency versions. This can occur if using
CodeMirror 5 and CodeMirror 6 in the same repo.

npm dedupe resolved the issue.
- Expose destroy method on editors
- Rename cleanup to cancel, in keeping with nomenclature elsewhere
- Remove focus border from editor
@gordonbrander gordonbrander marked this pull request as ready for review October 17, 2024 16:40
@gordonbrander gordonbrander merged commit 275a8a7 into main Oct 17, 2024
@gordonbrander gordonbrander deleted the feat/2024-10-16-codemirror-componet branch October 17, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codemirror component

2 participants