1.0.52 • Published 5 years ago

codemirror-examples v1.0.52

Weekly downloads
30
License
MIT
Repository
github
Last release
5 years ago

codemirror-examples

Example codemirror in textarea supporting html and css linting and auto resize in a bootstrap template.

Install

npm install codemirror-examples --save-dev

Then include the js and css in your web app.

Auto Resize

Auto resize is great for editing of small content. However, it becomes painful for large content. There should be a method to toggle this feature. Auto resize is enabled by default. You can set an explict editor height by:

element.editor({
	height: '300px' // auto, or pixels
});

Full Screen

All demos support fullscreen mode. This mode is really full viewport. After you click inside the editor keypress:

  • F11 - toggles full viewport
  • ESC - exits full viewport

For editors with toolbars wrap the editor with div:

<div class="cm-fullscreen-container">
	<!-- start of mega menu -->
	<!-- textarea here -->
</div>

The <div> which is expanded to full viewport is determined by:

  • The outer closest div (<div class="cm-fullscreen-container">) to the codemirror div, if not found
  • The code mirror wrapper instance (<div class="codemirror">).

Flexbox Layout: Toolbars, Footers, Flexbox and Fullscreen

You can add Bootstrap navbars (toobars) and footers to codemirror. The HTML flexbox layout is:

<div class="cm-fullscreen-container cm-flex-container">
	<div class="cm-toolbar cm-flex-child-fixed">
		{{! your bootstrap navbar}}
	</div>
	<div class="cm-body cm-flex-child-grow">
		{{! your textarea for codemirror}}
	</div>
	<div class="cm-footer cm-flex-child-fixed">
		{{! your footer navbar}}
	</div>
</div>

The css is shown below and is included in the examples:

.cm-flex-container {display: flex;flex-direction: column;height: 100%;}
.cm-flex-child-fixed {flex: none;}
.cm-flex-child-grow {flex: auto; overflow-y:hidden;}

Useful resources for flexbox include:

Auto-Sizing Limit

There should be option to limit the size of the editor in auto-scrolling.

Todo: Code Folding

Todo: Drag Resizing

Todo: Improve fullscreen

  • Support window scroll on exit: Be the user presses the fullscreen mode the browser window might be scrolled. This scrolled state should be restore upon existing fullscreen.
  • Support codemirror scroll on enter: Before the user presses fullscreen mode the editor might be too large for fullscreen. In this case the editor will scroll. The cursor can be below the fold.

Todo: add byte system to footer

Show the textarea value length as 10.1 KB

Todo: Workings of Monaco Editor For Comparison

Todo: Problem with sticky tooltips

When do the following:

  • Create lint error,
  • Click on the source of the error,
  • Move mouse to display the tooltip
  • Type on keyboard to fix the lint error
  • Tooltip is still visable and stuck to the cursor even though the lint error is resolved.

Check the lint integration compared to the demo:

See: //https://github.com/codemirror/CodeMirror/pull/4308

Workflow

grunt build
1.0.52

5 years ago

1.0.51

5 years ago

1.0.50

5 years ago

1.0.49

5 years ago

1.0.48

5 years ago

1.0.47

5 years ago

1.0.46

5 years ago

1.0.45

5 years ago

1.0.44

5 years ago

1.0.43

5 years ago

1.0.42

5 years ago

1.0.41

5 years ago

1.0.40

5 years ago

1.0.39

5 years ago

1.0.38

5 years ago

1.0.37

5 years ago

1.0.36

5 years ago

1.0.35

5 years ago

1.0.34

5 years ago

1.0.33

5 years ago

1.0.32

5 years ago

1.0.31

5 years ago

1.0.30

5 years ago

1.0.29

5 years ago

1.0.28

5 years ago

1.0.27

5 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.20

6 years ago

1.0.18

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago