Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting the lines in editor #216

Open
1 task done
rohitasare7 opened this issue Dec 13, 2023 · 1 comment
Open
1 task done

Highlighting the lines in editor #216

rohitasare7 opened this issue Dec 13, 2023 · 1 comment

Comments

@rohitasare7
Copy link

Clear and concise description of the problem

I need to highlight few lines by green color, I checked codemirror documentation but I am not able to understand (apologies as I am new to vue js and codemirror) can anyone help me please? my requirement is to highlight specific lines with a green color. I am unable to join discord since the link is not active hence raised the feature request

Suggested solution

please share solution if possible.

Alternative

No response

Additional context

No response

Validations

  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@rohitasare7
Copy link
Author

rohitasare7 commented Dec 13, 2023

also I am not able to get any reference, I want to use markselection --> https://codemirror.net/5/demo/markselection.html but I am not able to get proper reference of my code editor, below is the code -->

`//codemirror
import { Codemirror } from 'vue-codemirror';
import { java } from '@codemirror/lang-java';
import { oneDark } from '@codemirror/theme-one-dark';
import { EditorView } from 'codemirror';

//CodeMirror Data
const extensions = [java(), oneDark, EditorView.lineWrapping];
const view = shallowRef();
const handleReady = (payload) => {
view.value = payload.view;
// const state = view.value.state;
}`

as per the documentation (from the link I have shared)

<script> var editor = CodeMirror.fromTextArea(document.getElementById("code"), { lineNumbers: true, styleSelectedText: true }); editor.markText({line: 6, ch: 26}, {line: 6, ch: 42}, {className: "styled-background"}); </script>

here I am unable to get the editor reference.

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

No branches or pull requests

1 participant