# v5

**URL:** https://discuss.codemirror.net/c/v5/9.md

[Latest](https://discuss.codemirror.net/latest.md) · [Categories](https://discuss.codemirror.net/categories.md)

---

## [About the v5 category](https://discuss.codemirror.net/t/about-the-v5-category/4499)

<div class="topic-metadata">

**Author:** [@marijn](https://discuss.codemirror.net/u/marijn)\
**Replies:** 0

</div>

---

## [How to add className to specified text and bind a click event?](https://discuss.codemirror.net/t/how-to-add-classname-to-specified-text-and-bind-a-click-event/9602)

<div class="topic-metadata">

**Author:** [@luorenfei](https://discuss.codemirror.net/u/luorenfei)\
**Replies:** 1\
**Last updated:** [December 5, 2025, 8:49am UTC](https://discuss.codemirror.net/t/how-to-add-classname-to-specified-text-and-bind-a-click-event/9602 "2025-12-05T08:49:07Z")

</div>

As the title suggests, I’m trying to get the corresponding text from the DOM and replace it, adding the className and click event I need, but it seems to be forcibly reset? Is there another way to achieve this?

---

## [Line numbers with CM5 runmode-standalone](https://discuss.codemirror.net/t/line-numbers-with-cm5-runmode-standalone/8920)

<div class="topic-metadata">

**Author:** [@erosman](https://discuss.codemirror.net/u/erosman)\
**Replies:** 1\
**Last updated:** [December 22, 2024, 9:35am UTC](https://discuss.codemirror.net/t/line-numbers-with-cm5-runmode-standalone/8920 "2024-12-22T09:35:42Z")

</div>

Is it possible to have line numbers with CodeMirror 5 runmode-standalone?

---

## [Register dragmove or mouse-/pointermove when dragging](https://discuss.codemirror.net/t/register-dragmove-or-mouse-pointermove-when-dragging/8701)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 1\
**Last updated:** [October 9, 2024, 12:28pm UTC](https://discuss.codemirror.net/t/register-dragmove-or-mouse-pointermove-when-dragging/8701 "2024-10-09T12:28:57Z")

</div>

When dropping text into the editor i wont not only the cursor to move, i also want to color the current line to give better feedback to the user where he currently whould drop it’s content. But idk why but the dragmove …

---

## [Paste Images into CodeMirror](https://discuss.codemirror.net/t/paste-images-into-codemirror/8653)

<div class="topic-metadata">

**Author:** [@cmason3](https://discuss.codemirror.net/u/cmason3)\
**Replies:** 2\
**Last updated:** [September 23, 2024, 4:13pm UTC](https://discuss.codemirror.net/t/paste-images-into-codemirror/8653 "2024-09-23T16:13:11Z")

</div>

I am currently using the beforeChange event to capture paste events into a CodeMirror pane and this works fine for text, but I am trying to paste in an image and then convert it into a base64 encoded data uri, which can …

---

## [Large file loading/rendering with a few million lines?](https://discuss.codemirror.net/t/large-file-loading-rendering-with-a-few-million-lines/8428)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 2\
**Last updated:** [July 4, 2024, 11:40am UTC](https://discuss.codemirror.net/t/large-file-loading-rendering-with-a-few-million-lines/8428 "2024-07-04T11:40:28Z")

</div>

i have found this example CodeMirror Huge Doc Demo but in my application i can’t go above line 1.597.830. any suggestions what could be the problem?

---

## [catch redo/undo event?](https://discuss.codemirror.net/t/catch-redo-undo-event/8389)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 2\
**Last updated:** [June 25, 2024, 11:58am UTC](https://discuss.codemirror.net/t/catch-redo-undo-event/8389 "2024-06-25T11:58:24Z")

</div>

is there an option or way to catch undo/redo events or like which events do still get fired. on(“change”) or on(“beforeChange”) or on(“beforeSelectionChanged”) kinda don’t get fired on redo/undo

---

## [Option to set Cursor at specific character globally not per lin?](https://discuss.codemirror.net/t/option-to-set-cursor-at-specific-character-globally-not-per-lin/8364)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 1\
**Last updated:** [June 19, 2024, 12:32pm UTC](https://discuss.codemirror.net/t/option-to-set-cursor-at-specific-character-globally-not-per-lin/8364 "2024-06-19T12:32:16Z")

</div>

I would like to set the cursor to a specific position but i only have the number of the character from the beginning of a huge text string with \\n so it get displayed as file in the editor. is there something like that …

---

## [Comment line command?](https://discuss.codemirror.net/t/comment-line-command/8308)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 0\
**Last updated:** [June 12, 2024, 9:07am UTC](https://discuss.codemirror.net/t/comment-line-command/8308 "2024-06-12T09:07:36Z")

</div>

Can’t find the Comment command described here CodeMirror 5 User Manual Like it’s not defined in the comment section

---

## [make only certain lines editable from certain column (ch) and the rest readOnly](https://discuss.codemirror.net/t/make-only-certain-lines-editable-from-certain-column-ch-and-the-rest-readonly/8297)

<div class="topic-metadata">

**Author:** [@soreka](https://discuss.codemirror.net/u/soreka)\
**Replies:** 1\
**Last updated:** [June 17, 2024, 10:04pm UTC](https://discuss.codemirror.net/t/make-only-certain-lines-editable-from-certain-column-ch-and-the-rest-readonly/8297 "2024-06-17T22:04:14Z")

</div>

let’s say i have range\[4,5,6\] of lines that i want to make editable and the rest to be readonly but with this condition i want the lines to be editable from a ceratin column let’s say from column 8 (line = 4,ch = 8) h…

---

## [Fastest replace range option?](https://discuss.codemirror.net/t/fastest-replace-range-option/8288)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 1\
**Last updated:** [June 6, 2024, 2:28pm UTC](https://discuss.codemirror.net/t/fastest-replace-range-option/8288 "2024-06-06T14:28:21Z")

</div>

So i try to or have to replace a lot of specific ranges. And it just takes to long so the browser times out multiple times or crashes. Basically i’m doing: Editor.codeMirror?.getDoc().replaceRange(NewText, { line: i, c…

---

## [To many lines are breaking line numbers, editor and line highlighting](https://discuss.codemirror.net/t/to-many-lines-are-breaking-line-numbers-editor-and-line-highlighting/8251)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 1\
**Last updated:** [May 24, 2024, 2:41pm UTC](https://discuss.codemirror.net/t/to-many-lines-are-breaking-line-numbers-editor-and-line-highlighting/8251 "2024-05-24T14:41:31Z")

</div>

So i have an application where my customer needs support for large files. Now we really are nearly finished with the project and now tested some files with some million lines. But we recognized that first the line numb…

---

## [show\_hint demo appears to do nothing](https://discuss.codemirror.net/t/show-hint-demo-appears-to-do-nothing/6746)

<div class="topic-metadata">

**Author:** [@cfry](https://discuss.codemirror.net/u/cfry)\
**Replies:** 2\
**Last updated:** [May 11, 2024, 7:51pm UTC](https://discuss.codemirror.net/t/show-hint-demo-appears-to-do-nothing/6746 "2024-05-11T19:51:47Z")

</div>

https://codemirror.net/5/doc/manual.html#addons points to a demo of the functionality for hints for JavaScript. On that page: CodeMirror: Autocomplete Demo it says “ctrl-space to activate autocompletion” but I click …

---

## [Inject global variables in autocompletion](https://discuss.codemirror.net/t/inject-global-variables-in-autocompletion/8203)

<div class="topic-metadata">

**Author:** [@francktchowa](https://discuss.codemirror.net/u/francktchowa)\
**Replies:** 1\
**Last updated:** [May 6, 2024, 8:53pm UTC](https://discuss.codemirror.net/t/inject-global-variables-in-autocompletion/8203 "2024-05-06T20:53:06Z")

</div>

Hi, I have a set of variables, and constants, that I wish to be available in the Editor while the user is triggering autocompletion. Let’s say I have const user = {age: 13, name: "Fred Nelo"}. How can I specify this co…

---

## [I have a question about this ::selection about the v5 version](https://discuss.codemirror.net/t/i-have-a-question-about-this-selection-about-the-v5-version/8152)

<div class="topic-metadata">

**Author:** [@Halecoder](https://discuss.codemirror.net/u/Halecoder)\
**Replies:** 1\
**Last updated:** [April 21, 2024, 2:14am UTC](https://discuss.codemirror.net/t/i-have-a-question-about-this-selection-about-the-v5-version/8152 "2024-04-21T02:14:16Z")

</div>

I have mark-selection and active-line plug-ins turned on, and when I double-click, it will not only select all the text, but also the rest of the positions, how do I close this background in the green box? The demo i…

---

## [Using tag \<article\>\</article\>, how too.](https://discuss.codemirror.net/t/using-tag-article-article-how-too/8103)

<div class="topic-metadata">

**Author:** [@ZtaQiS](https://discuss.codemirror.net/u/ZtaQiS)\
**Replies:** 1\
**Last updated:** [April 9, 2024, 9:19pm UTC](https://discuss.codemirror.net/t/using-tag-article-article-how-too/8103 "2024-04-09T21:19:03Z")

</div>

Hi, Was wondering is there any documentation on; \<article\>\</article\> and it use so that “Custom Scrollbars”? Does seem to actually work unless wrapped in those tags. As seen here. https://codemirror.net/5/demo/simpl…

---

## [custom styling for part of the text](https://discuss.codemirror.net/t/custom-styling-for-part-of-the-text/8098)

<div class="topic-metadata">

**Author:** [@skylaan](https://discuss.codemirror.net/u/skylaan)\
**Replies:** 0\
**Last updated:** [April 8, 2024, 10:33pm UTC](https://discuss.codemirror.net/t/custom-styling-for-part-of-the-text/8098 "2024-04-08T22:33:15Z")

</div>

hi! is there a way to give inline stylings to certain parts of the text without having to write a new mode? I want show log messages, like in a console. the closest I see is Shell, but I only want certain parts of the te…

---

## [Syntax Highlighting: CSS Nesting rules don't seem to be highlighted correctly](https://discuss.codemirror.net/t/syntax-highlighting-css-nesting-rules-dont-seem-to-be-highlighted-correctly/8082)

<div class="topic-metadata">

**Author:** [@Gazook89](https://discuss.codemirror.net/u/Gazook89)\
**Replies:** 1\
**Last updated:** [April 2, 2024, 8:50pm UTC](https://discuss.codemirror.net/t/syntax-highlighting-css-nesting-rules-dont-seem-to-be-highlighted-correctly/8082 "2024-04-02T20:50:16Z")

</div>

CSS Nesting is now in the major browsers, and it seems like the highlighter for CSS still doesn’t recognize it as valid syntax. This above shows the tr being highlighted as incorrect syntax, when in fact it does work. …

---

## [disable search bar](https://discuss.codemirror.net/t/disable-search-bar/8079)

<div class="topic-metadata">

**Author:** [@ganesh](https://discuss.codemirror.net/u/ganesh)\
**Replies:** 1\
**Last updated:** [April 2, 2024, 8:30am UTC](https://discuss.codemirror.net/t/disable-search-bar/8079 "2024-04-02T08:30:27Z")

</div>

I had three editor instances in my code. I don’t need a search dialog box for one of those instances. If I remove the dialog.js , I won’t have the search dialog for any of the instances, but I only want to disable it for…

---

## [Clicking in editor place cursor in wrong position](https://discuss.codemirror.net/t/clicking-in-editor-place-cursor-in-wrong-position/8075)

<div class="topic-metadata">

**Author:** [@mattwarrick](https://discuss.codemirror.net/u/mattwarrick)\
**Replies:** 0\
**Last updated:** [April 1, 2024, 5:53pm UTC](https://discuss.codemirror.net/t/clicking-in-editor-place-cursor-in-wrong-position/8075 "2024-04-01T17:53:29Z")

</div>

Hi, I am experiencing weird error. In 50% of cases, clicking in the editor doesn’t place cursor in proper position. The same for selecting - it’s selecting different text. It’s in all browsers and only sometimes… Video…

---

## [How to get rid of white area at the end of lines](https://discuss.codemirror.net/t/how-to-get-rid-of-white-area-at-the-end-of-lines/8050)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 1\
**Last updated:** [March 27, 2024, 7:17pm UTC](https://discuss.codemirror.net/t/how-to-get-rid-of-white-area-at-the-end-of-lines/8050 "2024-03-27T19:17:34Z")

</div>

How can i get rid of this white area on the rigth side of the lines? I have seen examples without this area, does it get activated by some specific option?

---

## [(deleted post)](https://discuss.codemirror.net/t/deleted-post/8047)

<div class="topic-metadata">

**Author:** [@idk](https://discuss.codemirror.net/u/idk)\
**Replies:** 0\
**Last updated:** [March 26, 2024, 10:16pm UTC](https://discuss.codemirror.net/t/deleted-post/8047 "2024-03-26T22:16:37Z")

</div>

(deleted post) Figured out what i wanted

---

## [autocapitalization does not work as expected?](https://discuss.codemirror.net/t/autocapitalization-does-not-work-as-expected/7998)

<div class="topic-metadata">

**Author:** [@newbie123](https://discuss.codemirror.net/u/newbie123)\
**Replies:** 1\
**Last updated:** [March 20, 2024, 7:28am UTC](https://discuss.codemirror.net/t/autocapitalization-does-not-work-as-expected/7998 "2024-03-20T07:28:52Z")

</div>

So i have set the “autocapitalize”-option to true. Is there more i have to do, to get autocapitalization to work? Or when should it autocapitalize by default? I have seen there is a string and object mode of the edito…

---

## [Usage of String.prototype.substr()](https://discuss.codemirror.net/t/usage-of-string-prototype-substr/7938)

<div class="topic-metadata">

**Author:** [@murat](https://discuss.codemirror.net/u/murat)\
**Replies:** 0\
**Last updated:** [March 3, 2024, 4:51pm UTC](https://discuss.codemirror.net/t/usage-of-string-prototype-substr/7938 "2024-03-03T16:51:25Z")

</div>

As far as I understand from the Github repo, v5 is still maintained to some extent. Wouldn’t it better to use String.prototype.substring() instead?

---

## [Context menu jumps cursor-bug when opening context menu from keyboard](https://discuss.codemirror.net/t/context-menu-jumps-cursor-bug-when-opening-context-menu-from-keyboard/7799)

<div class="topic-metadata">

**Author:** [@arun](https://discuss.codemirror.net/u/arun)\
**Replies:** 0\
**Last updated:** [February 2, 2024, 6:18am UTC](https://discuss.codemirror.net/t/context-menu-jumps-cursor-bug-when-opening-context-menu-from-keyboard/7799 "2024-02-02T06:18:34Z")

</div>

Hi, When opening context menu from the context menu key in keyboard, if there is no selection, the cursor jumps one line up. Additional context: Goto https://phcode.dev/ , open any text file and click the keyboard …

---

## [merge and paneljs](https://discuss.codemirror.net/t/merge-and-paneljs/7784)

<div class="topic-metadata">

**Author:** [@shihmin](https://discuss.codemirror.net/u/shihmin)\
**Replies:** 1\
**Last updated:** [February 1, 2024, 7:31am UTC](https://discuss.codemirror.net/t/merge-and-paneljs/7784 "2024-02-01T07:31:25Z")

</div>

Hi everyone. Can I combine mergejs (2 panel) and panel.js, let two panel have title?

---

## [I want to change the line numbers widget position from the left to the right](https://discuss.codemirror.net/t/i-want-to-change-the-line-numbers-widget-position-from-the-left-to-the-right/7726)

<div class="topic-metadata">

**Author:** [@jaga](https://discuss.codemirror.net/u/jaga)\
**Replies:** 2\
**Last updated:** [January 18, 2024, 2:01pm UTC](https://discuss.codemirror.net/t/i-want-to-change-the-line-numbers-widget-position-from-the-left-to-the-right/7726 "2024-01-18T14:01:29Z")

</div>

I am using the direction: “rtl”. I am able to type right to left. But I also want to move the line numbers widget to the right side. How to do that? If possible, share the code snippet for reference.

---

## [Powershell Language integration](https://discuss.codemirror.net/t/powershell-language-integration/7722)

<div class="topic-metadata">

**Author:** [@clementcst](https://discuss.codemirror.net/u/clementcst)\
**Replies:** 0\
**Last updated:** [January 18, 2024, 9:35am UTC](https://discuss.codemirror.net/t/powershell-language-integration/7722 "2024-01-18T09:35:27Z")

</div>

Hello everyone, I have a problem. I’m trying to use CodeMirror to display PowerShell code on my website, but I’m having trouble integrating the powershell.js file present in CodeMirror. Does anyone have an idea? My code …

---

## [How to Cover the Rest of the Page?](https://discuss.codemirror.net/t/how-to-cover-the-rest-of-the-page/7588)

<div class="topic-metadata">

**Author:** [@murat](https://discuss.codemirror.net/u/murat)\
**Replies:** 1\
**Last updated:** [December 19, 2023, 8:46am UTC](https://discuss.codemirror.net/t/how-to-cover-the-rest-of-the-page/7588 "2023-12-19T08:46:23Z")

</div>

I have a page. It has an iframe but I will only share the iframe. I don’t think it’s related to the original page. I know my programming skills are questionable. It’s definitely my mistake. The buttons are for saving an…

---

## [Problem with openDiolagBox](https://discuss.codemirror.net/t/problem-with-opendiolagbox/7514)

<div class="topic-metadata">

**Author:** [@ganesh](https://discuss.codemirror.net/u/ganesh)\
**Replies:** 2\
**Last updated:** [December 1, 2023, 10:23am UTC](https://discuss.codemirror.net/t/problem-with-opendiolagbox/7514 "2023-12-01T10:23:20Z")

</div>

1.) How to link the openDialogBox and a callback function in Search.js, 2.) can i customize the dialog box with find and replace input boxes at the same time like this 3.) is there any options to do like that in edit…

[Next page](https://discuss.codemirror.net/c/v5/9.md?page=1)
