문제

I'm struggling to correct a behaviour with the CodeMirror editor in which a whole paragraph is recognized as a single line within a set of PRE tags. By pressing the HOME or END buttons on the keyboard I either get navigated to the start of the paragraph or end of the paragraph regardless of how many lines that paragraph might span.

On the Editors extraKeys property I overrode the Home button as follows:

extraKeys : {
  "Home" : function(instance){
      console.log(instance);
   }
}

However, even though I have a paragraph that extends over 15 lines, only a single set of PRE tags are found so according to CodeMirror there is only a single line in the editor.

Does anyone know of a way to bypass this so that the HOME/END buttons work as intended? I have tried the built in "goLineStart" and "goLineStartSmart" functions but they both go to the start of the paragraph

도움이 되었습니까?

해결책

If you're meaning that they should take wrapping into account (go the start of the wrapped part of the line), you can bind Home and End to the "goLineLeft" and "goLineRight" commands to get the behavior you want.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top