Version Description
- Deprecated javascript updates
Download this release
Release Info
Developer | metaphorcreations |
Plugin | Ditty News Ticker |
Version | 2.3.1 |
Comparing to | |
See all releases |
Code changes from version 2.3 to 2.3.1
- ditty-news-ticker.php +2 -2
- inc/admin/fields/helpers.php +3 -3
- inc/admin/meta-boxes.php +0 -2
- inc/static.php +10 -24
- inc/static/js/ditty-news-ticker-images.js +5 -5
- inc/static/js/ditty-news-ticker-images.min.js +1 -0
- inc/static/js/ditty-news-ticker.js +70 -67
- inc/static/js/ditty-news-ticker.min.js +1 -1
- inc/static/js/ditty-rotate-ticker.js +0 -109
- inc/static/js/imagesloaded.pkgd.min.js +0 -7
- inc/static/js/jquery.easing.js +0 -168
- inc/static/js/jquery.touchSwipe.min.js +0 -1
- inc/static/js/partials/admin-general.js +34 -60
- inc/static/js/script-admin.min.js +1 -1
- inc/static/js/swiped-events.min.js +9 -0
- inc/static/libs/codemirror-5.44.0/.editorconfig +0 -7
- inc/static/libs/codemirror-5.44.0/.gitattributes +0 -8
- inc/static/libs/codemirror-5.44.0/.npmignore +0 -14
- inc/static/libs/codemirror-5.44.0/.travis.yml +0 -5
- inc/static/libs/codemirror-5.44.0/AUTHORS +0 -794
- inc/static/libs/codemirror-5.44.0/CHANGELOG.md +0 -1556
- inc/static/libs/codemirror-5.44.0/CONTRIBUTING.md +0 -92
- inc/static/libs/codemirror-5.44.0/LICENSE +0 -21
- inc/static/libs/codemirror-5.44.0/README.md +0 -48
- inc/static/libs/codemirror-5.44.0/addon/comment/comment.js +0 -209
- inc/static/libs/codemirror-5.44.0/addon/comment/continuecomment.js +0 -78
- inc/static/libs/codemirror-5.44.0/addon/dialog/dialog.css +0 -32
- inc/static/libs/codemirror-5.44.0/addon/dialog/dialog.js +0 -161
- inc/static/libs/codemirror-5.44.0/addon/display/autorefresh.js +0 -47
- inc/static/libs/codemirror-5.44.0/addon/display/fullscreen.css +0 -6
- inc/static/libs/codemirror-5.44.0/addon/display/fullscreen.js +0 -41
- inc/static/libs/codemirror-5.44.0/addon/display/panel.js +0 -127
- inc/static/libs/codemirror-5.44.0/addon/display/placeholder.js +0 -63
- inc/static/libs/codemirror-5.44.0/addon/display/rulers.js +0 -51
- inc/static/libs/codemirror-5.44.0/addon/edit/closebrackets.js +0 -187
- inc/static/libs/codemirror-5.44.0/addon/edit/closetag.js +0 -175
- inc/static/libs/codemirror-5.44.0/addon/edit/continuelist.js +0 -99
- inc/static/libs/codemirror-5.44.0/addon/edit/matchbrackets.js +0 -150
- inc/static/libs/codemirror-5.44.0/addon/edit/matchtags.js +0 -66
- inc/static/libs/codemirror-5.44.0/addon/edit/trailingspace.js +0 -27
- inc/static/libs/codemirror-5.44.0/addon/fold/brace-fold.js +0 -105
- inc/static/libs/codemirror-5.44.0/addon/fold/comment-fold.js +0 -59
- inc/static/libs/codemirror-5.44.0/addon/fold/foldcode.js +0 -152
- inc/static/libs/codemirror-5.44.0/addon/fold/foldgutter.css +0 -20
- inc/static/libs/codemirror-5.44.0/addon/fold/foldgutter.js +0 -146
- inc/static/libs/codemirror-5.44.0/addon/fold/indent-fold.js +0 -48
- inc/static/libs/codemirror-5.44.0/addon/fold/markdown-fold.js +0 -49
- inc/static/libs/codemirror-5.44.0/addon/fold/xml-fold.js +0 -184
- inc/static/libs/codemirror-5.44.0/addon/hint/anyword-hint.js +0 -41
- inc/static/libs/codemirror-5.44.0/addon/hint/css-hint.js +0 -60
- inc/static/libs/codemirror-5.44.0/addon/hint/html-hint.js +0 -350
- inc/static/libs/codemirror-5.44.0/addon/hint/javascript-hint.js +0 -157
- inc/static/libs/codemirror-5.44.0/addon/hint/show-hint.css +0 -36
- inc/static/libs/codemirror-5.44.0/addon/hint/show-hint.js +0 -448
- inc/static/libs/codemirror-5.44.0/addon/hint/sql-hint.js +0 -299
- inc/static/libs/codemirror-5.44.0/addon/hint/xml-hint.js +0 -110
- inc/static/libs/codemirror-5.44.0/addon/lint/coffeescript-lint.js +0 -47
- inc/static/libs/codemirror-5.44.0/addon/lint/css-lint.js +0 -40
- inc/static/libs/codemirror-5.44.0/addon/lint/html-lint.js +0 -53
- inc/static/libs/codemirror-5.44.0/addon/lint/javascript-lint.js +0 -63
- inc/static/libs/codemirror-5.44.0/addon/lint/json-lint.js +0 -40
- inc/static/libs/codemirror-5.44.0/addon/lint/lint.css +0 -73
- inc/static/libs/codemirror-5.44.0/addon/lint/lint.js +0 -252
- inc/static/libs/codemirror-5.44.0/addon/lint/yaml-lint.js +0 -41
- inc/static/libs/codemirror-5.44.0/addon/merge/merge.css +0 -119
- inc/static/libs/codemirror-5.44.0/addon/merge/merge.js +0 -1002
- inc/static/libs/codemirror-5.44.0/addon/mode/loadmode.js +0 -64
- inc/static/libs/codemirror-5.44.0/addon/mode/multiplex.js +0 -131
- inc/static/libs/codemirror-5.44.0/addon/mode/multiplex_test.js +0 -33
- inc/static/libs/codemirror-5.44.0/addon/mode/overlay.js +0 -90
- inc/static/libs/codemirror-5.44.0/addon/mode/simple.js +0 -216
- inc/static/libs/codemirror-5.44.0/addon/runmode/colorize.js +0 -40
- inc/static/libs/codemirror-5.44.0/addon/runmode/runmode-standalone.js +0 -158
- inc/static/libs/codemirror-5.44.0/addon/runmode/runmode.js +0 -72
- inc/static/libs/codemirror-5.44.0/addon/runmode/runmode.node.js +0 -197
- inc/static/libs/codemirror-5.44.0/addon/scroll/annotatescrollbar.js +0 -122
- inc/static/libs/codemirror-5.44.0/addon/scroll/scrollpastend.js +0 -48
- inc/static/libs/codemirror-5.44.0/addon/scroll/simplescrollbars.css +0 -66
- inc/static/libs/codemirror-5.44.0/addon/scroll/simplescrollbars.js +0 -152
- inc/static/libs/codemirror-5.44.0/addon/search/jump-to-line.js +0 -50
- inc/static/libs/codemirror-5.44.0/addon/search/match-highlighter.js +0 -165
- inc/static/libs/codemirror-5.44.0/addon/search/matchesonscrollbar.css +0 -8
- inc/static/libs/codemirror-5.44.0/addon/search/matchesonscrollbar.js +0 -97
- inc/static/libs/codemirror-5.44.0/addon/search/search.js +0 -258
- inc/static/libs/codemirror-5.44.0/addon/search/searchcursor.js +0 -293
- inc/static/libs/codemirror-5.44.0/addon/selection/active-line.js +0 -72
- inc/static/libs/codemirror-5.44.0/addon/selection/mark-selection.js +0 -119
- inc/static/libs/codemirror-5.44.0/addon/selection/selection-pointer.js +0 -98
- inc/static/libs/codemirror-5.44.0/addon/tern/tern.css +0 -87
- inc/static/libs/codemirror-5.44.0/addon/tern/tern.js +0 -718
- inc/static/libs/codemirror-5.44.0/addon/tern/worker.js +0 -44
- inc/static/libs/codemirror-5.44.0/addon/wrap/hardwrap.js +0 -145
- inc/static/libs/codemirror-5.44.0/bin/authors.sh +0 -6
- inc/static/libs/codemirror-5.44.0/bin/lint +0 -3
- inc/static/libs/codemirror-5.44.0/bin/release +0 -38
- inc/static/libs/codemirror-5.44.0/bin/source-highlight +0 -48
- inc/static/libs/codemirror-5.44.0/bin/upload-release.js +0 -35
- inc/static/libs/codemirror-5.44.0/demo/activeline.html +0 -88
- inc/static/libs/codemirror-5.44.0/demo/anywordhint.html +0 -79
- inc/static/libs/codemirror-5.44.0/demo/bidi.html +0 -106
- inc/static/libs/codemirror-5.44.0/demo/btree.html +0 -83
- inc/static/libs/codemirror-5.44.0/demo/buffers.html +0 -109
- inc/static/libs/codemirror-5.44.0/demo/changemode.html +0 -58
- inc/static/libs/codemirror-5.44.0/demo/closebrackets.html +0 -52
- inc/static/libs/codemirror-5.44.0/demo/closetag.html +0 -41
- inc/static/libs/codemirror-5.44.0/demo/complete.html +0 -126
- inc/static/libs/codemirror-5.44.0/demo/emacs.html +0 -76
- inc/static/libs/codemirror-5.44.0/demo/folding.html +0 -133
- inc/static/libs/codemirror-5.44.0/demo/fullscreen.html +0 -83
- inc/static/libs/codemirror-5.44.0/demo/hardwrap.html +0 -75
- inc/static/libs/codemirror-5.44.0/demo/html5complete.html +0 -56
- inc/static/libs/codemirror-5.44.0/demo/indentwrap.html +0 -59
- inc/static/libs/codemirror-5.44.0/demo/lint.html +0 -171
- inc/static/libs/codemirror-5.44.0/demo/loadmode.html +0 -72
- inc/static/libs/codemirror-5.44.0/demo/marker.html +0 -52
- inc/static/libs/codemirror-5.44.0/demo/markselection.html +0 -52
- inc/static/libs/codemirror-5.44.0/demo/matchhighlighter.html +0 -103
- inc/static/libs/codemirror-5.44.0/demo/matchtags.html +0 -48
- inc/static/libs/codemirror-5.44.0/demo/merge.html +0 -123
- inc/static/libs/codemirror-5.44.0/demo/multiplex.html +0 -75
- inc/static/libs/codemirror-5.44.0/demo/mustache.html +0 -69
- inc/static/libs/codemirror-5.44.0/demo/panel.html +0 -137
- inc/static/libs/codemirror-5.44.0/demo/placeholder.html +0 -45
- inc/static/libs/codemirror-5.44.0/demo/preview.html +0 -87
- inc/static/libs/codemirror-5.44.0/demo/requirejs.html +0 -70
- inc/static/libs/codemirror-5.44.0/demo/resize.html +0 -51
- inc/static/libs/codemirror-5.44.0/demo/rulers.html +0 -49
- inc/static/libs/codemirror-5.44.0/demo/runmode.html +0 -62
- inc/static/libs/codemirror-5.44.0/demo/search.html +0 -99
- inc/static/libs/codemirror-5.44.0/demo/simplemode.html +0 -185
- inc/static/libs/codemirror-5.44.0/demo/simplescrollbars.html +0 -82
- inc/static/libs/codemirror-5.44.0/demo/spanaffectswrapping_shim.html +0 -85
- inc/static/libs/codemirror-5.44.0/demo/sublime.html +0 -77
- inc/static/libs/codemirror-5.44.0/demo/tern.html +0 -133
- inc/static/libs/codemirror-5.44.0/demo/theme.html +0 -182
- inc/static/libs/codemirror-5.44.0/demo/trailingspace.html +0 -48
- inc/static/libs/codemirror-5.44.0/demo/variableheight.html +0 -67
- inc/static/libs/codemirror-5.44.0/demo/vim.html +0 -113
- inc/static/libs/codemirror-5.44.0/demo/visibletabs.html +0 -62
- inc/static/libs/codemirror-5.44.0/demo/widget.html +0 -85
- inc/static/libs/codemirror-5.44.0/demo/xmlcomplete.html +0 -119
- inc/static/libs/codemirror-5.44.0/doc/activebookmark.js +0 -57
- inc/static/libs/codemirror-5.44.0/doc/docs.css +0 -274
- inc/static/libs/codemirror-5.44.0/doc/internals.html +0 -504
- inc/static/libs/codemirror-5.44.0/doc/logo.png +0 -0
- inc/static/libs/codemirror-5.44.0/doc/logo.svg +0 -19
- inc/static/libs/codemirror-5.44.0/doc/manual.html +0 -3579
- inc/static/libs/codemirror-5.44.0/doc/realworld.html +0 -192
- inc/static/libs/codemirror-5.44.0/doc/releases.html +0 -924
ditty-news-ticker.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://dittynewsticker.com/
|
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
Text Domain: ditty-news-ticker
|
7 |
Domain Path: languages
|
8 |
-
Version: 2.3
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
@@ -62,7 +62,7 @@ final class Ditty_News_Ticker {
|
|
62 |
|
63 |
// Plugin version
|
64 |
if ( ! defined( 'MTPHR_DNT_VERSION' ) ) {
|
65 |
-
define( 'MTPHR_DNT_VERSION', '2.3' );
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
5 |
Description: Ditty News Ticker is a multi-functional data display plugin
|
6 |
Text Domain: ditty-news-ticker
|
7 |
Domain Path: languages
|
8 |
+
Version: 2.3.1
|
9 |
Author: Metaphor Creations
|
10 |
Author URI: http://www.metaphorcreations.com
|
11 |
Contributors: metaphorcreations
|
62 |
|
63 |
// Plugin version
|
64 |
if ( ! defined( 'MTPHR_DNT_VERSION' ) ) {
|
65 |
+
define( 'MTPHR_DNT_VERSION', '2.3.1' );
|
66 |
}
|
67 |
|
68 |
// Plugin Folder Path
|
inc/admin/fields/helpers.php
CHANGED
@@ -149,7 +149,7 @@ function mtphr_dnt_heading( $heading='', $description='', $help='' ) {
|
|
149 |
$html .= '<h3>'.$heading.'</h3>';
|
150 |
}
|
151 |
if( $help != '' ) {
|
152 |
-
$html .= '<a href="#" class="mtphr-dnt-help" data-
|
153 |
}
|
154 |
if( $description != '' ) {
|
155 |
$html .= '<p>'.$description.'</p>';
|
@@ -173,7 +173,7 @@ function mtphr_dnt_subheading( $args=array() ) {
|
|
173 |
$html = '<div class="mtphr-dnt-subheading">';
|
174 |
$html .= '<span class="mtphr-dnt-subheading-label">'.$args['subheading'].'</span>';
|
175 |
if( isset($args['subhelp']) && $args['subhelp'] != '' ) {
|
176 |
-
$html .= '<a href="#" class="mtphr-dnt-help" data-
|
177 |
}
|
178 |
$html .= '</div>';
|
179 |
|
@@ -488,7 +488,7 @@ function mtphr_dnt_sort_checkbox( $name, $val, $optional_fields=false, $args=arr
|
|
488 |
}
|
489 |
$html .= $heading.'</div>';
|
490 |
if( $help != '' ) {
|
491 |
-
$html .= '<span class="mtphr-dnt-help" data-
|
492 |
}
|
493 |
$html .= '<input type="hidden" name="'.$name.'" value="'.$val.'" />';
|
494 |
$html .= '</div>';
|
149 |
$html .= '<h3>'.$heading.'</h3>';
|
150 |
}
|
151 |
if( $help != '' ) {
|
152 |
+
$html .= '<a href="#" class="mtphr-dnt-help protip" data-pt-title="'.$help.'"><i class="dashicons dashicons-editor-help"></i></a>';
|
153 |
}
|
154 |
if( $description != '' ) {
|
155 |
$html .= '<p>'.$description.'</p>';
|
173 |
$html = '<div class="mtphr-dnt-subheading">';
|
174 |
$html .= '<span class="mtphr-dnt-subheading-label">'.$args['subheading'].'</span>';
|
175 |
if( isset($args['subhelp']) && $args['subhelp'] != '' ) {
|
176 |
+
$html .= '<a href="#" class="mtphr-dnt-help protip" data-pt-title="'.$args['subhelp'].'"><i class="dashicons dashicons-editor-help"></i></a>';
|
177 |
}
|
178 |
$html .= '</div>';
|
179 |
|
488 |
}
|
489 |
$html .= $heading.'</div>';
|
490 |
if( $help != '' ) {
|
491 |
+
$html .= '<span class="mtphr-dnt-help protip" data-pt-title="'.$help.'"><i class="dashicons dashicons-editor-help"></i></span>';
|
492 |
}
|
493 |
$html .= '<input type="hidden" name="'.$name.'" value="'.$val.'" />';
|
494 |
$html .= '</div>';
|
inc/admin/meta-boxes.php
CHANGED
@@ -19,7 +19,6 @@ function mtphr_dnt_display_code() {
|
|
19 |
echo '<h3>'.__('Shortcode', 'ditty-news-ticker').'</h3>';
|
20 |
echo '<p>'.__('Copy and paste this shortcode into a page or post to display the ticker within the post content.', 'ditty-news-ticker').'</p>';
|
21 |
echo '<pre><p>[ditty_news_ticker id="'.$post->ID.'"]</p></pre>';
|
22 |
-
echo '<a href="#" class="button mtphr-dnt-code-select">'.__('Select Shortcode', 'ditty-news-ticker').'</a>';
|
23 |
echo '</div>';
|
24 |
echo '</td>';
|
25 |
|
@@ -29,7 +28,6 @@ function mtphr_dnt_display_code() {
|
|
29 |
echo '<p>'.__('Copy and paste this code directly into one of your theme files to display the ticker any where you want on your site.', 'ditty-news-ticker').'</p>';
|
30 |
|
31 |
echo '<pre><p><?php if(function_exists(\'ditty_news_ticker\')){ditty_news_ticker('.$post->ID.');} ?></p></pre>';
|
32 |
-
echo '<a href="#" class="button mtphr-dnt-code-select">'.__('Select Function', 'ditty-news-ticker').'</a>';
|
33 |
echo '</div>';
|
34 |
echo '</td>';
|
35 |
echo '</tr>';
|
19 |
echo '<h3>'.__('Shortcode', 'ditty-news-ticker').'</h3>';
|
20 |
echo '<p>'.__('Copy and paste this shortcode into a page or post to display the ticker within the post content.', 'ditty-news-ticker').'</p>';
|
21 |
echo '<pre><p>[ditty_news_ticker id="'.$post->ID.'"]</p></pre>';
|
|
|
22 |
echo '</div>';
|
23 |
echo '</td>';
|
24 |
|
28 |
echo '<p>'.__('Copy and paste this code directly into one of your theme files to display the ticker any where you want on your site.', 'ditty-news-ticker').'</p>';
|
29 |
|
30 |
echo '<pre><p><?php if(function_exists(\'ditty_news_ticker\')){ditty_news_ticker('.$post->ID.');} ?></p></pre>';
|
|
|
31 |
echo '</div>';
|
32 |
echo '</td>';
|
33 |
echo '</tr>';
|
inc/static.php
CHANGED
@@ -4,9 +4,9 @@
|
|
4 |
/* !Load the front end scripts - 2.2 */
|
5 |
/* --------------------------------------------------------- */
|
6 |
|
7 |
-
function mtphr_dnt_scripts() {
|
8 |
|
9 |
-
if( is_admin() ) {
|
10 |
|
11 |
global $typenow;
|
12 |
|
@@ -20,21 +20,13 @@ function mtphr_dnt_scripts() {
|
|
20 |
wp_enqueue_script('media-upload');
|
21 |
wp_enqueue_script('thickbox');
|
22 |
}
|
23 |
-
|
24 |
-
// Load
|
25 |
-
wp_enqueue_style( '
|
26 |
-
wp_enqueue_script( '
|
27 |
-
wp_enqueue_script( 'codemirror-css', plugins_url('ditty-news-ticker/inc/static/libs/codemirror-5.44.0/mode/css/css.js'), array('jquery'), '5.44.0', true );
|
28 |
-
|
29 |
-
// Load qTip
|
30 |
-
wp_enqueue_style( 'qtip', plugins_url('ditty-news-ticker/inc/static/libs/qTip2/jquery.qtip.min.css'), false, '3.0.3' );
|
31 |
-
wp_enqueue_script( 'qtip', plugins_url('ditty-news-ticker/inc/static/libs/qTip2/jquery.qtip.min.js'), array( 'jquery' ), '3.0.3', true );
|
32 |
-
|
33 |
-
// Register jQuery easing
|
34 |
-
wp_register_script( 'jquery-easing', plugins_url('ditty-news-ticker/inc/static/js/jquery.easing.js'), array('jquery'), '1.4.1', true );
|
35 |
|
36 |
// Load the news ticker scripts
|
37 |
-
wp_enqueue_script( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/js/script-admin.min.js'), array( 'jquery','jquery-ui-core','jquery-ui-sortable', 'jquery-
|
38 |
wp_localize_script( 'ditty-news-ticker', 'ditty_news_ticker_vars', array(
|
39 |
'security' => wp_create_nonce( 'ditty-news-ticker' ),
|
40 |
'img_title' => __( 'Upload or select an image', 'ditty-news-ticker' ),
|
@@ -55,19 +47,13 @@ function mtphr_dnt_scripts() {
|
|
55 |
// Load the icon font css
|
56 |
wp_enqueue_style( 'ditty-news-ticker-font', plugins_url('ditty-news-ticker/inc/static/libs/fontastic/styles.css'), false, MTPHR_DNT_VERSION );
|
57 |
|
58 |
-
// Register
|
59 |
-
wp_enqueue_script( '
|
60 |
-
|
61 |
-
// Register the jQuery easing
|
62 |
-
wp_enqueue_script( 'jquery-easing', plugins_url('ditty-news-ticker/inc/static/js/jquery.easing.js'), array('jquery'), '1.4.1', true );
|
63 |
-
|
64 |
-
// Register images loaded
|
65 |
-
wp_enqueue_script( 'imagesLoaded', plugins_url('ditty-news-ticker/inc/static/js/imagesloaded.pkgd.min.js'), array('jquery'), '4.1.4', true );
|
66 |
|
67 |
// Register the Ditty News Ticker scripts
|
68 |
wp_enqueue_style( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/css/style.css'), false, filemtime(MTPHR_DNT_DIR.'inc/static/css/style.css') );
|
69 |
|
70 |
-
wp_enqueue_script( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/js/ditty-news-ticker.min.js'), array('jquery', '
|
71 |
wp_localize_script( 'ditty-news-ticker', 'mtphr_dnt_vars', array(
|
72 |
'is_rtl' => is_rtl(),
|
73 |
)
|
4 |
/* !Load the front end scripts - 2.2 */
|
5 |
/* --------------------------------------------------------- */
|
6 |
|
7 |
+
function mtphr_dnt_scripts( $hook ) {
|
8 |
|
9 |
+
if ( is_admin() ) {
|
10 |
|
11 |
global $typenow;
|
12 |
|
20 |
wp_enqueue_script('media-upload');
|
21 |
wp_enqueue_script('thickbox');
|
22 |
}
|
23 |
+
|
24 |
+
// Load protop
|
25 |
+
wp_enqueue_style( 'protip', plugins_url('ditty-news-ticker/inc/static/libs/protip/protip.min.css'), false, '1.4.21' );
|
26 |
+
wp_enqueue_script( 'protip', plugins_url('ditty-news-ticker/inc/static/libs/protip/protip.min.js'), array( 'jquery' ), '1.4.21', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
// Load the news ticker scripts
|
29 |
+
wp_enqueue_script( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/js/script-admin.min.js'), array( 'jquery','jquery-ui-core','jquery-ui-sortable', 'jquery-effects-core', 'protip' ), filemtime(MTPHR_DNT_DIR.'inc/static/js/script-admin.min.js'), true );
|
30 |
wp_localize_script( 'ditty-news-ticker', 'ditty_news_ticker_vars', array(
|
31 |
'security' => wp_create_nonce( 'ditty-news-ticker' ),
|
32 |
'img_title' => __( 'Upload or select an image', 'ditty-news-ticker' ),
|
47 |
// Load the icon font css
|
48 |
wp_enqueue_style( 'ditty-news-ticker-font', plugins_url('ditty-news-ticker/inc/static/libs/fontastic/styles.css'), false, MTPHR_DNT_VERSION );
|
49 |
|
50 |
+
// Register swiped events
|
51 |
+
wp_enqueue_script( 'swiped-events', plugins_url('ditty-news-ticker/inc/static/js/swiped-events.min.js'), false, '1.1.4', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
// Register the Ditty News Ticker scripts
|
54 |
wp_enqueue_style( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/css/style.css'), false, filemtime(MTPHR_DNT_DIR.'inc/static/css/style.css') );
|
55 |
|
56 |
+
wp_enqueue_script( 'ditty-news-ticker', plugins_url('ditty-news-ticker/inc/static/js/ditty-news-ticker.min.js'), array('jquery', 'imagesloaded', 'swiped-events', 'jquery-effects-core'), filemtime(MTPHR_DNT_DIR.'inc/static/js/ditty-news-ticker.min.js'), true );
|
57 |
wp_localize_script( 'ditty-news-ticker', 'mtphr_dnt_vars', array(
|
58 |
'is_rtl' => is_rtl(),
|
59 |
)
|
inc/static/js/ditty-news-ticker-images.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
jQuery( document ).ready( function($) {
|
2 |
|
3 |
|
4 |
-
var preload_limit = 4
|
5 |
currently_preloading = 0;
|
6 |
|
7 |
|
@@ -12,10 +12,10 @@ jQuery( document ).ready( function($) {
|
|
12 |
function mtphr_dnt_image_preload() {
|
13 |
|
14 |
var start = currently_preloading;
|
15 |
-
for( var i=start; i<preload_limit; i++ ) {
|
16 |
|
17 |
var $placeholder = $('.mtphr-dnt-image-placeholder:visible:first');
|
18 |
-
if( $placeholder.length
|
19 |
$placeholder = $('.mtphr-dnt-image-placeholder:first');
|
20 |
}
|
21 |
|
@@ -79,7 +79,7 @@ jQuery( document ).ready( function($) {
|
|
79 |
|
80 |
function mtphr_dnt_image_resize_placeholders() {
|
81 |
|
82 |
-
$('.mtphr-dnt-image-placeholder, .mtphr-dnt-image-placeholder-loading').each( function(
|
83 |
|
84 |
var init_w = $(this).data('width'),
|
85 |
init_h = $(this).data('height'),
|
@@ -99,7 +99,7 @@ jQuery( document ).ready( function($) {
|
|
99 |
|
100 |
|
101 |
|
102 |
-
$(window).
|
103 |
mtphr_dnt_image_resize_placeholders();
|
104 |
});
|
105 |
mtphr_dnt_image_resize_placeholders();
|
1 |
jQuery( document ).ready( function($) {
|
2 |
|
3 |
|
4 |
+
var preload_limit = 4,
|
5 |
currently_preloading = 0;
|
6 |
|
7 |
|
12 |
function mtphr_dnt_image_preload() {
|
13 |
|
14 |
var start = currently_preloading;
|
15 |
+
for( var i=start; i < preload_limit; i++ ) {
|
16 |
|
17 |
var $placeholder = $('.mtphr-dnt-image-placeholder:visible:first');
|
18 |
+
if( $placeholder.length === 0 ) {
|
19 |
$placeholder = $('.mtphr-dnt-image-placeholder:first');
|
20 |
}
|
21 |
|
79 |
|
80 |
function mtphr_dnt_image_resize_placeholders() {
|
81 |
|
82 |
+
$('.mtphr-dnt-image-placeholder, .mtphr-dnt-image-placeholder-loading').each( function() {
|
83 |
|
84 |
var init_w = $(this).data('width'),
|
85 |
init_h = $(this).data('height'),
|
99 |
|
100 |
|
101 |
|
102 |
+
$(window).on( 'resize', function() {
|
103 |
mtphr_dnt_image_resize_placeholders();
|
104 |
});
|
105 |
mtphr_dnt_image_resize_placeholders();
|
inc/static/js/ditty-news-ticker-images.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
jQuery(document).ready((function(t){function e(){for(var e,i=n;i<4;i++){var r=t(".mtphr-dnt-image-placeholder:visible:first");0===r.length&&(r=t(".mtphr-dnt-image-placeholder:first")),r.length>0&&(n++,r.attr("class","mtphr-dnt-image-placeholder-loading"),a(r))}}function a(a){var r=a.attr("data-src"),h=new Image;t(h).load((function(){var r=t(this);a.after(r),a.css("position","absolute").fadeOut((function(){t(this).next(".mtphr-dnt-image-placeholder-sizer").remove(),t(this).remove(),t("body").trigger("mtphr_dnt_resize",[r.parents(".mtphr-dnt").attr("id")]),i(),n--,t(".mtphr-dnt-image-placeholder").length>0&&e()})),t(this).fadeIn()})).attr("src",r)}function i(){t(".mtphr-dnt-image-placeholder, .mtphr-dnt-image-placeholder-loading").each((function(){var e=t(this).data("width"),a,i=t(this).data("height")/e,r=t(this).next(".mtphr-dnt-image-placeholder-sizer").width(),n=r*i;t(this).css({display:"block",width:r+"px",height:n+"px"})}))}var r=4,n=0;e(),t(window).on("resize",(function(){i()})),i()}));
|
inc/static/js/ditty-news-ticker.js
CHANGED
@@ -196,19 +196,19 @@
|
|
196 |
}
|
197 |
|
198 |
|
199 |
-
// Clear the loop on mouse
|
200 |
-
$ticker.
|
201 |
-
function
|
202 |
-
|
203 |
mtphr_dnt_scroll_pause();
|
204 |
}
|
205 |
-
|
206 |
-
function
|
207 |
-
|
208 |
mtphr_dnt_scroll_play();
|
209 |
}
|
210 |
-
|
211 |
-
);
|
212 |
}
|
213 |
|
214 |
function mtphr_dnt_scroll_pause() {
|
@@ -638,19 +638,19 @@
|
|
638 |
mtphr_dnt_rotator_play();
|
639 |
}
|
640 |
|
641 |
-
// Clear the loop on mouse
|
642 |
-
$ticker.
|
643 |
-
function
|
644 |
-
|
645 |
mtphr_dnt_rotator_pause();
|
646 |
}
|
647 |
-
|
648 |
-
function
|
649 |
-
|
650 |
mtphr_dnt_rotator_play();
|
651 |
}
|
652 |
-
|
653 |
-
);
|
654 |
}
|
655 |
|
656 |
/**
|
@@ -806,7 +806,7 @@
|
|
806 |
*/
|
807 |
function mtphr_dnt_rotator_resize_ticks() {
|
808 |
|
809 |
-
for( var i=0; i<vars.tick_count; i++ ) {
|
810 |
|
811 |
// Set the width of the tick
|
812 |
$(ticks[i]).width( ticker_width+'px' );
|
@@ -1207,12 +1207,12 @@
|
|
1207 |
*/
|
1208 |
if( $nav_prev && settings.type === 'rotate' ) {
|
1209 |
|
1210 |
-
$nav_prev.
|
1211 |
e.preventDefault();
|
1212 |
mtphr_dnt_prev();
|
1213 |
});
|
1214 |
|
1215 |
-
$nav_next.
|
1216 |
e.preventDefault();
|
1217 |
mtphr_dnt_next();
|
1218 |
});
|
@@ -1228,7 +1228,7 @@
|
|
1228 |
*/
|
1229 |
if( $nav_controls && settings.type === 'rotate' ) {
|
1230 |
|
1231 |
-
$nav_controls.children('a').
|
1232 |
e.preventDefault();
|
1233 |
|
1234 |
// Find the new tick
|
@@ -1286,7 +1286,7 @@
|
|
1286 |
$container.trigger('mtphr_dnt_play_pause', [vars, ticks]);
|
1287 |
}
|
1288 |
|
1289 |
-
$play_pause.
|
1290 |
e.preventDefault();
|
1291 |
mtphr_dnt_play_pause_toggle( vars.paused );
|
1292 |
});
|
@@ -1298,51 +1298,54 @@
|
|
1298 |
/* !Mobile swipe - 1.5.0 */
|
1299 |
/* --------------------------------------------------------- */
|
1300 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1301 |
if( settings.type === 'rotate' && !settings.disable_touchswipe ) {
|
1302 |
|
1303 |
-
$ticker.
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
}
|
1310 |
-
|
1311 |
-
// Find the new tick
|
1312 |
-
var new_tick = parseInt(vars.current_tick + 1);
|
1313 |
-
if( new_tick === vars.tick_count ) {
|
1314 |
-
new_tick = 0;
|
1315 |
-
}
|
1316 |
-
if( settings.rotate_type === 'slide_left' || settings.rotate_type === 'slide_right' ) {
|
1317 |
-
rotate_adjustment = 'slide_left';
|
1318 |
-
}
|
1319 |
-
mtphr_dnt_rotator_update( new_tick );
|
1320 |
-
},
|
1321 |
-
swipeRight: function() {
|
1322 |
-
|
1323 |
-
if(vars.running) {
|
1324 |
-
return false;
|
1325 |
-
}
|
1326 |
-
|
1327 |
-
// Find the new tick
|
1328 |
-
var new_tick = parseInt(vars.current_tick-1);
|
1329 |
-
if( new_tick < 0 ) {
|
1330 |
-
new_tick = vars.tick_count-1;
|
1331 |
-
}
|
1332 |
-
if( settings.rotate_type === 'slide_left' || settings.rotate_type === 'slide_right' ) {
|
1333 |
-
rotate_adjustment = 'slide_right';
|
1334 |
-
}
|
1335 |
-
if( settings.nav_reverse ) {
|
1336 |
-
if( settings.rotate_type === 'slide_down' ) {
|
1337 |
-
rotate_adjustment = 'slide_up';
|
1338 |
-
} else if( settings.rotate_type === 'slide_up' ) {
|
1339 |
-
rotate_adjustment = 'slide_down';
|
1340 |
-
}
|
1341 |
-
vars.reverse = 1;
|
1342 |
-
}
|
1343 |
-
mtphr_dnt_rotator_update( new_tick );
|
1344 |
-
}
|
1345 |
-
});
|
1346 |
}
|
1347 |
|
1348 |
|
@@ -1379,7 +1382,7 @@
|
|
1379 |
*
|
1380 |
* @since 1.4.1
|
1381 |
*/
|
1382 |
-
$(window).
|
1383 |
|
1384 |
// Resize the tickers if the width is different
|
1385 |
if( $ticker.outerWidth() !== ticker_width ) {
|
196 |
}
|
197 |
|
198 |
|
199 |
+
// Clear the loop on mouse enter
|
200 |
+
$ticker.on( {
|
201 |
+
mouseenter: function() {
|
202 |
+
if( settings.scroll_pause ) {
|
203 |
mtphr_dnt_scroll_pause();
|
204 |
}
|
205 |
+
},
|
206 |
+
mouseleave: function() {
|
207 |
+
if( settings.scroll_pause && !vars.paused ) {
|
208 |
mtphr_dnt_scroll_play();
|
209 |
}
|
210 |
+
}
|
211 |
+
} );
|
212 |
}
|
213 |
|
214 |
function mtphr_dnt_scroll_pause() {
|
638 |
mtphr_dnt_rotator_play();
|
639 |
}
|
640 |
|
641 |
+
// Clear the loop on mouse enter
|
642 |
+
$ticker.on( {
|
643 |
+
mouseenter: function() {
|
644 |
+
if( settings.auto_rotate && settings.rotate_pause && !vars.running ) {
|
645 |
mtphr_dnt_rotator_pause();
|
646 |
}
|
647 |
+
},
|
648 |
+
mouseleave: function() {
|
649 |
+
if( settings.auto_rotate && settings.rotate_pause && !vars.running && !vars.paused ) {
|
650 |
mtphr_dnt_rotator_play();
|
651 |
}
|
652 |
+
}
|
653 |
+
} );
|
654 |
}
|
655 |
|
656 |
/**
|
806 |
*/
|
807 |
function mtphr_dnt_rotator_resize_ticks() {
|
808 |
|
809 |
+
for( var i=0; i < vars.tick_count; i++ ) {
|
810 |
|
811 |
// Set the width of the tick
|
812 |
$(ticks[i]).width( ticker_width+'px' );
|
1207 |
*/
|
1208 |
if( $nav_prev && settings.type === 'rotate' ) {
|
1209 |
|
1210 |
+
$nav_prev.on('click', function( e ) {
|
1211 |
e.preventDefault();
|
1212 |
mtphr_dnt_prev();
|
1213 |
});
|
1214 |
|
1215 |
+
$nav_next.on('click', function(e) {
|
1216 |
e.preventDefault();
|
1217 |
mtphr_dnt_next();
|
1218 |
});
|
1228 |
*/
|
1229 |
if( $nav_controls && settings.type === 'rotate' ) {
|
1230 |
|
1231 |
+
$nav_controls.children('a').on('click', function( e ) {
|
1232 |
e.preventDefault();
|
1233 |
|
1234 |
// Find the new tick
|
1286 |
$container.trigger('mtphr_dnt_play_pause', [vars, ticks]);
|
1287 |
}
|
1288 |
|
1289 |
+
$play_pause.on('click', function(e) {
|
1290 |
e.preventDefault();
|
1291 |
mtphr_dnt_play_pause_toggle( vars.paused );
|
1292 |
});
|
1298 |
/* !Mobile swipe - 1.5.0 */
|
1299 |
/* --------------------------------------------------------- */
|
1300 |
|
1301 |
+
function swipe_left() {
|
1302 |
+
if(vars.running) {
|
1303 |
+
return false;
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
// Find the new tick
|
1307 |
+
var new_tick = parseInt(vars.current_tick + 1);
|
1308 |
+
if( new_tick === vars.tick_count ) {
|
1309 |
+
new_tick = 0;
|
1310 |
+
}
|
1311 |
+
if( settings.rotate_type === 'slide_left' || settings.rotate_type === 'slide_right' ) {
|
1312 |
+
rotate_adjustment = 'slide_left';
|
1313 |
+
}
|
1314 |
+
mtphr_dnt_rotator_update( new_tick );
|
1315 |
+
}
|
1316 |
+
|
1317 |
+
function swipe_right() {
|
1318 |
+
if(vars.running) {
|
1319 |
+
return false;
|
1320 |
+
}
|
1321 |
+
|
1322 |
+
// Find the new tick
|
1323 |
+
var new_tick = parseInt(vars.current_tick-1);
|
1324 |
+
if( new_tick < 0 ) {
|
1325 |
+
new_tick = vars.tick_count-1;
|
1326 |
+
}
|
1327 |
+
if( settings.rotate_type === 'slide_left' || settings.rotate_type === 'slide_right' ) {
|
1328 |
+
rotate_adjustment = 'slide_right';
|
1329 |
+
}
|
1330 |
+
if( settings.nav_reverse ) {
|
1331 |
+
if( settings.rotate_type === 'slide_down' ) {
|
1332 |
+
rotate_adjustment = 'slide_up';
|
1333 |
+
} else if( settings.rotate_type === 'slide_up' ) {
|
1334 |
+
rotate_adjustment = 'slide_down';
|
1335 |
+
}
|
1336 |
+
vars.reverse = 1;
|
1337 |
+
}
|
1338 |
+
mtphr_dnt_rotator_update( new_tick );
|
1339 |
+
}
|
1340 |
+
|
1341 |
if( settings.type === 'rotate' && !settings.disable_touchswipe ) {
|
1342 |
|
1343 |
+
$ticker[0].addEventListener('swiped-left', function() {
|
1344 |
+
swipe_left();
|
1345 |
+
});
|
1346 |
+
$ticker[0].addEventListener('swiped-right', function() {
|
1347 |
+
swipe_right();
|
1348 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1349 |
}
|
1350 |
|
1351 |
|
1382 |
*
|
1383 |
* @since 1.4.1
|
1384 |
*/
|
1385 |
+
$(window).on( 'resize', function() {
|
1386 |
|
1387 |
// Resize the tickers if the width is different
|
1388 |
if( $ticker.outerWidth() !== ticker_width ) {
|
inc/static/js/ditty-news-ticker.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var e={init:function(e){return this.each((function(){function r(){J.tick_count=N.find(".mtphr-dnt-tick").length,J.tick_count>0&&("scroll"===H.type?n():"rotate"===H.type&&m()),H.after_load.call(K,N),K.trigger("mtphr_dnt_after_load_single",[J,tt]),t("body").trigger("mtphr_dnt_after_load",[K,J,tt])}function i(){N.find(".mtphr-dnt-tick").each((function(){t(this).height()>$&&($=t(this).height()),"up"!==H.scroll_direction&&"down"!==H.scroll_direction||t(this).css("height","auto")})),N.css("height",$+"px")}function n(){var e=N.find(".mtphr-dnt-tick:first");if(e.attr("style")){var r,n=e.attr("style").split("width:");rt=!(n.length>1)}tt=[],N.find("img").length?N.imagesLoaded((function(){i(),N.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];tt.push(e)})),g(),o()})):(i(),N.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];tt.push(e)})),g(),o()),N.hover((function(){H.scroll_pause&&s()}),(function(){H.scroll_pause&&!J.paused&&a()}))}function s(){clearInterval(et)}function a(){o()}function o(){clearInterval(et),et=setInterval((function(){for(var t=0;t<J.tick_count;t++)if(!0===tt[t][0].visible){var e="reset";"left"===H.scroll_direction||"right"===H.scroll_direction?("reset"===(e="left"===H.scroll_direction?c(t):p(t))?(e=tt[t][0].reset,tt[t][0].headline.css("opacity",0)):tt[t][0].headline.css("opacity",1),tt[t][0].headline.css({transform:"translateX( "+e+"px )"})):("reset"===(e="up"===H.scroll_direction?l(t):_(t))?(e=tt[t][0].reset,tt[t][0].headline.css("opacity",0)):tt[t][0].headline.css("opacity",1),tt[t][0].headline.css({transform:"translateY( "+e+"px )"})),tt[t][0].position=e}}),1)}function c(t){var e=parseFloat(tt[t][0].position-.05*H.scroll_speed);return e<-(tt[t][0].headline.width()+H.offset)?e=f(t):e<parseFloat(Z-tt[t][0].headline.width()-H.scroll_spacing)&&u(t),e}function p(t){var e=parseFloat(tt[t][0].position+.05*H.scroll_speed);return e>Z+H.offset?e=f(t):e>H.scroll_spacing&&u(t),e}function l(t){var e=parseFloat(tt[t][0].position-.05*H.scroll_speed);return e<-(tt[t][0].headline.height()+H.offset)?e=f(t):e<$-tt[t][0].headline.height()-H.scroll_spacing&&u(t),e}function _(t){var e=parseFloat(tt[t][0].position+.05*H.scroll_speed);return e>$+H.offset?e=f(t):e>H.scroll_spacing&&u(t),e}function f(e){return J.tick_count>1&&(tt[e][0].visible=!1),J.tick_count===e+1&&(K.trigger("mtphr_dnt_scroll_complete",[J,tt]),t("body").trigger("mtphr_dnt_scroll_complete",[K,J,tt])),"reset"}function d(t){!1===tt[t][0].visible&&(J.previous_tick=parseInt(t-1),J.previous_tick<0&&(J.previous_tick=parseInt(J.tick_count-1)),J.current_tick=t,J.next_tick=parseInt(t+1),J.next_tick>=J.tick_count&&(J.next_tick=0))}function u(t){t===J.tick_count-1?H.scroll_loop&&(d(0),tt[0][0].visible=!0):(d(parseInt(t+1)),tt[t+1][0].visible=!0)}function h(){for(var t=0;t<J.tick_count;t++){var e,r=tt[t][0].headline;switch(H.scroll_direction){case"left":e=Z+H.offset,!1===tt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"right":e=parseInt("-"+(r.width()+H.offset)),!1===tt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"up":rt&&r.css("width",Z),e=parseInt($+H.offset),!1===tt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break;case"down":rt&&r.css("width",Z),e=parseInt("-"+(r.height()+H.offset)),!1===tt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break}tt[t][0].width=r.width(),tt[t][0].height=r.height(),!1===tt[t][0].visible&&(tt[t][0].position=e),tt[t][0].reset=e}}function g(){for(var t,e,r=0;r<J.tick_count;r++)if(tt[r]){switch(e=tt[r][0].headline,H.scroll_direction){case"left":t=Z+H.offset,e.css("transform","translateX( "+t+"px )");break;case"right":t=parseInt("-"+(e.width()+H.offset)),e.css("transform","translateX( "+t+"px )");break;case"up":rt&&e.css("width",Z),t=parseInt($+H.offset),e.css("transform","translateY( "+t+"px )");break;case"down":rt&&e.css("width",Z),t=parseInt("-"+(e.height()+H.offset)),e.css("transform","translateY( "+t+"px )");break}tt[r][0].width=e.width(),tt[r][0].height=e.height(),tt[r][0].position=t,tt[r][0].reset=t,tt[r][0].visible=!1}if(J.current_tick=0,tt[J.current_tick][0].visible=!0,H.scroll_init)for("left"===H.scroll_direction?t=.1*Z:"right"===H.scroll_direction?t=.9*Z:"up"===H.scroll_direction?t=.1*$:"down"===H.scroll_direction&&(t=.9*$),r=0;r<J.tick_count;r++)switch(e=tt[r][0].headline,H.scroll_direction){case"left":t<Z&&(e.css("transform","translateX( "+t+"px )"),tt[r][0].position=t,tt[r][0].visible=!0,t=t+tt[r][0].width+H.scroll_spacing);break;case"right":t>0&&(t-=tt[r][0].width,e.css("transform","translateX( "+t+"px )"),tt[r][0].position=t,tt[r][0].visible=!0,t-=H.scroll_spacing);break;case"up":t<$&&(e.css("transform","translateY( "+t+"px )"),tt[r][0].position=t,tt[r][0].visible=!0,t=t+tt[r][0].height+H.scroll_spacing);break;case"down":t>0&&(e.css("transform","translateY( "+t+"px )"),e.stop(!0,!0).css("top",t+"px"),tt[r][0].position=t,tt[r][0].visible=!0,t-=H.scroll_spacing);break}}function v(){y()}function k(){clearInterval(it)}function m(){switch(N.find(".mtphr-dnt-tick").each((function(){tt.push(t(this)),t(this).imagesLoaded((function(){F()}))})),F(),N.find(".mtphr-dnt-tick").show(),H.rotate_type){case"fade":X(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_left":D(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_right":L(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_down":j(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_up":M(N,tt,parseInt(100*H.rotate_speed),H.rotate_ease);break}w(0),H.auto_rotate&&v(),N.hover((function(){H.auto_rotate&&H.rotate_pause&&!J.running&&k()}),(function(){H.auto_rotate&&H.rotate_pause&&!J.running&&!J.paused&&v()}))}function y(){k(),it=setInterval((function(){var t=parseInt(J.current_tick+1);t===J.tick_count&&(t=0),b(t)}),parseInt(1e3*H.rotate_delay))}function b(e){J.current_tick!==e&&(H.auto_rotate&&k(),J.next_tick=e,H.before_change.call(K,N),K.trigger("mtphr_dnt_before_change_single",[J,tt]),t("body").trigger("mtphr_dnt_before_change",[K,J,tt]),J.running=1,I(e),x(e),J.previous_tick=J.current_tick,J.current_tick=e,st=setTimeout((function(){H.after_change.call(K,N),K.trigger("mtphr_dnt_after_change_single",[J,tt]),t("body").trigger("mtphr_dnt_after_change",[K,J,tt]),nt=H.rotate_type,J.reverse=0,J.running=0,H.auto_rotate&&!J.paused&&y()}),parseInt(100*H.rotate_speed)))}function w(t){U&&(U.children("a").removeClass("active"),U.children('a[href="'+t+'"]').addClass("active"))}function x(e){switch(w(e),nt){case"fade":Y(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_left":W(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_right":O(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_down":E(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_up":Q(N,t(tt[e]),t(tt[J.current_tick]),parseInt(100*H.rotate_speed),H.rotate_ease);break}}function I(e){switch(nt){case"fade":C(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_left":z(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_right":T(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_down":A(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break;case"slide_up":R(N,t(tt[J.current_tick]),t(tt[e]),parseInt(100*H.rotate_speed),H.rotate_ease);break}}function F(){for(var e=0;e<J.tick_count;e++)t(tt[e]).width(Z+"px"),J.current_tick!==e&&t(tt[e]).css({left:parseFloat(Z+H.offset)+"px"});var r=t(tt[J.current_tick]).height();N.stop().css("height",r+"px")}function X(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,left:"auto"})}function Y(t,e,r,i,n){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},i,n);var s=e.height();t.stop().animate({height:s+"px"},i,n)}function C(e,r,i,n,s){r.stop().animate({opacity:0},n,s,(function(){t(this).css({left:parseFloat(Z+H.offset)+"px"}),r.remove(),e.append(r)}))}function D(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,left:0})}function W(t,e,r,i,n){var s=e.height();e.css({opacity:1,left:parseFloat(Z+H.offset)+"px"}),t.stop().animate({height:s+"px"},i,n,(function(){})),e.stop().animate({left:"0"},i,n,(function(){}))}function z(t,e,r,i,n){e.stop().animate({left:"-"+parseFloat(Z+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function L(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,left:0})}function O(t,e,r,i,n){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(Z+H.offset)+"px"}),t.stop().animate({height:s+"px"},i,n,(function(){})),e.stop().animate({left:"0"},i,n)}function T(t,e,r,i,n){e.stop().animate({left:parseFloat(Z+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function j(t,e){var r=e[0],i=r.height();t.css("height",i+"px"),r.css({opacity:1,top:0,left:"auto"})}function E(t,e,r,i,n){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+H.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},i,n),e.stop().animate({top:"0"},i,n)}function A(t,e,r,i,n){var s=r.height();e.stop().animate({top:parseFloat(s+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function M(t,e){var r=e[0],i=r.height();t.css({height:i+"px",left:"auto"}),r.css({opacity:1,top:0})}function Q(t,e,r,i,n){var s=e.height();e.css({opacity:1,top:parseFloat(r.height()+H.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},i,n),e.stop().animate({top:"0"},i,n)}function R(t,e,r,i,n){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+H.offset)+"px"},i,n,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function q(){if(J.running)return!1;var t=parseInt(J.current_tick+1);t===J.tick_count&&(t=0),b(t)}function B(){if(J.running)return!1;var t=parseInt(J.current_tick-1);t<0&&(t=J.tick_count-1),H.nav_reverse&&("slide_left"===H.rotate_type?nt="slide_right":"slide_right"===H.rotate_type?nt="slide_left":"slide_down"===H.rotate_type?nt="slide_up":"slide_up"===H.rotate_type&&(nt="slide_down"),J.reverse=1),b(t)}function G(t){t?(J.paused=!1,V.removeClass("paused"),"scroll"===H.type?a():v()):(J.paused=!0,V.addClass("paused"),"scroll"===H.type?s():k()),K.trigger("mtphr_dnt_play_pause",[J,tt])}var H={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_loop:1,rotate_type:"fade",auto_rotate:0,rotate_delay:10,rotate_pause:0,rotate_speed:10,rotate_ease:"easeOutExpo",nav_reverse:0,disable_touchswipe:0,offset:20,before_change:function(){},after_change:function(){},after_load:function(){}},J={id:H.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};e&&t.extend(H,e);var K=t(this),N=K.find(".mtphr-dnt-tick-contents"),P=K.find(".mtphr-dnt-nav-prev"),S=K.find(".mtphr-dnt-nav-next"),U=K.find(".mtphr-dnt-control-links"),V=K.find(".mtphr-dnt-play-pause"),Z=N.outerWidth(!0),$=0,tt=[],et,rt=!0,it,nt=H.rotate_type,st;if(N.data("ditty:vars",J),P&&"rotate"===H.type&&(P.bind("click",(function(t){t.preventDefault(),B()})),S.bind("click",(function(t){t.preventDefault(),q()}))),U&&"rotate"===H.type&&U.children("a").bind("click",(function(e){e.preventDefault();var r=parseInt(t(this).attr("href"));if(J.running)return!1;if(r===J.current_tick)return!1;var i=r<J.current_tick?1:0;H.nav_reverse&&i&&("slide_left"===H.rotate_type?nt="slide_right":"slide_right"===H.rotate_type?nt="slide_left":"slide_down"===H.rotate_type?nt="slide_up":"slide_up"===H.rotate_type&&(nt="slide_down"),J.reverse=1),b(r)})),V.bind("click",(function(t){t.preventDefault(),G(J.paused)})),"rotate"!==H.type||H.disable_touchswipe||N.swipe({triggerOnTouchEnd:!0,swipeLeft:function(){if(J.running)return!1;var t=parseInt(J.current_tick+1);t===J.tick_count&&(t=0),"slide_left"!==H.rotate_type&&"slide_right"!==H.rotate_type||(nt="slide_left"),b(t)},swipeRight:function(){if(J.running)return!1;var t=parseInt(J.current_tick-1);t<0&&(t=J.tick_count-1),"slide_left"!==H.rotate_type&&"slide_right"!==H.rotate_type||(nt="slide_right"),H.nav_reverse&&("slide_down"===H.rotate_type?nt="slide_up":"slide_up"===H.rotate_type&&(nt="slide_down"),J.reverse=1),b(t)}}),K.on("mtphr_dnt_next",(function(){q()})),K.on("mtphr_dnt_prev",(function(){B()})),K.on("mtphr_dnt_goto",(function(t,e){b(parseInt(e))})),K.on("mtphr_dnt_pause",(function(){G()})),K.on("mtphr_dnt_play",(function(){G(!0)})),t(window).resize((function(){N.outerWidth()!==Z&&(Z=N.outerWidth(!0),"scroll"===H.type?("up"===H.scroll_direction||"down"===H.scroll_direction)&&rt?g():h():"rotate"===H.type&&F())})),K.on("mtphr_dnt_resize_single",(function(){"scroll"===H.type?h():"rotate"===H.type&&F()})),t("body").on("mtphr_dnt_resize",(function(t,e){e&&e.indexOf(H.id)>=0&&("scroll"===H.type?h():"rotate"===H.type&&F())})),K.on("mtphr_dnt_replace_ticks",(function(e,i,n){clearInterval(et),K.find(".mtphr-dnt-tick").remove(),i.each((function(){N.append(t(this))})),setTimeout((function(){r()}),n)})),0===K.width())var at=setInterval((function(){K.width()>10&&(clearInterval(at),Z=N.outerWidth(!0),r())}),100);else r()}))}};t.fn.ditty_news_ticker=function(r){return e[r]?e[r].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof r&&r?void t.error("Method "+r+" does not exist in ditty_news_ticker"):e.init.apply(this,arguments)}}(jQuery);
|
1 |
+
!function(t){var e={init:function(e){return this.each((function(){function r(){P.tick_count=S.find(".mtphr-dnt-tick").length,P.tick_count>0&&("scroll"===N.type?i():"rotate"===N.type&&m()),N.after_load.call(R,S),R.trigger("mtphr_dnt_after_load_single",[P,rt]),t("body").trigger("mtphr_dnt_after_load",[R,P,rt])}function n(){S.find(".mtphr-dnt-tick").each((function(){t(this).height()>et&&(et=t(this).height()),"up"!==N.scroll_direction&&"down"!==N.scroll_direction||t(this).css("height","auto")})),S.css("height",et+"px")}function i(){var e=S.find(".mtphr-dnt-tick:first");if(e.attr("style")){var r,i=e.attr("style").split("width:");it=!(i.length>1)}rt=[],S.find("img").length?S.imagesLoaded((function(){n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];rt.push(e)})),g(),o()})):(n(),S.find(".mtphr-dnt-tick").each((function(){t(this).show();var e=[{headline:t(this)}];rt.push(e)})),g(),o()),S.on({mouseenter:function(){N.scroll_pause&&s()},mouseleave:function(){N.scroll_pause&&!P.paused&&a()}})}function s(){clearInterval(nt)}function a(){o()}function o(){clearInterval(nt),nt=setInterval((function(){for(var t=0;t<P.tick_count;t++)if(!0===rt[t][0].visible){var e="reset";"left"===N.scroll_direction||"right"===N.scroll_direction?("reset"===(e="left"===N.scroll_direction?c(t):p(t))?(e=rt[t][0].reset,rt[t][0].headline.css("opacity",0)):rt[t][0].headline.css("opacity",1),rt[t][0].headline.css({transform:"translateX( "+e+"px )"})):("reset"===(e="up"===N.scroll_direction?l(t):_(t))?(e=rt[t][0].reset,rt[t][0].headline.css("opacity",0)):rt[t][0].headline.css("opacity",1),rt[t][0].headline.css({transform:"translateY( "+e+"px )"})),rt[t][0].position=e}}),1)}function c(t){var e=parseFloat(rt[t][0].position-.05*N.scroll_speed);return e<-(rt[t][0].headline.width()+N.offset)?e=f(t):e<parseFloat(tt-rt[t][0].headline.width()-N.scroll_spacing)&&u(t),e}function p(t){var e=parseFloat(rt[t][0].position+.05*N.scroll_speed);return e>tt+N.offset?e=f(t):e>N.scroll_spacing&&u(t),e}function l(t){var e=parseFloat(rt[t][0].position-.05*N.scroll_speed);return e<-(rt[t][0].headline.height()+N.offset)?e=f(t):e<et-rt[t][0].headline.height()-N.scroll_spacing&&u(t),e}function _(t){var e=parseFloat(rt[t][0].position+.05*N.scroll_speed);return e>et+N.offset?e=f(t):e>N.scroll_spacing&&u(t),e}function f(e){return P.tick_count>1&&(rt[e][0].visible=!1),P.tick_count===e+1&&(R.trigger("mtphr_dnt_scroll_complete",[P,rt]),t("body").trigger("mtphr_dnt_scroll_complete",[R,P,rt])),"reset"}function d(t){!1===rt[t][0].visible&&(P.previous_tick=parseInt(t-1),P.previous_tick<0&&(P.previous_tick=parseInt(P.tick_count-1)),P.current_tick=t,P.next_tick=parseInt(t+1),P.next_tick>=P.tick_count&&(P.next_tick=0))}function u(t){t===P.tick_count-1?N.scroll_loop&&(d(0),rt[0][0].visible=!0):(d(parseInt(t+1)),rt[t+1][0].visible=!0)}function h(){for(var t=0;t<P.tick_count;t++){var e,r=rt[t][0].headline;switch(N.scroll_direction){case"left":e=tt+N.offset,!1===rt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"right":e=parseInt("-"+(r.width()+N.offset)),!1===rt[t][0].visible&&r.css("transform","translateX( "+e+"px )");break;case"up":it&&r.css("width",tt),e=parseInt(et+N.offset),!1===rt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break;case"down":it&&r.css("width",tt),e=parseInt("-"+(r.height()+N.offset)),!1===rt[t][0].visible&&r.css("transform","translateY( "+e+"px )");break}rt[t][0].width=r.width(),rt[t][0].height=r.height(),!1===rt[t][0].visible&&(rt[t][0].position=e),rt[t][0].reset=e}}function g(){for(var t,e,r=0;r<P.tick_count;r++)if(rt[r]){switch(e=rt[r][0].headline,N.scroll_direction){case"left":t=tt+N.offset,e.css("transform","translateX( "+t+"px )");break;case"right":t=parseInt("-"+(e.width()+N.offset)),e.css("transform","translateX( "+t+"px )");break;case"up":it&&e.css("width",tt),t=parseInt(et+N.offset),e.css("transform","translateY( "+t+"px )");break;case"down":it&&e.css("width",tt),t=parseInt("-"+(e.height()+N.offset)),e.css("transform","translateY( "+t+"px )");break}rt[r][0].width=e.width(),rt[r][0].height=e.height(),rt[r][0].position=t,rt[r][0].reset=t,rt[r][0].visible=!1}if(P.current_tick=0,rt[P.current_tick][0].visible=!0,N.scroll_init)for("left"===N.scroll_direction?t=.1*tt:"right"===N.scroll_direction?t=.9*tt:"up"===N.scroll_direction?t=.1*et:"down"===N.scroll_direction&&(t=.9*et),r=0;r<P.tick_count;r++)switch(e=rt[r][0].headline,N.scroll_direction){case"left":t<tt&&(e.css("transform","translateX( "+t+"px )"),rt[r][0].position=t,rt[r][0].visible=!0,t=t+rt[r][0].width+N.scroll_spacing);break;case"right":t>0&&(t-=rt[r][0].width,e.css("transform","translateX( "+t+"px )"),rt[r][0].position=t,rt[r][0].visible=!0,t-=N.scroll_spacing);break;case"up":t<et&&(e.css("transform","translateY( "+t+"px )"),rt[r][0].position=t,rt[r][0].visible=!0,t=t+rt[r][0].height+N.scroll_spacing);break;case"down":t>0&&(e.css("transform","translateY( "+t+"px )"),e.stop(!0,!0).css("top",t+"px"),rt[r][0].position=t,rt[r][0].visible=!0,t-=N.scroll_spacing);break}}function v(){y()}function k(){clearInterval(st)}function m(){switch(S.find(".mtphr-dnt-tick").each((function(){rt.push(t(this)),t(this).imagesLoaded((function(){F()}))})),F(),S.find(".mtphr-dnt-tick").show(),N.rotate_type){case"fade":X(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":D(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":z(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":O(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":M(S,rt,parseInt(100*N.rotate_speed),N.rotate_ease);break}w(0),N.auto_rotate&&v(),S.on({mouseenter:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&k()},mouseleave:function(){N.auto_rotate&&N.rotate_pause&&!P.running&&!P.paused&&v()}})}function y(){k(),st=setInterval((function(){var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),b(t)}),parseInt(1e3*N.rotate_delay))}function b(e){P.current_tick!==e&&(N.auto_rotate&&k(),P.next_tick=e,N.before_change.call(R,S),R.trigger("mtphr_dnt_before_change_single",[P,rt]),t("body").trigger("mtphr_dnt_before_change",[R,P,rt]),P.running=1,I(e),x(e),P.previous_tick=P.current_tick,P.current_tick=e,ot=setTimeout((function(){N.after_change.call(R,S),R.trigger("mtphr_dnt_after_change_single",[P,rt]),t("body").trigger("mtphr_dnt_after_change",[R,P,rt]),at=N.rotate_type,P.reverse=0,P.running=0,N.auto_rotate&&!P.paused&&y()}),parseInt(100*N.rotate_speed)))}function w(t){Z&&(Z.children("a").removeClass("active"),Z.children('a[href="'+t+'"]').addClass("active"))}function x(e){switch(w(e),at){case"fade":Y(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":L(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":E(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":T(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":Q(S,t(rt[e]),t(rt[P.current_tick]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function I(e){switch(at){case"fade":C(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_left":W(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_right":j(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_down":A(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break;case"slide_up":q(S,t(rt[P.current_tick]),t(rt[e]),parseInt(100*N.rotate_speed),N.rotate_ease);break}}function F(){for(var e=0;e<P.tick_count;e++)t(rt[e]).width(tt+"px"),P.current_tick!==e&&t(rt[e]).css({left:parseFloat(tt+N.offset)+"px"});var r=t(rt[P.current_tick]).height();S.stop().css("height",r+"px")}function X(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,left:"auto"})}function Y(t,e,r,n,i){e.css({opacity:0,left:"auto"}),e.stop().animate({opacity:1},n,i);var s=e.height();t.stop().animate({height:s+"px"},n,i)}function C(e,r,n,i,s){r.stop().animate({opacity:0},i,s,(function(){t(this).css({left:parseFloat(tt+N.offset)+"px"}),r.remove(),e.append(r)}))}function D(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,left:0})}function L(t,e,r,n,i){var s=e.height();e.css({opacity:1,left:parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,i,(function(){})),e.stop().animate({left:"0"},n,i,(function(){}))}function W(t,e,r,n,i){e.stop().animate({left:"-"+parseFloat(tt+N.offset)+"px"},n,i,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function z(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,left:0})}function E(t,e,r,n,i){var s=e.height();e.css({opacity:1,left:"-"+parseFloat(tt+N.offset)+"px"}),t.stop().animate({height:s+"px"},n,i,(function(){})),e.stop().animate({left:"0"},n,i)}function j(t,e,r,n,i){e.stop().animate({left:parseFloat(tt+N.offset)+"px"},n,i,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function O(t,e){var r=e[0],n=r.height();t.css("height",n+"px"),r.css({opacity:1,top:0,left:"auto"})}function T(t,e,r,n,i){var s=e.height();e.css({opacity:1,top:"-"+parseFloat(s+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,i),e.stop().animate({top:"0"},n,i)}function A(t,e,r,n,i){var s=r.height();e.stop().animate({top:parseFloat(s+N.offset)+"px"},n,i,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function M(t,e){var r=e[0],n=r.height();t.css({height:n+"px",left:"auto"}),r.css({opacity:1,top:0})}function Q(t,e,r,n,i){var s=e.height();e.css({opacity:1,top:parseFloat(r.height()+N.offset)+"px",left:"auto"}),t.stop().animate({height:s+"px"},n,i),e.stop().animate({top:"0"},n,i)}function q(t,e,r,n,i){var s=e.height();e.stop().animate({top:"-"+parseFloat(s+N.offset)+"px"},n,i,(function(){e.css({opacity:0}),e.remove(),t.append(e)}))}function B(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),b(t)}function G(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),N.nav_reverse&&("slide_left"===N.rotate_type?at="slide_right":"slide_right"===N.rotate_type?at="slide_left":"slide_down"===N.rotate_type?at="slide_up":"slide_up"===N.rotate_type&&(at="slide_down"),P.reverse=1),b(t)}function H(t){t?(P.paused=!1,$.removeClass("paused"),"scroll"===N.type?a():v()):(P.paused=!0,$.addClass("paused"),"scroll"===N.type?s():k()),R.trigger("mtphr_dnt_play_pause",[P,rt])}function J(){if(P.running)return!1;var t=parseInt(P.current_tick+1);t===P.tick_count&&(t=0),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(at="slide_left"),b(t)}function K(){if(P.running)return!1;var t=parseInt(P.current_tick-1);t<0&&(t=P.tick_count-1),"slide_left"!==N.rotate_type&&"slide_right"!==N.rotate_type||(at="slide_right"),N.nav_reverse&&("slide_down"===N.rotate_type?at="slide_up":"slide_up"===N.rotate_type&&(at="slide_down"),P.reverse=1),b(t)}var N={id:"",type:"scroll",scroll_direction:"left",scroll_speed:10,scroll_pause:0,scroll_spacing:40,scroll_units:10,scroll_init:0,scroll_loop:1,rotate_type:"fade",auto_rotate:0,rotate_delay:10,rotate_pause:0,rotate_speed:10,rotate_ease:"easeOutExpo",nav_reverse:0,disable_touchswipe:0,offset:20,before_change:function(){},after_change:function(){},after_load:function(){}},P={id:N.id,tick_count:0,previous_tick:0,current_tick:0,next_tick:0,reverse:0,running:0,paused:0};e&&t.extend(N,e);var R=t(this),S=R.find(".mtphr-dnt-tick-contents"),U=R.find(".mtphr-dnt-nav-prev"),V=R.find(".mtphr-dnt-nav-next"),Z=R.find(".mtphr-dnt-control-links"),$=R.find(".mtphr-dnt-play-pause"),tt=S.outerWidth(!0),et=0,rt=[],nt,it=!0,st,at=N.rotate_type,ot;if(S.data("ditty:vars",P),U&&"rotate"===N.type&&(U.on("click",(function(t){t.preventDefault(),G()})),V.on("click",(function(t){t.preventDefault(),B()}))),Z&&"rotate"===N.type&&Z.children("a").on("click",(function(e){e.preventDefault();var r=parseInt(t(this).attr("href"));if(P.running)return!1;if(r===P.current_tick)return!1;var n=r<P.current_tick?1:0;N.nav_reverse&&n&&("slide_left"===N.rotate_type?at="slide_right":"slide_right"===N.rotate_type?at="slide_left":"slide_down"===N.rotate_type?at="slide_up":"slide_up"===N.rotate_type&&(at="slide_down"),P.reverse=1),b(r)})),$.on("click",(function(t){t.preventDefault(),H(P.paused)})),"rotate"!==N.type||N.disable_touchswipe||(S[0].addEventListener("swiped-left",(function(){J()})),S[0].addEventListener("swiped-right",(function(){K()}))),R.on("mtphr_dnt_next",(function(){B()})),R.on("mtphr_dnt_prev",(function(){G()})),R.on("mtphr_dnt_goto",(function(t,e){b(parseInt(e))})),R.on("mtphr_dnt_pause",(function(){H()})),R.on("mtphr_dnt_play",(function(){H(!0)})),t(window).on("resize",(function(){S.outerWidth()!==tt&&(tt=S.outerWidth(!0),"scroll"===N.type?("up"===N.scroll_direction||"down"===N.scroll_direction)&&it?g():h():"rotate"===N.type&&F())})),R.on("mtphr_dnt_resize_single",(function(){"scroll"===N.type?h():"rotate"===N.type&&F()})),t("body").on("mtphr_dnt_resize",(function(t,e){e&&e.indexOf(N.id)>=0&&("scroll"===N.type?h():"rotate"===N.type&&F())})),R.on("mtphr_dnt_replace_ticks",(function(e,n,i){clearInterval(nt),R.find(".mtphr-dnt-tick").remove(),n.each((function(){S.append(t(this))})),setTimeout((function(){r()}),i)})),0===R.width())var ct=setInterval((function(){R.width()>10&&(clearInterval(ct),tt=S.outerWidth(!0),r())}),100);else r()}))}};t.fn.ditty_news_ticker=function(r){return e[r]?e[r].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof r&&r?void t.error("Method "+r+" does not exist in ditty_news_ticker"):e.init.apply(this,arguments)}}(jQuery);
|
inc/static/js/ditty-rotate-ticker.js
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Ditty Rotate Ticker
|
3 |
-
* Date: 04/21/16
|
4 |
-
*
|
5 |
-
* @author Metaphor Creations
|
6 |
-
* @version 1.0.0
|
7 |
-
*
|
8 |
-
**/
|
9 |
-
|
10 |
-
( function($) {
|
11 |
-
|
12 |
-
var methods = {
|
13 |
-
|
14 |
-
init : function( options ) {
|
15 |
-
|
16 |
-
return this.each( function(){
|
17 |
-
|
18 |
-
// Create default options
|
19 |
-
var settings = {
|
20 |
-
id : '',
|
21 |
-
ticks : '',
|
22 |
-
autoplay : false,
|
23 |
-
speed : 750,
|
24 |
-
delay : 3000,
|
25 |
-
animation : 'horizontal',
|
26 |
-
animateHeight : true
|
27 |
-
};
|
28 |
-
|
29 |
-
// Add any set options
|
30 |
-
if (options) {
|
31 |
-
$.extend(settings, options);
|
32 |
-
}
|
33 |
-
|
34 |
-
// Useful variables. Play carefully.
|
35 |
-
var vars = {
|
36 |
-
id : settings.id,
|
37 |
-
current_tick : 0,
|
38 |
-
total_ticks : 0,
|
39 |
-
};
|
40 |
-
|
41 |
-
// Create variables
|
42 |
-
var $ticker = $(this),
|
43 |
-
$wrapper = $ticker.find('.mtphr-dnt-wrapper'),
|
44 |
-
$contents = $ticker.find('.mtphr-dnt-tick-contents');
|
45 |
-
|
46 |
-
// Add the vars
|
47 |
-
$ticker.data('ditty:vars', vars);
|
48 |
-
|
49 |
-
vars.total_ticks = settings.ticks.length;
|
50 |
-
|
51 |
-
|
52 |
-
/* --------------------------------------------------------- */
|
53 |
-
/* !Initialize rotate - 1.0.0 */
|
54 |
-
/* --------------------------------------------------------- */
|
55 |
-
|
56 |
-
$wrapper.unslider({
|
57 |
-
arrows: {
|
58 |
-
// Unslider default behaviour
|
59 |
-
prev: '<a class="unslider-arrow prev">Previous slide</a>',
|
60 |
-
next: '<a class="unslider-arrow next">Next slide</a>',
|
61 |
-
|
62 |
-
// Example: generate buttons to start/stop the slider autoplaying
|
63 |
-
stop: '<a class="unslider-pause" />',
|
64 |
-
start: '<a class="unslider-play">Play</a>'
|
65 |
-
},
|
66 |
-
animation: settings.animation,
|
67 |
-
selectors: {
|
68 |
-
container: '.mtphr-dnt-tick-contents',
|
69 |
-
slides: '.mtphr-dnt-tick'
|
70 |
-
},
|
71 |
-
animateHeight: settings.animateHeight
|
72 |
-
});
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
/* --------------------------------------------------------- */
|
82 |
-
/* !Close each */
|
83 |
-
/* --------------------------------------------------------- */
|
84 |
-
|
85 |
-
});
|
86 |
-
}
|
87 |
-
};
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
/**
|
94 |
-
* Setup the class
|
95 |
-
*
|
96 |
-
* @since 1.0.0
|
97 |
-
*/
|
98 |
-
$.fn.ditty_rotate_ticker = function( method ) {
|
99 |
-
|
100 |
-
if ( methods[method] ) {
|
101 |
-
return methods[method].apply( this, Array.prototype.slice.call(arguments, 1) );
|
102 |
-
} else if ( typeof method === 'object' || !method ) {
|
103 |
-
return methods.init.apply( this, arguments );
|
104 |
-
} else {
|
105 |
-
$.error( 'Method ' + method + ' does not exist in ditty_rotate_ticker' );
|
106 |
-
}
|
107 |
-
};
|
108 |
-
|
109 |
-
})( jQuery );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/js/imagesloaded.pkgd.min.js
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* imagesLoaded PACKAGED v4.1.4
|
3 |
-
* JavaScript is all like "You images are done yet or what?"
|
4 |
-
* MIT License
|
5 |
-
*/
|
6 |
-
|
7 |
-
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return t(e,i)}):"object"==typeof module&&module.exports?module.exports=t(e,require("ev-emitter")):e.imagesLoaded=t(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t="object"==typeof e&&"number"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return"string"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof t?r=t:i(this.options,t),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once("progress",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},r.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var e=this.getIsImageComplete();e&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.element,t])},o.makeJQueryPlugin=function(t){t=t||e.jQuery,t&&(h=t,h.fn.imagesLoaded=function(e,t){var i=new o(this,e,t);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/js/jquery.easing.js
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/
|
3 |
-
* Open source under the BSD License.
|
4 |
-
* Copyright � 2008 George McGinley Smith
|
5 |
-
* All rights reserved.
|
6 |
-
* https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
|
7 |
-
*/
|
8 |
-
|
9 |
-
(function (factory) {
|
10 |
-
if (typeof define === "function" && define.amd) {
|
11 |
-
define(['jquery'], function ($) {
|
12 |
-
return factory($);
|
13 |
-
});
|
14 |
-
} else if (typeof module === "object" && typeof module.exports === "object") {
|
15 |
-
exports = factory(require('jquery'));
|
16 |
-
} else {
|
17 |
-
factory(jQuery);
|
18 |
-
}
|
19 |
-
})(function($){
|
20 |
-
|
21 |
-
// Preserve the original jQuery "swing" easing as "jswing"
|
22 |
-
if (typeof $.easing !== 'undefined') {
|
23 |
-
$.easing['jswing'] = $.easing['swing'];
|
24 |
-
}
|
25 |
-
|
26 |
-
var pow = Math.pow,
|
27 |
-
sqrt = Math.sqrt,
|
28 |
-
sin = Math.sin,
|
29 |
-
cos = Math.cos,
|
30 |
-
PI = Math.PI,
|
31 |
-
c1 = 1.70158,
|
32 |
-
c2 = c1 * 1.525,
|
33 |
-
c3 = c1 + 1,
|
34 |
-
c4 = ( 2 * PI ) / 3,
|
35 |
-
c5 = ( 2 * PI ) / 4.5;
|
36 |
-
|
37 |
-
// x is the fraction of animation progress, in the range 0..1
|
38 |
-
function bounceOut(x) {
|
39 |
-
var n1 = 7.5625,
|
40 |
-
d1 = 2.75;
|
41 |
-
if ( x < 1/d1 ) {
|
42 |
-
return n1*x*x;
|
43 |
-
} else if ( x < 2/d1 ) {
|
44 |
-
return n1*(x-=(1.5/d1))*x + .75;
|
45 |
-
} else if ( x < 2.5/d1 ) {
|
46 |
-
return n1*(x-=(2.25/d1))*x + .9375;
|
47 |
-
} else {
|
48 |
-
return n1*(x-=(2.625/d1))*x + .984375;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
|
52 |
-
$.extend( $.easing,
|
53 |
-
{
|
54 |
-
def: 'easeOutQuad',
|
55 |
-
swing: function (x) {
|
56 |
-
return $.easing[$.easing.def](x);
|
57 |
-
},
|
58 |
-
easeInQuad: function (x) {
|
59 |
-
return x * x;
|
60 |
-
},
|
61 |
-
easeOutQuad: function (x) {
|
62 |
-
return 1 - ( 1 - x ) * ( 1 - x );
|
63 |
-
},
|
64 |
-
easeInOutQuad: function (x) {
|
65 |
-
return x < 0.5 ?
|
66 |
-
2 * x * x :
|
67 |
-
1 - pow( -2 * x + 2, 2 ) / 2;
|
68 |
-
},
|
69 |
-
easeInCubic: function (x) {
|
70 |
-
return x * x * x;
|
71 |
-
},
|
72 |
-
easeOutCubic: function (x) {
|
73 |
-
return 1 - pow( 1 - x, 3 );
|
74 |
-
},
|
75 |
-
easeInOutCubic: function (x) {
|
76 |
-
return x < 0.5 ?
|
77 |
-
4 * x * x * x :
|
78 |
-
1 - pow( -2 * x + 2, 3 ) / 2;
|
79 |
-
},
|
80 |
-
easeInQuart: function (x) {
|
81 |
-
return x * x * x * x;
|
82 |
-
},
|
83 |
-
easeOutQuart: function (x) {
|
84 |
-
return 1 - pow( 1 - x, 4 );
|
85 |
-
},
|
86 |
-
easeInOutQuart: function (x) {
|
87 |
-
return x < 0.5 ?
|
88 |
-
8 * x * x * x * x :
|
89 |
-
1 - pow( -2 * x + 2, 4 ) / 2;
|
90 |
-
},
|
91 |
-
easeInQuint: function (x) {
|
92 |
-
return x * x * x * x * x;
|
93 |
-
},
|
94 |
-
easeOutQuint: function (x) {
|
95 |
-
return 1 - pow( 1 - x, 5 );
|
96 |
-
},
|
97 |
-
easeInOutQuint: function (x) {
|
98 |
-
return x < 0.5 ?
|
99 |
-
16 * x * x * x * x * x :
|
100 |
-
1 - pow( -2 * x + 2, 5 ) / 2;
|
101 |
-
},
|
102 |
-
easeInSine: function (x) {
|
103 |
-
return 1 - cos( x * PI/2 );
|
104 |
-
},
|
105 |
-
easeOutSine: function (x) {
|
106 |
-
return sin( x * PI/2 );
|
107 |
-
},
|
108 |
-
easeInOutSine: function (x) {
|
109 |
-
return -( cos( PI * x ) - 1 ) / 2;
|
110 |
-
},
|
111 |
-
easeInExpo: function (x) {
|
112 |
-
return x === 0 ? 0 : pow( 2, 10 * x - 10 );
|
113 |
-
},
|
114 |
-
easeOutExpo: function (x) {
|
115 |
-
return x === 1 ? 1 : 1 - pow( 2, -10 * x );
|
116 |
-
},
|
117 |
-
easeInOutExpo: function (x) {
|
118 |
-
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
119 |
-
pow( 2, 20 * x - 10 ) / 2 :
|
120 |
-
( 2 - pow( 2, -20 * x + 10 ) ) / 2;
|
121 |
-
},
|
122 |
-
easeInCirc: function (x) {
|
123 |
-
return 1 - sqrt( 1 - pow( x, 2 ) );
|
124 |
-
},
|
125 |
-
easeOutCirc: function (x) {
|
126 |
-
return sqrt( 1 - pow( x - 1, 2 ) );
|
127 |
-
},
|
128 |
-
easeInOutCirc: function (x) {
|
129 |
-
return x < 0.5 ?
|
130 |
-
( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
|
131 |
-
( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
|
132 |
-
},
|
133 |
-
easeInElastic: function (x) {
|
134 |
-
return x === 0 ? 0 : x === 1 ? 1 :
|
135 |
-
-pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
|
136 |
-
},
|
137 |
-
easeOutElastic: function (x) {
|
138 |
-
return x === 0 ? 0 : x === 1 ? 1 :
|
139 |
-
pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
|
140 |
-
},
|
141 |
-
easeInOutElastic: function (x) {
|
142 |
-
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
|
143 |
-
-( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
|
144 |
-
pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
|
145 |
-
},
|
146 |
-
easeInBack: function (x) {
|
147 |
-
return c3 * x * x * x - c1 * x * x;
|
148 |
-
},
|
149 |
-
easeOutBack: function (x) {
|
150 |
-
return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
|
151 |
-
},
|
152 |
-
easeInOutBack: function (x) {
|
153 |
-
return x < 0.5 ?
|
154 |
-
( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
|
155 |
-
( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
|
156 |
-
},
|
157 |
-
easeInBounce: function (x) {
|
158 |
-
return 1 - bounceOut( 1 - x );
|
159 |
-
},
|
160 |
-
easeOutBounce: bounceOut,
|
161 |
-
easeInOutBounce: function (x) {
|
162 |
-
return x < 0.5 ?
|
163 |
-
( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
|
164 |
-
( 1 + bounceOut( 2 * x - 1 ) ) / 2;
|
165 |
-
}
|
166 |
-
});
|
167 |
-
|
168 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/js/jquery.touchSwipe.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
(function(a){if(typeof define==="function"&&define.amd&&define.amd.jQuery){define(["jquery"],a)}else{a(jQuery)}}(function(f){var y="1.6.9",p="left",o="right",e="up",x="down",c="in",A="out",m="none",s="auto",l="swipe",t="pinch",B="tap",j="doubletap",b="longtap",z="hold",E="horizontal",u="vertical",i="all",r=10,g="start",k="move",h="end",q="cancel",a="ontouchstart" in window,v=window.navigator.msPointerEnabled&&!window.navigator.pointerEnabled,d=window.navigator.pointerEnabled||window.navigator.msPointerEnabled,C="TouchSwipe";var n={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,hold:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"label, button, input, select, textarea, a, .noSwipe",preventDefaultEvents:true};f.fn.swipe=function(H){var G=f(this),F=G.data(C);if(F&&typeof H==="string"){if(F[H]){return F[H].apply(this,Array.prototype.slice.call(arguments,1))}else{f.error("Method "+H+" does not exist on jQuery.swipe")}}else{if(!F&&(typeof H==="object"||!H)){return w.apply(this,arguments)}}return G};f.fn.swipe.version=y;f.fn.swipe.defaults=n;f.fn.swipe.phases={PHASE_START:g,PHASE_MOVE:k,PHASE_END:h,PHASE_CANCEL:q};f.fn.swipe.directions={LEFT:p,RIGHT:o,UP:e,DOWN:x,IN:c,OUT:A};f.fn.swipe.pageScroll={NONE:m,HORIZONTAL:E,VERTICAL:u,AUTO:s};f.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:i};function w(F){if(F&&(F.allowPageScroll===undefined&&(F.swipe!==undefined||F.swipeStatus!==undefined))){F.allowPageScroll=m}if(F.click!==undefined&&F.tap===undefined){F.tap=F.click}if(!F){F={}}F=f.extend({},f.fn.swipe.defaults,F);return this.each(function(){var H=f(this);var G=H.data(C);if(!G){G=new D(this,F);H.data(C,G)}})}function D(a5,aw){var aA=(a||d||!aw.fallbackToMouseEvents),K=aA?(d?(v?"MSPointerDown":"pointerdown"):"touchstart"):"mousedown",az=aA?(d?(v?"MSPointerMove":"pointermove"):"touchmove"):"mousemove",V=aA?(d?(v?"MSPointerUp":"pointerup"):"touchend"):"mouseup",T=aA?null:"mouseleave",aE=(d?(v?"MSPointerCancel":"pointercancel"):"touchcancel");var ah=0,aQ=null,ac=0,a2=0,a0=0,H=1,ar=0,aK=0,N=null;var aS=f(a5);var aa="start";var X=0;var aR=null;var U=0,a3=0,a6=0,ae=0,O=0;var aX=null,ag=null;try{aS.bind(K,aO);aS.bind(aE,ba)}catch(al){f.error("events not supported "+K+","+aE+" on jQuery.swipe")}this.enable=function(){aS.bind(K,aO);aS.bind(aE,ba);return aS};this.disable=function(){aL();return aS};this.destroy=function(){aL();aS.data(C,null);aS=null};this.option=function(bd,bc){if(aw[bd]!==undefined){if(bc===undefined){return aw[bd]}else{aw[bd]=bc}}else{f.error("Option "+bd+" does not exist on jQuery.swipe.options")}return null};function aO(be){if(aC()){return}if(f(be.target).closest(aw.excludedElements,aS).length>0){return}var bf=be.originalEvent?be.originalEvent:be;var bd,bg=bf.touches,bc=bg?bg[0]:bf;aa=g;if(bg){X=bg.length}else{be.preventDefault()}ah=0;aQ=null;aK=null;ac=0;a2=0;a0=0;H=1;ar=0;aR=ak();N=ab();S();if(!bg||(X===aw.fingers||aw.fingers===i)||aY()){aj(0,bc);U=au();if(X==2){aj(1,bg[1]);a2=a0=av(aR[0].start,aR[1].start)}if(aw.swipeStatus||aw.pinchStatus){bd=P(bf,aa)}}else{bd=false}if(bd===false){aa=q;P(bf,aa);return bd}else{if(aw.hold){ag=setTimeout(f.proxy(function(){aS.trigger("hold",[bf.target]);if(aw.hold){bd=aw.hold.call(aS,bf,bf.target)}},this),aw.longTapThreshold)}ap(true)}return null}function a4(bf){var bi=bf.originalEvent?bf.originalEvent:bf;if(aa===h||aa===q||an()){return}var be,bj=bi.touches,bd=bj?bj[0]:bi;var bg=aI(bd);a3=au();if(bj){X=bj.length}if(aw.hold){clearTimeout(ag)}aa=k;if(X==2){if(a2==0){aj(1,bj[1]);a2=a0=av(aR[0].start,aR[1].start)}else{aI(bj[1]);a0=av(aR[0].end,aR[1].end);aK=at(aR[0].end,aR[1].end)}H=a8(a2,a0);ar=Math.abs(a2-a0)}if((X===aw.fingers||aw.fingers===i)||!bj||aY()){aQ=aM(bg.start,bg.end);am(bf,aQ);ah=aT(bg.start,bg.end);ac=aN();aJ(aQ,ah);if(aw.swipeStatus||aw.pinchStatus){be=P(bi,aa)}if(!aw.triggerOnTouchEnd||aw.triggerOnTouchLeave){var bc=true;if(aw.triggerOnTouchLeave){var bh=aZ(this);bc=F(bg.end,bh)}if(!aw.triggerOnTouchEnd&&bc){aa=aD(k)}else{if(aw.triggerOnTouchLeave&&!bc){aa=aD(h)}}if(aa==q||aa==h){P(bi,aa)}}}else{aa=q;P(bi,aa)}if(be===false){aa=q;P(bi,aa)}}function M(bc){var bd=bc.originalEvent?bc.originalEvent:bc,be=bd.touches;if(be){if(be.length){G();return true}}if(an()){X=ae}a3=au();ac=aN();if(bb()||!ao()){aa=q;P(bd,aa)}else{if(aw.triggerOnTouchEnd||(aw.triggerOnTouchEnd==false&&aa===k)){bc.preventDefault();aa=h;P(bd,aa)}else{if(!aw.triggerOnTouchEnd&&a7()){aa=h;aG(bd,aa,B)}else{if(aa===k){aa=q;P(bd,aa)}}}}ap(false);return null}function ba(){X=0;a3=0;U=0;a2=0;a0=0;H=1;S();ap(false)}function L(bc){var bd=bc.originalEvent?bc.originalEvent:bc;if(aw.triggerOnTouchLeave){aa=aD(h);P(bd,aa)}}function aL(){aS.unbind(K,aO);aS.unbind(aE,ba);aS.unbind(az,a4);aS.unbind(V,M);if(T){aS.unbind(T,L)}ap(false)}function aD(bg){var bf=bg;var be=aB();var bd=ao();var bc=bb();if(!be||bc){bf=q}else{if(bd&&bg==k&&(!aw.triggerOnTouchEnd||aw.triggerOnTouchLeave)){bf=h}else{if(!bd&&bg==h&&aw.triggerOnTouchLeave){bf=q}}}return bf}function P(be,bc){var bd,bf=be.touches;if((J()||W())||(Q()||aY())){if(J()||W()){bd=aG(be,bc,l)}if((Q()||aY())&&bd!==false){bd=aG(be,bc,t)}}else{if(aH()&&bd!==false){bd=aG(be,bc,j)}else{if(aq()&&bd!==false){bd=aG(be,bc,b)}else{if(ai()&&bd!==false){bd=aG(be,bc,B)}}}}if(bc===q){ba(be)}if(bc===h){if(bf){if(!bf.length){ba(be)}}else{ba(be)}}return bd}function aG(bf,bc,be){var bd;if(be==l){aS.trigger("swipeStatus",[bc,aQ||null,ah||0,ac||0,X,aR]);if(aw.swipeStatus){bd=aw.swipeStatus.call(aS,bf,bc,aQ||null,ah||0,ac||0,X,aR);if(bd===false){return false}}if(bc==h&&aW()){aS.trigger("swipe",[aQ,ah,ac,X,aR]);if(aw.swipe){bd=aw.swipe.call(aS,bf,aQ,ah,ac,X,aR);if(bd===false){return false}}switch(aQ){case p:aS.trigger("swipeLeft",[aQ,ah,ac,X,aR]);if(aw.swipeLeft){bd=aw.swipeLeft.call(aS,bf,aQ,ah,ac,X,aR)}break;case o:aS.trigger("swipeRight",[aQ,ah,ac,X,aR]);if(aw.swipeRight){bd=aw.swipeRight.call(aS,bf,aQ,ah,ac,X,aR)}break;case e:aS.trigger("swipeUp",[aQ,ah,ac,X,aR]);if(aw.swipeUp){bd=aw.swipeUp.call(aS,bf,aQ,ah,ac,X,aR)}break;case x:aS.trigger("swipeDown",[aQ,ah,ac,X,aR]);if(aw.swipeDown){bd=aw.swipeDown.call(aS,bf,aQ,ah,ac,X,aR)}break}}}if(be==t){aS.trigger("pinchStatus",[bc,aK||null,ar||0,ac||0,X,H,aR]);if(aw.pinchStatus){bd=aw.pinchStatus.call(aS,bf,bc,aK||null,ar||0,ac||0,X,H,aR);if(bd===false){return false}}if(bc==h&&a9()){switch(aK){case c:aS.trigger("pinchIn",[aK||null,ar||0,ac||0,X,H,aR]);if(aw.pinchIn){bd=aw.pinchIn.call(aS,bf,aK||null,ar||0,ac||0,X,H,aR)}break;case A:aS.trigger("pinchOut",[aK||null,ar||0,ac||0,X,H,aR]);if(aw.pinchOut){bd=aw.pinchOut.call(aS,bf,aK||null,ar||0,ac||0,X,H,aR)}break}}}if(be==B){if(bc===q||bc===h){clearTimeout(aX);clearTimeout(ag);if(Z()&&!I()){O=au();aX=setTimeout(f.proxy(function(){O=null;aS.trigger("tap",[bf.target]);if(aw.tap){bd=aw.tap.call(aS,bf,bf.target)}},this),aw.doubleTapThreshold)}else{O=null;aS.trigger("tap",[bf.target]);if(aw.tap){bd=aw.tap.call(aS,bf,bf.target)}}}}else{if(be==j){if(bc===q||bc===h){clearTimeout(aX);O=null;aS.trigger("doubletap",[bf.target]);if(aw.doubleTap){bd=aw.doubleTap.call(aS,bf,bf.target)}}}else{if(be==b){if(bc===q||bc===h){clearTimeout(aX);O=null;aS.trigger("longtap",[bf.target]);if(aw.longTap){bd=aw.longTap.call(aS,bf,bf.target)}}}}}return bd}function ao(){var bc=true;if(aw.threshold!==null){bc=ah>=aw.threshold}return bc}function bb(){var bc=false;if(aw.cancelThreshold!==null&&aQ!==null){bc=(aU(aQ)-ah)>=aw.cancelThreshold}return bc}function af(){if(aw.pinchThreshold!==null){return ar>=aw.pinchThreshold}return true}function aB(){var bc;if(aw.maxTimeThreshold){if(ac>=aw.maxTimeThreshold){bc=false}else{bc=true}}else{bc=true}return bc}function am(bc,bd){if(aw.preventDefaultEvents===false){return}if(aw.allowPageScroll===m){bc.preventDefault()}else{var be=aw.allowPageScroll===s;switch(bd){case p:if((aw.swipeLeft&&be)||(!be&&aw.allowPageScroll!=E)){bc.preventDefault()}break;case o:if((aw.swipeRight&&be)||(!be&&aw.allowPageScroll!=E)){bc.preventDefault()}break;case e:if((aw.swipeUp&&be)||(!be&&aw.allowPageScroll!=u)){bc.preventDefault()}break;case x:if((aw.swipeDown&&be)||(!be&&aw.allowPageScroll!=u)){bc.preventDefault()}break}}}function a9(){var bd=aP();var bc=Y();var be=af();return bd&&bc&&be}function aY(){return !!(aw.pinchStatus||aw.pinchIn||aw.pinchOut)}function Q(){return !!(a9()&&aY())}function aW(){var bf=aB();var bh=ao();var be=aP();var bc=Y();var bd=bb();var bg=!bd&&bc&&be&&bh&&bf;return bg}function W(){return !!(aw.swipe||aw.swipeStatus||aw.swipeLeft||aw.swipeRight||aw.swipeUp||aw.swipeDown)}function J(){return !!(aW()&&W())}function aP(){return((X===aw.fingers||aw.fingers===i)||!a)}function Y(){return aR[0].end.x!==0}function a7(){return !!(aw.tap)}function Z(){return !!(aw.doubleTap)}function aV(){return !!(aw.longTap)}function R(){if(O==null){return false}var bc=au();return(Z()&&((bc-O)<=aw.doubleTapThreshold))}function I(){return R()}function ay(){return((X===1||!a)&&(isNaN(ah)||ah<aw.threshold))}function a1(){return((ac>aw.longTapThreshold)&&(ah<r))}function ai(){return !!(ay()&&a7())}function aH(){return !!(R()&&Z())}function aq(){return !!(a1()&&aV())}function G(){a6=au();ae=event.touches.length+1}function S(){a6=0;ae=0}function an(){var bc=false;if(a6){var bd=au()-a6;if(bd<=aw.fingerReleaseThreshold){bc=true}}return bc}function aC(){return !!(aS.data(C+"_intouch")===true)}function ap(bc){if(bc===true){aS.bind(az,a4);aS.bind(V,M);if(T){aS.bind(T,L)}}else{aS.unbind(az,a4,false);aS.unbind(V,M,false);if(T){aS.unbind(T,L,false)}}aS.data(C+"_intouch",bc===true)}function aj(bd,bc){var be=bc.identifier!==undefined?bc.identifier:0;aR[bd].identifier=be;aR[bd].start.x=aR[bd].end.x=bc.pageX||bc.clientX;aR[bd].start.y=aR[bd].end.y=bc.pageY||bc.clientY;return aR[bd]}function aI(bc){var be=bc.identifier!==undefined?bc.identifier:0;var bd=ad(be);bd.end.x=bc.pageX||bc.clientX;bd.end.y=bc.pageY||bc.clientY;return bd}function ad(bd){for(var bc=0;bc<aR.length;bc++){if(aR[bc].identifier==bd){return aR[bc]}}}function ak(){var bc=[];for(var bd=0;bd<=5;bd++){bc.push({start:{x:0,y:0},end:{x:0,y:0},identifier:0})}return bc}function aJ(bc,bd){bd=Math.max(bd,aU(bc));N[bc].distance=bd}function aU(bc){if(N[bc]){return N[bc].distance}return undefined}function ab(){var bc={};bc[p]=ax(p);bc[o]=ax(o);bc[e]=ax(e);bc[x]=ax(x);return bc}function ax(bc){return{direction:bc,distance:0}}function aN(){return a3-U}function av(bf,be){var bd=Math.abs(bf.x-be.x);var bc=Math.abs(bf.y-be.y);return Math.round(Math.sqrt(bd*bd+bc*bc))}function a8(bc,bd){var be=(bd/bc)*1;return be.toFixed(2)}function at(){if(H<1){return A}else{return c}}function aT(bd,bc){return Math.round(Math.sqrt(Math.pow(bc.x-bd.x,2)+Math.pow(bc.y-bd.y,2)))}function aF(bf,bd){var bc=bf.x-bd.x;var bh=bd.y-bf.y;var be=Math.atan2(bh,bc);var bg=Math.round(be*180/Math.PI);if(bg<0){bg=360-Math.abs(bg)}return bg}function aM(bd,bc){var be=aF(bd,bc);if((be<=45)&&(be>=0)){return p}else{if((be<=360)&&(be>=315)){return p}else{if((be>=135)&&(be<=225)){return o}else{if((be>45)&&(be<135)){return x}else{return e}}}}}function au(){var bc=new Date();return bc.getTime()}function aZ(bc){bc=f(bc);var be=bc.offset();var bd={left:be.left,right:be.left+bc.outerWidth(),top:be.top,bottom:be.top+bc.outerHeight()};return bd}function F(bc,bd){return(bc.x>bd.left&&bc.x<bd.right&&bc.y>bd.top&&bc.y<bd.bottom)}}}));
|
|
inc/static/js/partials/admin-general.js
CHANGED
@@ -25,7 +25,7 @@ jQuery( document ).ready( function($) {
|
|
25 |
/* !Main settings selects - 2.0.0 */
|
26 |
/* --------------------------------------------------------- */
|
27 |
|
28 |
-
$('
|
29 |
e.preventDefault();
|
30 |
|
31 |
var value = $(this).attr('href');
|
@@ -66,38 +66,7 @@ jQuery( document ).ready( function($) {
|
|
66 |
'lineWrapping' : true
|
67 |
});
|
68 |
myCodeMirror.setSize( false, 140 );
|
69 |
-
});
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
/* --------------------------------------------------------- */
|
74 |
-
/* !Code select - 1.4.0 */
|
75 |
-
/* --------------------------------------------------------- */
|
76 |
-
|
77 |
-
$('.mtphr-dnt-code-select').click( function(e) {
|
78 |
-
e.preventDefault();
|
79 |
-
|
80 |
-
var $pre = $(this).siblings('pre'),
|
81 |
-
range,
|
82 |
-
selection;
|
83 |
-
|
84 |
-
var refNode = $pre[0];
|
85 |
-
if ( $.browser.msie ) {
|
86 |
-
range = document.body.createTextRange();
|
87 |
-
range.moveToElementText( refNode );
|
88 |
-
range.select();
|
89 |
-
} else if ( $.browser.mozilla || $.browser.opera ) {
|
90 |
-
selection = window.getSelection();
|
91 |
-
range = document.createRange();
|
92 |
-
range.selectNodeContents( refNode );
|
93 |
-
selection.removeAllRanges();
|
94 |
-
selection.addRange( range );
|
95 |
-
} else if ( $.browser.safari || $.browser.chrome ) {
|
96 |
-
selection = window.getSelection();
|
97 |
-
selection.setBaseAndExtent( refNode, 0, refNode, 1 );
|
98 |
-
}
|
99 |
-
});
|
100 |
-
|
101 |
|
102 |
|
103 |
/* --------------------------------------------------------- */
|
@@ -119,7 +88,7 @@ jQuery( document ).ready( function($) {
|
|
119 |
// Set the metaboxes
|
120 |
$('#mtphr-dnt-'+kind+'-metaboxes > div').stop(true, true).hide();
|
121 |
var metaboxes = $button.attr('metabox').split(' ');
|
122 |
-
for( var i=0; i<metaboxes.length; i++ ) {
|
123 |
$('#'+metaboxes[i]).show();
|
124 |
}
|
125 |
|
@@ -139,7 +108,7 @@ jQuery( document ).ready( function($) {
|
|
139 |
mtphr_dnt_toggle_metaboxes( $('.mtphr-dnt-mode-toggle.button-primary'), 'mode' );
|
140 |
}
|
141 |
|
142 |
-
$('
|
143 |
|
144 |
e.preventDefault();
|
145 |
if( !$(this).hasClass('button-primary') ) {
|
@@ -147,7 +116,7 @@ jQuery( document ).ready( function($) {
|
|
147 |
}
|
148 |
});
|
149 |
|
150 |
-
$('
|
151 |
|
152 |
e.preventDefault();
|
153 |
if( !$(this).hasClass('button-primary') ) {
|
@@ -292,19 +261,16 @@ jQuery( document ).ready( function($) {
|
|
292 |
/* --------------------------------------------------------- */
|
293 |
/* !Tool tips - 2.0.0 */
|
294 |
/* --------------------------------------------------------- */
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
$('body').on( 'click', '.mtphr-dnt-help[data-tooltip!=""]', function(e) {
|
306 |
-
e.preventDefault();
|
307 |
-
});
|
308 |
|
309 |
|
310 |
|
@@ -356,14 +322,15 @@ jQuery( document ).ready( function($) {
|
|
356 |
}
|
357 |
|
358 |
var $table = $(this);
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
367 |
|
368 |
$table.sortable( {
|
369 |
handle: '.mtphr-dnt-list-heading',
|
@@ -453,7 +420,7 @@ jQuery( document ).ready( function($) {
|
|
453 |
// Reset the duplicate
|
454 |
$dup.find('textarea, input, select').each( function() {
|
455 |
if( $(this).attr('type') === 'checkbox' || $(this).attr('type') === 'radio' ) {
|
456 |
-
$(this).
|
457 |
} else {
|
458 |
$(this).val('');
|
459 |
}
|
@@ -497,8 +464,15 @@ jQuery( document ).ready( function($) {
|
|
497 |
$item.after( $dup );
|
498 |
$dup.fadeIn().addClass(unique_class);
|
499 |
|
500 |
-
//
|
501 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
|
503 |
// Set the order
|
504 |
mtphr_dnt_list_set_order();
|
25 |
/* !Main settings selects - 2.0.0 */
|
26 |
/* --------------------------------------------------------- */
|
27 |
|
28 |
+
$('#mtphr-dnt-metabox-group-toggles').on( 'click', '.mtphr-dnt-metabox-group-toggle', function(e) {
|
29 |
e.preventDefault();
|
30 |
|
31 |
var value = $(this).attr('href');
|
66 |
'lineWrapping' : true
|
67 |
});
|
68 |
myCodeMirror.setSize( false, 140 );
|
69 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
|
72 |
/* --------------------------------------------------------- */
|
88 |
// Set the metaboxes
|
89 |
$('#mtphr-dnt-'+kind+'-metaboxes > div').stop(true, true).hide();
|
90 |
var metaboxes = $button.attr('metabox').split(' ');
|
91 |
+
for( var i=0; i < metaboxes.length; i++ ) {
|
92 |
$('#'+metaboxes[i]).show();
|
93 |
}
|
94 |
|
108 |
mtphr_dnt_toggle_metaboxes( $('.mtphr-dnt-mode-toggle.button-primary'), 'mode' );
|
109 |
}
|
110 |
|
111 |
+
$('#mtphr-dnt-type-select').on( 'click', '.mtphr-dnt-type-toggle', function(e) {
|
112 |
|
113 |
e.preventDefault();
|
114 |
if( !$(this).hasClass('button-primary') ) {
|
116 |
}
|
117 |
});
|
118 |
|
119 |
+
$('#mtphr-dnt-mode-select').on( 'click', '.mtphr-dnt-mode-toggle', function(e) {
|
120 |
|
121 |
e.preventDefault();
|
122 |
if( !$(this).hasClass('button-primary') ) {
|
261 |
/* --------------------------------------------------------- */
|
262 |
/* !Tool tips - 2.0.0 */
|
263 |
/* --------------------------------------------------------- */
|
264 |
+
|
265 |
+
// Setup protip
|
266 |
+
$.protip( {
|
267 |
+
defaults: {
|
268 |
+
position: 'top',
|
269 |
+
size: 'small',
|
270 |
+
scheme: 'black',
|
271 |
+
classes: 'ditty-protip',
|
272 |
+
}
|
273 |
+
} );
|
|
|
|
|
|
|
274 |
|
275 |
|
276 |
|
322 |
}
|
323 |
|
324 |
var $table = $(this);
|
325 |
+
// Setup protip
|
326 |
+
$.protip( {
|
327 |
+
defaults: {
|
328 |
+
position: 'top',
|
329 |
+
size: 'small',
|
330 |
+
scheme: 'black',
|
331 |
+
classes: 'ditty-protip',
|
332 |
+
}
|
333 |
+
} );
|
334 |
|
335 |
$table.sortable( {
|
336 |
handle: '.mtphr-dnt-list-heading',
|
420 |
// Reset the duplicate
|
421 |
$dup.find('textarea, input, select').each( function() {
|
422 |
if( $(this).attr('type') === 'checkbox' || $(this).attr('type') === 'radio' ) {
|
423 |
+
$(this).attr('checked', false);
|
424 |
} else {
|
425 |
$(this).val('');
|
426 |
}
|
464 |
$item.after( $dup );
|
465 |
$dup.fadeIn().addClass(unique_class);
|
466 |
|
467 |
+
// Setup protip
|
468 |
+
$.protip( {
|
469 |
+
defaults: {
|
470 |
+
position: 'top',
|
471 |
+
size: 'small',
|
472 |
+
scheme: 'black',
|
473 |
+
classes: 'ditty-protip',
|
474 |
+
}
|
475 |
+
} );
|
476 |
|
477 |
// Set the order
|
478 |
mtphr_dnt_list_set_order();
|
inc/static/js/script-admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){"use strict";function e(e){return this.each((function(){var n=t(this),r=n.data("bs.mtphr_dnt_affix"),o="object"==typeof e&&e;r||n.data("bs.mtphr_dnt_affix",r=new i(this,o)),"string"==typeof e&&r[e]()}))}var i=function(e,n){this.options=t.extend({},i.DEFAULTS,n),this.$target=t(this.options.target).on("scroll.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.mtphr_dnt_affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.5",i.RESET="mtphr_dnt_affix mtphr_dnt_affix-top mtphr_dnt_affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(t,e,i,n){var r=this.$target.scrollTop(),o=this.$element.offset(),a=this.$target.height();if(null!==i&&"top"===this.mtphr_dnt_affixed)return r<i&&"top";if("bottom"===this.mtphr_dnt_affixed)return null!==i?!(r+this.unpin<=o.top)&&"bottom":!(r+a<=t-n)&&"bottom";var s=null===this.mtphr_dnt_affixed,d=s?r:o.top,h;return null!==i&&r<=i?"top":null!==n&&d+(s?a:e)>=t-n&&"bottom"},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("mtphr_dnt_affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),n=this.options.offset,r=n.top,o=n.bottom,a=Math.max(t(document).height(),t(document.body).height());"object"!=typeof n&&(o=r=n),"function"==typeof r&&(r=n.top(this.$element)),"function"==typeof o&&(o=n.bottom(this.$element));var s=this.getState(a,e,r,o);if(this.mtphr_dnt_affixed!==s){null!==this.unpin&&this.$element.css("top","");var d="mtphr_dnt_affix"+(s?"-"+s:""),h=t.Event(d+".bs.mtphr_dnt_affix");if(this.$element.trigger(h),h.isDefaultPrevented())return;this.mtphr_dnt_affixed=s,this.unpin="bottom"===s?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(d).trigger(d.replace("mtphr_dnt_affix","mtphr_dnt_affixed")+".bs.mtphr_dnt_affix")}"bottom"===s&&this.$element.offset({top:a-e-o})}};var n=t.fn.mtphr_dnt_affix;t.fn.mtphr_dnt_affix=e,t.fn.mtphr_dnt_affix.Constructor=i,t.fn.mtphr_dnt_affix.noConflict=function(){return t.fn.mtphr_dnt_affix=n,this},t(window).on("load",(function(){t('[data-spy="mtphr_dnt_affix"]').each((function(){var i=t(this),n=i.data();n.offset=n.offset||{},null!==n.offsetBottom&&(n.offset.bottom=n.offsetBottom),null!==n.offsetTop&&(n.offset.top=n.offsetTop),e.call(i,n)}))}))}(jQuery),jQuery(document).ready((function(t){function e(e,i){t("#mtphr-dnt-"+i+"-metaboxes > div").stop(!0,!0).hide();for(var n=e.attr("metabox").split(" "),r=0;r<n.length;r++)t("#"+n[r]).show();e.siblings("a").removeClass("button-primary"),e.addClass("button-primary"),e.siblings("input").val(e.attr("href").substring(1))}function i(t){var e;t.find("input").is(":checked")?t.next().fadeOut():t.next().fadeIn()}var n=t("#mtphr-dnt-settings-select"),r=t("#wpadminbar");n.mtphr_dnt_affix({offset:{top:function(){return t(window).width()<601?this.top=n.offset().top+5:this.top=n.offset().top-r.height()+5}}}),t(".mtphr-dnt-metabox-group-toggle").click((function(e){e.preventDefault();var i=t(this).attr("href");t(".mtphr-dnt-metabox-group-toggle").removeClass("active"),t(".mtphr-dnt-metabox-group").removeClass("active"),t(this).addClass("active"),t(i).addClass("active"),t('input[name="_mtphr_dnt_admin_tab"]').val(i)})),t(".mtphr-dnt-codemirror-css").each((function(){var e=t(this).children("textarea");CodeMirror.fromTextArea(e[0],{mode:"css",lineNumbers:!0,lineWrapping:!0,viewportMargin:1/0})})),t(".mtphr-dnt-codemirror-js").each((function(){var e=t(this).children("textarea"),i;CodeMirror.fromTextArea(e[0],{mode:"htmlmixed",lineNumbers:!0,lineWrapping:!0}).setSize(!1,140)})),t(".mtphr-dnt-code-select").click((function(e){e.preventDefault();var i,n,r,o=t(this).siblings("pre")[0];t.browser.msie?((n=document.body.createTextRange()).moveToElementText(o),n.select()):t.browser.mozilla||t.browser.opera?(r=window.getSelection(),(n=document.createRange()).selectNodeContents(o),r.removeAllRanges(),r.addRange(n)):(t.browser.safari||t.browser.chrome)&&(r=window.getSelection()).setBaseAndExtent(o,0,o,1)})),t('input[name="_mtphr_dnt_admin_javascript"]').length&&t('input[name="_mtphr_dnt_admin_javascript"]').val("ok"),t(".mtphr-dnt-type-toggle.button-primary").length&&e(t(".mtphr-dnt-type-toggle.button-primary"),"type"),t(".mtphr-dnt-mode-toggle.button-primary").length&&e(t(".mtphr-dnt-mode-toggle.button-primary"),"mode"),t(".mtphr-dnt-type-toggle").click((function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"type")})),t(".mtphr-dnt-mode-toggle").click((function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"mode")})),t(".mtphr-dnt-sort").length>0&&(t(".mtphr-dnt-sort").sortable({handle:".mtphr-dnt-sort-heading",items:".mtphr-dnt-sort-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r}}),t("body").on("click",".mtphr-dnt-sort-heading.optional",(function(e){e.preventDefault();var i=t(this).parents(".mtphr-dnt-sort-item"),n=t(this).next(".mtphr-dnt-sort-item-fields"),r=t(this).children("input");i.hasClass("active")?(i.removeClass("active"),r.val("off"),n.length&&n.stop(!0,!0).slideUp(1e3,"easeOutQuint")):(i.addClass("active"),r.val("on"),n.length&&n.stop(!0,!0).slideDown(1e3,"easeOutQuint"))}))),t(".mtphr-dnt-list").mtphr_dnt_list(),t("body").on("click",".mtphr-dnt-single-image .mtphr-dnt-delete",(function(e){e.preventDefault();var i=t(this).parent(),n=i.siblings(".mtphr-dnt-single-image-upload"),r;i.siblings("input").val(""),i.remove(),n.show()})),t("body").on("click",".mtphr-dnt-single-image-upload",(function(e){e.preventDefault();var i=t(this),n=i.parent(),r=n.children("input"),o;if(!o)return(o=wp.media({title:ditty_news_ticker_vars.img_title,button:{text:ditty_news_ticker_vars.img_button,size:"small"},multiple:!1,library:{type:"image"}})).on("select",(function(){var t=o.state().get("selection").toJSON();if(t.length>0){r.val(t[0].id);var e={action:"mtphr_dnt_single_image_ajax",attachment:t[0],security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,e,(function(t){i.hide(),n.append(t)}))}})),o.open(),!1;o.open()}));var o={content:{attr:"data-tooltip"},style:{classes:"qtip-light qtip-rounded qtip-shadow"}};t('.mtphr-dnt-help[data-tooltip!=""]').qtip(o),t("body").on("click",'.mtphr-dnt-help[data-tooltip!=""]',(function(t){t.preventDefault()})),t("body").on("click",".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all input",(function(){i(t(this).parents(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all"))})),t(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all").each((function(){i(t(this))}))})),function(t){var e={init:function(e){return this.each((function(){function i(){a.find(".mtphr-dnt-list-item").length>1?(a.find(".mtphr-dnt-list-handle").show(),a.find(".mtphr-dnt-list-delete").show()):(a.find(".mtphr-dnt-list-handle").hide(),a.find(".mtphr-dnt-list-delete").hide())}function n(){a.find(".mtphr-dnt-list-item").each((function(e){t(this).find("textarea, input, select").each((function(){var i,n;if(t(this).hasClass("wp-editor-area")){var r=t(this).parents(".mtphr-dnt-field-type-wysiwyg");i=r.attr("data-name"),n=r.attr("data-key")}else i=t(this).attr("data-name"),n=t(this).attr("data-key");i&&n&&t(this).attr("name",i+"["+e+"]["+n+"]")}))})),i()}function r(e,i){var r=e.clone();r.find("textarea, input, select").each((function(){"checkbox"===t(this).attr("type")||"radio"===t(this).attr("type")?t(this).removeAttr("checked"):t(this).val("")})),r.find("textarea").each((function(){if(t(this).hasClass("wp-editor-area")){var e=t(this).parents(".mtphr-dnt-field-type-wysiwyg"),i=e.attr("data-name");e.children(".wp-core-ui").remove();var r={action:"mtphr_dnt_wysiwyg_ajax",name:i,security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,r,(function(i){var r,o=t(i).find("textarea").attr("id");e.append(i),"object"==typeof tinyMCE&&"function"==typeof tinyMCE.execCommand&&tinyMCE.execCommand("mceAddEditor",!1,o),n()}))}})),r.hide(),e.after(r),r.fadeIn().addClass(i),r.find('.mtphr-dnt-help[data-tooltip!=""]').qtip(s),n(),a.trigger("mtphr_dnt_list_item_added",[r,i])}var o={};e&&t.extend(o,e);var a=t(this),s={content:{attr:"data-tooltip"},style:{classes:"qtip-light qtip-rounded qtip-shadow"}};a.sortable({handle:".mtphr-dnt-list-heading",items:".mtphr-dnt-list-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r},start:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceRemoveEditor",!0,r)}},stop:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceAddEditor",!0,r)}}}),a.on("click",".mtphr-dnt-list-delete",(function(e){e.preventDefault(),t(this).parents(".mtphr-dnt-list-item").fadeOut((function(){t(this).remove(),n()}))})),a.on("click",".mtphr-dnt-list-add",(function(e){e.preventDefault(),r(t(this).parents(".mtphr-dnt-list-item"))})),a.on("mtphr_dnt_list_add_item",(function(t,e,i){r(e,i)})),n()}))}};t.fn.mtphr_dnt_list=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist in mtphr_dnt_list"):e.init.apply(this,arguments)}}(jQuery);
|
1 |
+
!function(t){"use strict";function e(e){return this.each((function(){var n=t(this),r=n.data("bs.mtphr_dnt_affix"),o="object"==typeof e&&e;r||n.data("bs.mtphr_dnt_affix",r=new i(this,o)),"string"==typeof e&&r[e]()}))}var i=function(e,n){this.options=t.extend({},i.DEFAULTS,n),this.$target=t(this.options.target).on("scroll.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPosition,this)).on("click.bs.mtphr_dnt_affix.data-api",t.proxy(this.checkPositionWithEventLoop,this)),this.$element=t(e),this.mtphr_dnt_affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};i.VERSION="3.3.5",i.RESET="mtphr_dnt_affix mtphr_dnt_affix-top mtphr_dnt_affix-bottom",i.DEFAULTS={offset:0,target:window},i.prototype.getState=function(t,e,i,n){var r=this.$target.scrollTop(),o=this.$element.offset(),a=this.$target.height();if(null!==i&&"top"===this.mtphr_dnt_affixed)return r<i&&"top";if("bottom"===this.mtphr_dnt_affixed)return null!==i?!(r+this.unpin<=o.top)&&"bottom":!(r+a<=t-n)&&"bottom";var s=null===this.mtphr_dnt_affixed,h=s?r:o.top,d;return null!==i&&r<=i?"top":null!==n&&h+(s?a:e)>=t-n&&"bottom"},i.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(i.RESET).addClass("mtphr_dnt_affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},i.prototype.checkPositionWithEventLoop=function(){setTimeout(t.proxy(this.checkPosition,this),1)},i.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e=this.$element.height(),n=this.options.offset,r=n.top,o=n.bottom,a=Math.max(t(document).height(),t(document.body).height());"object"!=typeof n&&(o=r=n),"function"==typeof r&&(r=n.top(this.$element)),"function"==typeof o&&(o=n.bottom(this.$element));var s=this.getState(a,e,r,o);if(this.mtphr_dnt_affixed!==s){null!==this.unpin&&this.$element.css("top","");var h="mtphr_dnt_affix"+(s?"-"+s:""),d=t.Event(h+".bs.mtphr_dnt_affix");if(this.$element.trigger(d),d.isDefaultPrevented())return;this.mtphr_dnt_affixed=s,this.unpin="bottom"===s?this.getPinnedOffset():null,this.$element.removeClass(i.RESET).addClass(h).trigger(h.replace("mtphr_dnt_affix","mtphr_dnt_affixed")+".bs.mtphr_dnt_affix")}"bottom"===s&&this.$element.offset({top:a-e-o})}};var n=t.fn.mtphr_dnt_affix;t.fn.mtphr_dnt_affix=e,t.fn.mtphr_dnt_affix.Constructor=i,t.fn.mtphr_dnt_affix.noConflict=function(){return t.fn.mtphr_dnt_affix=n,this},t(window).on("load",(function(){t('[data-spy="mtphr_dnt_affix"]').each((function(){var i=t(this),n=i.data();n.offset=n.offset||{},null!==n.offsetBottom&&(n.offset.bottom=n.offsetBottom),null!==n.offsetTop&&(n.offset.top=n.offsetTop),e.call(i,n)}))}))}(jQuery),jQuery(document).ready((function(t){function e(e,i){t("#mtphr-dnt-"+i+"-metaboxes > div").stop(!0,!0).hide();for(var n=e.attr("metabox").split(" "),r=0;r<n.length;r++)t("#"+n[r]).show();e.siblings("a").removeClass("button-primary"),e.addClass("button-primary"),e.siblings("input").val(e.attr("href").substring(1))}function i(t){var e;t.find("input").is(":checked")?t.next().fadeOut():t.next().fadeIn()}var n=t("#mtphr-dnt-settings-select"),r=t("#wpadminbar");n.mtphr_dnt_affix({offset:{top:function(){return t(window).width()<601?this.top=n.offset().top+5:this.top=n.offset().top-r.height()+5}}}),t("#mtphr-dnt-metabox-group-toggles").on("click",".mtphr-dnt-metabox-group-toggle",(function(e){e.preventDefault();var i=t(this).attr("href");t(".mtphr-dnt-metabox-group-toggle").removeClass("active"),t(".mtphr-dnt-metabox-group").removeClass("active"),t(this).addClass("active"),t(i).addClass("active"),t('input[name="_mtphr_dnt_admin_tab"]').val(i)})),t(".mtphr-dnt-codemirror-css").each((function(){var e=t(this).children("textarea");CodeMirror.fromTextArea(e[0],{mode:"css",lineNumbers:!0,lineWrapping:!0,viewportMargin:1/0})})),t(".mtphr-dnt-codemirror-js").each((function(){var e=t(this).children("textarea"),i;CodeMirror.fromTextArea(e[0],{mode:"htmlmixed",lineNumbers:!0,lineWrapping:!0}).setSize(!1,140)})),t('input[name="_mtphr_dnt_admin_javascript"]').length&&t('input[name="_mtphr_dnt_admin_javascript"]').val("ok"),t(".mtphr-dnt-type-toggle.button-primary").length&&e(t(".mtphr-dnt-type-toggle.button-primary"),"type"),t(".mtphr-dnt-mode-toggle.button-primary").length&&e(t(".mtphr-dnt-mode-toggle.button-primary"),"mode"),t("#mtphr-dnt-type-select").on("click",".mtphr-dnt-type-toggle",(function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"type")})),t("#mtphr-dnt-mode-select").on("click",".mtphr-dnt-mode-toggle",(function(i){i.preventDefault(),t(this).hasClass("button-primary")||e(t(this),"mode")})),t(".mtphr-dnt-sort").length>0&&(t(".mtphr-dnt-sort").sortable({handle:".mtphr-dnt-sort-heading",items:".mtphr-dnt-sort-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r}}),t("body").on("click",".mtphr-dnt-sort-heading.optional",(function(e){e.preventDefault();var i=t(this).parents(".mtphr-dnt-sort-item"),n=t(this).next(".mtphr-dnt-sort-item-fields"),r=t(this).children("input");i.hasClass("active")?(i.removeClass("active"),r.val("off"),n.length&&n.stop(!0,!0).slideUp(1e3,"easeOutQuint")):(i.addClass("active"),r.val("on"),n.length&&n.stop(!0,!0).slideDown(1e3,"easeOutQuint"))}))),t(".mtphr-dnt-list").mtphr_dnt_list(),t("body").on("click",".mtphr-dnt-single-image .mtphr-dnt-delete",(function(e){e.preventDefault();var i=t(this).parent(),n=i.siblings(".mtphr-dnt-single-image-upload"),r;i.siblings("input").val(""),i.remove(),n.show()})),t("body").on("click",".mtphr-dnt-single-image-upload",(function(e){e.preventDefault();var i=t(this),n=i.parent(),r=n.children("input"),o;if(!o)return(o=wp.media({title:ditty_news_ticker_vars.img_title,button:{text:ditty_news_ticker_vars.img_button,size:"small"},multiple:!1,library:{type:"image"}})).on("select",(function(){var t=o.state().get("selection").toJSON();if(t.length>0){r.val(t[0].id);var e={action:"mtphr_dnt_single_image_ajax",attachment:t[0],security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,e,(function(t){i.hide(),n.append(t)}))}})),o.open(),!1;o.open()})),t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),t("body").on("click",".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all input",(function(){i(t(this).parents(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all"))})),t(".mtphr-dnt-list-field-mtphr_dnt_mixed_ticks_all").each((function(){i(t(this))}))})),function(t){var e={init:function(e){return this.each((function(){function i(){a.find(".mtphr-dnt-list-item").length>1?(a.find(".mtphr-dnt-list-handle").show(),a.find(".mtphr-dnt-list-delete").show()):(a.find(".mtphr-dnt-list-handle").hide(),a.find(".mtphr-dnt-list-delete").hide())}function n(){a.find(".mtphr-dnt-list-item").each((function(e){t(this).find("textarea, input, select").each((function(){var i,n;if(t(this).hasClass("wp-editor-area")){var r=t(this).parents(".mtphr-dnt-field-type-wysiwyg");i=r.attr("data-name"),n=r.attr("data-key")}else i=t(this).attr("data-name"),n=t(this).attr("data-key");i&&n&&t(this).attr("name",i+"["+e+"]["+n+"]")}))})),i()}function r(e,i){var r=e.clone();r.find("textarea, input, select").each((function(){"checkbox"===t(this).attr("type")||"radio"===t(this).attr("type")?t(this).attr("checked",!1):t(this).val("")})),r.find("textarea").each((function(){if(t(this).hasClass("wp-editor-area")){var e=t(this).parents(".mtphr-dnt-field-type-wysiwyg"),i=e.attr("data-name");e.children(".wp-core-ui").remove();var r={action:"mtphr_dnt_wysiwyg_ajax",name:i,security:ditty_news_ticker_vars.security};jQuery.post(ajaxurl,r,(function(i){var r,o=t(i).find("textarea").attr("id");e.append(i),"object"==typeof tinyMCE&&"function"==typeof tinyMCE.execCommand&&tinyMCE.execCommand("mceAddEditor",!1,o),n()}))}})),r.hide(),e.after(r),r.fadeIn().addClass(i),t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),n(),a.trigger("mtphr_dnt_list_item_added",[r,i])}var o={};e&&t.extend(o,e);var a=t(this);t.protip({defaults:{position:"top",size:"small",scheme:"black",classes:"ditty-protip"}}),a.sortable({handle:".mtphr-dnt-list-heading",items:".mtphr-dnt-list-item",axis:"y",opacity:.7,placeholder:{element:function(e){var i=t(e).innerHeight();return t('<div class="mtphr-dnt-sort-placeholder" style="height:'+i+'px;"></div>')[0]},update:function(){}},helper:function(e,i){var n=i.children(),r=i.clone();return r.children().each((function(e){t(this).width(n.eq(e).width()),t(this).height(n.eq(e).height())})),r},start:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceRemoveEditor",!0,r)}},stop:function(e,i){var n=t(i.item);if(n.find(".wp-editor-container").length){var r=n.find(".wp-editor-area").attr("id");tinyMCE.execCommand("mceAddEditor",!0,r)}}}),a.on("click",".mtphr-dnt-list-delete",(function(e){e.preventDefault(),t(this).parents(".mtphr-dnt-list-item").fadeOut((function(){t(this).remove(),n()}))})),a.on("click",".mtphr-dnt-list-add",(function(e){e.preventDefault(),r(t(this).parents(".mtphr-dnt-list-item"))})),a.on("mtphr_dnt_list_add_item",(function(t,e,i){r(e,i)})),n()}))}};t.fn.mtphr_dnt_list=function(i){return e[i]?e[i].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist in mtphr_dnt_list"):e.init.apply(this,arguments)}}(jQuery);
|
inc/static/js/swiped-events.min.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* swiped-events.js - v1.1.4
|
3 |
+
* Pure JavaScript swipe events
|
4 |
+
* https://github.com/john-doherty/swiped-events
|
5 |
+
* @inspiration https://stackoverflow.com/questions/16348031/disable-scrolling-when-touch-moving-certain-element
|
6 |
+
* @author John Doherty <www.johndoherty.info>
|
7 |
+
* @license MIT
|
8 |
+
*/
|
9 |
+
!function(t,e){"use strict";"function"!=typeof t.CustomEvent&&(t.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var a=e.createEvent("CustomEvent");return a.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),a},t.CustomEvent.prototype=t.Event.prototype),e.addEventListener("touchstart",function(t){if("true"===t.target.getAttribute("data-swipe-ignore"))return;s=t.target,r=Date.now(),n=t.touches[0].clientX,a=t.touches[0].clientY,u=0,i=0},!1),e.addEventListener("touchmove",function(t){if(!n||!a)return;var e=t.touches[0].clientX,r=t.touches[0].clientY;u=n-e,i=a-r},!1),e.addEventListener("touchend",function(t){if(s!==t.target)return;var e=parseInt(l(s,"data-swipe-threshold","20"),10),o=parseInt(l(s,"data-swipe-timeout","500"),10),c=Date.now()-r,d="",p=t.changedTouches||t.touches||[];Math.abs(u)>Math.abs(i)?Math.abs(u)>e&&c<o&&(d=u>0?"swiped-left":"swiped-right"):Math.abs(i)>e&&c<o&&(d=i>0?"swiped-up":"swiped-down");if(""!==d){var b={dir:d.replace(/swiped-/,""),xStart:parseInt(n,10),xEnd:parseInt((p[0]||{}).clientX||-1,10),yStart:parseInt(a,10),yEnd:parseInt((p[0]||{}).clientY||-1,10)};s.dispatchEvent(new CustomEvent("swiped",{bubbles:!0,cancelable:!0,detail:b})),s.dispatchEvent(new CustomEvent(d,{bubbles:!0,cancelable:!0,detail:b}))}n=null,a=null,r=null},!1);var n=null,a=null,u=null,i=null,r=null,s=null;function l(t,n,a){for(;t&&t!==e.documentElement;){var u=t.getAttribute(n);if(u)return u;t=t.parentNode}return a}}(window,document);
|
inc/static/libs/codemirror-5.44.0/.editorconfig
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
root = true
|
2 |
-
|
3 |
-
[*]
|
4 |
-
indent_style = space
|
5 |
-
indent_size = 2
|
6 |
-
end_of_line = lf
|
7 |
-
charset = utf-8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/.gitattributes
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
*.txt text eol=lf
|
2 |
-
*.js text eol=lf
|
3 |
-
*.html text eol=lf
|
4 |
-
*.md text eol=lf
|
5 |
-
*.json text eol=lf
|
6 |
-
*.yml text eol=lf
|
7 |
-
*.css text eol=lf
|
8 |
-
*.svg text eol=lf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/.npmignore
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
/node_modules
|
2 |
-
/demo
|
3 |
-
/doc
|
4 |
-
/test
|
5 |
-
/test*.html
|
6 |
-
/index.html
|
7 |
-
/mode/*/*test.js
|
8 |
-
/mode/*/*.html
|
9 |
-
/mode/index.html
|
10 |
-
.*
|
11 |
-
/bin/authors.sh
|
12 |
-
/bin/lint
|
13 |
-
/bin/release
|
14 |
-
/bin/upload-release.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/.travis.yml
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
language: node_js
|
2 |
-
node_js:
|
3 |
-
- stable
|
4 |
-
sudo: false
|
5 |
-
cache: npm
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/AUTHORS
DELETED
@@ -1,794 +0,0 @@
|
|
1 |
-
List of CodeMirror contributors. Updated before every release.
|
2 |
-
|
3 |
-
4oo4
|
4 |
-
4r2r
|
5 |
-
Aaron Brooks
|
6 |
-
Abdelouahab
|
7 |
-
Abdussalam Abdurrahman
|
8 |
-
Abe Fettig
|
9 |
-
Abhishek Gahlot
|
10 |
-
Adam Ahmed
|
11 |
-
Adam King
|
12 |
-
Adam Particka
|
13 |
-
adanlobato
|
14 |
-
Adán Lobato
|
15 |
-
Adrian Aichner
|
16 |
-
Adrian Heine
|
17 |
-
Adrien Bertrand
|
18 |
-
aeroson
|
19 |
-
Ahmad Amireh
|
20 |
-
Ahmad M. Zawawi
|
21 |
-
ahoward
|
22 |
-
Akeksandr Motsjonov
|
23 |
-
Alasdair Smith
|
24 |
-
AlbertHilb
|
25 |
-
Alberto González Palomo
|
26 |
-
Alberto Pose
|
27 |
-
Albert Xing
|
28 |
-
Alexander Pavlov
|
29 |
-
Alexander Schepanovski
|
30 |
-
Alexander Shvets
|
31 |
-
Alexander Solovyov
|
32 |
-
Alexandre Bique
|
33 |
-
alexey-k
|
34 |
-
Alex Piggott
|
35 |
-
Aliaksei Chapyzhenka
|
36 |
-
Allen Sarkisyan
|
37 |
-
Ami Fischman
|
38 |
-
Amin Shali
|
39 |
-
Amin Ullah Khan
|
40 |
-
amshali@google.com
|
41 |
-
Amsul
|
42 |
-
amuntean
|
43 |
-
Amy
|
44 |
-
Ananya Sen
|
45 |
-
anaran
|
46 |
-
AndersMad
|
47 |
-
Anders Nawroth
|
48 |
-
Anderson Mesquita
|
49 |
-
Anders Wåglund
|
50 |
-
Andrea G
|
51 |
-
Andreas Reischuck
|
52 |
-
Andres Taylor
|
53 |
-
Andre von Houck
|
54 |
-
Andrew Cheng
|
55 |
-
Andrew Dassonville
|
56 |
-
Andrey Fedorov
|
57 |
-
Andrey Klyuchnikov
|
58 |
-
Andrey Lushnikov
|
59 |
-
Andrey Shchekin
|
60 |
-
Andy Joslin
|
61 |
-
Andy Kimball
|
62 |
-
Andy Li
|
63 |
-
Angelo
|
64 |
-
angelozerr
|
65 |
-
angelo.zerr@gmail.com
|
66 |
-
Ankit
|
67 |
-
Ankit Ahuja
|
68 |
-
Ansel Santosa
|
69 |
-
Anthony Dugois
|
70 |
-
anthonygego
|
71 |
-
Anthony Gégo
|
72 |
-
Anthony Grimes
|
73 |
-
Anton Kovalyov
|
74 |
-
Apollo Zhu
|
75 |
-
AQNOUCH Mohammed
|
76 |
-
Aram Shatakhtsyan
|
77 |
-
areos
|
78 |
-
Arnab Bose
|
79 |
-
Arsène von Wyss
|
80 |
-
Arthur Müller
|
81 |
-
Arun Narasani
|
82 |
-
as3boyan
|
83 |
-
asolove
|
84 |
-
atelierbram
|
85 |
-
AtomicPages LLC
|
86 |
-
Atul Bhouraskar
|
87 |
-
Aurelian Oancea
|
88 |
-
Axel Lewenhaupt
|
89 |
-
Baptiste Augrain
|
90 |
-
Barret Rennie
|
91 |
-
Bartosz Dziewoński
|
92 |
-
Basarat Ali Syed
|
93 |
-
Bastian Müller
|
94 |
-
belhaj
|
95 |
-
Bem Jones-Bey
|
96 |
-
benbro
|
97 |
-
Beni Cherniavsky-Paskin
|
98 |
-
Benjamin DeCoste
|
99 |
-
Benjamin Young
|
100 |
-
Ben Keen
|
101 |
-
Ben Miller
|
102 |
-
Ben Mosher
|
103 |
-
Bernhard Sirlinger
|
104 |
-
Bert Chang
|
105 |
-
Bharad
|
106 |
-
BigBlueHat
|
107 |
-
Billy Moon
|
108 |
-
binny
|
109 |
-
Bjorn Hansen
|
110 |
-
B Krishna Chaitanya
|
111 |
-
Blaine G
|
112 |
-
blukat29
|
113 |
-
Bo
|
114 |
-
boomyjee
|
115 |
-
Bo Peng
|
116 |
-
borawjm
|
117 |
-
Brad Metcalf
|
118 |
-
Brandon Frohs
|
119 |
-
Brandon Wamboldt
|
120 |
-
Bret Little
|
121 |
-
Brett Zamir
|
122 |
-
Brian Grinstead
|
123 |
-
Brian Sletten
|
124 |
-
brrd
|
125 |
-
Bruce Mitchener
|
126 |
-
Bryan Massoth
|
127 |
-
Caitlin Potter
|
128 |
-
Calin Barbat
|
129 |
-
callodacity
|
130 |
-
Camilo Roca
|
131 |
-
Casey Klebba
|
132 |
-
César González Íñiguez
|
133 |
-
Chad Jolly
|
134 |
-
Chandra Sekhar Pydi
|
135 |
-
Charles Skelton
|
136 |
-
Cheah Chu Yeow
|
137 |
-
Chhekur
|
138 |
-
Chris Colborne
|
139 |
-
Chris Coyier
|
140 |
-
Chris Ford
|
141 |
-
Chris Granger
|
142 |
-
Chris Houseknecht
|
143 |
-
Chris Lohfink
|
144 |
-
Chris Morgan
|
145 |
-
Chris Reeves
|
146 |
-
Chris Smith
|
147 |
-
Christian Gruen
|
148 |
-
Christian Oyarzun
|
149 |
-
Christian Petrov
|
150 |
-
christopherblaser
|
151 |
-
Christopher Brown
|
152 |
-
Christopher Kramer
|
153 |
-
Christopher Mitchell
|
154 |
-
Christopher Pfohl
|
155 |
-
Christopher Wallis
|
156 |
-
Chunliang Lyu
|
157 |
-
ciaranj
|
158 |
-
CodeAnimal
|
159 |
-
CodeBitt
|
160 |
-
coderaiser
|
161 |
-
Cole R Lawrence
|
162 |
-
ComFreek
|
163 |
-
Cristian Prieto
|
164 |
-
Curran Kelleher
|
165 |
-
Curtis Gagliardi
|
166 |
-
dagsta
|
167 |
-
daines
|
168 |
-
Dale Jung
|
169 |
-
Dan Bentley
|
170 |
-
Dan Heberden
|
171 |
-
Daniel, Dao Quang Minh
|
172 |
-
Daniele Di Sarli
|
173 |
-
Daniel Faust
|
174 |
-
Daniel Hanggi
|
175 |
-
Daniel Huigens
|
176 |
-
Daniel Kesler
|
177 |
-
Daniel KJ
|
178 |
-
Daniel Neel
|
179 |
-
Daniel Parnell
|
180 |
-
Daniel Thwaites
|
181 |
-
Danila Malyutin
|
182 |
-
Danny Yoo
|
183 |
-
darealshinji
|
184 |
-
Darius Roberts
|
185 |
-
databricks-david-lewis
|
186 |
-
Dave Brondsema
|
187 |
-
Dave MacLachlan
|
188 |
-
Dave Myers
|
189 |
-
David Barnett
|
190 |
-
David H. Bronke
|
191 |
-
David Mignot
|
192 |
-
David Pathakjee
|
193 |
-
David Santana
|
194 |
-
David Vázquez
|
195 |
-
David Whittington
|
196 |
-
deebugger
|
197 |
-
Deep Thought
|
198 |
-
Devin Abbott
|
199 |
-
Devon Carew
|
200 |
-
Dick Choi
|
201 |
-
dignifiedquire
|
202 |
-
Dimage Sapelkin
|
203 |
-
dmaclach
|
204 |
-
Dmitry Kiselyov
|
205 |
-
domagoj412
|
206 |
-
Dominator008
|
207 |
-
Domizio Demichelis
|
208 |
-
Doug Blank
|
209 |
-
Doug Wikle
|
210 |
-
Drew Bratcher
|
211 |
-
Drew Hintz
|
212 |
-
Drew Khoury
|
213 |
-
Drini Cami
|
214 |
-
Dror BG
|
215 |
-
duralog
|
216 |
-
dwelle
|
217 |
-
eborden
|
218 |
-
edsharp
|
219 |
-
ekhaled
|
220 |
-
Elisée
|
221 |
-
Emmanuel Schanzer
|
222 |
-
Enam Mijbah Noor
|
223 |
-
Eric Allam
|
224 |
-
Eric Bogard
|
225 |
-
Erik Welander
|
226 |
-
eustas
|
227 |
-
Fabien Dubosson
|
228 |
-
Fabien O'Carroll
|
229 |
-
Fabio Zendhi Nagao
|
230 |
-
Faiza Alsaied
|
231 |
-
Fauntleroy
|
232 |
-
fbuchinger
|
233 |
-
feizhang365
|
234 |
-
Felipe Lalanne
|
235 |
-
Felix Raab
|
236 |
-
ficristo
|
237 |
-
Filip Noetzel
|
238 |
-
Filip Stollár
|
239 |
-
Filype Pereira
|
240 |
-
finalfantasia
|
241 |
-
flack
|
242 |
-
Florian Felten
|
243 |
-
ForbesLindesay
|
244 |
-
Forbes Lindesay
|
245 |
-
Ford_Lawnmower
|
246 |
-
Forrest Oliphant
|
247 |
-
Franco Catena
|
248 |
-
Frank Wiegand
|
249 |
-
fraxx001
|
250 |
-
Fredrik Borg
|
251 |
-
FUJI Goro (gfx)
|
252 |
-
Gabriel Gheorghian
|
253 |
-
Gabriel Horner
|
254 |
-
Gabriel Nahmias
|
255 |
-
galambalazs
|
256 |
-
Gary Sheng
|
257 |
-
Gautam Mehta
|
258 |
-
Gavin Douglas
|
259 |
-
gekkoe
|
260 |
-
Geordie Hall
|
261 |
-
George Stephanis
|
262 |
-
geowarin
|
263 |
-
Gerard Braad
|
264 |
-
Gergely Hegykozi
|
265 |
-
Germain Chazot
|
266 |
-
Giovanni Calò
|
267 |
-
Glebov Boris
|
268 |
-
Glenn Jorde
|
269 |
-
Glenn Ruehle
|
270 |
-
goldsmcb
|
271 |
-
Golevka
|
272 |
-
Google LLC
|
273 |
-
Gordon Smith
|
274 |
-
Grant Skinner
|
275 |
-
greengiant
|
276 |
-
Gregory Koberger
|
277 |
-
Grzegorz Mazur
|
278 |
-
Guan Gui
|
279 |
-
Guillaume Massé
|
280 |
-
Guillaume Massé
|
281 |
-
guraga
|
282 |
-
Gustavo Rodrigues
|
283 |
-
Hakan Tunc
|
284 |
-
Hans Engel
|
285 |
-
Harald Schilly
|
286 |
-
Hardest
|
287 |
-
Harshvardhan Gupta
|
288 |
-
Hasan Karahan
|
289 |
-
Heanes
|
290 |
-
Hector Oswaldo Caballero
|
291 |
-
Hélio
|
292 |
-
Hendrik Wallbaum
|
293 |
-
Henrik Haugbølle
|
294 |
-
Herculano Campos
|
295 |
-
hidaiy
|
296 |
-
Hiroyuki Makino
|
297 |
-
hitsthings
|
298 |
-
Hocdoc
|
299 |
-
Hugues Malphettes
|
300 |
-
Ian Beck
|
301 |
-
Ian Davies
|
302 |
-
Ian Dickinson
|
303 |
-
Ian Rose
|
304 |
-
Ian Wehrman
|
305 |
-
Ian Wetherbee
|
306 |
-
Ice White
|
307 |
-
ICHIKAWA, Yuji
|
308 |
-
idleberg
|
309 |
-
ilvalle
|
310 |
-
Ingo Richter
|
311 |
-
Irakli Gozalishvili
|
312 |
-
Ivan Kurnosov
|
313 |
-
Ivoah
|
314 |
-
Jacob Lee
|
315 |
-
Jaimin
|
316 |
-
Jake Peyser
|
317 |
-
Jakob Miland
|
318 |
-
Jakub Vrana
|
319 |
-
Jakub Vrána
|
320 |
-
James Campos
|
321 |
-
James Howard
|
322 |
-
James Thorne
|
323 |
-
Jamie Hill
|
324 |
-
Jamie Morris
|
325 |
-
Janice Leung
|
326 |
-
Jan Jongboom
|
327 |
-
jankeromnes
|
328 |
-
Jan Keromnes
|
329 |
-
Jan Odvarko
|
330 |
-
Jan Schär
|
331 |
-
Jan T. Sott
|
332 |
-
Jared Dean
|
333 |
-
Jared Forsyth
|
334 |
-
Jared Jacobs
|
335 |
-
Jason
|
336 |
-
Jason Barnabe
|
337 |
-
Jason Grout
|
338 |
-
Jason Heeris
|
339 |
-
Jason Johnston
|
340 |
-
Jason San Jose
|
341 |
-
Jason Siefken
|
342 |
-
Jayaprabhakar
|
343 |
-
Jaydeep Solanki
|
344 |
-
Jean Boussier
|
345 |
-
Jeff Blaisdell
|
346 |
-
Jeff Hanke
|
347 |
-
Jeff Jenkins
|
348 |
-
jeffkenton
|
349 |
-
Jeff Pickhardt
|
350 |
-
jem (graphite)
|
351 |
-
Jeremy Parmenter
|
352 |
-
Jim
|
353 |
-
Jim Avery
|
354 |
-
jkaplon
|
355 |
-
JobJob
|
356 |
-
jochenberger
|
357 |
-
Jochen Berger
|
358 |
-
Joel Einbinder
|
359 |
-
joelpinheiro
|
360 |
-
joewalsh
|
361 |
-
Johan Ask
|
362 |
-
John Connor
|
363 |
-
John-David Dalton
|
364 |
-
John Engler
|
365 |
-
John Lees-Miller
|
366 |
-
John Snelson
|
367 |
-
John Van Der Loo
|
368 |
-
Jon Ander Peñalba
|
369 |
-
Jonas Döbertin
|
370 |
-
Jonas Helfer
|
371 |
-
Jonathan Dierksen
|
372 |
-
Jonathan Hart
|
373 |
-
Jonathan Malmaud
|
374 |
-
Jon Gacnik
|
375 |
-
jongalloway
|
376 |
-
Jon Malmaud
|
377 |
-
Jon Sangster
|
378 |
-
Joost-Wim Boekesteijn
|
379 |
-
Joseph Pecoraro
|
380 |
-
Josh Barnes
|
381 |
-
Josh Cohen
|
382 |
-
Josh Soref
|
383 |
-
Joshua Newman
|
384 |
-
Josh Watzman
|
385 |
-
jots
|
386 |
-
Joy Zhong
|
387 |
-
jsoojeon
|
388 |
-
ju1ius
|
389 |
-
Juan Benavides Romero
|
390 |
-
Jucovschi Constantin
|
391 |
-
Juho Vuori
|
392 |
-
Julien CROUZET
|
393 |
-
Julien Rebetez
|
394 |
-
Justin Andresen
|
395 |
-
Justin Hileman
|
396 |
-
jwallers@gmail.com
|
397 |
-
kaniga
|
398 |
-
karevn
|
399 |
-
Karol
|
400 |
-
Kayur Patel
|
401 |
-
Kazuhito Hokamura
|
402 |
-
Kenan Christian Dimas
|
403 |
-
Ken Newman
|
404 |
-
ken restivo
|
405 |
-
Ken Rockot
|
406 |
-
Kevin Earls
|
407 |
-
Kevin Kwok
|
408 |
-
Kevin Muret
|
409 |
-
Kevin Sawicki
|
410 |
-
Kevin Ushey
|
411 |
-
Kier Darby
|
412 |
-
Klaus Silveira
|
413 |
-
Koh Zi Han, Cliff
|
414 |
-
komakino
|
415 |
-
Konstantin Lopuhin
|
416 |
-
koops
|
417 |
-
Kris Ciccarello
|
418 |
-
ks-ifware
|
419 |
-
kubelsmieci
|
420 |
-
KwanEsq
|
421 |
-
Kyle Kelley
|
422 |
-
KyleMcNutt
|
423 |
-
LaKing
|
424 |
-
Lanfei
|
425 |
-
Lanny
|
426 |
-
laobubu
|
427 |
-
Laszlo Vidacs
|
428 |
-
leaf corcoran
|
429 |
-
Lemmon
|
430 |
-
Leonid Khachaturov
|
431 |
-
Leon Sorokin
|
432 |
-
Leonya Khachaturov
|
433 |
-
Liam Newman
|
434 |
-
Libo Cannici
|
435 |
-
Lior Goldberg
|
436 |
-
Lior Shub
|
437 |
-
LloydMilligan
|
438 |
-
LM
|
439 |
-
lochel
|
440 |
-
Lorenzo Simionato
|
441 |
-
Lorenzo Stoakes
|
442 |
-
Louis Mauchet
|
443 |
-
Luca Fabbri
|
444 |
-
Luciano Longo
|
445 |
-
Lu Fangjian
|
446 |
-
Luke Browning
|
447 |
-
Luke Granger-Brown
|
448 |
-
Luke Stagner
|
449 |
-
lynschinzer
|
450 |
-
M1cha
|
451 |
-
Madhura Jayaratne
|
452 |
-
Maksim Lin
|
453 |
-
Maksym Taran
|
454 |
-
Malay Majithia
|
455 |
-
Manideep
|
456 |
-
Manuel Rego Casasnovas
|
457 |
-
Marat Dreizin
|
458 |
-
Marcel Gerber
|
459 |
-
Marcelo Camargo
|
460 |
-
Marco Aurélio
|
461 |
-
Marco Munizaga
|
462 |
-
Marcus Bointon
|
463 |
-
Marek Rudnicki
|
464 |
-
Marijn Haverbeke
|
465 |
-
Mário Gonçalves
|
466 |
-
Mario Pietsch
|
467 |
-
Mark Anderson
|
468 |
-
Mark Dalgleish
|
469 |
-
Mark Lentczner
|
470 |
-
Marko Bonaci
|
471 |
-
Mark Peace
|
472 |
-
Markus Bordihn
|
473 |
-
Markus Olsson
|
474 |
-
Martin Balek
|
475 |
-
Martín Gaitán
|
476 |
-
Martin Hasoň
|
477 |
-
Martin Hunt
|
478 |
-
Martin Laine
|
479 |
-
Martin Zagora
|
480 |
-
Mason Malone
|
481 |
-
Mateusz Paprocki
|
482 |
-
Mathias Bynens
|
483 |
-
mats cronqvist
|
484 |
-
Matt Gaide
|
485 |
-
Matthew Bauer
|
486 |
-
Matthew Beale
|
487 |
-
matthewhayes
|
488 |
-
Matthew Rathbone
|
489 |
-
Matthew Suozzo
|
490 |
-
Matthias Bussonnier
|
491 |
-
Matthias BUSSONNIER
|
492 |
-
Matt MacPherson
|
493 |
-
Matt McDonald
|
494 |
-
Matt Pass
|
495 |
-
Matt Sacks
|
496 |
-
mauricio
|
497 |
-
Maximilian Hils
|
498 |
-
Maxim Kraev
|
499 |
-
Max Kirsch
|
500 |
-
Max Schaefer
|
501 |
-
Max Xiantu
|
502 |
-
mbarkhau
|
503 |
-
McBrainy
|
504 |
-
mce2
|
505 |
-
melpon
|
506 |
-
meshuamam
|
507 |
-
Metatheos
|
508 |
-
Micah Dubinko
|
509 |
-
Michael
|
510 |
-
Michael Goderbauer
|
511 |
-
Michael Grey
|
512 |
-
Michael Kaminsky
|
513 |
-
Michael Lehenbauer
|
514 |
-
Michael Wadman
|
515 |
-
Michael Walker
|
516 |
-
Michael Zhou
|
517 |
-
Michal Čihař
|
518 |
-
Michal Dorner
|
519 |
-
Michal Kapiczynski
|
520 |
-
Mighty Guava
|
521 |
-
Miguel Castillo
|
522 |
-
mihailik
|
523 |
-
Mika Andrianarijaona
|
524 |
-
Mike
|
525 |
-
Mike Bostock
|
526 |
-
Mike Brevoort
|
527 |
-
Mike Diaz
|
528 |
-
Mike Ivanov
|
529 |
-
Mike Kadin
|
530 |
-
Mike Kobit
|
531 |
-
Milan Szekely
|
532 |
-
MinRK
|
533 |
-
Miraculix87
|
534 |
-
misfo
|
535 |
-
mkaminsky11
|
536 |
-
mloginov
|
537 |
-
Moritz Schubotz (physikerwelt)
|
538 |
-
Moritz Schwörer
|
539 |
-
Moshe Wajnberg
|
540 |
-
mps
|
541 |
-
ms
|
542 |
-
mtaran-google
|
543 |
-
Mu-An Chiou
|
544 |
-
Mu-An ✌️ Chiou
|
545 |
-
mzabuawala
|
546 |
-
Narciso Jaramillo
|
547 |
-
Nathan Williams
|
548 |
-
ndr
|
549 |
-
Neil Anderson
|
550 |
-
neon-dev
|
551 |
-
nerbert
|
552 |
-
NetworkNode
|
553 |
-
nextrevision
|
554 |
-
ngn
|
555 |
-
nguillaumin
|
556 |
-
Ng Zhi An
|
557 |
-
Nicholas Bollweg
|
558 |
-
Nicholas Bollweg (Nick)
|
559 |
-
NickKolok
|
560 |
-
Nick Kreeger
|
561 |
-
Nick Small
|
562 |
-
Nicolas Chevobbe
|
563 |
-
Nicolas Kick
|
564 |
-
Nicolò Ribaudo
|
565 |
-
Niels van Groningen
|
566 |
-
nightwing
|
567 |
-
Nikita Beloglazov
|
568 |
-
Nikita Vasilyev
|
569 |
-
Nikolaj Kappler
|
570 |
-
Nikolay Kostov
|
571 |
-
nilp0inter
|
572 |
-
Nisarg Jhaveri
|
573 |
-
nlwillia
|
574 |
-
noragrossman
|
575 |
-
Norman Rzepka
|
576 |
-
Oleksandr Yakovenko
|
577 |
-
opl-
|
578 |
-
Oreoluwa Onatemowo
|
579 |
-
Oskar Segersvärd
|
580 |
-
overdodactyl
|
581 |
-
pablo
|
582 |
-
pabloferz
|
583 |
-
Pablo Zubieta
|
584 |
-
paddya
|
585 |
-
Page
|
586 |
-
paladox
|
587 |
-
Panupong Pasupat
|
588 |
-
paris
|
589 |
-
Paris
|
590 |
-
Paris Kasidiaris
|
591 |
-
Patil Arpith
|
592 |
-
Patrick Stoica
|
593 |
-
Patrick Strawderman
|
594 |
-
Paul Garvin
|
595 |
-
Paul Ivanov
|
596 |
-
Paul Masson
|
597 |
-
Pavel
|
598 |
-
Pavel Feldman
|
599 |
-
Pavel Petržela
|
600 |
-
Pavel Strashkin
|
601 |
-
Paweł Bartkiewicz
|
602 |
-
peteguhl
|
603 |
-
peter
|
604 |
-
Peter Flynn
|
605 |
-
peterkroon
|
606 |
-
Peter Kroon
|
607 |
-
Philipp A
|
608 |
-
Philipp Markovics
|
609 |
-
Philip Stadermann
|
610 |
-
Pi Delport
|
611 |
-
Pierre Gerold
|
612 |
-
Pieter Ouwerkerk
|
613 |
-
Pontus Melke
|
614 |
-
prasanthj
|
615 |
-
Prasanth J
|
616 |
-
Prayag Verma
|
617 |
-
Prendota
|
618 |
-
Qiang Li
|
619 |
-
Radek Piórkowski
|
620 |
-
Rahul
|
621 |
-
Rahul Anand
|
622 |
-
ramwin1
|
623 |
-
Randall Mason
|
624 |
-
Randy Burden
|
625 |
-
Randy Edmunds
|
626 |
-
Randy Luecke
|
627 |
-
Raphael Amorim
|
628 |
-
Rasmus Erik Voel Jensen
|
629 |
-
Rasmus Schultz
|
630 |
-
Raymond Hill
|
631 |
-
ray ratchup
|
632 |
-
Ray Ratchup
|
633 |
-
Remi Nyborg
|
634 |
-
Renaud Durlin
|
635 |
-
Reynold Xin
|
636 |
-
Richard Denton
|
637 |
-
Richard van der Meer
|
638 |
-
Richard Z.H. Wang
|
639 |
-
Rishi Goomar
|
640 |
-
Robert Brignull
|
641 |
-
Robert Crossfield
|
642 |
-
Robert Martin
|
643 |
-
Roberto Abdelkader Martínez Pérez
|
644 |
-
robertop23
|
645 |
-
Robert Plummer
|
646 |
-
Rrandom
|
647 |
-
Rrrandom
|
648 |
-
Ruslan Osmanov
|
649 |
-
Ryan Petrello
|
650 |
-
Ryan Prior
|
651 |
-
ryu-sato
|
652 |
-
sabaca
|
653 |
-
Sam Lee
|
654 |
-
Sam Rawlins
|
655 |
-
Samuel Ainsworth
|
656 |
-
Sam Wilson
|
657 |
-
sandeepshetty
|
658 |
-
Sander AKA Redsandro
|
659 |
-
Sander Verweij
|
660 |
-
santec
|
661 |
-
Sarah McAlear and Wenlin Zhang
|
662 |
-
Sascha Peilicke
|
663 |
-
satamas
|
664 |
-
satchmorun
|
665 |
-
sathyamoorthi
|
666 |
-
Saul Costa
|
667 |
-
S. Chris Colbert
|
668 |
-
SCLINIC\jdecker
|
669 |
-
Scott Aikin
|
670 |
-
Scott Goodhew
|
671 |
-
Sebastian Wilzbach
|
672 |
-
Sebastian Zaha
|
673 |
-
Seren D
|
674 |
-
Sergey Goder
|
675 |
-
Sergey Tselovalnikov
|
676 |
-
Se-Won Kim
|
677 |
-
Shane Liesegang
|
678 |
-
shaund
|
679 |
-
shaun gilchrist
|
680 |
-
Shawn A
|
681 |
-
Shea Bunge
|
682 |
-
sheopory
|
683 |
-
Shil S
|
684 |
-
Shiv Deepak
|
685 |
-
Shmuel Englard
|
686 |
-
Shubham Jain
|
687 |
-
Siamak Mokhtari
|
688 |
-
silverwind
|
689 |
-
Simon Edwards
|
690 |
-
sinkuu
|
691 |
-
snasa
|
692 |
-
soliton4
|
693 |
-
sonson
|
694 |
-
Sorab Bisht
|
695 |
-
spastorelli
|
696 |
-
srajanpaliwal
|
697 |
-
Stanislav Oaserele
|
698 |
-
stan-z
|
699 |
-
Stas Kobzar
|
700 |
-
Stefan Borsje
|
701 |
-
Steffen Beyer
|
702 |
-
Steffen Bruchmann
|
703 |
-
Steffen Kowalski
|
704 |
-
Stephane Moore
|
705 |
-
Stephen Lavelle
|
706 |
-
Steve Champagne
|
707 |
-
Steve Hoover
|
708 |
-
Steve O'Hara
|
709 |
-
stoskov
|
710 |
-
Stryder Crown
|
711 |
-
Stu Kennedy
|
712 |
-
Sungho Kim
|
713 |
-
sverweij
|
714 |
-
Taha Jahangir
|
715 |
-
takamori
|
716 |
-
Tako Schotanus
|
717 |
-
Takuji Shimokawa
|
718 |
-
Takuya Matsuyama
|
719 |
-
Tarmil
|
720 |
-
TDaglis
|
721 |
-
tel
|
722 |
-
Tentone
|
723 |
-
tfjgeorge
|
724 |
-
Thaddee Tyl
|
725 |
-
thanasis
|
726 |
-
TheHowl
|
727 |
-
themrmax
|
728 |
-
think
|
729 |
-
Thomas Brouard
|
730 |
-
Thomas Dvornik
|
731 |
-
Thomas Kluyver
|
732 |
-
Thomas Schmid
|
733 |
-
Tim Alby
|
734 |
-
Tim Baumann
|
735 |
-
Timothy Farrell
|
736 |
-
Timothy Gu
|
737 |
-
Timothy Hatcher
|
738 |
-
Tobias Bertelsen
|
739 |
-
TobiasBg
|
740 |
-
Todd Berman
|
741 |
-
Todd Kennedy
|
742 |
-
Tomas-A
|
743 |
-
Tomas Varaneckas
|
744 |
-
Tom Erik Støwer
|
745 |
-
Tom Klancer
|
746 |
-
Tom MacWright
|
747 |
-
Tom McLaughlin
|
748 |
-
Tony Jian
|
749 |
-
tophf
|
750 |
-
totalamd
|
751 |
-
Travis Heppe
|
752 |
-
Triangle717
|
753 |
-
Tristan Tarrant
|
754 |
-
TSUYUSATO Kitsune
|
755 |
-
Tugrul Elmas
|
756 |
-
twifkak
|
757 |
-
Tyler Long
|
758 |
-
Vadzim Ramanenka
|
759 |
-
Vaibhav Sagar
|
760 |
-
VapidWorx
|
761 |
-
Vestimir Markov
|
762 |
-
vf
|
763 |
-
Victor Bocharsky
|
764 |
-
Vincent Woo
|
765 |
-
Volker Mische
|
766 |
-
vtripolitakis
|
767 |
-
wdouglashall
|
768 |
-
Weiyan Shao
|
769 |
-
wenli
|
770 |
-
Wes Cossick
|
771 |
-
Wesley Wiser
|
772 |
-
Weston Ruter
|
773 |
-
Will Binns-Smith
|
774 |
-
Will Dean
|
775 |
-
William Jamieson
|
776 |
-
William Stein
|
777 |
-
Willy
|
778 |
-
Wojtek Ptak
|
779 |
-
wonderboyjon
|
780 |
-
Wu Cheng-Han
|
781 |
-
Xavier Mendez
|
782 |
-
Yassin N. Hassan
|
783 |
-
YNH Webdev
|
784 |
-
yoongu
|
785 |
-
Yunchi Luo
|
786 |
-
Yuvi Panda
|
787 |
-
Yvonnick Esnault
|
788 |
-
Zac Anger
|
789 |
-
Zachary Dremann
|
790 |
-
Zeno Rocha
|
791 |
-
Zhang Hao
|
792 |
-
Ziv
|
793 |
-
zziuni
|
794 |
-
魏鹏刚
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/CHANGELOG.md
DELETED
@@ -1,1556 +0,0 @@
|
|
1 |
-
## 5.44.0 (2019-02-21)
|
2 |
-
|
3 |
-
### Bug fixes
|
4 |
-
|
5 |
-
Fix issue where lines that only contained a zero-height widget got assigned an invalid height.
|
6 |
-
|
7 |
-
Improve support for middle-click paste on X Windows.
|
8 |
-
|
9 |
-
Fix a bug where a paste that doesn't contain any text caused the next input event to be treated as a paste.
|
10 |
-
|
11 |
-
[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Fix accidental global variable.
|
12 |
-
|
13 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Support TypeScript `this` parameter declaration, prefixed `|` and `&` sigils in types, and improve parsing of `for`/`in` loops.
|
14 |
-
|
15 |
-
### New features
|
16 |
-
|
17 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Properly emulate forward-delete.
|
18 |
-
|
19 |
-
New theme: [nord](https://codemirror.net/demo/theme.html#nord).
|
20 |
-
|
21 |
-
## 5.43.0 (2019-01-21)
|
22 |
-
|
23 |
-
### Bug fixes
|
24 |
-
|
25 |
-
Fix mistakes in passing through the arguments to `indent` in several wrapping modes.
|
26 |
-
|
27 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Fix parsing for a number of new and obscure TypeScript features.
|
28 |
-
|
29 |
-
[ruby mode](https://codemirror.net/mode/ruby): Support indented end tokens for heredoc strings.
|
30 |
-
|
31 |
-
### New features
|
32 |
-
|
33 |
-
New options `autocorrect` and `autocapitalize` to turn on those browser features.
|
34 |
-
|
35 |
-
## 5.42.2 (2018-12-21)
|
36 |
-
|
37 |
-
### Bug fixes
|
38 |
-
|
39 |
-
Fix problem where canceling a change via the `"beforeChange"` event could corrupt the textarea input.
|
40 |
-
|
41 |
-
Fix issues that sometimes caused the context menu hack to fail, or even leave visual artifacts on IE.
|
42 |
-
|
43 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Make it possible to select text between angle brackets.
|
44 |
-
|
45 |
-
[css mode](https://codemirror.net/mode/css/): Fix tokenizing of CSS variables.
|
46 |
-
|
47 |
-
[python mode](https://codemirror.net/mode/python/): Fix another bug in tokenizing of format strings.
|
48 |
-
|
49 |
-
[soy mode](https://codemirror.net/mode/soy/): More accurate highlighting.
|
50 |
-
|
51 |
-
## 5.42.0 (2018-11-20)
|
52 |
-
|
53 |
-
### Bug fixes
|
54 |
-
|
55 |
-
Fix an issue where wide characters could cause lines to be come wider than the editor's horizontal scroll width.
|
56 |
-
|
57 |
-
Optimize handling of window resize events.
|
58 |
-
|
59 |
-
[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Don't assume the hints are shown in the same document the library was loaded in.
|
60 |
-
|
61 |
-
[python mode](https://codemirror.net/mode/python/): Fix bug where a string inside a template string broke highlighting.
|
62 |
-
|
63 |
-
[swift mode](https://codemirror.net/mode/swift): Support multi-line strings.
|
64 |
-
|
65 |
-
### New features
|
66 |
-
|
67 |
-
The [`markText` method](https://codemirror.net/doc/manual.html#markText) now takes an [`attributes`](https://codemirror.net/doc/manual.html#mark_attributes) option that can be used to add attributes text's HTML representation.
|
68 |
-
|
69 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Add support for the `=` binding.
|
70 |
-
|
71 |
-
## 5.41.0 (2018-10-25)
|
72 |
-
|
73 |
-
### Bug fixes
|
74 |
-
|
75 |
-
Fix firing of [`"gutterContextMenu"`](https://codemirror.net/doc/manual.html#event_gutterContextMenu) event on Firefox.
|
76 |
-
|
77 |
-
Solve an issue where copying multiple selections might mess with subsequent typing.
|
78 |
-
|
79 |
-
Don't crash when [`endOperation`](https://codemirror.net/doc/manual.html#endOperation) is called with no operation active.
|
80 |
-
|
81 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Fix insert mode repeat after visualBlock edits.
|
82 |
-
|
83 |
-
[scheme mode](https://codemirror.net/mode/scheme/index.html): Improve highlighting of quoted expressions.
|
84 |
-
|
85 |
-
[soy mode](https://codemirror.net/mode/soy/): Support injected data and `@param` in comments.
|
86 |
-
|
87 |
-
[objective c mode](https://codemirror.net/mode/clike/): Improve conformance to the actual language.
|
88 |
-
|
89 |
-
### New features
|
90 |
-
|
91 |
-
A new [`selectionsMayTouch`](https://codemirror.net/doc/manual.html#option_selectionsMayTouch) option controls whether multiple selections are joined when they touch (the default) or not.
|
92 |
-
|
93 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Add `noremap` binding command.
|
94 |
-
|
95 |
-
## 5.40.2 (2018-09-20)
|
96 |
-
|
97 |
-
### Bug fixes
|
98 |
-
|
99 |
-
Fix firing of `gutterContextMenu` event on Firefox.
|
100 |
-
|
101 |
-
Add `hintWords` (basic completion) helper to [clojure](https://codemirror.net/mode/clojure/index.html), [mllike](https://codemirror.net/mode/mllike/index.html), [julia](https://codemirror.net/mode/julia/), [shell](https://codemirror.net/mode/shell/), and [r](https://codemirror.net/mode/r/) modes.
|
102 |
-
|
103 |
-
[clojure mode](https://codemirror.net/mode/clojure/index.html): Clean up and improve.
|
104 |
-
|
105 |
-
## 5.40.0 (2018-08-25)
|
106 |
-
|
107 |
-
### Bug fixes
|
108 |
-
|
109 |
-
[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Fix issue where bracket-closing wouldn't work before punctuation.
|
110 |
-
|
111 |
-
[panel addon](https://codemirror.net/doc/manual.html#addon_panel): Fix problem where replacing the last remaining panel dropped the newly added panel.
|
112 |
-
|
113 |
-
[hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap): Fix an infinite loop when the indention is greater than the target column.
|
114 |
-
|
115 |
-
[jinja2](https://codemirror.net/mode/jinja2/) and [markdown](https://codemirror.net/mode/markdown/) modes: Add comment metadata.
|
116 |
-
|
117 |
-
### New features
|
118 |
-
|
119 |
-
New method [`phrase`](https://codemirror.net/doc/manual.html#phrase) and option [`phrases`](https://codemirror.net/doc/manual.html#option_phrases) to make translating UI text in addons easier.
|
120 |
-
|
121 |
-
## 5.39.2 (2018-07-20)
|
122 |
-
|
123 |
-
### Bug fixes
|
124 |
-
|
125 |
-
Fix issue where when you pass the document as a `Doc` instance to the `CodeMirror` constructor, the `mode` option was ignored.
|
126 |
-
|
127 |
-
Fix bug where line height could be computed wrong with a line widget below a collapsed line.
|
128 |
-
|
129 |
-
Fix overeager `.npmignore` dropping the `bin/source-highlight` utility from the distribution.
|
130 |
-
|
131 |
-
[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Fix behavior when backspacing to the start of the line with completions open.
|
132 |
-
|
133 |
-
## 5.39.0 (2018-06-20)
|
134 |
-
|
135 |
-
### Bug fixes
|
136 |
-
|
137 |
-
Fix issue that in some circumstances caused content to be clipped off at the bottom after a resize.
|
138 |
-
|
139 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Improve handling of blank lines in HTML tags.
|
140 |
-
|
141 |
-
### New features
|
142 |
-
|
143 |
-
[stex mode](https://codemirror.net/mode/stex/): Add an `inMathMode` option to start the mode in math mode.
|
144 |
-
|
145 |
-
## 5.38.0 (2018-05-21)
|
146 |
-
|
147 |
-
### Bug fixes
|
148 |
-
|
149 |
-
Improve reliability of noticing a missing mouseup event during dragging.
|
150 |
-
|
151 |
-
Make sure `getSelection` is always called on the correct document.
|
152 |
-
|
153 |
-
Fix interpretation of line breaks and non-breaking spaces inserted by renderer in contentEditable mode.
|
154 |
-
|
155 |
-
Work around some browsers inexplicably making the fake scrollbars focusable.
|
156 |
-
|
157 |
-
Make sure `coordsChar` doesn't return positions inside collapsed ranges.
|
158 |
-
|
159 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Support block scopes, bindingless catch, bignum suffix, `s` regexp flag.
|
160 |
-
|
161 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Adjust a wasteful regexp.
|
162 |
-
|
163 |
-
[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Allow opening the control without any item selected.
|
164 |
-
|
165 |
-
### New features
|
166 |
-
|
167 |
-
New theme: [darcula](https://codemirror.net/demo/theme.html#darcula).
|
168 |
-
|
169 |
-
[dialog addon](https://codemirror.net/doc/manual.html#addon_dialog): Add a CSS class (`dialog-opened`) to the editor when a dialog is open.
|
170 |
-
|
171 |
-
## 5.37.0 (2018-04-20)
|
172 |
-
|
173 |
-
### Bug fixes
|
174 |
-
|
175 |
-
Suppress keypress events during composition, for platforms that don't properly do this themselves.
|
176 |
-
|
177 |
-
[xml-fold addon](https://codemirror.net/demo/folding.html): Improve handling of line-wrapped opening tags.
|
178 |
-
|
179 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Improve TypeScript support.
|
180 |
-
|
181 |
-
[python mode](https://codemirror.net/mode/python/): Highlight expressions inside format strings.
|
182 |
-
|
183 |
-
### New features
|
184 |
-
|
185 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Add support for '(' and ')' movement.
|
186 |
-
|
187 |
-
New themes: [idea](https://codemirror.net/demo/theme.html#idea), [ssms](https://codemirror.net/demo/theme.html#ssms), [gruvbox-dark](https://codemirror.net/demo/theme.html#gruvbox-dark).
|
188 |
-
|
189 |
-
## 5.36.0 (2018-03-20)
|
190 |
-
|
191 |
-
### Bug fixes
|
192 |
-
|
193 |
-
Make sure all document-level event handlers are registered on the document that the editor is part of.
|
194 |
-
|
195 |
-
Fix issue that prevented edits whose origin starts with `+` from being combined in history events for an editor-less document.
|
196 |
-
|
197 |
-
[multiplex addon](https://codemirror.net/demo/multiplex.html): Improve handling of indentation.
|
198 |
-
|
199 |
-
[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Use CSS `:after` element to style the scroll-lock icon.
|
200 |
-
|
201 |
-
[javascript-hint addon](https://codemirror.net/doc/manual.html#addon_javascript-hint): Don't provide completions in JSON mode.
|
202 |
-
|
203 |
-
[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Fix numbering error.
|
204 |
-
|
205 |
-
[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Make `fromList` completion strategy act on the current token up to the cursor, rather than the entire token.
|
206 |
-
|
207 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Fix a regexp with potentially exponental complexity.
|
208 |
-
|
209 |
-
### New features
|
210 |
-
|
211 |
-
New theme: [lucario](https://codemirror.net/demo/theme.html#lucario).
|
212 |
-
|
213 |
-
## 5.35.0 (2018-02-20)
|
214 |
-
|
215 |
-
### Bug fixes
|
216 |
-
|
217 |
-
Fix problem where selection undo might change read-only documents.
|
218 |
-
|
219 |
-
Fix crash when calling `addLineWidget` on a document that has no attached editor.
|
220 |
-
|
221 |
-
[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Fix behavior of `^` in multiline regexp mode.
|
222 |
-
|
223 |
-
[match-highlighter addon](https://codemirror.net/doc/manual.html#addon_match-highlighter): Fix problem with matching words that have regexp special syntax in them.
|
224 |
-
|
225 |
-
[sublime bindings](https://codemirror.net/demo/sublime.html): Fix `addCursorToSelection` for short lines.
|
226 |
-
|
227 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Support TypeScript intersection types, dynamic `import`.
|
228 |
-
|
229 |
-
[stex mode](https://codemirror.net/mode/stex/): Fix parsing of `\(` `\)` delimiters, recognize more atom arguments.
|
230 |
-
|
231 |
-
[haskell mode](https://codemirror.net/mode/haskell/): Highlight more builtins, support `<*` and `*>`.
|
232 |
-
|
233 |
-
[sql mode](https://codemirror.net/mode/sql/): Make it possible to disable backslash escapes in strings for dialects that don't have them, do this for MS SQL.
|
234 |
-
|
235 |
-
[dockerfile mode](https://codemirror.net/mode/dockerfile/): Highlight strings and ports, recognize more instructions.
|
236 |
-
|
237 |
-
### New features
|
238 |
-
|
239 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Support alternative delimiters in replace command.
|
240 |
-
|
241 |
-
## 5.34.0 (2018-01-29)
|
242 |
-
|
243 |
-
### Bug fixes
|
244 |
-
|
245 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Fix a problem where inline styles would persist across list items.
|
246 |
-
|
247 |
-
[sublime bindings](https://codemirror.net/demo/sublime.html): Fix the `toggleBookmark` command.
|
248 |
-
|
249 |
-
[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Improve behavior when closing triple quotes.
|
250 |
-
|
251 |
-
[xml-fold addon](https://codemirror.net/demo/folding.html): Fix folding of line-broken XML tags.
|
252 |
-
|
253 |
-
[shell mode](https://codemirror.net/mode/shell/): Better handling of nested quoting.
|
254 |
-
|
255 |
-
[javascript-lint addon](https://codemirror.net/demo/lint.html): Clean up and simplify.
|
256 |
-
|
257 |
-
[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Fix support for multiple editors at the same time.
|
258 |
-
|
259 |
-
### New features
|
260 |
-
|
261 |
-
New themes: [oceanic-next](https://codemirror.net/demo/theme.html#oceanic-next) and [shadowfox](https://codemirror.net/demo/theme.html#shadowfox).
|
262 |
-
|
263 |
-
## 5.33.0 (2017-12-21)
|
264 |
-
|
265 |
-
### Bug fixes
|
266 |
-
|
267 |
-
[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Make updates more efficient.
|
268 |
-
|
269 |
-
[css mode](https://codemirror.net/mode/css/): The mode is now properly case-insensitive.
|
270 |
-
|
271 |
-
[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Fix broken handling of unordered lists introduced in previous release.
|
272 |
-
|
273 |
-
[swift](https://codemirror.net/mode/swift) and [scala](https://codemirror.net/mode/clike/) modes: Support nested block comments.
|
274 |
-
|
275 |
-
[mllike mode](https://codemirror.net/mode/mllike/index.html): Improve OCaml support.
|
276 |
-
|
277 |
-
[sublime bindings](https://codemirror.net/demo/sublime.html): Use the proper key bindings for `addCursorToNextLine` and `addCursorToPrevLine`.
|
278 |
-
|
279 |
-
### New features
|
280 |
-
|
281 |
-
[jsx mode](https://codemirror.net/mode/jsx/index.html): Support JSX fragments.
|
282 |
-
|
283 |
-
[closetag addon](https://codemirror.net/demo/closetag.html): Add an option to disable auto-indenting.
|
284 |
-
|
285 |
-
## 5.32.0 (2017-11-22)
|
286 |
-
|
287 |
-
### Bug fixes
|
288 |
-
|
289 |
-
Increase contrast on default bracket-matching colors.
|
290 |
-
|
291 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Recognize TypeScript type parameters for calls, type guards, and type parameter defaults. Improve handling of `enum` and `module` keywords.
|
292 |
-
|
293 |
-
[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix bug when uncommenting a comment that spans all but the last selected line.
|
294 |
-
|
295 |
-
[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Fix bug in case folding.
|
296 |
-
|
297 |
-
[emacs bindings](https://codemirror.net/demo/emacs.html): Prevent single-character deletions from resetting the kill ring.
|
298 |
-
|
299 |
-
[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Tweak quote matching behavior.
|
300 |
-
|
301 |
-
### New features
|
302 |
-
|
303 |
-
[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Increment ordered list numbers when adding one.
|
304 |
-
|
305 |
-
## 5.31.0 (2017-10-20)
|
306 |
-
|
307 |
-
### Bug fixes
|
308 |
-
|
309 |
-
Further improve selection drawing and cursor motion in right-to-left documents.
|
310 |
-
|
311 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable [input mode](https://codemirror.net/doc/manual.html#option_contentEditable).
|
312 |
-
|
313 |
-
[continuecomment addon](https://codemirror.net/doc/manual.html#addon_continuecomment): Fix bug when pressing enter after a single-line block comment.
|
314 |
-
|
315 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Fix issue with leaving indented fenced code blocks.
|
316 |
-
|
317 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.
|
318 |
-
|
319 |
-
### New features
|
320 |
-
|
321 |
-
Modes added with [`addOverlay`](https://codemirror.net/doc/manual.html#addOverlay) now have access to a [`baseToken`](https://codemirror.net/doc/manual.html#baseToken) method on their input stream, giving access to the tokens of the underlying mode.
|
322 |
-
|
323 |
-
## 5.30.0 (2017-09-20)
|
324 |
-
|
325 |
-
### Bug fixes
|
326 |
-
|
327 |
-
Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.
|
328 |
-
|
329 |
-
[search addon](https://codemirror.net/demo/search/): Fix crash when restarting search after doing empty search.
|
330 |
-
|
331 |
-
[mark-selection addon](http://cm/doc/manual.html#addon_mark-selection): Fix off-by-one bug.
|
332 |
-
|
333 |
-
[tern addon](https://codemirror.net/demo/tern.html): Fix bad request made when editing at the bottom of a large document.
|
334 |
-
|
335 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Improve parsing in a number of corner cases.
|
336 |
-
|
337 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.
|
338 |
-
|
339 |
-
[gfm mode](https://codemirror.net/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives.
|
340 |
-
|
341 |
-
[soy mode](https://codemirror.net/mode/soy/): Support injected data and `@param` in comments.
|
342 |
-
|
343 |
-
### New features
|
344 |
-
|
345 |
-
[simple mode addon](https://codemirror.net/demo/simplemode.html): Allow groups in regexps when `token` isn't an array.
|
346 |
-
|
347 |
-
## 5.29.0 (2017-08-24)
|
348 |
-
|
349 |
-
### Bug fixes
|
350 |
-
|
351 |
-
Fix crash in contentEditable input style when editing near a bookmark.
|
352 |
-
|
353 |
-
Make sure change origins are preserved when splitting changes on [read-only marks](https://codemirror.net/doc/manual.html#mark_readOnly).
|
354 |
-
|
355 |
-
[javascript mode](https://codemirror.net/mode/javascript/): More support for TypeScript syntax.
|
356 |
-
|
357 |
-
[d mode](https://codemirror.net/mode/d/): Support nested comments.
|
358 |
-
|
359 |
-
[python mode](https://codemirror.net/mode/python/): Improve tokenizing of operators.
|
360 |
-
|
361 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Further improve CommonMark conformance.
|
362 |
-
|
363 |
-
[css mode](https://codemirror.net/mode/css/): Don't run comment tokens through the mode's state machine.
|
364 |
-
|
365 |
-
[shell mode](https://codemirror.net/mode/shell/): Allow strings to span lines.
|
366 |
-
|
367 |
-
[search addon](https://codemirror.net/demo/search/): Fix crash in persistent search when `extraKeys` is null.
|
368 |
-
|
369 |
-
## 5.28.0 (2017-07-21)
|
370 |
-
|
371 |
-
### Bug fixes
|
372 |
-
|
373 |
-
Fix copying of, or replacing editor content with, a single dash character when copying a big selection in some corner cases.
|
374 |
-
|
375 |
-
Make [`"goLineLeft"`](https://codemirror.net/doc/manual.html#command_goLineLeft)/`"goLineRight"` behave better on wrapped lines.
|
376 |
-
|
377 |
-
[sql mode](https://codemirror.net/mode/sql/): Fix tokenizing of multi-dot operator and allow digits in subfield names.
|
378 |
-
|
379 |
-
[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Fix infinite loop on some composed character inputs.
|
380 |
-
|
381 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Make list parsing more CommonMark-compliant.
|
382 |
-
|
383 |
-
[gfm mode](https://codemirror.net/mode/gfm/): Highlight colon syntax for emoji.
|
384 |
-
|
385 |
-
### New features
|
386 |
-
|
387 |
-
Expose [`startOperation`](https://codemirror.net/doc/manual.html#startOperation) and `endOperation` for explicit operation management.
|
388 |
-
|
389 |
-
[sublime bindings](https://codemirror.net/demo/sublime.html): Add extend-selection (Ctrl-Alt- or Cmd-Shift-Up/Down).
|
390 |
-
|
391 |
-
## 5.27.4 (2017-06-29)
|
392 |
-
|
393 |
-
### Bug fixes
|
394 |
-
|
395 |
-
Fix crash when using mode lookahead.
|
396 |
-
|
397 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Don't block inner mode's indentation support.
|
398 |
-
|
399 |
-
## 5.27.2 (2017-06-22)
|
400 |
-
|
401 |
-
### Bug fixes
|
402 |
-
|
403 |
-
Fix crash in the [simple mode](https://codemirror.net/demo/simplemode.html)< addon.
|
404 |
-
|
405 |
-
## 5.27.0 (2017-06-22)
|
406 |
-
|
407 |
-
### Bug fixes
|
408 |
-
|
409 |
-
Fix infinite loop in forced display update.
|
410 |
-
|
411 |
-
Properly disable the hidden textarea when `readOnly` is `"nocursor"`.
|
412 |
-
|
413 |
-
Calling the `Doc` constructor without `new` works again.
|
414 |
-
|
415 |
-
[sql mode](https://codemirror.net/mode/sql/): Handle nested comments.
|
416 |
-
|
417 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Improve support for TypeScript syntax.
|
418 |
-
|
419 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Fix bug where markup was ignored on indented paragraph lines.
|
420 |
-
|
421 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Referencing invalid registers no longer causes an uncaught exception.
|
422 |
-
|
423 |
-
[rust mode](https://codemirror.net/mode/rust/): Add the correct MIME type.
|
424 |
-
|
425 |
-
[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Document options.
|
426 |
-
|
427 |
-
### New features
|
428 |
-
|
429 |
-
Mouse button clicks can now be bound in keymaps by using names like `"LeftClick"` or `"Ctrl-Alt-MiddleTripleClick"`. When bound to a function, that function will be passed the position of the click as second argument.
|
430 |
-
|
431 |
-
The behavior of mouse selection and dragging can now be customized with the [`configureMouse`](https://codemirror.net/doc/manual.html#option_configureMouse) option.
|
432 |
-
|
433 |
-
Modes can now look ahead across line boundaries with the [`StringStream`](https://codemirror.net/doc/manual.html#StringStream)`.lookahead` method.
|
434 |
-
|
435 |
-
Introduces a `"type"` token type, makes modes that recognize types output it, and add styling for it to the themes.
|
436 |
-
|
437 |
-
New [`pasteLinesPerSelection`](https://codemirror.net/doc/manual.html#option_pasteLinesPerSelection) option to control the behavior of pasting multiple lines into multiple selections.
|
438 |
-
|
439 |
-
[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Support multi-line regular expression matches, and normalize strings when matching.
|
440 |
-
|
441 |
-
## 5.26.0 (2017-05-22)
|
442 |
-
|
443 |
-
### Bug fixes
|
444 |
-
|
445 |
-
In textarea-mode, don't reset the input field during composition.
|
446 |
-
|
447 |
-
More careful restoration of selections in widgets, during editor redraw.
|
448 |
-
|
449 |
-
[javascript mode](https://codemirror.net/mode/javascript/): More TypeScript parsing fixes.
|
450 |
-
|
451 |
-
[julia mode](https://codemirror.net/mode/julia/): Fix issue where the mode gets stuck.
|
452 |
-
|
453 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Understand cross-line links, parse all bracketed things as links.
|
454 |
-
|
455 |
-
[soy mode](https://codemirror.net/mode/soy/): Support single-quoted strings.
|
456 |
-
|
457 |
-
[go mode](https://codemirror.net/mode/go/): Don't try to indent inside strings or comments.
|
458 |
-
|
459 |
-
### New features
|
460 |
-
|
461 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Parse line offsets in line or range specs.
|
462 |
-
|
463 |
-
## 5.25.2 (2017-04-20)
|
464 |
-
|
465 |
-
### Bug fixes
|
466 |
-
|
467 |
-
Better handling of selections that cover the whole viewport in contentEditable-mode.
|
468 |
-
|
469 |
-
No longer accidentally scroll the editor into view when calling `setValue`.
|
470 |
-
|
471 |
-
Work around Chrome Android bug when converting screen coordinates to editor positions.
|
472 |
-
|
473 |
-
Make sure long-clicking a selection sets a cursor and doesn't show the editor losing focus.
|
474 |
-
|
475 |
-
Fix issue where pointer events were incorrectly disabled on Chrome's overlay scrollbars.
|
476 |
-
|
477 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Recognize annotations and TypeScript-style type parameters.
|
478 |
-
|
479 |
-
[shell mode](https://codemirror.net/mode/shell/): Handle nested braces.
|
480 |
-
|
481 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Make parsing of strong/em delimiters CommonMark-compliant.
|
482 |
-
|
483 |
-
## 5.25.0 (2017-03-20)
|
484 |
-
|
485 |
-
### Bug fixes
|
486 |
-
|
487 |
-
In contentEditable-mode, properly locate changes that repeat a character when inserted with IME.
|
488 |
-
|
489 |
-
Fix handling of selections bigger than the viewport in contentEditable mode.
|
490 |
-
|
491 |
-
Improve handling of changes that insert or delete lines in contentEditable mode.
|
492 |
-
|
493 |
-
Count Unicode control characters 0x80 to 0x9F as special (non-printing) chars.
|
494 |
-
|
495 |
-
Fix handling of shadow DOM roots when finding the active element.
|
496 |
-
|
497 |
-
Add `role=presentation` to more DOM elements to improve screen reader support.
|
498 |
-
|
499 |
-
[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Make aligning of unchanged chunks more robust.
|
500 |
-
|
501 |
-
[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (differnet) block comment.
|
502 |
-
|
503 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Improve support for TypeScript syntax.
|
504 |
-
|
505 |
-
[r mode](https://codemirror.net/mode/r/): Fix indentation after semicolon-less statements.
|
506 |
-
|
507 |
-
[shell mode](https://codemirror.net/mode/shell/): Properly handle escaped parentheses in parenthesized expressions.
|
508 |
-
|
509 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Fix a few bugs around leaving fenced code blocks.
|
510 |
-
|
511 |
-
[soy mode](https://codemirror.net/mode/soy/): Improve indentation.
|
512 |
-
|
513 |
-
### New features
|
514 |
-
|
515 |
-
[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Support asynchronous linters that return promises.
|
516 |
-
|
517 |
-
[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Support continuing task lists.
|
518 |
-
|
519 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Make Y behave like yy.
|
520 |
-
|
521 |
-
[sql mode](https://codemirror.net/mode/sql/): Support sqlite dialect.
|
522 |
-
|
523 |
-
## 5.24.2 (2017-02-22)
|
524 |
-
|
525 |
-
### Bug fixes
|
526 |
-
|
527 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Support computed class method names.
|
528 |
-
|
529 |
-
[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Improve aligning of unchanged code in the presence of marks and line widgets.
|
530 |
-
|
531 |
-
## 5.24.0 (2017-02-20)
|
532 |
-
|
533 |
-
### Bug fixes
|
534 |
-
|
535 |
-
A cursor directly before a line-wrapping break is now drawn before or after the line break depending on which direction you arrived from.
|
536 |
-
|
537 |
-
Visual cursor motion in line-wrapped right-to-left text should be much more correct.
|
538 |
-
|
539 |
-
Fix bug in handling of read-only marked text.
|
540 |
-
|
541 |
-
[shell mode](https://codemirror.net/mode/shell/): Properly tokenize nested parentheses.
|
542 |
-
|
543 |
-
[python mode](https://codemirror.net/mode/python/): Support underscores in number literals.
|
544 |
-
|
545 |
-
[sass mode](https://codemirror.net/mode/sass/): Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset.
|
546 |
-
|
547 |
-
[css mode](https://codemirror.net/mode/css/): Expose `lineComment` property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.
|
548 |
-
|
549 |
-
[julia mode](https://codemirror.net/mode/julia/): Properly indent `elseif` lines.
|
550 |
-
|
551 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Properly recognize the end of fenced code blocks when inside other markup.
|
552 |
-
|
553 |
-
[scala mode](https://codemirror.net/mode/clike/): Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.
|
554 |
-
|
555 |
-
[xml mode](https://codemirror.net/mode/xml/): Allow dashes in HTML tag names.
|
556 |
-
|
557 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Improve parsing of async methods, TypeScript-style comma-separated superclass lists.
|
558 |
-
|
559 |
-
[indent-fold addon](https://codemirror.net/demo/folding.html): Ignore comment lines.
|
560 |
-
|
561 |
-
### New features
|
562 |
-
|
563 |
-
Positions now support a `sticky` property which determines whether they should be associated with the character before (value `"before"`) or after (value `"after"`) them.
|
564 |
-
|
565 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Make it possible to remove built-in bindings through the API.
|
566 |
-
|
567 |
-
[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.
|
568 |
-
|
569 |
-
### Breaking changes
|
570 |
-
|
571 |
-
The [sass mode](https://codemirror.net/mode/sass/) now depends on the [css mode](https://codemirror.net/mode/css/).
|
572 |
-
|
573 |
-
## 5.23.0 (2017-01-19)
|
574 |
-
|
575 |
-
### Bug fixes
|
576 |
-
|
577 |
-
Presentation-related elements DOM elements are now marked as such to help screen readers.
|
578 |
-
|
579 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Be more picky about what HTML tags look like to avoid false positives.
|
580 |
-
|
581 |
-
### New features
|
582 |
-
|
583 |
-
`findModeByMIME` now understands `+json` and `+xml` MIME suffixes.
|
584 |
-
|
585 |
-
[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Add support for an `override` option to ignore language-specific defaults.
|
586 |
-
|
587 |
-
[panel addon](https://codemirror.net/doc/manual.html#addon_panel): Add a `stable` option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.
|
588 |
-
|
589 |
-
## 5.22.2 (2017-01-12)
|
590 |
-
|
591 |
-
### Bug fixes
|
592 |
-
|
593 |
-
Include rollup.config.js in NPM package, so that it can be used to build from source.
|
594 |
-
|
595 |
-
## 5.22.0 (2016-12-20)
|
596 |
-
|
597 |
-
### Bug fixes
|
598 |
-
|
599 |
-
[sublime bindings](https://codemirror.net/demo/sublime.html): Make `selectBetweenBrackets` work with multiple cursors.
|
600 |
-
|
601 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Fix issues with parsing complex TypeScript types, imports, and exports.
|
602 |
-
|
603 |
-
A contentEditable editor instance with autofocus enabled no longer crashes during initializing.
|
604 |
-
|
605 |
-
### New features
|
606 |
-
|
607 |
-
[emacs bindings](https://codemirror.net/demo/emacs.html): Export `CodeMirror.emacs` to allow other addons to hook into Emacs-style functionality.
|
608 |
-
|
609 |
-
[active-line addon](https://codemirror.net/doc/manual.html#addon_active-line): Add `nonEmpty` option.
|
610 |
-
|
611 |
-
New event: [`optionChange`](https://codemirror.net/doc/manual.html#event_optionChange).
|
612 |
-
|
613 |
-
## 5.21.0 (2016-11-21)
|
614 |
-
|
615 |
-
### Bug fixes
|
616 |
-
|
617 |
-
Tapping/clicking the editor in [contentEditable mode](https://codemirror.net/doc/manual.html#option_inputStyle) on Chrome now puts the cursor at the tapped position.
|
618 |
-
|
619 |
-
Fix various crashes and misbehaviors when reading composition events in [contentEditable mode](https://codemirror.net/doc/manual.html#option_inputStyle).
|
620 |
-
|
621 |
-
Catches and ignores an IE 'Unspecified Error' when creating an editor in an iframe before there is a `<body>`.
|
622 |
-
|
623 |
-
[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Fix several issues in the chunk-aligning feature.
|
624 |
-
|
625 |
-
[verilog mode](https://codemirror.net/mode/verilog): Rewritten to address various issues.
|
626 |
-
|
627 |
-
[julia mode](https://codemirror.net/mode/julia): Recognize Julia 0.5 syntax.
|
628 |
-
|
629 |
-
[swift mode](https://codemirror.net/mode/swift): Various fixes and adjustments to current syntax.
|
630 |
-
|
631 |
-
[markdown mode](https://codemirror.net/mode/markdown): Allow lists without a blank line above them.
|
632 |
-
|
633 |
-
### New features
|
634 |
-
|
635 |
-
The [`setGutterMarker`](https://codemirror.net/doc/manual.html#setGutterMarker), [`clearGutter`](https://codemirror.net/doc/manual.html#clearGutter), and [`lineInfo`](https://codemirror.net/doc/manual.html#lineInfo) methods are now available on `Doc` objects.
|
636 |
-
|
637 |
-
The [`heightAtLine`](https://codemirror.net/doc/manual.html#heightAtLine) method now takes an extra argument to allow finding the height at the top of the line's line widgets.
|
638 |
-
|
639 |
-
[ruby mode](https://codemirror.net/mode/ruby): `else` and `elsif` are now immediately indented.
|
640 |
-
|
641 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Bind Ctrl-T and Ctrl-D to in- and dedent in insert mode.
|
642 |
-
|
643 |
-
## 5.20.2 (2016-10-21)
|
644 |
-
|
645 |
-
### Bug fixes
|
646 |
-
|
647 |
-
Fix `CodeMirror.version` returning the wrong version number.
|
648 |
-
|
649 |
-
## 5.20.0 (2016-10-20)
|
650 |
-
|
651 |
-
### Bug fixes
|
652 |
-
|
653 |
-
Make `newlineAndIndent` command work with multiple cursors on the same line.
|
654 |
-
|
655 |
-
Make sure keypress events for backspace are ignored.
|
656 |
-
|
657 |
-
Tokens styled with overlays no longer get a nonsense `cm-cm-overlay` class.
|
658 |
-
|
659 |
-
Line endings for pasted content are now normalized to the editor's [preferred ending](https://codemirror.net/doc/manual.html#option_lineSeparator).
|
660 |
-
|
661 |
-
[javascript mode](https://codemirror.net/mode/javascript): Improve support for class expressions. Support TypeScript optional class properties, the `abstract` keyword, and return type declarations for arrow functions.
|
662 |
-
|
663 |
-
[css mode](https://codemirror.net/mode/css): Fix highlighting of mixed-case keywords.
|
664 |
-
|
665 |
-
[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Improve behavior when typing a quote before a string.
|
666 |
-
|
667 |
-
### New features
|
668 |
-
|
669 |
-
The core is now maintained as a number of small files, using ES6 syntax and modules, under the `src/` directory. A git checkout no longer contains a working `codemirror.js` until you `npm run build` (but when installing from NPM, it is included).
|
670 |
-
|
671 |
-
The [`refresh`](https://codemirror.net/doc/manual.html#event_refresh) event is now documented and stable.
|
672 |
-
|
673 |
-
## 5.19.0 (2016-09-20)
|
674 |
-
|
675 |
-
### Bugfixes
|
676 |
-
|
677 |
-
[erlang mode](https://codemirror.net/mode/erlang): Fix mode crash when trying to read an empty context.
|
678 |
-
|
679 |
-
[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix broken behavior when toggling comments inside a comment.
|
680 |
-
|
681 |
-
xml-fold addon: Fix a null-dereference bug.
|
682 |
-
|
683 |
-
Page up and page down now do something even in single-line documents.
|
684 |
-
|
685 |
-
Fix an issue where the cursor position could be off in really long (~8000 character) tokens.
|
686 |
-
|
687 |
-
### New features
|
688 |
-
|
689 |
-
[javascript mode](https://codemirror.net/mode/javascript): Better indentation when semicolons are missing. Better support for TypeScript classes, optional parameters, and the `type` keyword.
|
690 |
-
|
691 |
-
The [`blur`](https://codemirror.net/doc/manual.html#event_blur) and [`focus`](https://codemirror.net/doc/manual.html#event_focus) events now pass the DOM event to their handlers.
|
692 |
-
|
693 |
-
## 5.18.2 (2016-08-23)
|
694 |
-
|
695 |
-
### Bugfixes
|
696 |
-
|
697 |
-
[vue mode](https://codemirror.net/mode/vue): Fix outdated references to renamed Pug mode dependency.
|
698 |
-
|
699 |
-
## 5.18.0 (2016-08-22)
|
700 |
-
|
701 |
-
### Bugfixes
|
702 |
-
|
703 |
-
Make sure [gutter backgrounds](https://codemirror.net/doc/manual.html#addLineClass) stick to the rest of the gutter during horizontal scrolling.
|
704 |
-
|
705 |
-
The contenteditable [`inputStyle`](https://codemirror.net/doc/manual.html#option_inputStyle) now properly supports pasting on pre-Edge IE versions.
|
706 |
-
|
707 |
-
[javascript mode](https://codemirror.net/mode/javascript): Fix some small parsing bugs and improve TypeScript support.
|
708 |
-
|
709 |
-
[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Fix bug where active highlighting was left in editor when the addon was disabled.
|
710 |
-
|
711 |
-
[match-highlighter addon](https://codemirror.net/doc/manual.html#addon_match-highlighter): Only start highlighting things when the editor gains focus.
|
712 |
-
|
713 |
-
[javascript-hint addon](https://codemirror.net/doc/manual.html#addon_javascript-hint): Also complete non-enumerable properties.
|
714 |
-
|
715 |
-
### New features
|
716 |
-
|
717 |
-
The [`addOverlay`](https://codemirror.net/doc/manual.html#addOverlay) method now supports a `priority` option to control the order in which overlays are applied.
|
718 |
-
|
719 |
-
MIME types that end in `+json` now default to the JSON mode when the MIME itself is not defined.
|
720 |
-
|
721 |
-
### Breaking changes
|
722 |
-
|
723 |
-
The mode formerly known as Jade was renamed to [Pug](https://codemirror.net/mode/pug).
|
724 |
-
|
725 |
-
The [Python mode](https://codemirror.net/mode/python) now defaults to Python 3 (rather than 2) syntax.
|
726 |
-
|
727 |
-
## 5.17.0 (2016-07-19)
|
728 |
-
|
729 |
-
### Bugfixes
|
730 |
-
|
731 |
-
Fix problem with wrapped trailing whitespace displaying incorrectly.
|
732 |
-
|
733 |
-
Prevent IME dialog from overlapping typed content in Chrome.
|
734 |
-
|
735 |
-
Improve measuring of characters near a line wrap.
|
736 |
-
|
737 |
-
[javascript mode](https://codemirror.net/mode/javascript): Improve support for `async`, allow trailing commas in `import` lists.
|
738 |
-
|
739 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Fix backspace in replace mode.
|
740 |
-
|
741 |
-
[sublime bindings](https://codemirror.net/demo/sublime.html): Fix some key bindings on OS X to match Sublime Text.
|
742 |
-
|
743 |
-
### New features
|
744 |
-
|
745 |
-
[markdown mode](https://codemirror.net/mode/markdown): Add more classes to image links in highlight-formatting mode.
|
746 |
-
|
747 |
-
## 5.16.0 (2016-06-20)
|
748 |
-
|
749 |
-
### Bugfixes
|
750 |
-
|
751 |
-
Fix glitches when dragging content caused by the drop indicator receiving mouse events.
|
752 |
-
|
753 |
-
Make Control-drag work on Firefox.
|
754 |
-
|
755 |
-
Make clicking or selection-dragging at the end of a wrapped line select the right position.
|
756 |
-
|
757 |
-
[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Prevent widget scrollbar from hiding part of the hint text.
|
758 |
-
|
759 |
-
[rulers addon](https://codemirror.net/doc/manual.html#addon_rulers): Prevent rulers from forcing a horizontal editor scrollbar.
|
760 |
-
|
761 |
-
### New features
|
762 |
-
|
763 |
-
[search addon](https://codemirror.net/doc/manual.html#addon_search): Automatically bind search-related keys in persistent dialog.
|
764 |
-
|
765 |
-
[sublime keymap](https://codemirror.net/demo/sublime.html): Add a multi-cursor aware smart backspace binding.
|
766 |
-
|
767 |
-
## 5.15.2 (2016-05-20)
|
768 |
-
|
769 |
-
### Bugfixes
|
770 |
-
|
771 |
-
Fix a critical document corruption bug that occurs when a document is gradually grown.
|
772 |
-
|
773 |
-
## 5.15.0 (2016-05-20)
|
774 |
-
|
775 |
-
### Bugfixes
|
776 |
-
|
777 |
-
Fix bug that caused the selection to reset when focusing the editor in contentEditable input mode.
|
778 |
-
|
779 |
-
Fix issue where not all ASCII control characters were being replaced by placeholders.
|
780 |
-
|
781 |
-
Remove the assumption that all modes have a `startState` method from several wrapping modes.
|
782 |
-
|
783 |
-
Fix issue where the editor would complain about overlapping collapsed ranges when there weren't any.
|
784 |
-
|
785 |
-
Optimize document tree building when loading or pasting huge chunks of content.
|
786 |
-
|
787 |
-
[markdown mode](https://codemirror.net/mode/markdown/): Fix several issues in matching link targets.
|
788 |
-
|
789 |
-
[clike mode](https://codemirror.net/mode/clike/): Improve indentation of C++ template declarations.
|
790 |
-
|
791 |
-
### New features
|
792 |
-
|
793 |
-
Explicitly bind Ctrl-O on OS X to make that binding (“open line”) act as expected.
|
794 |
-
|
795 |
-
Pasting [linewise-copied](https://codemirror.net/doc/manual.html#option_lineWiseCopyCut) content when there is no selection now inserts the lines above the current line.
|
796 |
-
|
797 |
-
[javascript mode](https://codemirror.net/mode/javascript/): Support `async`/`await` and improve support for TypeScript type syntax.
|
798 |
-
|
799 |
-
## 5.14.2 (2016-04-20)
|
800 |
-
|
801 |
-
### Bugfixes
|
802 |
-
|
803 |
-
Push a new package to NPM due to an [NPM bug](https://github.com/npm/npm/issues/5082) omitting the LICENSE file in 5.14.0.
|
804 |
-
|
805 |
-
Set `dataTransfer.effectAllowed` in `dragstart` handler to help browsers use the right drag icon.
|
806 |
-
|
807 |
-
Add the [mbox mode](https://codemirror.net/mode/mbox/index.html) to `mode/meta.js`.
|
808 |
-
|
809 |
-
## 5.14.0 (2016-04-20)
|
810 |
-
|
811 |
-
### Bugfixes
|
812 |
-
|
813 |
-
[`posFromIndex`](https://codemirror.net/doc/manual.html#posFromIndex) and [`indexFromPos`](https://codemirror.net/doc/manual.html#indexFromPos) now take [`lineSeparator`](https://codemirror.net/doc/manual.html#option_lineSeparator) into account.
|
814 |
-
|
815 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Only call `.save()` when it is actually available.
|
816 |
-
|
817 |
-
[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Be careful not to mangle multi-line strings.
|
818 |
-
|
819 |
-
[Python mode](https://codemirror.net/mode/python/index.html): Improve distinguishing of decorators from `@` operators.
|
820 |
-
|
821 |
-
[`findMarks`](https://codemirror.net/doc/manual.html#findMarks): No longer return marks that touch but don't overlap given range.
|
822 |
-
|
823 |
-
### New features
|
824 |
-
|
825 |
-
[vim bindings](https://codemirror.net/demo/vim.html): Add yank command.
|
826 |
-
|
827 |
-
[match-highlighter addon](https://codemirror.net/doc/manual.html#addon_match-highlighter): Add `trim` option to disable ignoring of whitespace.
|
828 |
-
|
829 |
-
[PowerShell mode](https://codemirror.net/mode/powershell/index.html): Added.
|
830 |
-
|
831 |
-
[Yacas mode](https://codemirror.net/mode/yacas/index.html): Added.
|
832 |
-
|
833 |
-
[Web IDL mode](https://codemirror.net/mode/webidl/index.html): Added.
|
834 |
-
|
835 |
-
[SAS mode](https://codemirror.net/mode/sas/index.html): Added.
|
836 |
-
|
837 |
-
[mbox mode](https://codemirror.net/mode/mbox/index.html): Added.
|
838 |
-
|
839 |
-
## 5.13.2 (2016-03-23)
|
840 |
-
|
841 |
-
### Bugfixes
|
842 |
-
|
843 |
-
Solves a problem where the gutter would sometimes not extend all the way to the end of the document.
|
844 |
-
|
845 |
-
## 5.13.0 (2016-03-21)
|
846 |
-
|
847 |
-
### New features
|
848 |
-
|
849 |
-
New DOM event forwarded: [`"dragleave"`](https://codemirror.net/doc/manual.html#event_dom).
|
850 |
-
|
851 |
-
[protobuf mode](https://codemirror.net/mode/protobuf/index.html): Newly added.
|
852 |
-
|
853 |
-
### Bugfixes
|
854 |
-
|
855 |
-
Fix problem where [`findMarks`](https://codemirror.net/doc/manual.html#findMarks) sometimes failed to find multi-line marks.
|
856 |
-
|
857 |
-
Fix crash that showed up when atomic ranges and bidi text were combined.
|
858 |
-
|
859 |
-
[show-hint addon](https://codemirror.net/demo/complete.html): Completion widgets no longer close when the line indented or dedented.
|
860 |
-
|
861 |
-
[merge addon](https://codemirror.net/demo/merge.html): Fix bug when merging chunks at the end of the file.
|
862 |
-
|
863 |
-
[placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder): No longer gets confused by [`swapDoc`](https://codemirror.net/doc/manual.html#swapDoc).
|
864 |
-
|
865 |
-
[simplescrollbars addon](https://codemirror.net/doc/manual.html#addon_simplescrollbars): Fix invalid state when deleting at end of document.
|
866 |
-
|
867 |
-
[clike mode](https://codemirror.net/mode/clike/index.html): No longer gets confused when a comment starts after an operator.
|
868 |
-
|
869 |
-
[markdown mode](https://codemirror.net/mode/markdown/index.html): Now supports CommonMark-style flexible list indentation.
|
870 |
-
|
871 |
-
[dylan mode](https://codemirror.net/mode/dylan/index.html): Several improvements and fixes.
|
872 |
-
|
873 |
-
## 5.12.0 (2016-02-19)
|
874 |
-
|
875 |
-
### New features
|
876 |
-
|
877 |
-
[Vim bindings](https://codemirror.net/demo/vim.html): Ctrl-Q is now an alias for Ctrl-V.
|
878 |
-
|
879 |
-
[Vim bindings](https://codemirror.net/demo/vim.html): The Vim API now exposes an `unmap` method to unmap bindings.
|
880 |
-
|
881 |
-
[active-line addon](https://codemirror.net/demo/activeline.html): This addon can now style the active line's gutter.
|
882 |
-
|
883 |
-
[FCL mode](https://codemirror.net/mode/fcl/): Newly added.
|
884 |
-
|
885 |
-
[SQL mode](https://codemirror.net/mode/sql/): Now has a Postgresql dialect.
|
886 |
-
|
887 |
-
### Bugfixes
|
888 |
-
|
889 |
-
Fix [issue](https://github.com/codemirror/CodeMirror/issues/3781) where trying to scroll to a horizontal position outside of the document's width could cause the gutter to be positioned incorrectly.
|
890 |
-
|
891 |
-
Use absolute, rather than fixed positioning in the context-menu intercept hack, to work around a [problem](https://github.com/codemirror/CodeMirror/issues/3238) when the editor is inside a transformed parent container.
|
892 |
-
|
893 |
-
Solve a [problem](https://github.com/codemirror/CodeMirror/issues/3821) where the horizontal scrollbar could hide text in Firefox.
|
894 |
-
|
895 |
-
Fix a [bug](https://github.com/codemirror/CodeMirror/issues/3834) that caused phantom scroll space under the text in some situations.
|
896 |
-
|
897 |
-
[Sublime Text bindings](https://codemirror.net/demo/sublime.html): Bind delete-line to Shift-Ctrl-K on OS X.
|
898 |
-
|
899 |
-
[Markdown mode](https://codemirror.net/mode/markdown/): Fix [issue](https://github.com/codemirror/CodeMirror/issues/3787) where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.
|
900 |
-
|
901 |
-
[Markdown mode](https://codemirror.net/mode/markdown/): Ignore backslashes in code fragments.
|
902 |
-
|
903 |
-
[Markdown mode](https://codemirror.net/mode/markdown/): Use whichever mode is registered as `text/html` to parse HTML.
|
904 |
-
|
905 |
-
[Clike mode](https://codemirror.net/mode/clike/): Improve indentation of Scala `=>` functions.
|
906 |
-
|
907 |
-
[Python mode](https://codemirror.net/mode/python/): Improve indentation of bracketed code.
|
908 |
-
|
909 |
-
[HTMLMixed mode](https://codemirror.net/mode/htmlmixed/): Support multi-line opening tags for sub-languages (`<script>`, `<style>`, etc).
|
910 |
-
|
911 |
-
[Spreadsheet mode](https://codemirror.net/mode/spreadsheet/): Fix bug where the mode did not advance the stream when finding a backslash.
|
912 |
-
|
913 |
-
[XML mode](https://codemirror.net/mode/xml/): The mode now takes a `matchClosing` option to configure whether mismatched closing tags should be highlighted as errors.
|
914 |
-
|
915 |
-
## 5.11.0 (2016-01-20)
|
916 |
-
|
917 |
-
* New modes: [JSX](https://codemirror.net/mode/jsx/index.html), [literate Haskell](https://codemirror.net/mode/haskell-literate/index.html)
|
918 |
-
* The editor now forwards more [DOM events](https://codemirror.net/doc/manual.html#event_dom): `cut`, `copy`, `paste`, and `touchstart`. It will also forward `mousedown` for drag events
|
919 |
-
* Fixes a bug where bookmarks next to collapsed spans were not rendered
|
920 |
-
* The [Swift](https://codemirror.net/mode/swift/index.html) mode now supports auto-indentation
|
921 |
-
* Frontmatters in the [YAML frontmatter](https://codemirror.net/mode/yaml-frontmatter/index.html) mode are now optional as intended
|
922 |
-
|
923 |
-
## 5.10.0 (2015-12-21)
|
924 |
-
|
925 |
-
* Modify the way [atomic ranges](https://codemirror.net/doc/manual.html#mark_atomic) are skipped by selection to try and make it less surprising.
|
926 |
-
* The [Swift mode](https://codemirror.net/mode/swift/index.html) was rewritten.
|
927 |
-
* New addon: [jump-to-line](https://codemirror.net/doc/manual.html#addon_jump-to-line).
|
928 |
-
* New method: [`isReadOnly`](https://codemirror.net/doc/manual.html#isReadOnly).
|
929 |
-
* The [show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint) now defaults to picking completions on single click.
|
930 |
-
* The object passed to [`"beforeSelectionChange"`](https://codemirror.net/doc/manual.html#event_beforeSelectionChange) events now has an `origin` property.
|
931 |
-
* New mode: [Crystal](https://codemirror.net/mode/crystal/index.html).
|
932 |
-
|
933 |
-
## 5.9.0 (2015-11-23)
|
934 |
-
|
935 |
-
* Improve the way overlay (OS X-style) scrollbars are handled
|
936 |
-
* Make [annotatescrollbar](https://codemirror.net/doc/manual.html#addon_annotatescrollbar) and scrollpastend addons work properly together
|
937 |
-
* Make [show-hint](https://codemirror.net/doc/manual.html#addon_show-hint) addon select options on single click by default, move selection to hovered item
|
938 |
-
* Properly fold comments that include block-comment-start markers
|
939 |
-
* Many small language mode fixes
|
940 |
-
|
941 |
-
## 5.8.0 (2015-10-20)
|
942 |
-
|
943 |
-
* Fixes an infinite loop in the [hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap)
|
944 |
-
* New modes: [NSIS](https://codemirror.net/mode/nsis/index.html), [Ceylon](https://codemirror.net/mode/clike/index.html)
|
945 |
-
* The Kotlin mode is now a [clike](https://codemirror.net/mode/clike/index.html) dialect, rather than a stand-alone mode
|
946 |
-
* New option: [`allowDropFileTypes`](https://codemirror.net/doc/manual.html#option_allowDropFileTypes). Binary files can no longer be dropped into CodeMirror
|
947 |
-
* New themes: [bespin](https://codemirror.net/demo/theme.html#bespin), [hopscotch](https://codemirror.net/demo/theme.html#hopscotch), [isotope](https://codemirror.net/demo/theme.html#isotope), [railscasts](https://codemirror.net/demo/theme.html#railscasts)
|
948 |
-
|
949 |
-
## 5.7.0 (2015-09-21)
|
950 |
-
|
951 |
-
* New modes: [Vue](https://codemirror.net/mode/vue/index.html), [Oz](https://codemirror.net/mode/oz/index.html), [MscGen](https://codemirror.net/mode/mscgen/index.html) (and dialects), [Closure Stylesheets](https://codemirror.net/mode/css/gss.html)
|
952 |
-
* Implement [CommonMark](http://commonmark.org)-style flexible list indent and cross-line code spans in [Markdown](https://codemirror.net/mode/markdown/index.html) mode
|
953 |
-
* Add a replace-all button to the [search addon](https://codemirror.net/doc/manual.html#addon_search), and make the persistent search dialog transparent when it obscures the match
|
954 |
-
* Handle `acync`/`await` and ocal and binary numbers in [JavaScript mode](https://codemirror.net/mode/javascript/index.html)
|
955 |
-
* Fix various issues with the [Haxe mode](https://codemirror.net/mode/haxe/index.html)
|
956 |
-
* Make the [closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets) select only the wrapped text when wrapping selection in brackets
|
957 |
-
* Tokenize properties as properties in the [CoffeeScript mode](https://codemirror.net/mode/coffeescript/index.html)
|
958 |
-
* The [placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder) now accepts a DOM node as well as a string placeholder
|
959 |
-
|
960 |
-
## 5.6.0 (2015-08-20)
|
961 |
-
|
962 |
-
* Fix bug where you could paste into a `readOnly` editor
|
963 |
-
* Show a cursor at the drop location when dragging over the editor
|
964 |
-
* The [Rust mode](https://codemirror.net/mode/rust/index.html) was rewritten to handle modern Rust
|
965 |
-
* The editor and theme CSS was cleaned up. Some selectors are now less specific than before
|
966 |
-
* New theme: [abcdef](https://codemirror.net/demo/theme.html#abcdef)
|
967 |
-
* Lines longer than [`maxHighlightLength`](https://codemirror.net/doc/manual.html#option_maxHighlightLength) are now less likely to mess up indentation
|
968 |
-
* New addons: [`autorefresh`](https://codemirror.net/doc/manual.html#addon_autorefresh) for refreshing an editor the first time it becomes visible, and `html-lint` for using [HTMLHint](http://htmlhint.com/)
|
969 |
-
* The [`search`](https://codemirror.net/doc/manual.html#addon_search) addon now recognizes `\r` and `\n` in pattern and replacement input
|
970 |
-
|
971 |
-
## 5.5.0 (2015-07-20)
|
972 |
-
|
973 |
-
* New option: [`lineSeparator`](https://codemirror.net/doc/manual.html#option_lineSeparator) (with corresponding [method](https://codemirror.net/doc/manual.html#lineSeparator))
|
974 |
-
* New themes: [dracula](https://codemirror.net/demo/theme.html#dracula), [seti](https://codemirror.net/demo/theme.html#seti), [yeti](https://codemirror.net/demo/theme.html#yeti), [material](https://codemirror.net/demo/theme.html#material), and [icecoder](https://codemirror.net/demo/theme.html#icecoder)
|
975 |
-
* New modes: [Brainfuck](https://codemirror.net/mode/brainfuck/index.html), [VHDL](https://codemirror.net/mode/vhdl/index.html), Squirrel ([clike](https://codemirror.net/mode/clike/index.html) dialect)
|
976 |
-
* Define a `findPersistent` command in the [search](https://codemirror.net/demo/search.html) addon, for a dialog that stays open as you cycle through matches
|
977 |
-
* From this release on, the NPM module doesn't include documentation and demos
|
978 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.4.0...5.5.0)
|
979 |
-
|
980 |
-
## 5.4.0 (2015-06-25)
|
981 |
-
|
982 |
-
* New modes: [Twig](https://codemirror.net/mode/twig/index.html), [Elm](https://codemirror.net/mode/elm/index.html), [Factor](https://codemirror.net/mode/factor/index.html), [Swift](https://codemirror.net/mode/swift/index.html)
|
983 |
-
* Prefer clipboard API (if available) when pasting
|
984 |
-
* Refined definition highlighting in [clike](https://codemirror.net/mode/clike/index.html) mode
|
985 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.3.0...5.4.0)
|
986 |
-
|
987 |
-
## 5.3.0 (2015-05-20)
|
988 |
-
|
989 |
-
* Fix several regressions in the [`show-hint`](https://codemirror.net/doc/manual.html#addon_show-hint) addon (`completeSingle` option, `"shown"` and `"close"` events)
|
990 |
-
* The [vim mode](https://codemirror.net/demo/vim.html) API was [documented](https://codemirror.net/doc/manual.html#vimapi)
|
991 |
-
* New modes: [ASN.1](https://codemirror.net/mode/asn.1/index.html), [TTCN](https://codemirror.net/mode/ttcn/index.html), and [TTCN-CFG](https://codemirror.net/mode/ttcn-cfg/index.html)
|
992 |
-
* The [clike](https://codemirror.net/mode/clike/index.html) mode can now deep-indent `switch` statements, and roughly recognizes types and defined identifiers
|
993 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.2.0...5.3.0)
|
994 |
-
|
995 |
-
## 5.2.0 (2015-04-20)
|
996 |
-
|
997 |
-
* Fix several race conditions in [`show-hint`](https://codemirror.net/doc/manual.html#addon_show-hint)'s asynchronous mode
|
998 |
-
* Fix backspace binding in [Sublime bindings](https://codemirror.net/demo/sublime.html)
|
999 |
-
* Change the way IME is handled in the `"textarea"` [input style](https://codemirror.net/doc/manual.html#option_inputStyle)
|
1000 |
-
* New modes: [MUMPS](https://codemirror.net/mode/mumps/index.html), [Handlebars](https://codemirror.net/mode/handlebars/index.html)
|
1001 |
-
* Rewritten modes: [Django](https://codemirror.net/mode/django/index.html), [Z80](https://codemirror.net/mode/z80/index.html)
|
1002 |
-
* New theme: [Liquibyte](https://codemirror.net/demo/theme.html#liquibyte)
|
1003 |
-
* New option: [`lineWiseCopyCut`](https://codemirror.net/doc/manual.html#option_lineWiseCopyCut)
|
1004 |
-
* The [Vim mode](https://codemirror.net/demo/vim.html) now supports buffer-local options and the `filetype` setting
|
1005 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.1.0...5.2.0)
|
1006 |
-
|
1007 |
-
## 5.1.0 (2015-03-23)
|
1008 |
-
|
1009 |
-
* New modes: [ASCII armor](https://codemirror.net/mode/asciiarmor/index.html) (PGP data), [Troff](https://codemirror.net/mode/troff/index.html), and [CMake](https://codemirror.net/mode/cmake/index.html).
|
1010 |
-
* Remove SmartyMixed mode, rewrite [Smarty](https://codemirror.net/mode/smarty/index.html) mode to supersede it.
|
1011 |
-
* New commands in the [merge addon](https://codemirror.net/doc/manual.html#addon_merge): `goNextDiff` and `goPrevDiff`.
|
1012 |
-
* The [closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets) can now be configured per mode.
|
1013 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.0.0...5.1.0).
|
1014 |
-
|
1015 |
-
## 5.0.0 (2015-02-20)
|
1016 |
-
|
1017 |
-
* Experimental mobile support (tested on iOS, Android Chrome, stock Android browser)
|
1018 |
-
* New option [`inputStyle`](https://codemirror.net/doc/manual.html#option_inputStyle) to switch between hidden textarea and contenteditable input.
|
1019 |
-
* The [`getInputField`](https://codemirror.net/doc/manual.html#getInputField) method is no longer guaranteed to return a textarea.
|
1020 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.13.0...5.0.0).
|
1021 |
-
|
1022 |
-
## 4.13.0 (2015-02-20)
|
1023 |
-
|
1024 |
-
* Fix the way the [`closetag`](https://codemirror.net/demo/closetag.html) demo handles the slash character.
|
1025 |
-
* New modes: [Forth](https://codemirror.net/mode/forth/index.html), [Stylus](https://codemirror.net/mode/stylus/index.html).
|
1026 |
-
* Make the [CSS mode](https://codemirror.net/mode/css/index.html) understand some modern CSS extensions.
|
1027 |
-
* Have the [Scala mode](https://codemirror.net/mode/clike/index.html) handle symbols and triple-quoted strings.
|
1028 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.12.0...4.13.0).
|
1029 |
-
|
1030 |
-
## 4.12.0 (2015-01-22)
|
1031 |
-
|
1032 |
-
* The [`closetag`](https://codemirror.net/doc/manual.html#addon_closetag) addon now defines a `"closeTag"` command.
|
1033 |
-
* Adds a `findModeByFileName` to the [mode metadata](https://codemirror.net/doc/manual.html#addon_meta) addon.
|
1034 |
-
* [Simple mode](https://codemirror.net/demo/simplemode.html) rules can now contain a `sol` property to only match at the start of a line.
|
1035 |
-
* New addon: [`selection-pointer`](https://codemirror.net/doc/manual.html#addon_selection-pointer) to style the mouse cursor over the selection.
|
1036 |
-
* Improvements to the [Sass mode](https://codemirror.net/mode/sass/index.html)'s indentation.
|
1037 |
-
* The [Vim keymap](https://codemirror.net/demo/vim.html)'s search functionality now supports [scrollbar annotation](https://codemirror.net/doc/manual.html#addon_matchesonscrollbar).
|
1038 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.11.0...4.12.0).
|
1039 |
-
|
1040 |
-
## 4.11.0 (2015-01-09)
|
1041 |
-
|
1042 |
-
Unfortunately, 4.10 did not take care of the Firefox scrolling issue entirely. This release adds two more patches to address that.
|
1043 |
-
|
1044 |
-
## 4.10.0 (2014-12-29)
|
1045 |
-
|
1046 |
-
Emergency single-patch update to 4.9\. Fixes Firefox-specific problem where the cursor could end up behind the horizontal scrollbar.
|
1047 |
-
|
1048 |
-
## 4.9.0 (2014-12-23)
|
1049 |
-
|
1050 |
-
* Overhauled scroll bar handling. Add pluggable [scrollbar implementations](https://codemirror.net/demo/simplescrollbars.html).
|
1051 |
-
* Tweaked behavior for the [completion addons](https://codemirror.net/doc/manual.html#addon_show-hint) to not take text after cursor into account.
|
1052 |
-
* Two new optional features in the [merge addon](https://codemirror.net/doc/manual.html#addon_merge): aligning editors, and folding unchanged text.
|
1053 |
-
* New modes: [Dart](https://codemirror.net/mode/dart/index.html), [EBNF](https://codemirror.net/mode/ebnf/index.html), [spreadsheet](https://codemirror.net/mode/spreadsheet/index.html), and [Soy](https://codemirror.net/mode/soy/index.html).
|
1054 |
-
* New [addon](https://codemirror.net/demo/panel.html) to show persistent panels below/above an editor.
|
1055 |
-
* New themes: [zenburn](https://codemirror.net/demo/theme.html#zenburn) and [tomorrow night bright](https://codemirror.net/demo/theme.html#tomorrow-night-bright).
|
1056 |
-
* Allow ctrl-click to clear existing cursors.
|
1057 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.8.0...4.9.0).
|
1058 |
-
|
1059 |
-
## 4.8.0 (2014-11-22)
|
1060 |
-
|
1061 |
-
* Built-in support for [multi-stroke key bindings](https://codemirror.net/doc/manual.html#normalizeKeyMap).
|
1062 |
-
* New method: [`getLineTokens`](https://codemirror.net/doc/manual.html#getLineTokens).
|
1063 |
-
* New modes: [dockerfile](https://codemirror.net/mode/dockerfile/index.html), [IDL](https://codemirror.net/mode/idl/index.html), [Objective C](https://codemirror.net/mode/clike/index.html) (crude).
|
1064 |
-
* Support styling of gutter backgrounds, allow `"gutter"` styles in [`addLineClass`](https://codemirror.net/doc/manual.html#addLineClass).
|
1065 |
-
* Many improvements to the [Vim mode](https://codemirror.net/demo/vim.html), rewritten visual mode.
|
1066 |
-
* Improvements to modes: [gfm](https://codemirror.net/mode/gfm/index.html) (strikethrough), [SPARQL](https://codemirror.net/mode/sparql/index.html) (version 1.1 support), and [sTeX](https://codemirror.net/mode/stex/index.html) (no more runaway math mode).
|
1067 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.7.0...4.8.0).
|
1068 |
-
|
1069 |
-
## 4.7.0 (2014-10-20)
|
1070 |
-
|
1071 |
-
* **Incompatible**: The [lint addon](https://codemirror.net/demo/lint.html) now passes the editor's value as first argument to asynchronous lint functions, for consistency. The editor is still passed, as fourth argument.
|
1072 |
-
* Improved handling of unicode identifiers in modes for languages that support them.
|
1073 |
-
* More mode improvements: [CoffeeScript](https://codemirror.net/mode/coffeescript/index.html) (indentation), [Verilog](https://codemirror.net/mode/verilog/index.html) (indentation), [Scala](https://codemirror.net/mode/clike/index.html) (indentation, triple-quoted strings), and [PHP](https://codemirror.net/mode/php/index.html) (interpolated variables in heredoc strings).
|
1074 |
-
* New modes: [Textile](https://codemirror.net/mode/textile/index.html) and [Tornado templates](https://codemirror.net/mode/tornado/index.html).
|
1075 |
-
* Experimental new [way to define modes](https://codemirror.net/demo/simplemode.html).
|
1076 |
-
* Improvements to the [Vim bindings](https://codemirror.net/demo/vim.html): Arbitrary insert mode key mappings are now possible, and text objects are supported in visual mode.
|
1077 |
-
* The mode [meta-information file](https://codemirror.net/mode/meta.js) now includes information about file extensions, and [helper functions](https://codemirror.net/doc/manual.html#addon_meta) `findModeByMIME` and `findModeByExtension`.
|
1078 |
-
* New logo!
|
1079 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.6.0...4.7.0).
|
1080 |
-
|
1081 |
-
## 4.6.0 (2014-09-19)
|
1082 |
-
|
1083 |
-
* New mode: [Modelica](https://codemirror.net/mode/modelica/index.html)
|
1084 |
-
* New method: [`findWordAt`](https://codemirror.net/doc/manual.html#findWordAt)
|
1085 |
-
* Make it easier to [use text background styling](https://codemirror.net/demo/markselection.html)
|
1086 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.5.0...4.6.0).
|
1087 |
-
|
1088 |
-
## 4.5.0 (2014-08-21)
|
1089 |
-
|
1090 |
-
* Fix several serious bugs with horizontal scrolling
|
1091 |
-
* New mode: [Slim](https://codemirror.net/mode/slim/index.html)
|
1092 |
-
* New command: [`goLineLeftSmart`](https://codemirror.net/doc/manual.html#command_goLineLeftSmart)
|
1093 |
-
* More fixes and extensions for the [Vim](https://codemirror.net/demo/vim.html) visual block mode
|
1094 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.4.0...4.5.0).
|
1095 |
-
|
1096 |
-
## 4.4.0 (2014-07-21)
|
1097 |
-
|
1098 |
-
* **Note:** Some events might now fire in slightly different order (`"change"` is still guaranteed to fire before `"cursorActivity"`)
|
1099 |
-
* Nested operations in multiple editors are now synced (complete at same time, reducing DOM reflows)
|
1100 |
-
* Visual block mode for [vim](https://codemirror.net/demo/vim.html) (<C-v>) is nearly complete
|
1101 |
-
* New mode: [Kotlin](https://codemirror.net/mode/kotlin/index.html)
|
1102 |
-
* Better multi-selection paste for text copied from multiple CodeMirror selections
|
1103 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.3.0...4.4.0).
|
1104 |
-
|
1105 |
-
## 4.3.0 (2014-06-23)
|
1106 |
-
|
1107 |
-
* Several [vim bindings](https://codemirror.net/demo/vim.html) improvements: search and exCommand history, global flag for `:substitute`, `:global` command.
|
1108 |
-
* Allow hiding the cursor by setting [`cursorBlinkRate`](https://codemirror.net/doc/manual.html#option_cursorBlinkRate) to a negative value.
|
1109 |
-
* Make gutter markers themeable, use this in foldgutter.
|
1110 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.2.0...4.3.0).
|
1111 |
-
|
1112 |
-
## 4.2.0 (2014-05-19)
|
1113 |
-
|
1114 |
-
* Fix problem where some modes were broken by the fact that empty tokens were forbidden.
|
1115 |
-
* Several fixes to context menu handling.
|
1116 |
-
* On undo, scroll _change_, not cursor, into view.
|
1117 |
-
* Rewritten [Jade](https://codemirror.net/mode/jade/index.html) mode.
|
1118 |
-
* Various improvements to [Shell](https://codemirror.net/mode/shell/index.html) (support for more syntax) and [Python](https://codemirror.net/mode/python/index.html) (better indentation) modes.
|
1119 |
-
* New mode: [Cypher](https://codemirror.net/mode/cypher/index.html).
|
1120 |
-
* New theme: [Neo](https://codemirror.net/demo/theme.html#neo).
|
1121 |
-
* Support direct styling options (color, line style, width) in the [rulers](https://codemirror.net/doc/manual.html#addon_rulers) addon.
|
1122 |
-
* Recognize per-editor configuration for the [show-hint](https://codemirror.net/doc/manual.html#addon_show-hint) and [foldcode](https://codemirror.net/doc/manual.html#addon_foldcode) addons.
|
1123 |
-
* More intelligent scanning for existing close tags in [closetag](https://codemirror.net/doc/manual.html#addon_closetag) addon.
|
1124 |
-
* In the [Vim bindings](https://codemirror.net/demo/vim.html): Fix bracket matching, support case conversion in visual mode, visual paste, append action.
|
1125 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.1.0...4.2.0).
|
1126 |
-
|
1127 |
-
## 4.1.0 (2014-04-22)
|
1128 |
-
|
1129 |
-
* _Slightly incompatible_: The [`"cursorActivity"`](https://codemirror.net/doc/manual.html#event_cursorActivity) event now fires after all other events for the operation (and only for handlers that were actually registered at the time the activity happened).
|
1130 |
-
* New command: [`insertSoftTab`](https://codemirror.net/doc/manual.html#command_insertSoftTab).
|
1131 |
-
* New mode: [Django](https://codemirror.net/mode/django/index.html).
|
1132 |
-
* Improved modes: [Verilog](https://codemirror.net/mode/verilog/index.html) (rewritten), [Jinja2](https://codemirror.net/mode/jinja2/index.html), [Haxe](https://codemirror.net/mode/haxe/index.html), [PHP](https://codemirror.net/mode/php/index.html) (string interpolation highlighted), [JavaScript](https://codemirror.net/mode/javascript/index.html) (indentation of trailing else, template strings), [LiveScript](https://codemirror.net/mode/livescript/index.html) (multi-line strings).
|
1133 |
-
* Many small issues from the 3.x→4.x transition were found and fixed.
|
1134 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.0.3...4.1.0).
|
1135 |
-
|
1136 |
-
## 3.24.0 (2014-04-22)
|
1137 |
-
|
1138 |
-
Merges the improvements from 4.1 that could easily be applied to the 3.x code. Also improves the way the editor size is updated when line widgets change.
|
1139 |
-
|
1140 |
-
## 3.23.0 (2014-03-20)
|
1141 |
-
|
1142 |
-
* In the [XML mode](https://codemirror.net/mode/xml/index.html), add `brackets` style to angle brackets, fix case-sensitivity of tags for HTML.
|
1143 |
-
* New mode: [Dylan](https://codemirror.net/mode/dylan/index.html).
|
1144 |
-
* Many improvements to the [Vim bindings](https://codemirror.net/demo/vim.html).
|
1145 |
-
|
1146 |
-
## 3.22.0 (2014-02-21)
|
1147 |
-
|
1148 |
-
* Adds the [`findMarks`](https://codemirror.net/doc/manual.html#findMarks) method.
|
1149 |
-
* New addons: [rulers](https://codemirror.net/doc/manual.html#addon_rulers), markdown-fold, yaml-lint.
|
1150 |
-
* New theme: [mdn-like](https://codemirror.net/demo/theme.html#mdn-like).
|
1151 |
-
* New mode: [Solr](https://codemirror.net/mode/solr/index.html).
|
1152 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.21.0...3.22.0).
|
1153 |
-
|
1154 |
-
## 3.21.0 (2014-01-16)
|
1155 |
-
|
1156 |
-
* Auto-indenting a block will no longer add trailing whitespace to blank lines.
|
1157 |
-
* Marking text has a new option [`clearWhenEmpty`](https://codemirror.net/doc/manual.html#markText) to control auto-removal.
|
1158 |
-
* Several bugfixes in the handling of bidirectional text.
|
1159 |
-
* The [XML](https://codemirror.net/mode/xml/index.html) and [CSS](https://codemirror.net/mode/css/index.html) modes were largely rewritten. [LESS](https://codemirror.net/mode/css/less.html) support was added to the CSS mode.
|
1160 |
-
* The OCaml mode was moved to an [mllike](https://codemirror.net/mode/mllike/index.html) mode, F# support added.
|
1161 |
-
* Make it possible to fetch multiple applicable helper values with [`getHelpers`](https://codemirror.net/doc/manual.html#getHelpers), and to register helpers matched on predicates with [`registerGlobalHelper`](https://codemirror.net/doc/manual.html#registerGlobalHelper).
|
1162 |
-
* New theme [pastel-on-dark](https://codemirror.net/demo/theme.html#pastel-on-dark).
|
1163 |
-
* Better ECMAScript 6 support in [JavaScript](https://codemirror.net/mode/javascript/index.html) mode.
|
1164 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.20.0...3.21.0).
|
1165 |
-
|
1166 |
-
## 3.20.0 (2013-11-21)
|
1167 |
-
|
1168 |
-
* New modes: [Julia](https://codemirror.net/mode/julia/index.html) and [PEG.js](https://codemirror.net/mode/pegjs/index.html).
|
1169 |
-
* Support ECMAScript 6 in the [JavaScript mode](https://codemirror.net/mode/javascript/index.html).
|
1170 |
-
* Improved indentation for the [CoffeeScript mode](https://codemirror.net/mode/coffeescript/index.html).
|
1171 |
-
* Make non-printable-character representation [configurable](https://codemirror.net/doc/manual.html#option_specialChars).
|
1172 |
-
* Add ‘notification’ functionality to [dialog](https://codemirror.net/doc/manual.html#addon_dialog) addon.
|
1173 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.19.0...3.20.0).
|
1174 |
-
|
1175 |
-
## 3.19.0 (2013-10-21)
|
1176 |
-
|
1177 |
-
* New modes: [Eiffel](https://codemirror.net/mode/eiffel/index.html), [Gherkin](https://codemirror.net/mode/gherkin/index.html), [MSSQL dialect](https://codemirror.net/mode/sql/?mime=text/x-mssql).
|
1178 |
-
* New addons: [hardwrap](https://codemirror.net/doc/manual.html#addon_hardwrap), [sql-hint](https://codemirror.net/doc/manual.html#addon_sql-hint).
|
1179 |
-
* New theme: [MBO](https://codemirror.net/demo/theme.html#mbo).
|
1180 |
-
* Add [support](https://codemirror.net/doc/manual.html#token_style_line) for line-level styling from mode tokenizers.
|
1181 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.18.0...3.19.0).
|
1182 |
-
|
1183 |
-
## 3.18.0 (2013-09-23)
|
1184 |
-
|
1185 |
-
Emergency release to fix a problem in 3.17 where `.setOption("lineNumbers", false)` would raise an error.
|
1186 |
-
|
1187 |
-
## 3.17.0 (2013-09-23)
|
1188 |
-
|
1189 |
-
* New modes: [Fortran](https://codemirror.net/mode/fortran/index.html), [Octave](https://codemirror.net/mode/octave/index.html) (Matlab), [TOML](https://codemirror.net/mode/toml/index.html), and [DTD](https://codemirror.net/mode/dtd/index.html).
|
1190 |
-
* New addons: [`css-lint`](https://codemirror.net/addon/lint/css-lint.js), [`css-hint`](https://codemirror.net/doc/manual.html#addon_css-hint).
|
1191 |
-
* Improve resilience to CSS 'frameworks' that globally mess up `box-sizing`.
|
1192 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.16.0...3.17.0).
|
1193 |
-
|
1194 |
-
## 3.16.0 (2013-08-21)
|
1195 |
-
|
1196 |
-
* The whole codebase is now under a single [license](https://codemirror.net/LICENSE) file.
|
1197 |
-
* The project page was overhauled and redesigned.
|
1198 |
-
* New themes: [Paraiso](https://codemirror.net/demo/theme.html#paraiso-dark) ([light](https://codemirror.net/demo/theme.html#paraiso-light)), [The Matrix](https://codemirror.net/demo/theme.html#the-matrix).
|
1199 |
-
* Improved interaction between themes and [active-line](https://codemirror.net/doc/manual.html#addon_active-line)/[matchbrackets](https://codemirror.net/doc/manual.html#addon_matchbrackets) addons.
|
1200 |
-
* New [folding](https://codemirror.net/doc/manual.html#addon_foldcode) function `CodeMirror.fold.comment`.
|
1201 |
-
* Added [fullscreen](https://codemirror.net/doc/manual.html#addon_fullscreen) addon.
|
1202 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.15.0...3.16.0).
|
1203 |
-
|
1204 |
-
## 3.15.0 (2013-07-29)
|
1205 |
-
|
1206 |
-
* New modes: [Jade](https://codemirror.net/mode/jade/index.html), [Nginx](https://codemirror.net/mode/nginx/index.html).
|
1207 |
-
* New addons: [Tern](https://codemirror.net/demo/tern.html), [matchtags](https://codemirror.net/doc/manual.html#addon_matchtags), and [foldgutter](https://codemirror.net/doc/manual.html#addon_foldgutter).
|
1208 |
-
* Introduced [_helper_](https://codemirror.net/doc/manual.html#getHelper) concept ([context](https://groups.google.com/forum/#!msg/codemirror/cOc0xvUUEUU/nLrX1-qnidgJ)).
|
1209 |
-
* New method: [`getModeAt`](https://codemirror.net/doc/manual.html#getModeAt).
|
1210 |
-
* New themes: base16 [dark](https://codemirror.net/demo/theme.html#base16-dark)/[light](https://codemirror.net/demo/theme.html#base16-light), 3024 [dark](https://codemirror.net/demo/theme.html#3024-night)/[light](https://codemirror.net/demo/theme.html#3024-day), [tomorrow-night](https://codemirror.net/demo/theme.html#tomorrow-night-eighties).
|
1211 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.14.0...3.15.0).
|
1212 |
-
|
1213 |
-
## 3.14.0 (2013-06-20)
|
1214 |
-
|
1215 |
-
* New addons: [trailing space highlight](https://codemirror.net/doc/manual.html#addon_trailingspace), [XML completion](https://codemirror.net/doc/manual.html#addon_xml-hint) (rewritten), and [diff merging](https://codemirror.net/doc/manual.html#addon_merge).
|
1216 |
-
* [`markText`](https://codemirror.net/doc/manual.html#markText) and [`addLineWidget`](https://codemirror.net/doc/manual.html#addLineWidget) now take a `handleMouseEvents` option.
|
1217 |
-
* New methods: [`lineAtHeight`](https://codemirror.net/doc/manual.html#lineAtHeight), [`getTokenTypeAt`](https://codemirror.net/doc/manual.html#getTokenTypeAt).
|
1218 |
-
* More precise cleanness-tracking using [`changeGeneration`](https://codemirror.net/doc/manual.html#changeGeneration) and [`isClean`](https://codemirror.net/doc/manual.html#isClean).
|
1219 |
-
* Many extensions to [Emacs](https://codemirror.net/demo/emacs.html) mode (prefixes, more navigation units, and more).
|
1220 |
-
* New events [`"keyHandled"`](https://codemirror.net/doc/manual.html#event_keyHandled) and [`"inputRead"`](https://codemirror.net/doc/manual.html#event_inputRead).
|
1221 |
-
* Various improvements to [Ruby](https://codemirror.net/mode/ruby/index.html), [Smarty](https://codemirror.net/mode/smarty/index.html), [SQL](https://codemirror.net/mode/sql/index.html), and [Vim](https://codemirror.net/demo/vim.html) modes.
|
1222 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.13.0...3.14.0).
|
1223 |
-
|
1224 |
-
## 3.13.0 (2013-05-20)
|
1225 |
-
|
1226 |
-
* New modes: [COBOL](https://codemirror.net/mode/cobol/index.html) and [HAML](https://codemirror.net/mode/haml/index.html).
|
1227 |
-
* New options: [`cursorScrollMargin`](https://codemirror.net/doc/manual.html#option_cursorScrollMargin) and [`coverGutterNextToScrollbar`](https://codemirror.net/doc/manual.html#option_coverGutterNextToScrollbar).
|
1228 |
-
* New addon: [commenting](https://codemirror.net/doc/manual.html#addon_comment).
|
1229 |
-
* More features added to the [Vim keymap](https://codemirror.net/demo/vim.html).
|
1230 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.12...3.13.0).
|
1231 |
-
|
1232 |
-
## 3.12.0 (2013-04-19)
|
1233 |
-
|
1234 |
-
* New mode: [GNU assembler](https://codemirror.net/mode/gas/index.html).
|
1235 |
-
* New options: [`maxHighlightLength`](https://codemirror.net/doc/manual.html#option_maxHighlightLength) and [`historyEventDelay`](https://codemirror.net/doc/manual.html#option_historyEventDelay).
|
1236 |
-
* Added [`addToHistory`](https://codemirror.net/doc/manual.html#mark_addToHistory) option for `markText`.
|
1237 |
-
* Various fixes to JavaScript tokenization and indentation corner cases.
|
1238 |
-
* Further improvements to the vim mode.
|
1239 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.11...v3.12).
|
1240 |
-
|
1241 |
-
## 3.11.0 (2013-03-20)
|
1242 |
-
|
1243 |
-
* **Removed code:** `collapserange`, `formatting`, and `simple-hint` addons. `plsql` and `mysql` modes (use [`sql`](https://codemirror.net/mode/sql/index.html) mode).
|
1244 |
-
* **Moved code:** the range-finding functions for folding now have [their own files](https://codemirror.net/addon/fold/).
|
1245 |
-
* **Changed interface:** the [`continuecomment`](https://codemirror.net/doc/manual.html#addon_continuecomment) addon now exposes an option, rather than a command.
|
1246 |
-
* New modes: [SCSS](https://codemirror.net/mode/css/scss.html), [Tcl](https://codemirror.net/mode/tcl/index.html), [LiveScript](https://codemirror.net/mode/livescript/index.html), and [mIRC](https://codemirror.net/mode/mirc/index.html).
|
1247 |
-
* New addons: [`placeholder`](https://codemirror.net/demo/placeholder.html), [HTML completion](https://codemirror.net/demo/html5complete.html).
|
1248 |
-
* New methods: [`hasFocus`](https://codemirror.net/doc/manual.html#hasFocus), [`defaultCharWidth`](https://codemirror.net/doc/manual.html#defaultCharWidth).
|
1249 |
-
* New events: [`beforeCursorEnter`](https://codemirror.net/doc/manual.html#event_beforeCursorEnter), [`renderLine`](https://codemirror.net/doc/manual.html#event_renderLine).
|
1250 |
-
* Many improvements to the [`show-hint`](https://codemirror.net/doc/manual.html#addon_show-hint) completion dialog addon.
|
1251 |
-
* Tweak behavior of by-word cursor motion.
|
1252 |
-
* Further improvements to the [vim mode](https://codemirror.net/demo/vim.html).
|
1253 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.1...v3.11).
|
1254 |
-
|
1255 |
-
## 3.02.0 (2013-01-25)
|
1256 |
-
|
1257 |
-
Single-bugfix release. Fixes a problem that prevents CodeMirror instances from being garbage-collected after they become unused.
|
1258 |
-
|
1259 |
-
## 3.01.0 (2013-01-21)
|
1260 |
-
|
1261 |
-
* Move all add-ons into an organized directory structure under [`/addon`](https://codemirror.net/addon/). **You might have to adjust your paths.**
|
1262 |
-
* New modes: [D](https://codemirror.net/mode/d/index.html), [Sass](https://codemirror.net/mode/sass/index.html), [APL](https://codemirror.net/mode/apl/index.html), [SQL](https://codemirror.net/mode/sql/index.html) (configurable), and [Asterisk](https://codemirror.net/mode/asterisk/index.html).
|
1263 |
-
* Several bugfixes in right-to-left text support.
|
1264 |
-
* Add [`rtlMoveVisually`](https://codemirror.net/doc/manual.html#option_rtlMoveVisually) option.
|
1265 |
-
* Improvements to vim keymap.
|
1266 |
-
* Add built-in (lightweight) [overlay mode](https://codemirror.net/doc/manual.html#addOverlay) support.
|
1267 |
-
* Support `showIfHidden` option for [line widgets](https://codemirror.net/doc/manual.html#addLineWidget).
|
1268 |
-
* Add simple [Python hinter](https://codemirror.net/doc/manual.html#addon_python-hint).
|
1269 |
-
* Bring back the [`fixedGutter`](https://codemirror.net/doc/manual.html#option_fixedGutter) option.
|
1270 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.0...v3.01).
|
1271 |
-
|
1272 |
-
## 3.1.0 (2013-02-21)
|
1273 |
-
|
1274 |
-
* **Incompatible:** key handlers may now _return_, rather than _throw_ `CodeMirror.Pass` to signal they didn't handle the key.
|
1275 |
-
* Make documents a [first-class construct](https://codemirror.net/doc/manual.html#api_doc), support split views and subviews.
|
1276 |
-
* Add a [new module](https://codemirror.net/doc/manual.html#addon_show-hint) for showing completion hints. Deprecate `simple-hint.js`.
|
1277 |
-
* Extend [htmlmixed mode](https://codemirror.net/mode/htmlmixed/index.html) to allow custom handling of script types.
|
1278 |
-
* Support an `insertLeft` option to [`setBookmark`](https://codemirror.net/doc/manual.html#setBookmark).
|
1279 |
-
* Add an [`eachLine`](https://codemirror.net/doc/manual.html#eachLine) method to iterate over a document.
|
1280 |
-
* New addon modules: [selection marking](https://codemirror.net/demo/markselection.html), [linting](https://codemirror.net/demo/lint.html), and [automatic bracket closing](https://codemirror.net/demo/closebrackets.html).
|
1281 |
-
* Add [`"beforeChange"`](https://codemirror.net/doc/manual.html#event_beforeChange) and [`"beforeSelectionChange"`](https://codemirror.net/doc/manual.html#event_beforeSelectionChange) events.
|
1282 |
-
* Add [`"hide"`](https://codemirror.net/doc/manual.html#event_hide) and [`"unhide"`](https://codemirror.net/doc/manual.html#event_unhide) events to marked ranges.
|
1283 |
-
* Fix [`coordsChar`](https://codemirror.net/doc/manual.html#coordsChar)'s interpretation of its argument to match the documentation.
|
1284 |
-
* New modes: [Turtle](https://codemirror.net/mode/turtle/index.html) and [Q](https://codemirror.net/mode/q/index.html).
|
1285 |
-
* Further improvements to the [vim mode](https://codemirror.net/demo/vim.html).
|
1286 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.01...v3.1).
|
1287 |
-
|
1288 |
-
## 3.0.0 (2012-12-10)
|
1289 |
-
|
1290 |
-
**New major version**. Only partially backwards-compatible. See the [upgrading guide](https://codemirror.net/doc/upgrade_v3.html) for more information. Changes since release candidate 2:
|
1291 |
-
|
1292 |
-
* Rewritten VIM mode.
|
1293 |
-
* Fix a few minor scrolling and sizing issues.
|
1294 |
-
* Work around Safari segfault when dragging.
|
1295 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.0rc2...v3.0).
|
1296 |
-
|
1297 |
-
## 2.38.0 (2013-01-21)
|
1298 |
-
|
1299 |
-
Integrate some bugfixes, enhancements to the vim keymap, and new modes ([D](https://codemirror.net/mode/d/index.html), [Sass](https://codemirror.net/mode/sass/index.html), [APL](https://codemirror.net/mode/apl/index.html)) from the v3 branch.
|
1300 |
-
|
1301 |
-
## 2.37.0 (2012-12-20)
|
1302 |
-
|
1303 |
-
* New mode: [SQL](https://codemirror.net/mode/sql/index.html) (will replace [plsql](https://codemirror.net/mode/plsql/index.html) and [mysql](https://codemirror.net/mode/mysql/index.html) modes).
|
1304 |
-
* Further work on the new VIM mode.
|
1305 |
-
* Fix Cmd/Ctrl keys on recent Operas on OS X.
|
1306 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v2.36...v2.37).
|
1307 |
-
|
1308 |
-
## 2.36.0 (2012-11-20)
|
1309 |
-
|
1310 |
-
* New mode: [Z80 assembly](https://codemirror.net/mode/z80/index.html).
|
1311 |
-
* New theme: [Twilight](https://codemirror.net/demo/theme.html#twilight).
|
1312 |
-
* Add command-line compression helper.
|
1313 |
-
* Make [`scrollIntoView`](https://codemirror.net/doc/manual.html#scrollIntoView) public.
|
1314 |
-
* Add [`defaultTextHeight`](https://codemirror.net/doc/manual.html#defaultTextHeight) method.
|
1315 |
-
* Various extensions to the vim keymap.
|
1316 |
-
* Make [PHP mode](https://codemirror.net/mode/php/index.html) build on [mixed HTML mode](https://codemirror.net/mode/htmlmixed/index.html).
|
1317 |
-
* Add [comment-continuing](https://codemirror.net/doc/manual.html#addon_continuecomment) add-on.
|
1318 |
-
* Full [list of patches](https://codemirror.net/https://github.com/codemirror/CodeMirror/compare/v2.35...v2.36).
|
1319 |
-
|
1320 |
-
## 2.35.0 (2012-10-22)
|
1321 |
-
|
1322 |
-
* New (sub) mode: [TypeScript](https://codemirror.net/mode/javascript/typescript.html).
|
1323 |
-
* Don't overwrite (insert key) when pasting.
|
1324 |
-
* Fix several bugs in [`markText`](https://codemirror.net/doc/manual.html#markText)/undo interaction.
|
1325 |
-
* Better indentation of JavaScript code without semicolons.
|
1326 |
-
* Add [`defineInitHook`](https://codemirror.net/doc/manual.html#defineInitHook) function.
|
1327 |
-
* Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v2.34...v2.35).
|
1328 |
-
|
1329 |
-
## 2.34.0 (2012-09-19)
|
1330 |
-
|
1331 |
-
* New mode: [Common Lisp](https://codemirror.net/mode/commonlisp/index.html).
|
1332 |
-
* Fix right-click select-all on most browsers.
|
1333 |
-
* Change the way highlighting happens:
|
1334 |
-
Saves memory and CPU cycles.
|
1335 |
-
`compareStates` is no longer needed.
|
1336 |
-
`onHighlightComplete` no longer works.
|
1337 |
-
* Integrate mode (Markdown, XQuery, CSS, sTex) tests in central testsuite.
|
1338 |
-
* Add a [`CodeMirror.version`](https://codemirror.net/doc/manual.html#version) property.
|
1339 |
-
* More robust handling of nested modes in [formatting](https://codemirror.net/demo/formatting.html) and [closetag](https://codemirror.net/demo/closetag.html) plug-ins.
|
1340 |
-
* Un/redo now preserves [marked text](https://codemirror.net/doc/manual.html#markText) and bookmarks.
|
1341 |
-
* [Full list](https://github.com/codemirror/CodeMirror/compare/v2.33...v2.34) of patches.
|
1342 |
-
|
1343 |
-
## 2.33.0 (2012-08-23)
|
1344 |
-
|
1345 |
-
* New mode: [Sieve](https://codemirror.net/mode/sieve/index.html).
|
1346 |
-
* New [`getViewPort`](https://codemirror.net/doc/manual.html#getViewport) and [`onViewportChange`](https://codemirror.net/doc/manual.html#option_onViewportChange) API.
|
1347 |
-
* [Configurable](https://codemirror.net/doc/manual.html#option_cursorBlinkRate) cursor blink rate.
|
1348 |
-
* Make binding a key to `false` disabling handling (again).
|
1349 |
-
* Show non-printing characters as red dots.
|
1350 |
-
* More tweaks to the scrolling model.
|
1351 |
-
* Expanded testsuite. Basic linter added.
|
1352 |
-
* Remove most uses of `innerHTML`. Remove `CodeMirror.htmlEscape`.
|
1353 |
-
* [Full list](https://github.com/codemirror/CodeMirror/compare/v2.32...v2.33) of patches.
|
1354 |
-
|
1355 |
-
## 2.32.0 (2012-07-23)
|
1356 |
-
|
1357 |
-
Emergency fix for a bug where an editor with line wrapping on IE will break when there is _no_ scrollbar.
|
1358 |
-
|
1359 |
-
## 2.31.0 (2012-07-20)
|
1360 |
-
|
1361 |
-
* New modes: [OCaml](https://codemirror.net/mode/ocaml/index.html), [Haxe](https://codemirror.net/mode/haxe/index.html), and [VB.NET](https://codemirror.net/mode/vb/index.html).
|
1362 |
-
* Several fixes to the new scrolling model.
|
1363 |
-
* Add a [`setSize`](https://codemirror.net/doc/manual.html#setSize) method for programmatic resizing.
|
1364 |
-
* Add [`getHistory`](https://codemirror.net/doc/manual.html#getHistory) and [`setHistory`](https://codemirror.net/doc/manual.html#setHistory) methods.
|
1365 |
-
* Allow custom line separator string in [`getValue`](https://codemirror.net/doc/manual.html#getValue) and [`getRange`](https://codemirror.net/doc/manual.html#getRange).
|
1366 |
-
* Support double- and triple-click drag, double-clicking whitespace.
|
1367 |
-
* And more... [(all patches)](https://github.com/codemirror/CodeMirror/compare/v2.3...v2.31)
|
1368 |
-
|
1369 |
-
## 2.30.0 (2012-06-22)
|
1370 |
-
|
1371 |
-
* **New scrollbar implementation**. Should flicker less. Changes DOM structure of the editor.
|
1372 |
-
* New theme: [vibrant-ink](https://codemirror.net/demo/theme.html#vibrant-ink).
|
1373 |
-
* Many extensions to the VIM keymap (including text objects).
|
1374 |
-
* Add [mode-multiplexing](https://codemirror.net/demo/multiplex.html) utility script.
|
1375 |
-
* Fix bug where right-click paste works in read-only mode.
|
1376 |
-
* Add a [`getScrollInfo`](https://codemirror.net/doc/manual.html#getScrollInfo) method.
|
1377 |
-
* Lots of other [fixes](https://github.com/codemirror/CodeMirror/compare/v2.25...v2.3).
|
1378 |
-
|
1379 |
-
## 2.25.0 (2012-05-23)
|
1380 |
-
|
1381 |
-
* New mode: [Erlang](https://codemirror.net/mode/erlang/index.html).
|
1382 |
-
* **Remove xmlpure mode** (use [xml.js](https://codemirror.net/mode/xml/index.html)).
|
1383 |
-
* Fix line-wrapping in Opera.
|
1384 |
-
* Fix X Windows middle-click paste in Chrome.
|
1385 |
-
* Fix bug that broke pasting of huge documents.
|
1386 |
-
* Fix backspace and tab key repeat in Opera.
|
1387 |
-
|
1388 |
-
## 2.24.0 (2012-04-23)
|
1389 |
-
|
1390 |
-
* **Drop support for Internet Explorer 6**.
|
1391 |
-
* New modes: [Shell](https://codemirror.net/mode/shell/index.html), [Tiki wiki](https://codemirror.net/mode/tiki/index.html), [Pig Latin](https://codemirror.net/mode/pig/index.html).
|
1392 |
-
* New themes: [Ambiance](https://codemirror.net/demo/theme.html#ambiance), [Blackboard](https://codemirror.net/demo/theme.html#blackboard).
|
1393 |
-
* More control over drag/drop with [`dragDrop`](https://codemirror.net/doc/manual.html#option_dragDrop) and [`onDragEvent`](https://codemirror.net/doc/manual.html#option_onDragEvent) options.
|
1394 |
-
* Make HTML mode a bit less pedantic.
|
1395 |
-
* Add [`compoundChange`](https://codemirror.net/doc/manual.html#compoundChange) API method.
|
1396 |
-
* Several fixes in undo history and line hiding.
|
1397 |
-
* Remove (broken) support for `catchall` in key maps, add `nofallthrough` boolean field instead.
|
1398 |
-
|
1399 |
-
## 2.23.0 (2012-03-26)
|
1400 |
-
|
1401 |
-
* Change **default binding for tab**. Starting in 2.23, these bindings are default:
|
1402 |
-
* Tab: Insert tab character
|
1403 |
-
* Shift-tab: Reset line indentation to default
|
1404 |
-
* Ctrl/Cmd-[: Reduce line indentation (old tab behaviour)
|
1405 |
-
* Ctrl/Cmd-]: Increase line indentation (old shift-tab behaviour)
|
1406 |
-
* New modes: [XQuery](https://codemirror.net/mode/xquery/index.html) and [VBScript](https://codemirror.net/mode/vbscript/index.html).
|
1407 |
-
* Two new themes: [lesser-dark](https://codemirror.net/mode/less/index.html) and [xq-dark](https://codemirror.net/mode/xquery/index.html).
|
1408 |
-
* Differentiate between background and text styles in [`setLineClass`](https://codemirror.net/doc/manual.html#setLineClass).
|
1409 |
-
* Fix drag-and-drop in IE9+.
|
1410 |
-
* Extend [`charCoords`](https://codemirror.net/doc/manual.html#charCoords) and [`cursorCoords`](https://codemirror.net/doc/manual.html#cursorCoords) with a `mode` argument.
|
1411 |
-
* Add [`autofocus`](https://codemirror.net/doc/manual.html#option_autofocus) option.
|
1412 |
-
* Add [`findMarksAt`](https://codemirror.net/doc/manual.html#findMarksAt) method.
|
1413 |
-
|
1414 |
-
## 2.22.0 (2012-02-27)
|
1415 |
-
|
1416 |
-
* Allow [key handlers](https://codemirror.net/doc/manual.html#keymaps) to pass up events, allow binding characters.
|
1417 |
-
* Add [`autoClearEmptyLines`](https://codemirror.net/doc/manual.html#option_autoClearEmptyLines) option.
|
1418 |
-
* Properly use tab stops when rendering tabs.
|
1419 |
-
* Make PHP mode more robust.
|
1420 |
-
* Support indentation blocks in [code folder](https://codemirror.net/doc/manual.html#addon_foldcode).
|
1421 |
-
* Add a script for [highlighting instances of the selection](https://codemirror.net/doc/manual.html#addon_match-highlighter).
|
1422 |
-
* New [.properties](https://codemirror.net/mode/properties/index.html) mode.
|
1423 |
-
* Fix many bugs.
|
1424 |
-
|
1425 |
-
## 2.21.0 (2012-01-27)
|
1426 |
-
|
1427 |
-
* Added [LESS](https://codemirror.net/mode/less/index.html), [MySQL](https://codemirror.net/mode/mysql/index.html), [Go](https://codemirror.net/mode/go/index.html), and [Verilog](https://codemirror.net/mode/verilog/index.html) modes.
|
1428 |
-
* Add [`smartIndent`](https://codemirror.net/doc/manual.html#option_smartIndent) option.
|
1429 |
-
* Support a cursor in [`readOnly`](https://codemirror.net/doc/manual.html#option_readOnly)-mode.
|
1430 |
-
* Support assigning multiple styles to a token.
|
1431 |
-
* Use a new approach to drawing the selection.
|
1432 |
-
* Add [`scrollTo`](https://codemirror.net/doc/manual.html#scrollTo) method.
|
1433 |
-
* Allow undo/redo events to span non-adjacent lines.
|
1434 |
-
* Lots and lots of bugfixes.
|
1435 |
-
|
1436 |
-
## 2.20.0 (2011-12-20)
|
1437 |
-
|
1438 |
-
* Slightly incompatible API changes. Read [this](https://codemirror.net/doc/upgrade_v2.2.html).
|
1439 |
-
* New approach to [binding](https://codemirror.net/doc/manual.html#option_extraKeys) keys, support for [custom bindings](https://codemirror.net/doc/manual.html#option_keyMap).
|
1440 |
-
* Support for overwrite (insert).
|
1441 |
-
* [Custom-width](https://codemirror.net/doc/manual.html#option_tabSize) and [stylable](https://codemirror.net/demo/visibletabs.html) tabs.
|
1442 |
-
* Moved more code into [add-on scripts](https://codemirror.net/doc/manual.html#addons).
|
1443 |
-
* Support for sane vertical cursor movement in wrapped lines.
|
1444 |
-
* More reliable handling of editing [marked text](https://codemirror.net/doc/manual.html#markText).
|
1445 |
-
* Add minimal [emacs](https://codemirror.net/demo/emacs.html) and [vim](https://codemirror.net/demo/vim.html) bindings.
|
1446 |
-
* Rename `coordsFromIndex` to [`posFromIndex`](https://codemirror.net/doc/manual.html#posFromIndex), add [`indexFromPos`](https://codemirror.net/doc/manual.html#indexFromPos) method.
|
1447 |
-
|
1448 |
-
## 2.18.0 (2011-11-21)
|
1449 |
-
|
1450 |
-
Fixes `TextMarker.clear`, which is broken in 2.17.
|
1451 |
-
|
1452 |
-
## 2.17.0 (2011-11-21)
|
1453 |
-
|
1454 |
-
* Add support for [line wrapping](https://codemirror.net/doc/manual.html#option_lineWrapping) and [code folding](https://codemirror.net/doc/manual.html#hideLine).
|
1455 |
-
* Add [Github-style Markdown](https://codemirror.net/mode/gfm/index.html) mode.
|
1456 |
-
* Add [Monokai](https://codemirror.net/theme/monokai.css) and [Rubyblue](https://codemirror.net/theme/rubyblue.css) themes.
|
1457 |
-
* Add [`setBookmark`](https://codemirror.net/doc/manual.html#setBookmark) method.
|
1458 |
-
* Move some of the demo code into reusable components under [`lib/util`](https://codemirror.net/addon/).
|
1459 |
-
* Make screen-coord-finding code faster and more reliable.
|
1460 |
-
* Fix drag-and-drop in Firefox.
|
1461 |
-
* Improve support for IME.
|
1462 |
-
* Speed up content rendering.
|
1463 |
-
* Fix browser's built-in search in Webkit.
|
1464 |
-
* Make double- and triple-click work in IE.
|
1465 |
-
* Various fixes to modes.
|
1466 |
-
|
1467 |
-
## 2.16.0 (2011-10-27)
|
1468 |
-
|
1469 |
-
* Add [Perl](https://codemirror.net/mode/perl/index.html), [Rust](https://codemirror.net/mode/rust/index.html), [TiddlyWiki](https://codemirror.net/mode/tiddlywiki/index.html), and [Groovy](https://codemirror.net/mode/groovy/index.html) modes.
|
1470 |
-
* Dragging text inside the editor now moves, rather than copies.
|
1471 |
-
* Add a [`coordsFromIndex`](https://codemirror.net/doc/manual.html#coordsFromIndex) method.
|
1472 |
-
* **API change**: `setValue` now no longer clears history. Use [`clearHistory`](https://codemirror.net/doc/manual.html#clearHistory) for that.
|
1473 |
-
* **API change**: [`markText`](https://codemirror.net/doc/manual.html#markText) now returns an object with `clear` and `find` methods. Marked text is now more robust when edited.
|
1474 |
-
* Fix editing code with tabs in Internet Explorer.
|
1475 |
-
|
1476 |
-
## 2.15.0 (2011-09-26)
|
1477 |
-
|
1478 |
-
Fix bug that snuck into 2.14: Clicking the character that currently has the cursor didn't re-focus the editor.
|
1479 |
-
|
1480 |
-
## 2.14.0 (2011-09-26)
|
1481 |
-
|
1482 |
-
* Add [Clojure](https://codemirror.net/mode/clojure/index.html), [Pascal](https://codemirror.net/mode/pascal/index.html), [NTriples](https://codemirror.net/mode/ntriples/index.html), [Jinja2](https://codemirror.net/mode/jinja2/index.html), and [Markdown](https://codemirror.net/mode/markdown/index.html) modes.
|
1483 |
-
* Add [Cobalt](https://codemirror.net/theme/cobalt.css) and [Eclipse](https://codemirror.net/theme/eclipse.css) themes.
|
1484 |
-
* Add a [`fixedGutter`](https://codemirror.net/doc/manual.html#option_fixedGutter) option.
|
1485 |
-
* Fix bug with `setValue` breaking cursor movement.
|
1486 |
-
* Make gutter updates much more efficient.
|
1487 |
-
* Allow dragging of text out of the editor (on modern browsers).
|
1488 |
-
|
1489 |
-
## 2.13.0 (2011-08-23)
|
1490 |
-
|
1491 |
-
* Add [Ruby](https://codemirror.net/mode/ruby/index.html), [R](https://codemirror.net/mode/r/index.html), [CoffeeScript](https://codemirror.net/mode/coffeescript/index.html), and [Velocity](https://codemirror.net/mode/velocity/index.html) modes.
|
1492 |
-
* Add [`getGutterElement`](https://codemirror.net/doc/manual.html#getGutterElement) to API.
|
1493 |
-
* Several fixes to scrolling and positioning.
|
1494 |
-
* Add [`smartHome`](https://codemirror.net/doc/manual.html#option_smartHome) option.
|
1495 |
-
* Add an experimental [pure XML](https://codemirror.net/mode/xmlpure/index.html) mode.
|
1496 |
-
|
1497 |
-
## 2.12.0 (2011-07-25)
|
1498 |
-
|
1499 |
-
* Add a [SPARQL](https://codemirror.net/mode/sparql/index.html) mode.
|
1500 |
-
* Fix bug with cursor jumping around in an unfocused editor in IE.
|
1501 |
-
* Allow key and mouse events to bubble out of the editor. Ignore widget clicks.
|
1502 |
-
* Solve cursor flakiness after undo/redo.
|
1503 |
-
* Fix block-reindent ignoring the last few lines.
|
1504 |
-
* Fix parsing of multi-line attrs in XML mode.
|
1505 |
-
* Use `innerHTML` for HTML-escaping.
|
1506 |
-
* Some fixes to indentation in C-like mode.
|
1507 |
-
* Shrink horiz scrollbars when long lines removed.
|
1508 |
-
* Fix width feedback loop bug that caused the width of an inner DIV to shrink.
|
1509 |
-
|
1510 |
-
## 2.11.0 (2011-07-04)
|
1511 |
-
|
1512 |
-
* Add a [Scheme mode](https://codemirror.net/mode/scheme/index.html).
|
1513 |
-
* Add a `replace` method to search cursors, for cursor-preserving replacements.
|
1514 |
-
* Make the [C-like mode](https://codemirror.net/mode/clike/index.html) mode more customizable.
|
1515 |
-
* Update XML mode to spot mismatched tags.
|
1516 |
-
* Add `getStateAfter` API and `compareState` mode API methods for finer-grained mode magic.
|
1517 |
-
* Add a `getScrollerElement` API method to manipulate the scrolling DIV.
|
1518 |
-
* Fix drag-and-drop for Firefox.
|
1519 |
-
* Add a C# configuration for the [C-like mode](https://codemirror.net/mode/clike/index.html).
|
1520 |
-
* Add [full-screen editing](https://codemirror.net/demo/fullscreen.html) and [mode-changing](https://codemirror.net/demo/changemode.html) demos.
|
1521 |
-
|
1522 |
-
## 2.10.0 (2011-06-07)
|
1523 |
-
|
1524 |
-
Add a [theme](https://codemirror.net/doc/manual.html#option_theme) system ([demo](https://codemirror.net/demo/theme.html)). Note that this is not backwards-compatible—you'll have to update your styles and modes!
|
1525 |
-
|
1526 |
-
## 2.2.0 (2011-06-07)
|
1527 |
-
|
1528 |
-
* Add a [Lua mode](https://codemirror.net/mode/lua/index.html).
|
1529 |
-
* Fix reverse-searching for a regexp.
|
1530 |
-
* Empty lines can no longer break highlighting.
|
1531 |
-
* Rework scrolling model (the outer wrapper no longer does the scrolling).
|
1532 |
-
* Solve horizontal jittering on long lines.
|
1533 |
-
* Add [runmode.js](https://codemirror.net/demo/runmode.html).
|
1534 |
-
* Immediately re-highlight text when typing.
|
1535 |
-
* Fix problem with 'sticking' horizontal scrollbar.
|
1536 |
-
|
1537 |
-
## 2.1.0 (2011-05-26)
|
1538 |
-
|
1539 |
-
* Add a [Smalltalk mode](https://codemirror.net/mode/smalltalk/index.html).
|
1540 |
-
* Add a [reStructuredText mode](https://codemirror.net/mode/rst/index.html).
|
1541 |
-
* Add a [Python mode](https://codemirror.net/mode/python/index.html).
|
1542 |
-
* Add a [PL/SQL mode](https://codemirror.net/mode/plsql/index.html).
|
1543 |
-
* `coordsChar` now works
|
1544 |
-
* Fix a problem where `onCursorActivity` interfered with `onChange`.
|
1545 |
-
* Fix a number of scrolling and mouse-click-position glitches.
|
1546 |
-
* Pass information about the changed lines to `onChange`.
|
1547 |
-
* Support cmd-up/down on OS X.
|
1548 |
-
* Add triple-click line selection.
|
1549 |
-
* Don't handle shift when changing the selection through the API.
|
1550 |
-
* Support `"nocursor"` mode for `readOnly` option.
|
1551 |
-
* Add an `onHighlightComplete` option.
|
1552 |
-
* Fix the context menu for Firefox.
|
1553 |
-
|
1554 |
-
## 2.0.0 (2011-03-28)
|
1555 |
-
|
1556 |
-
CodeMirror 2 is a complete rewrite that's faster, smaller, simpler to use, and less dependent on browser quirks. See [this](https://codemirror.net/doc/internals.html) and [this](http://groups.google.com/group/codemirror/browse_thread/thread/5a8e894024a9f580) for more information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/CONTRIBUTING.md
DELETED
@@ -1,92 +0,0 @@
|
|
1 |
-
# How to contribute
|
2 |
-
|
3 |
-
- [Getting help](#getting-help)
|
4 |
-
- [Submitting bug reports](#submitting-bug-reports)
|
5 |
-
- [Contributing code](#contributing-code)
|
6 |
-
|
7 |
-
## Getting help
|
8 |
-
|
9 |
-
Community discussion, questions, and informal bug reporting is done on the
|
10 |
-
[discuss.CodeMirror forum](http://discuss.codemirror.net).
|
11 |
-
|
12 |
-
## Submitting bug reports
|
13 |
-
|
14 |
-
The preferred way to report bugs is to use the
|
15 |
-
[GitHub issue tracker](http://github.com/codemirror/CodeMirror/issues). Before
|
16 |
-
reporting a bug, read these pointers.
|
17 |
-
|
18 |
-
**Note:** The issue tracker is for *bugs*, not requests for help. Questions
|
19 |
-
should be asked on the
|
20 |
-
[discuss.CodeMirror forum](http://discuss.codemirror.net) instead.
|
21 |
-
|
22 |
-
### Reporting bugs effectively
|
23 |
-
|
24 |
-
- CodeMirror is maintained by volunteers. They don't owe you anything, so be
|
25 |
-
polite. Reports with an indignant or belligerent tone tend to be moved to the
|
26 |
-
bottom of the pile.
|
27 |
-
|
28 |
-
- Include information about **the browser in which the problem occurred**. Even
|
29 |
-
if you tested several browsers, and the problem occurred in all of them,
|
30 |
-
mention this fact in the bug report. Also include browser version numbers and
|
31 |
-
the operating system that you're on.
|
32 |
-
|
33 |
-
- Mention which release of CodeMirror you're using. Preferably, try also with
|
34 |
-
the current development snapshot, to ensure the problem has not already been
|
35 |
-
fixed.
|
36 |
-
|
37 |
-
- Mention very precisely what went wrong. "X is broken" is not a good bug
|
38 |
-
report. What did you expect to happen? What happened instead? Describe the
|
39 |
-
exact steps a maintainer has to take to make the problem occur. We can not
|
40 |
-
fix something that we can not observe.
|
41 |
-
|
42 |
-
- If the problem can not be reproduced in any of the demos included in the
|
43 |
-
CodeMirror distribution, please provide an HTML document that demonstrates
|
44 |
-
the problem. The best way to do this is to go to
|
45 |
-
[jsbin.com](http://jsbin.com/ihunin/edit), enter it there, press save, and
|
46 |
-
include the resulting link in your bug report.
|
47 |
-
|
48 |
-
## Contributing code
|
49 |
-
|
50 |
-
Note that we are not accepting any new addons or modes into the main
|
51 |
-
distribution. If you've written such a module, please distribute it as
|
52 |
-
a separate NPM package.
|
53 |
-
|
54 |
-
- Make sure you have a [GitHub Account](https://github.com/signup/free)
|
55 |
-
- Fork [CodeMirror](https://github.com/codemirror/CodeMirror/)
|
56 |
-
([how to fork a repo](https://help.github.com/articles/fork-a-repo))
|
57 |
-
- Make your changes
|
58 |
-
- If your changes are easy to test or likely to regress, add tests.
|
59 |
-
Tests for the core go into `test/test.js`, some modes have their own
|
60 |
-
test suite under `mode/XXX/test.js`. Feel free to add new test
|
61 |
-
suites to modes that don't have one yet (be sure to link the new
|
62 |
-
tests into `test/index.html`).
|
63 |
-
- Follow the general code style of the rest of the project (see
|
64 |
-
below). Run `bin/lint` to verify that the linter is happy.
|
65 |
-
- Make sure all tests pass. Visit `test/index.html` in your browser to
|
66 |
-
run them.
|
67 |
-
- Submit a pull request
|
68 |
-
([how to create a pull request](https://help.github.com/articles/fork-a-repo)).
|
69 |
-
Don't put more than one feature/fix in a single pull request.
|
70 |
-
|
71 |
-
By contributing code to CodeMirror you
|
72 |
-
|
73 |
-
- agree to license the contributed code under CodeMirror's [MIT
|
74 |
-
license](https://codemirror.net/LICENSE).
|
75 |
-
|
76 |
-
- confirm that you have the right to contribute and license the code
|
77 |
-
in question. (Either you hold all rights on the code, or the rights
|
78 |
-
holder has explicitly granted the right to use it like this,
|
79 |
-
through a compatible open source license or through a direct
|
80 |
-
agreement with you.)
|
81 |
-
|
82 |
-
### Coding standards
|
83 |
-
|
84 |
-
- 2 spaces per indentation level, no tabs.
|
85 |
-
|
86 |
-
- Note that the linter (`bin/lint`) which is run after each commit
|
87 |
-
complains about unused variables and functions. Prefix their names
|
88 |
-
with an underscore to muffle it.
|
89 |
-
|
90 |
-
- CodeMirror does *not* follow JSHint or JSLint prescribed style.
|
91 |
-
Patches that try to 'fix' code to pass one of these linters will be
|
92 |
-
unceremoniously discarded.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
MIT License
|
2 |
-
|
3 |
-
Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
|
4 |
-
|
5 |
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
-
of this software and associated documentation files (the "Software"), to deal
|
7 |
-
in the Software without restriction, including without limitation the rights
|
8 |
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
-
copies of the Software, and to permit persons to whom the Software is
|
10 |
-
furnished to do so, subject to the following conditions:
|
11 |
-
|
12 |
-
The above copyright notice and this permission notice shall be included in
|
13 |
-
all copies or substantial portions of the Software.
|
14 |
-
|
15 |
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21 |
-
THE SOFTWARE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/README.md
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
# CodeMirror
|
2 |
-
|
3 |
-
[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)
|
4 |
-
[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)
|
5 |
-
[![Join the chat at https://gitter.im/codemirror/CodeMirror](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codemirror/CodeMirror)
|
6 |
-
|
7 |
-
CodeMirror is a versatile text editor implemented in JavaScript for
|
8 |
-
the browser. It is specialized for editing code, and comes with over
|
9 |
-
100 language modes and various addons that implement more advanced
|
10 |
-
editing functionality. Every language comes with fully-featured code
|
11 |
-
and syntax highlighting to help with reading and editing complex code.
|
12 |
-
|
13 |
-
A rich programming API and a CSS theming system are available for
|
14 |
-
customizing CodeMirror to fit your application, and extending it with
|
15 |
-
new functionality.
|
16 |
-
|
17 |
-
You can find more information (and the
|
18 |
-
[manual](https://codemirror.net/doc/manual.html)) on the [project
|
19 |
-
page](https://codemirror.net). For questions and discussion, use the
|
20 |
-
[discussion forum](https://discuss.codemirror.net/).
|
21 |
-
|
22 |
-
See
|
23 |
-
[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)
|
24 |
-
for contributing guidelines.
|
25 |
-
|
26 |
-
The CodeMirror community aims to be welcoming to everybody. We use the
|
27 |
-
[Contributor Covenant
|
28 |
-
(1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of
|
29 |
-
conduct.
|
30 |
-
|
31 |
-
### Installation
|
32 |
-
|
33 |
-
Either get the [zip file](https://codemirror.net/codemirror.zip) with
|
34 |
-
the latest version, or make sure you have [Node](https://nodejs.org/)
|
35 |
-
installed and run:
|
36 |
-
|
37 |
-
npm install codemirror
|
38 |
-
|
39 |
-
**NOTE**: This is the source repository for the library, and not the
|
40 |
-
distribution channel. Cloning it is not the recommended way to install
|
41 |
-
the library, and will in fact not work unless you also run the build
|
42 |
-
step.
|
43 |
-
|
44 |
-
### Quickstart
|
45 |
-
|
46 |
-
To build the project, make sure you have Node.js installed (at least version 6)
|
47 |
-
and then `npm install`. To run, just open `index.html` in your
|
48 |
-
browser (you don't need to run a webserver). Run the tests with `npm test`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/comment/comment.js
DELETED
@@ -1,209 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var noOptions = {};
|
15 |
-
var nonWS = /[^\s\u00a0]/;
|
16 |
-
var Pos = CodeMirror.Pos;
|
17 |
-
|
18 |
-
function firstNonWS(str) {
|
19 |
-
var found = str.search(nonWS);
|
20 |
-
return found == -1 ? 0 : found;
|
21 |
-
}
|
22 |
-
|
23 |
-
CodeMirror.commands.toggleComment = function(cm) {
|
24 |
-
cm.toggleComment();
|
25 |
-
};
|
26 |
-
|
27 |
-
CodeMirror.defineExtension("toggleComment", function(options) {
|
28 |
-
if (!options) options = noOptions;
|
29 |
-
var cm = this;
|
30 |
-
var minLine = Infinity, ranges = this.listSelections(), mode = null;
|
31 |
-
for (var i = ranges.length - 1; i >= 0; i--) {
|
32 |
-
var from = ranges[i].from(), to = ranges[i].to();
|
33 |
-
if (from.line >= minLine) continue;
|
34 |
-
if (to.line >= minLine) to = Pos(minLine, 0);
|
35 |
-
minLine = from.line;
|
36 |
-
if (mode == null) {
|
37 |
-
if (cm.uncomment(from, to, options)) mode = "un";
|
38 |
-
else { cm.lineComment(from, to, options); mode = "line"; }
|
39 |
-
} else if (mode == "un") {
|
40 |
-
cm.uncomment(from, to, options);
|
41 |
-
} else {
|
42 |
-
cm.lineComment(from, to, options);
|
43 |
-
}
|
44 |
-
}
|
45 |
-
});
|
46 |
-
|
47 |
-
// Rough heuristic to try and detect lines that are part of multi-line string
|
48 |
-
function probablyInsideString(cm, pos, line) {
|
49 |
-
return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
|
50 |
-
}
|
51 |
-
|
52 |
-
function getMode(cm, pos) {
|
53 |
-
var mode = cm.getMode()
|
54 |
-
return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
|
55 |
-
}
|
56 |
-
|
57 |
-
CodeMirror.defineExtension("lineComment", function(from, to, options) {
|
58 |
-
if (!options) options = noOptions;
|
59 |
-
var self = this, mode = getMode(self, from);
|
60 |
-
var firstLine = self.getLine(from.line);
|
61 |
-
if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
|
62 |
-
|
63 |
-
var commentString = options.lineComment || mode.lineComment;
|
64 |
-
if (!commentString) {
|
65 |
-
if (options.blockCommentStart || mode.blockCommentStart) {
|
66 |
-
options.fullLines = true;
|
67 |
-
self.blockComment(from, to, options);
|
68 |
-
}
|
69 |
-
return;
|
70 |
-
}
|
71 |
-
|
72 |
-
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
|
73 |
-
var pad = options.padding == null ? " " : options.padding;
|
74 |
-
var blankLines = options.commentBlankLines || from.line == to.line;
|
75 |
-
|
76 |
-
self.operation(function() {
|
77 |
-
if (options.indent) {
|
78 |
-
var baseString = null;
|
79 |
-
for (var i = from.line; i < end; ++i) {
|
80 |
-
var line = self.getLine(i);
|
81 |
-
var whitespace = line.slice(0, firstNonWS(line));
|
82 |
-
if (baseString == null || baseString.length > whitespace.length) {
|
83 |
-
baseString = whitespace;
|
84 |
-
}
|
85 |
-
}
|
86 |
-
for (var i = from.line; i < end; ++i) {
|
87 |
-
var line = self.getLine(i), cut = baseString.length;
|
88 |
-
if (!blankLines && !nonWS.test(line)) continue;
|
89 |
-
if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
|
90 |
-
self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
|
91 |
-
}
|
92 |
-
} else {
|
93 |
-
for (var i = from.line; i < end; ++i) {
|
94 |
-
if (blankLines || nonWS.test(self.getLine(i)))
|
95 |
-
self.replaceRange(commentString + pad, Pos(i, 0));
|
96 |
-
}
|
97 |
-
}
|
98 |
-
});
|
99 |
-
});
|
100 |
-
|
101 |
-
CodeMirror.defineExtension("blockComment", function(from, to, options) {
|
102 |
-
if (!options) options = noOptions;
|
103 |
-
var self = this, mode = getMode(self, from);
|
104 |
-
var startString = options.blockCommentStart || mode.blockCommentStart;
|
105 |
-
var endString = options.blockCommentEnd || mode.blockCommentEnd;
|
106 |
-
if (!startString || !endString) {
|
107 |
-
if ((options.lineComment || mode.lineComment) && options.fullLines != false)
|
108 |
-
self.lineComment(from, to, options);
|
109 |
-
return;
|
110 |
-
}
|
111 |
-
if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
|
112 |
-
|
113 |
-
var end = Math.min(to.line, self.lastLine());
|
114 |
-
if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
|
115 |
-
|
116 |
-
var pad = options.padding == null ? " " : options.padding;
|
117 |
-
if (from.line > end) return;
|
118 |
-
|
119 |
-
self.operation(function() {
|
120 |
-
if (options.fullLines != false) {
|
121 |
-
var lastLineHasText = nonWS.test(self.getLine(end));
|
122 |
-
self.replaceRange(pad + endString, Pos(end));
|
123 |
-
self.replaceRange(startString + pad, Pos(from.line, 0));
|
124 |
-
var lead = options.blockCommentLead || mode.blockCommentLead;
|
125 |
-
if (lead != null) for (var i = from.line + 1; i <= end; ++i)
|
126 |
-
if (i != end || lastLineHasText)
|
127 |
-
self.replaceRange(lead + pad, Pos(i, 0));
|
128 |
-
} else {
|
129 |
-
self.replaceRange(endString, to);
|
130 |
-
self.replaceRange(startString, from);
|
131 |
-
}
|
132 |
-
});
|
133 |
-
});
|
134 |
-
|
135 |
-
CodeMirror.defineExtension("uncomment", function(from, to, options) {
|
136 |
-
if (!options) options = noOptions;
|
137 |
-
var self = this, mode = getMode(self, from);
|
138 |
-
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
|
139 |
-
|
140 |
-
// Try finding line comments
|
141 |
-
var lineString = options.lineComment || mode.lineComment, lines = [];
|
142 |
-
var pad = options.padding == null ? " " : options.padding, didSomething;
|
143 |
-
lineComment: {
|
144 |
-
if (!lineString) break lineComment;
|
145 |
-
for (var i = start; i <= end; ++i) {
|
146 |
-
var line = self.getLine(i);
|
147 |
-
var found = line.indexOf(lineString);
|
148 |
-
if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
|
149 |
-
if (found == -1 && nonWS.test(line)) break lineComment;
|
150 |
-
if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
|
151 |
-
lines.push(line);
|
152 |
-
}
|
153 |
-
self.operation(function() {
|
154 |
-
for (var i = start; i <= end; ++i) {
|
155 |
-
var line = lines[i - start];
|
156 |
-
var pos = line.indexOf(lineString), endPos = pos + lineString.length;
|
157 |
-
if (pos < 0) continue;
|
158 |
-
if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
|
159 |
-
didSomething = true;
|
160 |
-
self.replaceRange("", Pos(i, pos), Pos(i, endPos));
|
161 |
-
}
|
162 |
-
});
|
163 |
-
if (didSomething) return true;
|
164 |
-
}
|
165 |
-
|
166 |
-
// Try block comments
|
167 |
-
var startString = options.blockCommentStart || mode.blockCommentStart;
|
168 |
-
var endString = options.blockCommentEnd || mode.blockCommentEnd;
|
169 |
-
if (!startString || !endString) return false;
|
170 |
-
var lead = options.blockCommentLead || mode.blockCommentLead;
|
171 |
-
var startLine = self.getLine(start), open = startLine.indexOf(startString)
|
172 |
-
if (open == -1) return false
|
173 |
-
var endLine = end == start ? startLine : self.getLine(end)
|
174 |
-
var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
|
175 |
-
var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
|
176 |
-
if (close == -1 ||
|
177 |
-
!/comment/.test(self.getTokenTypeAt(insideStart)) ||
|
178 |
-
!/comment/.test(self.getTokenTypeAt(insideEnd)) ||
|
179 |
-
self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
|
180 |
-
return false;
|
181 |
-
|
182 |
-
// Avoid killing block comments completely outside the selection.
|
183 |
-
// Positions of the last startString before the start of the selection, and the first endString after it.
|
184 |
-
var lastStart = startLine.lastIndexOf(startString, from.ch);
|
185 |
-
var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
|
186 |
-
if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
|
187 |
-
// Positions of the first endString after the end of the selection, and the last startString before it.
|
188 |
-
firstEnd = endLine.indexOf(endString, to.ch);
|
189 |
-
var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
|
190 |
-
lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
|
191 |
-
if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
|
192 |
-
|
193 |
-
self.operation(function() {
|
194 |
-
self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
|
195 |
-
Pos(end, close + endString.length));
|
196 |
-
var openEnd = open + startString.length;
|
197 |
-
if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
|
198 |
-
self.replaceRange("", Pos(start, open), Pos(start, openEnd));
|
199 |
-
if (lead) for (var i = start + 1; i <= end; ++i) {
|
200 |
-
var line = self.getLine(i), found = line.indexOf(lead);
|
201 |
-
if (found == -1 || nonWS.test(line.slice(0, found))) continue;
|
202 |
-
var foundEnd = found + lead.length;
|
203 |
-
if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
|
204 |
-
self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
|
205 |
-
}
|
206 |
-
});
|
207 |
-
return true;
|
208 |
-
});
|
209 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/comment/continuecomment.js
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
function continueComment(cm) {
|
13 |
-
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
14 |
-
var ranges = cm.listSelections(), mode, inserts = [];
|
15 |
-
for (var i = 0; i < ranges.length; i++) {
|
16 |
-
var pos = ranges[i].head
|
17 |
-
if (!/\bcomment\b/.test(cm.getTokenTypeAt(pos))) return CodeMirror.Pass;
|
18 |
-
var modeHere = cm.getModeAt(pos)
|
19 |
-
if (!mode) mode = modeHere;
|
20 |
-
else if (mode != modeHere) return CodeMirror.Pass;
|
21 |
-
|
22 |
-
var insert = null;
|
23 |
-
if (mode.blockCommentStart && mode.blockCommentContinue) {
|
24 |
-
var line = cm.getLine(pos.line).slice(0, pos.ch)
|
25 |
-
var end = line.lastIndexOf(mode.blockCommentEnd), found
|
26 |
-
if (end != -1 && end == pos.ch - mode.blockCommentEnd.length) {
|
27 |
-
// Comment ended, don't continue it
|
28 |
-
} else if ((found = line.lastIndexOf(mode.blockCommentStart)) > -1 && found > end) {
|
29 |
-
insert = line.slice(0, found)
|
30 |
-
if (/\S/.test(insert)) {
|
31 |
-
insert = ""
|
32 |
-
for (var j = 0; j < found; ++j) insert += " "
|
33 |
-
}
|
34 |
-
} else if ((found = line.indexOf(mode.blockCommentContinue)) > -1 && !/\S/.test(line.slice(0, found))) {
|
35 |
-
insert = line.slice(0, found)
|
36 |
-
}
|
37 |
-
if (insert != null) insert += mode.blockCommentContinue
|
38 |
-
}
|
39 |
-
if (insert == null && mode.lineComment && continueLineCommentEnabled(cm)) {
|
40 |
-
var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment);
|
41 |
-
if (found > -1) {
|
42 |
-
insert = line.slice(0, found);
|
43 |
-
if (/\S/.test(insert)) insert = null;
|
44 |
-
else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0];
|
45 |
-
}
|
46 |
-
}
|
47 |
-
if (insert == null) return CodeMirror.Pass;
|
48 |
-
inserts[i] = "\n" + insert;
|
49 |
-
}
|
50 |
-
|
51 |
-
cm.operation(function() {
|
52 |
-
for (var i = ranges.length - 1; i >= 0; i--)
|
53 |
-
cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert");
|
54 |
-
});
|
55 |
-
}
|
56 |
-
|
57 |
-
function continueLineCommentEnabled(cm) {
|
58 |
-
var opt = cm.getOption("continueComments");
|
59 |
-
if (opt && typeof opt == "object")
|
60 |
-
return opt.continueLineComment !== false;
|
61 |
-
return true;
|
62 |
-
}
|
63 |
-
|
64 |
-
CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
|
65 |
-
if (prev && prev != CodeMirror.Init)
|
66 |
-
cm.removeKeyMap("continueComment");
|
67 |
-
if (val) {
|
68 |
-
var key = "Enter";
|
69 |
-
if (typeof val == "string")
|
70 |
-
key = val;
|
71 |
-
else if (typeof val == "object" && val.key)
|
72 |
-
key = val.key;
|
73 |
-
var map = {name: "continueComment"};
|
74 |
-
map[key] = continueComment;
|
75 |
-
cm.addKeyMap(map);
|
76 |
-
}
|
77 |
-
});
|
78 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/dialog/dialog.css
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
.CodeMirror-dialog {
|
2 |
-
position: absolute;
|
3 |
-
left: 0; right: 0;
|
4 |
-
background: inherit;
|
5 |
-
z-index: 15;
|
6 |
-
padding: .1em .8em;
|
7 |
-
overflow: hidden;
|
8 |
-
color: inherit;
|
9 |
-
}
|
10 |
-
|
11 |
-
.CodeMirror-dialog-top {
|
12 |
-
border-bottom: 1px solid #eee;
|
13 |
-
top: 0;
|
14 |
-
}
|
15 |
-
|
16 |
-
.CodeMirror-dialog-bottom {
|
17 |
-
border-top: 1px solid #eee;
|
18 |
-
bottom: 0;
|
19 |
-
}
|
20 |
-
|
21 |
-
.CodeMirror-dialog input {
|
22 |
-
border: none;
|
23 |
-
outline: none;
|
24 |
-
background: transparent;
|
25 |
-
width: 20em;
|
26 |
-
color: inherit;
|
27 |
-
font-family: monospace;
|
28 |
-
}
|
29 |
-
|
30 |
-
.CodeMirror-dialog button {
|
31 |
-
font-size: 70%;
|
32 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/dialog/dialog.js
DELETED
@@ -1,161 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
5 |
-
|
6 |
-
(function(mod) {
|
7 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
8 |
-
mod(require("../../lib/codemirror"));
|
9 |
-
else if (typeof define == "function" && define.amd) // AMD
|
10 |
-
define(["../../lib/codemirror"], mod);
|
11 |
-
else // Plain browser env
|
12 |
-
mod(CodeMirror);
|
13 |
-
})(function(CodeMirror) {
|
14 |
-
function dialogDiv(cm, template, bottom) {
|
15 |
-
var wrap = cm.getWrapperElement();
|
16 |
-
var dialog;
|
17 |
-
dialog = wrap.appendChild(document.createElement("div"));
|
18 |
-
if (bottom)
|
19 |
-
dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
|
20 |
-
else
|
21 |
-
dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
|
22 |
-
|
23 |
-
if (typeof template == "string") {
|
24 |
-
dialog.innerHTML = template;
|
25 |
-
} else { // Assuming it's a detached DOM element.
|
26 |
-
dialog.appendChild(template);
|
27 |
-
}
|
28 |
-
CodeMirror.addClass(wrap, 'dialog-opened');
|
29 |
-
return dialog;
|
30 |
-
}
|
31 |
-
|
32 |
-
function closeNotification(cm, newVal) {
|
33 |
-
if (cm.state.currentNotificationClose)
|
34 |
-
cm.state.currentNotificationClose();
|
35 |
-
cm.state.currentNotificationClose = newVal;
|
36 |
-
}
|
37 |
-
|
38 |
-
CodeMirror.defineExtension("openDialog", function(template, callback, options) {
|
39 |
-
if (!options) options = {};
|
40 |
-
|
41 |
-
closeNotification(this, null);
|
42 |
-
|
43 |
-
var dialog = dialogDiv(this, template, options.bottom);
|
44 |
-
var closed = false, me = this;
|
45 |
-
function close(newVal) {
|
46 |
-
if (typeof newVal == 'string') {
|
47 |
-
inp.value = newVal;
|
48 |
-
} else {
|
49 |
-
if (closed) return;
|
50 |
-
closed = true;
|
51 |
-
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
|
52 |
-
dialog.parentNode.removeChild(dialog);
|
53 |
-
me.focus();
|
54 |
-
|
55 |
-
if (options.onClose) options.onClose(dialog);
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
var inp = dialog.getElementsByTagName("input")[0], button;
|
60 |
-
if (inp) {
|
61 |
-
inp.focus();
|
62 |
-
|
63 |
-
if (options.value) {
|
64 |
-
inp.value = options.value;
|
65 |
-
if (options.selectValueOnOpen !== false) {
|
66 |
-
inp.select();
|
67 |
-
}
|
68 |
-
}
|
69 |
-
|
70 |
-
if (options.onInput)
|
71 |
-
CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});
|
72 |
-
if (options.onKeyUp)
|
73 |
-
CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
|
74 |
-
|
75 |
-
CodeMirror.on(inp, "keydown", function(e) {
|
76 |
-
if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }
|
77 |
-
if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {
|
78 |
-
inp.blur();
|
79 |
-
CodeMirror.e_stop(e);
|
80 |
-
close();
|
81 |
-
}
|
82 |
-
if (e.keyCode == 13) callback(inp.value, e);
|
83 |
-
});
|
84 |
-
|
85 |
-
if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close);
|
86 |
-
} else if (button = dialog.getElementsByTagName("button")[0]) {
|
87 |
-
CodeMirror.on(button, "click", function() {
|
88 |
-
close();
|
89 |
-
me.focus();
|
90 |
-
});
|
91 |
-
|
92 |
-
if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close);
|
93 |
-
|
94 |
-
button.focus();
|
95 |
-
}
|
96 |
-
return close;
|
97 |
-
});
|
98 |
-
|
99 |
-
CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
|
100 |
-
closeNotification(this, null);
|
101 |
-
var dialog = dialogDiv(this, template, options && options.bottom);
|
102 |
-
var buttons = dialog.getElementsByTagName("button");
|
103 |
-
var closed = false, me = this, blurring = 1;
|
104 |
-
function close() {
|
105 |
-
if (closed) return;
|
106 |
-
closed = true;
|
107 |
-
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
|
108 |
-
dialog.parentNode.removeChild(dialog);
|
109 |
-
me.focus();
|
110 |
-
}
|
111 |
-
buttons[0].focus();
|
112 |
-
for (var i = 0; i < buttons.length; ++i) {
|
113 |
-
var b = buttons[i];
|
114 |
-
(function(callback) {
|
115 |
-
CodeMirror.on(b, "click", function(e) {
|
116 |
-
CodeMirror.e_preventDefault(e);
|
117 |
-
close();
|
118 |
-
if (callback) callback(me);
|
119 |
-
});
|
120 |
-
})(callbacks[i]);
|
121 |
-
CodeMirror.on(b, "blur", function() {
|
122 |
-
--blurring;
|
123 |
-
setTimeout(function() { if (blurring <= 0) close(); }, 200);
|
124 |
-
});
|
125 |
-
CodeMirror.on(b, "focus", function() { ++blurring; });
|
126 |
-
}
|
127 |
-
});
|
128 |
-
|
129 |
-
/*
|
130 |
-
* openNotification
|
131 |
-
* Opens a notification, that can be closed with an optional timer
|
132 |
-
* (default 5000ms timer) and always closes on click.
|
133 |
-
*
|
134 |
-
* If a notification is opened while another is opened, it will close the
|
135 |
-
* currently opened one and open the new one immediately.
|
136 |
-
*/
|
137 |
-
CodeMirror.defineExtension("openNotification", function(template, options) {
|
138 |
-
closeNotification(this, close);
|
139 |
-
var dialog = dialogDiv(this, template, options && options.bottom);
|
140 |
-
var closed = false, doneTimer;
|
141 |
-
var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000;
|
142 |
-
|
143 |
-
function close() {
|
144 |
-
if (closed) return;
|
145 |
-
closed = true;
|
146 |
-
clearTimeout(doneTimer);
|
147 |
-
CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
|
148 |
-
dialog.parentNode.removeChild(dialog);
|
149 |
-
}
|
150 |
-
|
151 |
-
CodeMirror.on(dialog, 'click', function(e) {
|
152 |
-
CodeMirror.e_preventDefault(e);
|
153 |
-
close();
|
154 |
-
});
|
155 |
-
|
156 |
-
if (duration)
|
157 |
-
doneTimer = setTimeout(close, duration);
|
158 |
-
|
159 |
-
return close;
|
160 |
-
});
|
161 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/display/autorefresh.js
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"))
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod)
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror)
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict"
|
13 |
-
|
14 |
-
CodeMirror.defineOption("autoRefresh", false, function(cm, val) {
|
15 |
-
if (cm.state.autoRefresh) {
|
16 |
-
stopListening(cm, cm.state.autoRefresh)
|
17 |
-
cm.state.autoRefresh = null
|
18 |
-
}
|
19 |
-
if (val && cm.display.wrapper.offsetHeight == 0)
|
20 |
-
startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250})
|
21 |
-
})
|
22 |
-
|
23 |
-
function startListening(cm, state) {
|
24 |
-
function check() {
|
25 |
-
if (cm.display.wrapper.offsetHeight) {
|
26 |
-
stopListening(cm, state)
|
27 |
-
if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight)
|
28 |
-
cm.refresh()
|
29 |
-
} else {
|
30 |
-
state.timeout = setTimeout(check, state.delay)
|
31 |
-
}
|
32 |
-
}
|
33 |
-
state.timeout = setTimeout(check, state.delay)
|
34 |
-
state.hurry = function() {
|
35 |
-
clearTimeout(state.timeout)
|
36 |
-
state.timeout = setTimeout(check, 50)
|
37 |
-
}
|
38 |
-
CodeMirror.on(window, "mouseup", state.hurry)
|
39 |
-
CodeMirror.on(window, "keyup", state.hurry)
|
40 |
-
}
|
41 |
-
|
42 |
-
function stopListening(_cm, state) {
|
43 |
-
clearTimeout(state.timeout)
|
44 |
-
CodeMirror.off(window, "mouseup", state.hurry)
|
45 |
-
CodeMirror.off(window, "keyup", state.hurry)
|
46 |
-
}
|
47 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/display/fullscreen.css
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
.CodeMirror-fullscreen {
|
2 |
-
position: fixed;
|
3 |
-
top: 0; left: 0; right: 0; bottom: 0;
|
4 |
-
height: auto;
|
5 |
-
z-index: 9;
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/display/fullscreen.js
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineOption("fullScreen", false, function(cm, val, old) {
|
15 |
-
if (old == CodeMirror.Init) old = false;
|
16 |
-
if (!old == !val) return;
|
17 |
-
if (val) setFullscreen(cm);
|
18 |
-
else setNormal(cm);
|
19 |
-
});
|
20 |
-
|
21 |
-
function setFullscreen(cm) {
|
22 |
-
var wrap = cm.getWrapperElement();
|
23 |
-
cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
|
24 |
-
width: wrap.style.width, height: wrap.style.height};
|
25 |
-
wrap.style.width = "";
|
26 |
-
wrap.style.height = "auto";
|
27 |
-
wrap.className += " CodeMirror-fullscreen";
|
28 |
-
document.documentElement.style.overflow = "hidden";
|
29 |
-
cm.refresh();
|
30 |
-
}
|
31 |
-
|
32 |
-
function setNormal(cm) {
|
33 |
-
var wrap = cm.getWrapperElement();
|
34 |
-
wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
|
35 |
-
document.documentElement.style.overflow = "";
|
36 |
-
var info = cm.state.fullScreenRestore;
|
37 |
-
wrap.style.width = info.width; wrap.style.height = info.height;
|
38 |
-
window.scrollTo(info.scrollLeft, info.scrollTop);
|
39 |
-
cm.refresh();
|
40 |
-
}
|
41 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/display/panel.js
DELETED
@@ -1,127 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
CodeMirror.defineExtension("addPanel", function(node, options) {
|
13 |
-
options = options || {};
|
14 |
-
|
15 |
-
if (!this.state.panels) initPanels(this);
|
16 |
-
|
17 |
-
var info = this.state.panels;
|
18 |
-
var wrapper = info.wrapper;
|
19 |
-
var cmWrapper = this.getWrapperElement();
|
20 |
-
var replace = options.replace instanceof Panel && !options.replace.cleared;
|
21 |
-
|
22 |
-
if (options.after instanceof Panel && !options.after.cleared) {
|
23 |
-
wrapper.insertBefore(node, options.before.node.nextSibling);
|
24 |
-
} else if (options.before instanceof Panel && !options.before.cleared) {
|
25 |
-
wrapper.insertBefore(node, options.before.node);
|
26 |
-
} else if (replace) {
|
27 |
-
wrapper.insertBefore(node, options.replace.node);
|
28 |
-
info.panels++;
|
29 |
-
options.replace.clear();
|
30 |
-
} else if (options.position == "bottom") {
|
31 |
-
wrapper.appendChild(node);
|
32 |
-
} else if (options.position == "before-bottom") {
|
33 |
-
wrapper.insertBefore(node, cmWrapper.nextSibling);
|
34 |
-
} else if (options.position == "after-top") {
|
35 |
-
wrapper.insertBefore(node, cmWrapper);
|
36 |
-
} else {
|
37 |
-
wrapper.insertBefore(node, wrapper.firstChild);
|
38 |
-
}
|
39 |
-
|
40 |
-
var height = (options && options.height) || node.offsetHeight;
|
41 |
-
this._setSize(null, info.heightLeft -= height);
|
42 |
-
if (!replace) {
|
43 |
-
info.panels++;
|
44 |
-
}
|
45 |
-
if (options.stable && isAtTop(this, node))
|
46 |
-
this.scrollTo(null, this.getScrollInfo().top + height)
|
47 |
-
|
48 |
-
return new Panel(this, node, options, height);
|
49 |
-
});
|
50 |
-
|
51 |
-
function Panel(cm, node, options, height) {
|
52 |
-
this.cm = cm;
|
53 |
-
this.node = node;
|
54 |
-
this.options = options;
|
55 |
-
this.height = height;
|
56 |
-
this.cleared = false;
|
57 |
-
}
|
58 |
-
|
59 |
-
Panel.prototype.clear = function() {
|
60 |
-
if (this.cleared) return;
|
61 |
-
this.cleared = true;
|
62 |
-
var info = this.cm.state.panels;
|
63 |
-
this.cm._setSize(null, info.heightLeft += this.height);
|
64 |
-
if (this.options.stable && isAtTop(this.cm, this.node))
|
65 |
-
this.cm.scrollTo(null, this.cm.getScrollInfo().top - this.height)
|
66 |
-
info.wrapper.removeChild(this.node);
|
67 |
-
if (--info.panels == 0) removePanels(this.cm);
|
68 |
-
};
|
69 |
-
|
70 |
-
Panel.prototype.changed = function(height) {
|
71 |
-
var newHeight = height == null ? this.node.offsetHeight : height;
|
72 |
-
var info = this.cm.state.panels;
|
73 |
-
this.cm._setSize(null, info.heightLeft -= (newHeight - this.height));
|
74 |
-
this.height = newHeight;
|
75 |
-
};
|
76 |
-
|
77 |
-
function initPanels(cm) {
|
78 |
-
var wrap = cm.getWrapperElement();
|
79 |
-
var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle;
|
80 |
-
var height = parseInt(style.height);
|
81 |
-
var info = cm.state.panels = {
|
82 |
-
setHeight: wrap.style.height,
|
83 |
-
heightLeft: height,
|
84 |
-
panels: 0,
|
85 |
-
wrapper: document.createElement("div")
|
86 |
-
};
|
87 |
-
wrap.parentNode.insertBefore(info.wrapper, wrap);
|
88 |
-
var hasFocus = cm.hasFocus();
|
89 |
-
info.wrapper.appendChild(wrap);
|
90 |
-
if (hasFocus) cm.focus();
|
91 |
-
|
92 |
-
cm._setSize = cm.setSize;
|
93 |
-
if (height != null) cm.setSize = function(width, newHeight) {
|
94 |
-
if (newHeight == null) return this._setSize(width, newHeight);
|
95 |
-
info.setHeight = newHeight;
|
96 |
-
if (typeof newHeight != "number") {
|
97 |
-
var px = /^(\d+\.?\d*)px$/.exec(newHeight);
|
98 |
-
if (px) {
|
99 |
-
newHeight = Number(px[1]);
|
100 |
-
} else {
|
101 |
-
info.wrapper.style.height = newHeight;
|
102 |
-
newHeight = info.wrapper.offsetHeight;
|
103 |
-
info.wrapper.style.height = "";
|
104 |
-
}
|
105 |
-
}
|
106 |
-
cm._setSize(width, info.heightLeft += (newHeight - height));
|
107 |
-
height = newHeight;
|
108 |
-
};
|
109 |
-
}
|
110 |
-
|
111 |
-
function removePanels(cm) {
|
112 |
-
var info = cm.state.panels;
|
113 |
-
cm.state.panels = null;
|
114 |
-
|
115 |
-
var wrap = cm.getWrapperElement();
|
116 |
-
info.wrapper.parentNode.replaceChild(wrap, info.wrapper);
|
117 |
-
wrap.style.height = info.setHeight;
|
118 |
-
cm.setSize = cm._setSize;
|
119 |
-
cm.setSize();
|
120 |
-
}
|
121 |
-
|
122 |
-
function isAtTop(cm, dom) {
|
123 |
-
for (var sibling = dom.nextSibling; sibling; sibling = sibling.nextSibling)
|
124 |
-
if (sibling == cm.getWrapperElement()) return true
|
125 |
-
return false
|
126 |
-
}
|
127 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/display/placeholder.js
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
|
13 |
-
var prev = old && old != CodeMirror.Init;
|
14 |
-
if (val && !prev) {
|
15 |
-
cm.on("blur", onBlur);
|
16 |
-
cm.on("change", onChange);
|
17 |
-
cm.on("swapDoc", onChange);
|
18 |
-
onChange(cm);
|
19 |
-
} else if (!val && prev) {
|
20 |
-
cm.off("blur", onBlur);
|
21 |
-
cm.off("change", onChange);
|
22 |
-
cm.off("swapDoc", onChange);
|
23 |
-
clearPlaceholder(cm);
|
24 |
-
var wrapper = cm.getWrapperElement();
|
25 |
-
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
|
26 |
-
}
|
27 |
-
|
28 |
-
if (val && !cm.hasFocus()) onBlur(cm);
|
29 |
-
});
|
30 |
-
|
31 |
-
function clearPlaceholder(cm) {
|
32 |
-
if (cm.state.placeholder) {
|
33 |
-
cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
|
34 |
-
cm.state.placeholder = null;
|
35 |
-
}
|
36 |
-
}
|
37 |
-
function setPlaceholder(cm) {
|
38 |
-
clearPlaceholder(cm);
|
39 |
-
var elt = cm.state.placeholder = document.createElement("pre");
|
40 |
-
elt.style.cssText = "height: 0; overflow: visible";
|
41 |
-
elt.style.direction = cm.getOption("direction");
|
42 |
-
elt.className = "CodeMirror-placeholder";
|
43 |
-
var placeHolder = cm.getOption("placeholder")
|
44 |
-
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
|
45 |
-
elt.appendChild(placeHolder)
|
46 |
-
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
|
47 |
-
}
|
48 |
-
|
49 |
-
function onBlur(cm) {
|
50 |
-
if (isEmpty(cm)) setPlaceholder(cm);
|
51 |
-
}
|
52 |
-
function onChange(cm) {
|
53 |
-
var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
|
54 |
-
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
|
55 |
-
|
56 |
-
if (empty) setPlaceholder(cm);
|
57 |
-
else clearPlaceholder(cm);
|
58 |
-
}
|
59 |
-
|
60 |
-
function isEmpty(cm) {
|
61 |
-
return (cm.lineCount() === 1) && (cm.getLine(0) === "");
|
62 |
-
}
|
63 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/display/rulers.js
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineOption("rulers", false, function(cm, val) {
|
15 |
-
if (cm.state.rulerDiv) {
|
16 |
-
cm.state.rulerDiv.parentElement.removeChild(cm.state.rulerDiv)
|
17 |
-
cm.state.rulerDiv = null
|
18 |
-
cm.off("refresh", drawRulers)
|
19 |
-
}
|
20 |
-
if (val && val.length) {
|
21 |
-
cm.state.rulerDiv = cm.display.lineSpace.parentElement.insertBefore(document.createElement("div"), cm.display.lineSpace)
|
22 |
-
cm.state.rulerDiv.className = "CodeMirror-rulers"
|
23 |
-
drawRulers(cm)
|
24 |
-
cm.on("refresh", drawRulers)
|
25 |
-
}
|
26 |
-
});
|
27 |
-
|
28 |
-
function drawRulers(cm) {
|
29 |
-
cm.state.rulerDiv.textContent = ""
|
30 |
-
var val = cm.getOption("rulers");
|
31 |
-
var cw = cm.defaultCharWidth();
|
32 |
-
var left = cm.charCoords(CodeMirror.Pos(cm.firstLine(), 0), "div").left;
|
33 |
-
cm.state.rulerDiv.style.minHeight = (cm.display.scroller.offsetHeight + 30) + "px";
|
34 |
-
for (var i = 0; i < val.length; i++) {
|
35 |
-
var elt = document.createElement("div");
|
36 |
-
elt.className = "CodeMirror-ruler";
|
37 |
-
var col, conf = val[i];
|
38 |
-
if (typeof conf == "number") {
|
39 |
-
col = conf;
|
40 |
-
} else {
|
41 |
-
col = conf.column;
|
42 |
-
if (conf.className) elt.className += " " + conf.className;
|
43 |
-
if (conf.color) elt.style.borderColor = conf.color;
|
44 |
-
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
|
45 |
-
if (conf.width) elt.style.borderLeftWidth = conf.width;
|
46 |
-
}
|
47 |
-
elt.style.left = (left + col * cw) + "px";
|
48 |
-
cm.state.rulerDiv.appendChild(elt)
|
49 |
-
}
|
50 |
-
}
|
51 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/edit/closebrackets.js
DELETED
@@ -1,187 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
var defaults = {
|
13 |
-
pairs: "()[]{}''\"\"",
|
14 |
-
triples: "",
|
15 |
-
explode: "[]{}"
|
16 |
-
};
|
17 |
-
|
18 |
-
var Pos = CodeMirror.Pos;
|
19 |
-
|
20 |
-
CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
|
21 |
-
if (old && old != CodeMirror.Init) {
|
22 |
-
cm.removeKeyMap(keyMap);
|
23 |
-
cm.state.closeBrackets = null;
|
24 |
-
}
|
25 |
-
if (val) {
|
26 |
-
ensureBound(getOption(val, "pairs"))
|
27 |
-
cm.state.closeBrackets = val;
|
28 |
-
cm.addKeyMap(keyMap);
|
29 |
-
}
|
30 |
-
});
|
31 |
-
|
32 |
-
function getOption(conf, name) {
|
33 |
-
if (name == "pairs" && typeof conf == "string") return conf;
|
34 |
-
if (typeof conf == "object" && conf[name] != null) return conf[name];
|
35 |
-
return defaults[name];
|
36 |
-
}
|
37 |
-
|
38 |
-
var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
|
39 |
-
function ensureBound(chars) {
|
40 |
-
for (var i = 0; i < chars.length; i++) {
|
41 |
-
var ch = chars.charAt(i), key = "'" + ch + "'"
|
42 |
-
if (!keyMap[key]) keyMap[key] = handler(ch)
|
43 |
-
}
|
44 |
-
}
|
45 |
-
ensureBound(defaults.pairs + "`")
|
46 |
-
|
47 |
-
function handler(ch) {
|
48 |
-
return function(cm) { return handleChar(cm, ch); };
|
49 |
-
}
|
50 |
-
|
51 |
-
function getConfig(cm) {
|
52 |
-
var deflt = cm.state.closeBrackets;
|
53 |
-
if (!deflt || deflt.override) return deflt;
|
54 |
-
var mode = cm.getModeAt(cm.getCursor());
|
55 |
-
return mode.closeBrackets || deflt;
|
56 |
-
}
|
57 |
-
|
58 |
-
function handleBackspace(cm) {
|
59 |
-
var conf = getConfig(cm);
|
60 |
-
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
61 |
-
|
62 |
-
var pairs = getOption(conf, "pairs");
|
63 |
-
var ranges = cm.listSelections();
|
64 |
-
for (var i = 0; i < ranges.length; i++) {
|
65 |
-
if (!ranges[i].empty()) return CodeMirror.Pass;
|
66 |
-
var around = charsAround(cm, ranges[i].head);
|
67 |
-
if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
68 |
-
}
|
69 |
-
for (var i = ranges.length - 1; i >= 0; i--) {
|
70 |
-
var cur = ranges[i].head;
|
71 |
-
cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete");
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
function handleEnter(cm) {
|
76 |
-
var conf = getConfig(cm);
|
77 |
-
var explode = conf && getOption(conf, "explode");
|
78 |
-
if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
|
79 |
-
|
80 |
-
var ranges = cm.listSelections();
|
81 |
-
for (var i = 0; i < ranges.length; i++) {
|
82 |
-
if (!ranges[i].empty()) return CodeMirror.Pass;
|
83 |
-
var around = charsAround(cm, ranges[i].head);
|
84 |
-
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
85 |
-
}
|
86 |
-
cm.operation(function() {
|
87 |
-
var linesep = cm.lineSeparator() || "\n";
|
88 |
-
cm.replaceSelection(linesep + linesep, null);
|
89 |
-
cm.execCommand("goCharLeft");
|
90 |
-
ranges = cm.listSelections();
|
91 |
-
for (var i = 0; i < ranges.length; i++) {
|
92 |
-
var line = ranges[i].head.line;
|
93 |
-
cm.indentLine(line, null, true);
|
94 |
-
cm.indentLine(line + 1, null, true);
|
95 |
-
}
|
96 |
-
});
|
97 |
-
}
|
98 |
-
|
99 |
-
function contractSelection(sel) {
|
100 |
-
var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
|
101 |
-
return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
|
102 |
-
head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
|
103 |
-
}
|
104 |
-
|
105 |
-
function handleChar(cm, ch) {
|
106 |
-
var conf = getConfig(cm);
|
107 |
-
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
108 |
-
|
109 |
-
var pairs = getOption(conf, "pairs");
|
110 |
-
var pos = pairs.indexOf(ch);
|
111 |
-
if (pos == -1) return CodeMirror.Pass;
|
112 |
-
var triples = getOption(conf, "triples");
|
113 |
-
|
114 |
-
var identical = pairs.charAt(pos + 1) == ch;
|
115 |
-
var ranges = cm.listSelections();
|
116 |
-
var opening = pos % 2 == 0;
|
117 |
-
|
118 |
-
var type;
|
119 |
-
for (var i = 0; i < ranges.length; i++) {
|
120 |
-
var range = ranges[i], cur = range.head, curType;
|
121 |
-
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
|
122 |
-
if (opening && !range.empty()) {
|
123 |
-
curType = "surround";
|
124 |
-
} else if ((identical || !opening) && next == ch) {
|
125 |
-
if (identical && stringStartsAfter(cm, cur))
|
126 |
-
curType = "both";
|
127 |
-
else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
|
128 |
-
curType = "skipThree";
|
129 |
-
else
|
130 |
-
curType = "skip";
|
131 |
-
} else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
|
132 |
-
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch) {
|
133 |
-
if (cur.ch > 2 && /\bstring/.test(cm.getTokenTypeAt(Pos(cur.line, cur.ch - 2)))) return CodeMirror.Pass;
|
134 |
-
curType = "addFour";
|
135 |
-
} else if (identical) {
|
136 |
-
var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
|
137 |
-
if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
|
138 |
-
else return CodeMirror.Pass;
|
139 |
-
} else if (opening) {
|
140 |
-
curType = "both";
|
141 |
-
} else {
|
142 |
-
return CodeMirror.Pass;
|
143 |
-
}
|
144 |
-
if (!type) type = curType;
|
145 |
-
else if (type != curType) return CodeMirror.Pass;
|
146 |
-
}
|
147 |
-
|
148 |
-
var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
|
149 |
-
var right = pos % 2 ? ch : pairs.charAt(pos + 1);
|
150 |
-
cm.operation(function() {
|
151 |
-
if (type == "skip") {
|
152 |
-
cm.execCommand("goCharRight");
|
153 |
-
} else if (type == "skipThree") {
|
154 |
-
for (var i = 0; i < 3; i++)
|
155 |
-
cm.execCommand("goCharRight");
|
156 |
-
} else if (type == "surround") {
|
157 |
-
var sels = cm.getSelections();
|
158 |
-
for (var i = 0; i < sels.length; i++)
|
159 |
-
sels[i] = left + sels[i] + right;
|
160 |
-
cm.replaceSelections(sels, "around");
|
161 |
-
sels = cm.listSelections().slice();
|
162 |
-
for (var i = 0; i < sels.length; i++)
|
163 |
-
sels[i] = contractSelection(sels[i]);
|
164 |
-
cm.setSelections(sels);
|
165 |
-
} else if (type == "both") {
|
166 |
-
cm.replaceSelection(left + right, null);
|
167 |
-
cm.triggerElectric(left + right);
|
168 |
-
cm.execCommand("goCharLeft");
|
169 |
-
} else if (type == "addFour") {
|
170 |
-
cm.replaceSelection(left + left + left + left, "before");
|
171 |
-
cm.execCommand("goCharRight");
|
172 |
-
}
|
173 |
-
});
|
174 |
-
}
|
175 |
-
|
176 |
-
function charsAround(cm, pos) {
|
177 |
-
var str = cm.getRange(Pos(pos.line, pos.ch - 1),
|
178 |
-
Pos(pos.line, pos.ch + 1));
|
179 |
-
return str.length == 2 ? str : null;
|
180 |
-
}
|
181 |
-
|
182 |
-
function stringStartsAfter(cm, pos) {
|
183 |
-
var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1))
|
184 |
-
return /\bstring/.test(token.type) && token.start == pos.ch &&
|
185 |
-
(pos.ch == 0 || !/\bstring/.test(cm.getTokenTypeAt(pos)))
|
186 |
-
}
|
187 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/edit/closetag.js
DELETED
@@ -1,175 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Tag-closer extension for CodeMirror.
|
6 |
-
*
|
7 |
-
* This extension adds an "autoCloseTags" option that can be set to
|
8 |
-
* either true to get the default behavior, or an object to further
|
9 |
-
* configure its behavior.
|
10 |
-
*
|
11 |
-
* These are supported options:
|
12 |
-
*
|
13 |
-
* `whenClosing` (default true)
|
14 |
-
* Whether to autoclose when the '/' of a closing tag is typed.
|
15 |
-
* `whenOpening` (default true)
|
16 |
-
* Whether to autoclose the tag when the final '>' of an opening
|
17 |
-
* tag is typed.
|
18 |
-
* `dontCloseTags` (default is empty tags for HTML, none for XML)
|
19 |
-
* An array of tag names that should not be autoclosed.
|
20 |
-
* `indentTags` (default is block tags for HTML, none for XML)
|
21 |
-
* An array of tag names that should, when opened, cause a
|
22 |
-
* blank line to be added inside the tag, and the blank line and
|
23 |
-
* closing line to be indented.
|
24 |
-
*
|
25 |
-
* See demos/closetag.html for a usage example.
|
26 |
-
*/
|
27 |
-
|
28 |
-
(function(mod) {
|
29 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
30 |
-
mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
|
31 |
-
else if (typeof define == "function" && define.amd) // AMD
|
32 |
-
define(["../../lib/codemirror", "../fold/xml-fold"], mod);
|
33 |
-
else // Plain browser env
|
34 |
-
mod(CodeMirror);
|
35 |
-
})(function(CodeMirror) {
|
36 |
-
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
|
37 |
-
if (old != CodeMirror.Init && old)
|
38 |
-
cm.removeKeyMap("autoCloseTags");
|
39 |
-
if (!val) return;
|
40 |
-
var map = {name: "autoCloseTags"};
|
41 |
-
if (typeof val != "object" || val.whenClosing)
|
42 |
-
map["'/'"] = function(cm) { return autoCloseSlash(cm); };
|
43 |
-
if (typeof val != "object" || val.whenOpening)
|
44 |
-
map["'>'"] = function(cm) { return autoCloseGT(cm); };
|
45 |
-
cm.addKeyMap(map);
|
46 |
-
});
|
47 |
-
|
48 |
-
var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
|
49 |
-
"source", "track", "wbr"];
|
50 |
-
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
|
51 |
-
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
|
52 |
-
|
53 |
-
function autoCloseGT(cm) {
|
54 |
-
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
55 |
-
var ranges = cm.listSelections(), replacements = [];
|
56 |
-
var opt = cm.getOption("autoCloseTags");
|
57 |
-
for (var i = 0; i < ranges.length; i++) {
|
58 |
-
if (!ranges[i].empty()) return CodeMirror.Pass;
|
59 |
-
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
|
60 |
-
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
61 |
-
if (inner.mode.name != "xml" || !state.tagName) return CodeMirror.Pass;
|
62 |
-
|
63 |
-
var html = inner.mode.configuration == "html";
|
64 |
-
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
|
65 |
-
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
|
66 |
-
|
67 |
-
var tagName = state.tagName;
|
68 |
-
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
|
69 |
-
var lowerTagName = tagName.toLowerCase();
|
70 |
-
// Don't process the '>' at the end of an end-tag or self-closing tag
|
71 |
-
if (!tagName ||
|
72 |
-
tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
|
73 |
-
tok.type == "tag" && state.type == "closeTag" ||
|
74 |
-
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
|
75 |
-
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
|
76 |
-
closingTagExists(cm, tagName, pos, state, true))
|
77 |
-
return CodeMirror.Pass;
|
78 |
-
|
79 |
-
var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
|
80 |
-
replacements[i] = {indent: indent,
|
81 |
-
text: ">" + (indent ? "\n\n" : "") + "</" + tagName + ">",
|
82 |
-
newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};
|
83 |
-
}
|
84 |
-
|
85 |
-
var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnAutoClose);
|
86 |
-
for (var i = ranges.length - 1; i >= 0; i--) {
|
87 |
-
var info = replacements[i];
|
88 |
-
cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
|
89 |
-
var sel = cm.listSelections().slice(0);
|
90 |
-
sel[i] = {head: info.newPos, anchor: info.newPos};
|
91 |
-
cm.setSelections(sel);
|
92 |
-
if (!dontIndentOnAutoClose && info.indent) {
|
93 |
-
cm.indentLine(info.newPos.line, null, true);
|
94 |
-
cm.indentLine(info.newPos.line + 1, null, true);
|
95 |
-
}
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
function autoCloseCurrent(cm, typingSlash) {
|
100 |
-
var ranges = cm.listSelections(), replacements = [];
|
101 |
-
var head = typingSlash ? "/" : "</";
|
102 |
-
var opt = cm.getOption("autoCloseTags");
|
103 |
-
var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnSlash);
|
104 |
-
for (var i = 0; i < ranges.length; i++) {
|
105 |
-
if (!ranges[i].empty()) return CodeMirror.Pass;
|
106 |
-
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
|
107 |
-
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
108 |
-
if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" ||
|
109 |
-
tok.start != pos.ch - 1))
|
110 |
-
return CodeMirror.Pass;
|
111 |
-
// Kludge to get around the fact that we are not in XML mode
|
112 |
-
// when completing in JS/CSS snippet in htmlmixed mode. Does not
|
113 |
-
// work for other XML embedded languages (there is no general
|
114 |
-
// way to go from a mixed mode to its current XML state).
|
115 |
-
var replacement;
|
116 |
-
if (inner.mode.name != "xml") {
|
117 |
-
if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript")
|
118 |
-
replacement = head + "script";
|
119 |
-
else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css")
|
120 |
-
replacement = head + "style";
|
121 |
-
else
|
122 |
-
return CodeMirror.Pass;
|
123 |
-
} else {
|
124 |
-
if (!state.context || !state.context.tagName ||
|
125 |
-
closingTagExists(cm, state.context.tagName, pos, state))
|
126 |
-
return CodeMirror.Pass;
|
127 |
-
replacement = head + state.context.tagName;
|
128 |
-
}
|
129 |
-
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
|
130 |
-
replacements[i] = replacement;
|
131 |
-
}
|
132 |
-
cm.replaceSelections(replacements);
|
133 |
-
ranges = cm.listSelections();
|
134 |
-
if (!dontIndentOnAutoClose) {
|
135 |
-
for (var i = 0; i < ranges.length; i++)
|
136 |
-
if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)
|
137 |
-
cm.indentLine(ranges[i].head.line);
|
138 |
-
}
|
139 |
-
}
|
140 |
-
|
141 |
-
function autoCloseSlash(cm) {
|
142 |
-
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
143 |
-
return autoCloseCurrent(cm, true);
|
144 |
-
}
|
145 |
-
|
146 |
-
CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };
|
147 |
-
|
148 |
-
function indexOf(collection, elt) {
|
149 |
-
if (collection.indexOf) return collection.indexOf(elt);
|
150 |
-
for (var i = 0, e = collection.length; i < e; ++i)
|
151 |
-
if (collection[i] == elt) return i;
|
152 |
-
return -1;
|
153 |
-
}
|
154 |
-
|
155 |
-
// If xml-fold is loaded, we use its functionality to try and verify
|
156 |
-
// whether a given tag is actually unclosed.
|
157 |
-
function closingTagExists(cm, tagName, pos, state, newTag) {
|
158 |
-
if (!CodeMirror.scanForClosingTag) return false;
|
159 |
-
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
|
160 |
-
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
161 |
-
if (!nextClose || nextClose.tag != tagName) return false;
|
162 |
-
var cx = state.context;
|
163 |
-
// If the immediate wrapping context contains onCx instances of
|
164 |
-
// the same tag, a closing tag only exists if there are at least
|
165 |
-
// that many closing tags of that type following.
|
166 |
-
for (var onCx = newTag ? 1 : 0; cx && cx.tagName == tagName; cx = cx.prev) ++onCx;
|
167 |
-
pos = nextClose.to;
|
168 |
-
for (var i = 1; i < onCx; i++) {
|
169 |
-
var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
|
170 |
-
if (!next || next.tag != tagName) return false;
|
171 |
-
pos = next.to;
|
172 |
-
}
|
173 |
-
return true;
|
174 |
-
}
|
175 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/edit/continuelist.js
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,
|
15 |
-
emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,
|
16 |
-
unorderedListRE = /[*+-]\s/;
|
17 |
-
|
18 |
-
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
|
19 |
-
if (cm.getOption("disableInput")) return CodeMirror.Pass;
|
20 |
-
var ranges = cm.listSelections(), replacements = [];
|
21 |
-
for (var i = 0; i < ranges.length; i++) {
|
22 |
-
var pos = ranges[i].head;
|
23 |
-
|
24 |
-
// If we're not in Markdown mode, fall back to normal newlineAndIndent
|
25 |
-
var eolState = cm.getStateAfter(pos.line);
|
26 |
-
var inner = cm.getMode().innerMode(eolState);
|
27 |
-
if (inner.mode.name !== "markdown") {
|
28 |
-
cm.execCommand("newlineAndIndent");
|
29 |
-
return;
|
30 |
-
} else {
|
31 |
-
eolState = inner.state;
|
32 |
-
}
|
33 |
-
|
34 |
-
var inList = eolState.list !== false;
|
35 |
-
var inQuote = eolState.quote !== 0;
|
36 |
-
|
37 |
-
var line = cm.getLine(pos.line), match = listRE.exec(line);
|
38 |
-
var cursorBeforeBullet = /^\s*$/.test(line.slice(0, pos.ch));
|
39 |
-
if (!ranges[i].empty() || (!inList && !inQuote) || !match || cursorBeforeBullet) {
|
40 |
-
cm.execCommand("newlineAndIndent");
|
41 |
-
return;
|
42 |
-
}
|
43 |
-
if (emptyListRE.test(line)) {
|
44 |
-
if (!/>\s*$/.test(line)) cm.replaceRange("", {
|
45 |
-
line: pos.line, ch: 0
|
46 |
-
}, {
|
47 |
-
line: pos.line, ch: pos.ch + 1
|
48 |
-
});
|
49 |
-
replacements[i] = "\n";
|
50 |
-
} else {
|
51 |
-
var indent = match[1], after = match[5];
|
52 |
-
var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0);
|
53 |
-
var bullet = numbered ? (parseInt(match[3], 10) + 1) + match[4] : match[2].replace("x", " ");
|
54 |
-
replacements[i] = "\n" + indent + bullet + after;
|
55 |
-
|
56 |
-
if (numbered) incrementRemainingMarkdownListNumbers(cm, pos);
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
cm.replaceSelections(replacements);
|
61 |
-
};
|
62 |
-
|
63 |
-
// Auto-updating Markdown list numbers when a new item is added to the
|
64 |
-
// middle of a list
|
65 |
-
function incrementRemainingMarkdownListNumbers(cm, pos) {
|
66 |
-
var startLine = pos.line, lookAhead = 0, skipCount = 0;
|
67 |
-
var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];
|
68 |
-
|
69 |
-
do {
|
70 |
-
lookAhead += 1;
|
71 |
-
var nextLineNumber = startLine + lookAhead;
|
72 |
-
var nextLine = cm.getLine(nextLineNumber), nextItem = listRE.exec(nextLine);
|
73 |
-
|
74 |
-
if (nextItem) {
|
75 |
-
var nextIndent = nextItem[1];
|
76 |
-
var newNumber = (parseInt(startItem[3], 10) + lookAhead - skipCount);
|
77 |
-
var nextNumber = (parseInt(nextItem[3], 10)), itemNumber = nextNumber;
|
78 |
-
|
79 |
-
if (startIndent === nextIndent && !isNaN(nextNumber)) {
|
80 |
-
if (newNumber === nextNumber) itemNumber = nextNumber + 1;
|
81 |
-
if (newNumber > nextNumber) itemNumber = newNumber + 1;
|
82 |
-
cm.replaceRange(
|
83 |
-
nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
|
84 |
-
{
|
85 |
-
line: nextLineNumber, ch: 0
|
86 |
-
}, {
|
87 |
-
line: nextLineNumber, ch: nextLine.length
|
88 |
-
});
|
89 |
-
} else {
|
90 |
-
if (startIndent.length > nextIndent.length) return;
|
91 |
-
// This doesn't run if the next line immediatley indents, as it is
|
92 |
-
// not clear of the users intention (new indented item or same level)
|
93 |
-
if ((startIndent.length < nextIndent.length) && (lookAhead === 1)) return;
|
94 |
-
skipCount += 1;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
} while (nextItem);
|
98 |
-
}
|
99 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/edit/matchbrackets.js
DELETED
@@ -1,150 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
|
13 |
-
(document.documentMode == null || document.documentMode < 8);
|
14 |
-
|
15 |
-
var Pos = CodeMirror.Pos;
|
16 |
-
|
17 |
-
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<"};
|
18 |
-
|
19 |
-
function bracketRegex(config) {
|
20 |
-
return config && config.bracketRegex || /[(){}[\]]/
|
21 |
-
}
|
22 |
-
|
23 |
-
function findMatchingBracket(cm, where, config) {
|
24 |
-
var line = cm.getLineHandle(where.line), pos = where.ch - 1;
|
25 |
-
var afterCursor = config && config.afterCursor
|
26 |
-
if (afterCursor == null)
|
27 |
-
afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
|
28 |
-
var re = bracketRegex(config)
|
29 |
-
|
30 |
-
// A cursor is defined as between two characters, but in in vim command mode
|
31 |
-
// (i.e. not insert mode), the cursor is visually represented as a
|
32 |
-
// highlighted box on top of the 2nd character. Otherwise, we allow matches
|
33 |
-
// from before or after the cursor.
|
34 |
-
var match = (!afterCursor && pos >= 0 && re.test(line.text.charAt(pos)) && matching[line.text.charAt(pos)]) ||
|
35 |
-
re.test(line.text.charAt(pos + 1)) && matching[line.text.charAt(++pos)];
|
36 |
-
if (!match) return null;
|
37 |
-
var dir = match.charAt(1) == ">" ? 1 : -1;
|
38 |
-
if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
|
39 |
-
var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
|
40 |
-
|
41 |
-
var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
|
42 |
-
if (found == null) return null;
|
43 |
-
return {from: Pos(where.line, pos), to: found && found.pos,
|
44 |
-
match: found && found.ch == match.charAt(0), forward: dir > 0};
|
45 |
-
}
|
46 |
-
|
47 |
-
// bracketRegex is used to specify which type of bracket to scan
|
48 |
-
// should be a regexp, e.g. /[[\]]/
|
49 |
-
//
|
50 |
-
// Note: If "where" is on an open bracket, then this bracket is ignored.
|
51 |
-
//
|
52 |
-
// Returns false when no bracket was found, null when it reached
|
53 |
-
// maxScanLines and gave up
|
54 |
-
function scanForBracket(cm, where, dir, style, config) {
|
55 |
-
var maxScanLen = (config && config.maxScanLineLength) || 10000;
|
56 |
-
var maxScanLines = (config && config.maxScanLines) || 1000;
|
57 |
-
|
58 |
-
var stack = [];
|
59 |
-
var re = bracketRegex(config)
|
60 |
-
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
|
61 |
-
: Math.max(cm.firstLine() - 1, where.line - maxScanLines);
|
62 |
-
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
|
63 |
-
var line = cm.getLine(lineNo);
|
64 |
-
if (!line) continue;
|
65 |
-
var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
|
66 |
-
if (line.length > maxScanLen) continue;
|
67 |
-
if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
|
68 |
-
for (; pos != end; pos += dir) {
|
69 |
-
var ch = line.charAt(pos);
|
70 |
-
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
|
71 |
-
var match = matching[ch];
|
72 |
-
if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
|
73 |
-
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
|
74 |
-
else stack.pop();
|
75 |
-
}
|
76 |
-
}
|
77 |
-
}
|
78 |
-
return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
|
79 |
-
}
|
80 |
-
|
81 |
-
function matchBrackets(cm, autoclear, config) {
|
82 |
-
// Disable brace matching in long lines, since it'll cause hugely slow updates
|
83 |
-
var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
|
84 |
-
var marks = [], ranges = cm.listSelections();
|
85 |
-
for (var i = 0; i < ranges.length; i++) {
|
86 |
-
var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
|
87 |
-
if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
|
88 |
-
var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
89 |
-
marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
|
90 |
-
if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
|
91 |
-
marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
if (marks.length) {
|
96 |
-
// Kludge to work around the IE bug from issue #1193, where text
|
97 |
-
// input stops going to the textare whever this fires.
|
98 |
-
if (ie_lt8 && cm.state.focused) cm.focus();
|
99 |
-
|
100 |
-
var clear = function() {
|
101 |
-
cm.operation(function() {
|
102 |
-
for (var i = 0; i < marks.length; i++) marks[i].clear();
|
103 |
-
});
|
104 |
-
};
|
105 |
-
if (autoclear) setTimeout(clear, 800);
|
106 |
-
else return clear;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
function doMatchBrackets(cm) {
|
111 |
-
cm.operation(function() {
|
112 |
-
if (cm.state.matchBrackets.currentlyHighlighted) {
|
113 |
-
cm.state.matchBrackets.currentlyHighlighted();
|
114 |
-
cm.state.matchBrackets.currentlyHighlighted = null;
|
115 |
-
}
|
116 |
-
cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
|
117 |
-
});
|
118 |
-
}
|
119 |
-
|
120 |
-
CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
|
121 |
-
if (old && old != CodeMirror.Init) {
|
122 |
-
cm.off("cursorActivity", doMatchBrackets);
|
123 |
-
if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
|
124 |
-
cm.state.matchBrackets.currentlyHighlighted();
|
125 |
-
cm.state.matchBrackets.currentlyHighlighted = null;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
if (val) {
|
129 |
-
cm.state.matchBrackets = typeof val == "object" ? val : {};
|
130 |
-
cm.on("cursorActivity", doMatchBrackets);
|
131 |
-
}
|
132 |
-
});
|
133 |
-
|
134 |
-
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
|
135 |
-
CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
|
136 |
-
// Backwards-compatibility kludge
|
137 |
-
if (oldConfig || typeof config == "boolean") {
|
138 |
-
if (!oldConfig) {
|
139 |
-
config = config ? {strict: true} : null
|
140 |
-
} else {
|
141 |
-
oldConfig.strict = config
|
142 |
-
config = oldConfig
|
143 |
-
}
|
144 |
-
}
|
145 |
-
return findMatchingBracket(this, pos, config)
|
146 |
-
});
|
147 |
-
CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
|
148 |
-
return scanForBracket(this, pos, dir, style, config);
|
149 |
-
});
|
150 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/edit/matchtags.js
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror", "../fold/xml-fold"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
|
15 |
-
if (old && old != CodeMirror.Init) {
|
16 |
-
cm.off("cursorActivity", doMatchTags);
|
17 |
-
cm.off("viewportChange", maybeUpdateMatch);
|
18 |
-
clear(cm);
|
19 |
-
}
|
20 |
-
if (val) {
|
21 |
-
cm.state.matchBothTags = typeof val == "object" && val.bothTags;
|
22 |
-
cm.on("cursorActivity", doMatchTags);
|
23 |
-
cm.on("viewportChange", maybeUpdateMatch);
|
24 |
-
doMatchTags(cm);
|
25 |
-
}
|
26 |
-
});
|
27 |
-
|
28 |
-
function clear(cm) {
|
29 |
-
if (cm.state.tagHit) cm.state.tagHit.clear();
|
30 |
-
if (cm.state.tagOther) cm.state.tagOther.clear();
|
31 |
-
cm.state.tagHit = cm.state.tagOther = null;
|
32 |
-
}
|
33 |
-
|
34 |
-
function doMatchTags(cm) {
|
35 |
-
cm.state.failedTagMatch = false;
|
36 |
-
cm.operation(function() {
|
37 |
-
clear(cm);
|
38 |
-
if (cm.somethingSelected()) return;
|
39 |
-
var cur = cm.getCursor(), range = cm.getViewport();
|
40 |
-
range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
|
41 |
-
var match = CodeMirror.findMatchingTag(cm, cur, range);
|
42 |
-
if (!match) return;
|
43 |
-
if (cm.state.matchBothTags) {
|
44 |
-
var hit = match.at == "open" ? match.open : match.close;
|
45 |
-
if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
|
46 |
-
}
|
47 |
-
var other = match.at == "close" ? match.open : match.close;
|
48 |
-
if (other)
|
49 |
-
cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
|
50 |
-
else
|
51 |
-
cm.state.failedTagMatch = true;
|
52 |
-
});
|
53 |
-
}
|
54 |
-
|
55 |
-
function maybeUpdateMatch(cm) {
|
56 |
-
if (cm.state.failedTagMatch) doMatchTags(cm);
|
57 |
-
}
|
58 |
-
|
59 |
-
CodeMirror.commands.toMatchingTag = function(cm) {
|
60 |
-
var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
|
61 |
-
if (found) {
|
62 |
-
var other = found.at == "close" ? found.open : found.close;
|
63 |
-
if (other) cm.extendSelection(other.to, other.from);
|
64 |
-
}
|
65 |
-
};
|
66 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/edit/trailingspace.js
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
|
13 |
-
if (prev == CodeMirror.Init) prev = false;
|
14 |
-
if (prev && !val)
|
15 |
-
cm.removeOverlay("trailingspace");
|
16 |
-
else if (!prev && val)
|
17 |
-
cm.addOverlay({
|
18 |
-
token: function(stream) {
|
19 |
-
for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}
|
20 |
-
if (i > stream.pos) { stream.pos = i; return null; }
|
21 |
-
stream.pos = l;
|
22 |
-
return "trailingspace";
|
23 |
-
},
|
24 |
-
name: "trailingspace"
|
25 |
-
});
|
26 |
-
});
|
27 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/brace-fold.js
DELETED
@@ -1,105 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.registerHelper("fold", "brace", function(cm, start) {
|
15 |
-
var line = start.line, lineText = cm.getLine(line);
|
16 |
-
var tokenType;
|
17 |
-
|
18 |
-
function findOpening(openCh) {
|
19 |
-
for (var at = start.ch, pass = 0;;) {
|
20 |
-
var found = at <= 0 ? -1 : lineText.lastIndexOf(openCh, at - 1);
|
21 |
-
if (found == -1) {
|
22 |
-
if (pass == 1) break;
|
23 |
-
pass = 1;
|
24 |
-
at = lineText.length;
|
25 |
-
continue;
|
26 |
-
}
|
27 |
-
if (pass == 1 && found < start.ch) break;
|
28 |
-
tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
|
29 |
-
if (!/^(comment|string)/.test(tokenType)) return found + 1;
|
30 |
-
at = found - 1;
|
31 |
-
}
|
32 |
-
}
|
33 |
-
|
34 |
-
var startToken = "{", endToken = "}", startCh = findOpening("{");
|
35 |
-
if (startCh == null) {
|
36 |
-
startToken = "[", endToken = "]";
|
37 |
-
startCh = findOpening("[");
|
38 |
-
}
|
39 |
-
|
40 |
-
if (startCh == null) return;
|
41 |
-
var count = 1, lastLine = cm.lastLine(), end, endCh;
|
42 |
-
outer: for (var i = line; i <= lastLine; ++i) {
|
43 |
-
var text = cm.getLine(i), pos = i == line ? startCh : 0;
|
44 |
-
for (;;) {
|
45 |
-
var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
|
46 |
-
if (nextOpen < 0) nextOpen = text.length;
|
47 |
-
if (nextClose < 0) nextClose = text.length;
|
48 |
-
pos = Math.min(nextOpen, nextClose);
|
49 |
-
if (pos == text.length) break;
|
50 |
-
if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == tokenType) {
|
51 |
-
if (pos == nextOpen) ++count;
|
52 |
-
else if (!--count) { end = i; endCh = pos; break outer; }
|
53 |
-
}
|
54 |
-
++pos;
|
55 |
-
}
|
56 |
-
}
|
57 |
-
if (end == null || line == end) return;
|
58 |
-
return {from: CodeMirror.Pos(line, startCh),
|
59 |
-
to: CodeMirror.Pos(end, endCh)};
|
60 |
-
});
|
61 |
-
|
62 |
-
CodeMirror.registerHelper("fold", "import", function(cm, start) {
|
63 |
-
function hasImport(line) {
|
64 |
-
if (line < cm.firstLine() || line > cm.lastLine()) return null;
|
65 |
-
var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
|
66 |
-
if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
|
67 |
-
if (start.type != "keyword" || start.string != "import") return null;
|
68 |
-
// Now find closing semicolon, return its position
|
69 |
-
for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) {
|
70 |
-
var text = cm.getLine(i), semi = text.indexOf(";");
|
71 |
-
if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)};
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
var startLine = start.line, has = hasImport(startLine), prev;
|
76 |
-
if (!has || hasImport(startLine - 1) || ((prev = hasImport(startLine - 2)) && prev.end.line == startLine - 1))
|
77 |
-
return null;
|
78 |
-
for (var end = has.end;;) {
|
79 |
-
var next = hasImport(end.line + 1);
|
80 |
-
if (next == null) break;
|
81 |
-
end = next.end;
|
82 |
-
}
|
83 |
-
return {from: cm.clipPos(CodeMirror.Pos(startLine, has.startCh + 1)), to: end};
|
84 |
-
});
|
85 |
-
|
86 |
-
CodeMirror.registerHelper("fold", "include", function(cm, start) {
|
87 |
-
function hasInclude(line) {
|
88 |
-
if (line < cm.firstLine() || line > cm.lastLine()) return null;
|
89 |
-
var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
|
90 |
-
if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
|
91 |
-
if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8;
|
92 |
-
}
|
93 |
-
|
94 |
-
var startLine = start.line, has = hasInclude(startLine);
|
95 |
-
if (has == null || hasInclude(startLine - 1) != null) return null;
|
96 |
-
for (var end = startLine;;) {
|
97 |
-
var next = hasInclude(end + 1);
|
98 |
-
if (next == null) break;
|
99 |
-
++end;
|
100 |
-
}
|
101 |
-
return {from: CodeMirror.Pos(startLine, has + 1),
|
102 |
-
to: cm.clipPos(CodeMirror.Pos(end))};
|
103 |
-
});
|
104 |
-
|
105 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/comment-fold.js
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
|
15 |
-
return mode.blockCommentStart && mode.blockCommentEnd;
|
16 |
-
}, function(cm, start) {
|
17 |
-
var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd;
|
18 |
-
if (!startToken || !endToken) return;
|
19 |
-
var line = start.line, lineText = cm.getLine(line);
|
20 |
-
|
21 |
-
var startCh;
|
22 |
-
for (var at = start.ch, pass = 0;;) {
|
23 |
-
var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1);
|
24 |
-
if (found == -1) {
|
25 |
-
if (pass == 1) return;
|
26 |
-
pass = 1;
|
27 |
-
at = lineText.length;
|
28 |
-
continue;
|
29 |
-
}
|
30 |
-
if (pass == 1 && found < start.ch) return;
|
31 |
-
if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
|
32 |
-
(found == 0 || lineText.slice(found - endToken.length, found) == endToken ||
|
33 |
-
!/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
|
34 |
-
startCh = found + startToken.length;
|
35 |
-
break;
|
36 |
-
}
|
37 |
-
at = found - 1;
|
38 |
-
}
|
39 |
-
|
40 |
-
var depth = 1, lastLine = cm.lastLine(), end, endCh;
|
41 |
-
outer: for (var i = line; i <= lastLine; ++i) {
|
42 |
-
var text = cm.getLine(i), pos = i == line ? startCh : 0;
|
43 |
-
for (;;) {
|
44 |
-
var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
|
45 |
-
if (nextOpen < 0) nextOpen = text.length;
|
46 |
-
if (nextClose < 0) nextClose = text.length;
|
47 |
-
pos = Math.min(nextOpen, nextClose);
|
48 |
-
if (pos == text.length) break;
|
49 |
-
if (pos == nextOpen) ++depth;
|
50 |
-
else if (!--depth) { end = i; endCh = pos; break outer; }
|
51 |
-
++pos;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
if (end == null || line == end && endCh == startCh) return;
|
55 |
-
return {from: CodeMirror.Pos(line, startCh),
|
56 |
-
to: CodeMirror.Pos(end, endCh)};
|
57 |
-
});
|
58 |
-
|
59 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/foldcode.js
DELETED
@@ -1,152 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
function doFold(cm, pos, options, force) {
|
15 |
-
if (options && options.call) {
|
16 |
-
var finder = options;
|
17 |
-
options = null;
|
18 |
-
} else {
|
19 |
-
var finder = getOption(cm, options, "rangeFinder");
|
20 |
-
}
|
21 |
-
if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
|
22 |
-
var minSize = getOption(cm, options, "minFoldSize");
|
23 |
-
|
24 |
-
function getRange(allowFolded) {
|
25 |
-
var range = finder(cm, pos);
|
26 |
-
if (!range || range.to.line - range.from.line < minSize) return null;
|
27 |
-
var marks = cm.findMarksAt(range.from);
|
28 |
-
for (var i = 0; i < marks.length; ++i) {
|
29 |
-
if (marks[i].__isFold && force !== "fold") {
|
30 |
-
if (!allowFolded) return null;
|
31 |
-
range.cleared = true;
|
32 |
-
marks[i].clear();
|
33 |
-
}
|
34 |
-
}
|
35 |
-
return range;
|
36 |
-
}
|
37 |
-
|
38 |
-
var range = getRange(true);
|
39 |
-
if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) {
|
40 |
-
pos = CodeMirror.Pos(pos.line - 1, 0);
|
41 |
-
range = getRange(false);
|
42 |
-
}
|
43 |
-
if (!range || range.cleared || force === "unfold") return;
|
44 |
-
|
45 |
-
var myWidget = makeWidget(cm, options);
|
46 |
-
CodeMirror.on(myWidget, "mousedown", function(e) {
|
47 |
-
myRange.clear();
|
48 |
-
CodeMirror.e_preventDefault(e);
|
49 |
-
});
|
50 |
-
var myRange = cm.markText(range.from, range.to, {
|
51 |
-
replacedWith: myWidget,
|
52 |
-
clearOnEnter: getOption(cm, options, "clearOnEnter"),
|
53 |
-
__isFold: true
|
54 |
-
});
|
55 |
-
myRange.on("clear", function(from, to) {
|
56 |
-
CodeMirror.signal(cm, "unfold", cm, from, to);
|
57 |
-
});
|
58 |
-
CodeMirror.signal(cm, "fold", cm, range.from, range.to);
|
59 |
-
}
|
60 |
-
|
61 |
-
function makeWidget(cm, options) {
|
62 |
-
var widget = getOption(cm, options, "widget");
|
63 |
-
if (typeof widget == "string") {
|
64 |
-
var text = document.createTextNode(widget);
|
65 |
-
widget = document.createElement("span");
|
66 |
-
widget.appendChild(text);
|
67 |
-
widget.className = "CodeMirror-foldmarker";
|
68 |
-
} else if (widget) {
|
69 |
-
widget = widget.cloneNode(true)
|
70 |
-
}
|
71 |
-
return widget;
|
72 |
-
}
|
73 |
-
|
74 |
-
// Clumsy backwards-compatible interface
|
75 |
-
CodeMirror.newFoldFunction = function(rangeFinder, widget) {
|
76 |
-
return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); };
|
77 |
-
};
|
78 |
-
|
79 |
-
// New-style interface
|
80 |
-
CodeMirror.defineExtension("foldCode", function(pos, options, force) {
|
81 |
-
doFold(this, pos, options, force);
|
82 |
-
});
|
83 |
-
|
84 |
-
CodeMirror.defineExtension("isFolded", function(pos) {
|
85 |
-
var marks = this.findMarksAt(pos);
|
86 |
-
for (var i = 0; i < marks.length; ++i)
|
87 |
-
if (marks[i].__isFold) return true;
|
88 |
-
});
|
89 |
-
|
90 |
-
CodeMirror.commands.toggleFold = function(cm) {
|
91 |
-
cm.foldCode(cm.getCursor());
|
92 |
-
};
|
93 |
-
CodeMirror.commands.fold = function(cm) {
|
94 |
-
cm.foldCode(cm.getCursor(), null, "fold");
|
95 |
-
};
|
96 |
-
CodeMirror.commands.unfold = function(cm) {
|
97 |
-
cm.foldCode(cm.getCursor(), null, "unfold");
|
98 |
-
};
|
99 |
-
CodeMirror.commands.foldAll = function(cm) {
|
100 |
-
cm.operation(function() {
|
101 |
-
for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
|
102 |
-
cm.foldCode(CodeMirror.Pos(i, 0), null, "fold");
|
103 |
-
});
|
104 |
-
};
|
105 |
-
CodeMirror.commands.unfoldAll = function(cm) {
|
106 |
-
cm.operation(function() {
|
107 |
-
for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
|
108 |
-
cm.foldCode(CodeMirror.Pos(i, 0), null, "unfold");
|
109 |
-
});
|
110 |
-
};
|
111 |
-
|
112 |
-
CodeMirror.registerHelper("fold", "combine", function() {
|
113 |
-
var funcs = Array.prototype.slice.call(arguments, 0);
|
114 |
-
return function(cm, start) {
|
115 |
-
for (var i = 0; i < funcs.length; ++i) {
|
116 |
-
var found = funcs[i](cm, start);
|
117 |
-
if (found) return found;
|
118 |
-
}
|
119 |
-
};
|
120 |
-
});
|
121 |
-
|
122 |
-
CodeMirror.registerHelper("fold", "auto", function(cm, start) {
|
123 |
-
var helpers = cm.getHelpers(start, "fold");
|
124 |
-
for (var i = 0; i < helpers.length; i++) {
|
125 |
-
var cur = helpers[i](cm, start);
|
126 |
-
if (cur) return cur;
|
127 |
-
}
|
128 |
-
});
|
129 |
-
|
130 |
-
var defaultOptions = {
|
131 |
-
rangeFinder: CodeMirror.fold.auto,
|
132 |
-
widget: "\u2194",
|
133 |
-
minFoldSize: 0,
|
134 |
-
scanUp: false,
|
135 |
-
clearOnEnter: true
|
136 |
-
};
|
137 |
-
|
138 |
-
CodeMirror.defineOption("foldOptions", null);
|
139 |
-
|
140 |
-
function getOption(cm, options, name) {
|
141 |
-
if (options && options[name] !== undefined)
|
142 |
-
return options[name];
|
143 |
-
var editorOptions = cm.options.foldOptions;
|
144 |
-
if (editorOptions && editorOptions[name] !== undefined)
|
145 |
-
return editorOptions[name];
|
146 |
-
return defaultOptions[name];
|
147 |
-
}
|
148 |
-
|
149 |
-
CodeMirror.defineExtension("foldOption", function(options, name) {
|
150 |
-
return getOption(this, options, name);
|
151 |
-
});
|
152 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/foldgutter.css
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
.CodeMirror-foldmarker {
|
2 |
-
color: blue;
|
3 |
-
text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
|
4 |
-
font-family: arial;
|
5 |
-
line-height: .3;
|
6 |
-
cursor: pointer;
|
7 |
-
}
|
8 |
-
.CodeMirror-foldgutter {
|
9 |
-
width: .7em;
|
10 |
-
}
|
11 |
-
.CodeMirror-foldgutter-open,
|
12 |
-
.CodeMirror-foldgutter-folded {
|
13 |
-
cursor: pointer;
|
14 |
-
}
|
15 |
-
.CodeMirror-foldgutter-open:after {
|
16 |
-
content: "\25BE";
|
17 |
-
}
|
18 |
-
.CodeMirror-foldgutter-folded:after {
|
19 |
-
content: "\25B8";
|
20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/foldgutter.js
DELETED
@@ -1,146 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), require("./foldcode"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror", "./foldcode"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineOption("foldGutter", false, function(cm, val, old) {
|
15 |
-
if (old && old != CodeMirror.Init) {
|
16 |
-
cm.clearGutter(cm.state.foldGutter.options.gutter);
|
17 |
-
cm.state.foldGutter = null;
|
18 |
-
cm.off("gutterClick", onGutterClick);
|
19 |
-
cm.off("change", onChange);
|
20 |
-
cm.off("viewportChange", onViewportChange);
|
21 |
-
cm.off("fold", onFold);
|
22 |
-
cm.off("unfold", onFold);
|
23 |
-
cm.off("swapDoc", onChange);
|
24 |
-
}
|
25 |
-
if (val) {
|
26 |
-
cm.state.foldGutter = new State(parseOptions(val));
|
27 |
-
updateInViewport(cm);
|
28 |
-
cm.on("gutterClick", onGutterClick);
|
29 |
-
cm.on("change", onChange);
|
30 |
-
cm.on("viewportChange", onViewportChange);
|
31 |
-
cm.on("fold", onFold);
|
32 |
-
cm.on("unfold", onFold);
|
33 |
-
cm.on("swapDoc", onChange);
|
34 |
-
}
|
35 |
-
});
|
36 |
-
|
37 |
-
var Pos = CodeMirror.Pos;
|
38 |
-
|
39 |
-
function State(options) {
|
40 |
-
this.options = options;
|
41 |
-
this.from = this.to = 0;
|
42 |
-
}
|
43 |
-
|
44 |
-
function parseOptions(opts) {
|
45 |
-
if (opts === true) opts = {};
|
46 |
-
if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter";
|
47 |
-
if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open";
|
48 |
-
if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded";
|
49 |
-
return opts;
|
50 |
-
}
|
51 |
-
|
52 |
-
function isFolded(cm, line) {
|
53 |
-
var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0));
|
54 |
-
for (var i = 0; i < marks.length; ++i)
|
55 |
-
if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i];
|
56 |
-
}
|
57 |
-
|
58 |
-
function marker(spec) {
|
59 |
-
if (typeof spec == "string") {
|
60 |
-
var elt = document.createElement("div");
|
61 |
-
elt.className = spec + " CodeMirror-guttermarker-subtle";
|
62 |
-
return elt;
|
63 |
-
} else {
|
64 |
-
return spec.cloneNode(true);
|
65 |
-
}
|
66 |
-
}
|
67 |
-
|
68 |
-
function updateFoldInfo(cm, from, to) {
|
69 |
-
var opts = cm.state.foldGutter.options, cur = from;
|
70 |
-
var minSize = cm.foldOption(opts, "minFoldSize");
|
71 |
-
var func = cm.foldOption(opts, "rangeFinder");
|
72 |
-
cm.eachLine(from, to, function(line) {
|
73 |
-
var mark = null;
|
74 |
-
if (isFolded(cm, cur)) {
|
75 |
-
mark = marker(opts.indicatorFolded);
|
76 |
-
} else {
|
77 |
-
var pos = Pos(cur, 0);
|
78 |
-
var range = func && func(cm, pos);
|
79 |
-
if (range && range.to.line - range.from.line >= minSize)
|
80 |
-
mark = marker(opts.indicatorOpen);
|
81 |
-
}
|
82 |
-
cm.setGutterMarker(line, opts.gutter, mark);
|
83 |
-
++cur;
|
84 |
-
});
|
85 |
-
}
|
86 |
-
|
87 |
-
function updateInViewport(cm) {
|
88 |
-
var vp = cm.getViewport(), state = cm.state.foldGutter;
|
89 |
-
if (!state) return;
|
90 |
-
cm.operation(function() {
|
91 |
-
updateFoldInfo(cm, vp.from, vp.to);
|
92 |
-
});
|
93 |
-
state.from = vp.from; state.to = vp.to;
|
94 |
-
}
|
95 |
-
|
96 |
-
function onGutterClick(cm, line, gutter) {
|
97 |
-
var state = cm.state.foldGutter;
|
98 |
-
if (!state) return;
|
99 |
-
var opts = state.options;
|
100 |
-
if (gutter != opts.gutter) return;
|
101 |
-
var folded = isFolded(cm, line);
|
102 |
-
if (folded) folded.clear();
|
103 |
-
else cm.foldCode(Pos(line, 0), opts.rangeFinder);
|
104 |
-
}
|
105 |
-
|
106 |
-
function onChange(cm) {
|
107 |
-
var state = cm.state.foldGutter;
|
108 |
-
if (!state) return;
|
109 |
-
var opts = state.options;
|
110 |
-
state.from = state.to = 0;
|
111 |
-
clearTimeout(state.changeUpdate);
|
112 |
-
state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
|
113 |
-
}
|
114 |
-
|
115 |
-
function onViewportChange(cm) {
|
116 |
-
var state = cm.state.foldGutter;
|
117 |
-
if (!state) return;
|
118 |
-
var opts = state.options;
|
119 |
-
clearTimeout(state.changeUpdate);
|
120 |
-
state.changeUpdate = setTimeout(function() {
|
121 |
-
var vp = cm.getViewport();
|
122 |
-
if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
|
123 |
-
updateInViewport(cm);
|
124 |
-
} else {
|
125 |
-
cm.operation(function() {
|
126 |
-
if (vp.from < state.from) {
|
127 |
-
updateFoldInfo(cm, vp.from, state.from);
|
128 |
-
state.from = vp.from;
|
129 |
-
}
|
130 |
-
if (vp.to > state.to) {
|
131 |
-
updateFoldInfo(cm, state.to, vp.to);
|
132 |
-
state.to = vp.to;
|
133 |
-
}
|
134 |
-
});
|
135 |
-
}
|
136 |
-
}, opts.updateViewportTimeSpan || 400);
|
137 |
-
}
|
138 |
-
|
139 |
-
function onFold(cm, from) {
|
140 |
-
var state = cm.state.foldGutter;
|
141 |
-
if (!state) return;
|
142 |
-
var line = from.line;
|
143 |
-
if (line >= state.from && line < state.to)
|
144 |
-
updateFoldInfo(cm, line, line + 1);
|
145 |
-
}
|
146 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/indent-fold.js
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
function lineIndent(cm, lineNo) {
|
15 |
-
var text = cm.getLine(lineNo)
|
16 |
-
var spaceTo = text.search(/\S/)
|
17 |
-
if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1))))
|
18 |
-
return -1
|
19 |
-
return CodeMirror.countColumn(text, null, cm.getOption("tabSize"))
|
20 |
-
}
|
21 |
-
|
22 |
-
CodeMirror.registerHelper("fold", "indent", function(cm, start) {
|
23 |
-
var myIndent = lineIndent(cm, start.line)
|
24 |
-
if (myIndent < 0) return
|
25 |
-
var lastLineInFold = null
|
26 |
-
|
27 |
-
// Go through lines until we find a line that definitely doesn't belong in
|
28 |
-
// the block we're folding, or to the end.
|
29 |
-
for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) {
|
30 |
-
var indent = lineIndent(cm, i)
|
31 |
-
if (indent == -1) {
|
32 |
-
} else if (indent > myIndent) {
|
33 |
-
// Lines with a greater indent are considered part of the block.
|
34 |
-
lastLineInFold = i;
|
35 |
-
} else {
|
36 |
-
// If this line has non-space, non-comment content, and is
|
37 |
-
// indented less or equal to the start line, it is the start of
|
38 |
-
// another block.
|
39 |
-
break;
|
40 |
-
}
|
41 |
-
}
|
42 |
-
if (lastLineInFold) return {
|
43 |
-
from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
|
44 |
-
to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length)
|
45 |
-
};
|
46 |
-
});
|
47 |
-
|
48 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/markdown-fold.js
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.registerHelper("fold", "markdown", function(cm, start) {
|
15 |
-
var maxDepth = 100;
|
16 |
-
|
17 |
-
function isHeader(lineNo) {
|
18 |
-
var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0));
|
19 |
-
return tokentype && /\bheader\b/.test(tokentype);
|
20 |
-
}
|
21 |
-
|
22 |
-
function headerLevel(lineNo, line, nextLine) {
|
23 |
-
var match = line && line.match(/^#+/);
|
24 |
-
if (match && isHeader(lineNo)) return match[0].length;
|
25 |
-
match = nextLine && nextLine.match(/^[=\-]+\s*$/);
|
26 |
-
if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2;
|
27 |
-
return maxDepth;
|
28 |
-
}
|
29 |
-
|
30 |
-
var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1);
|
31 |
-
var level = headerLevel(start.line, firstLine, nextLine);
|
32 |
-
if (level === maxDepth) return undefined;
|
33 |
-
|
34 |
-
var lastLineNo = cm.lastLine();
|
35 |
-
var end = start.line, nextNextLine = cm.getLine(end + 2);
|
36 |
-
while (end < lastLineNo) {
|
37 |
-
if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break;
|
38 |
-
++end;
|
39 |
-
nextLine = nextNextLine;
|
40 |
-
nextNextLine = cm.getLine(end + 2);
|
41 |
-
}
|
42 |
-
|
43 |
-
return {
|
44 |
-
from: CodeMirror.Pos(start.line, firstLine.length),
|
45 |
-
to: CodeMirror.Pos(end, cm.getLine(end).length)
|
46 |
-
};
|
47 |
-
});
|
48 |
-
|
49 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/fold/xml-fold.js
DELETED
@@ -1,184 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var Pos = CodeMirror.Pos;
|
15 |
-
function cmp(a, b) { return a.line - b.line || a.ch - b.ch; }
|
16 |
-
|
17 |
-
var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
18 |
-
var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
19 |
-
var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g");
|
20 |
-
|
21 |
-
function Iter(cm, line, ch, range) {
|
22 |
-
this.line = line; this.ch = ch;
|
23 |
-
this.cm = cm; this.text = cm.getLine(line);
|
24 |
-
this.min = range ? Math.max(range.from, cm.firstLine()) : cm.firstLine();
|
25 |
-
this.max = range ? Math.min(range.to - 1, cm.lastLine()) : cm.lastLine();
|
26 |
-
}
|
27 |
-
|
28 |
-
function tagAt(iter, ch) {
|
29 |
-
var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch));
|
30 |
-
return type && /\btag\b/.test(type);
|
31 |
-
}
|
32 |
-
|
33 |
-
function nextLine(iter) {
|
34 |
-
if (iter.line >= iter.max) return;
|
35 |
-
iter.ch = 0;
|
36 |
-
iter.text = iter.cm.getLine(++iter.line);
|
37 |
-
return true;
|
38 |
-
}
|
39 |
-
function prevLine(iter) {
|
40 |
-
if (iter.line <= iter.min) return;
|
41 |
-
iter.text = iter.cm.getLine(--iter.line);
|
42 |
-
iter.ch = iter.text.length;
|
43 |
-
return true;
|
44 |
-
}
|
45 |
-
|
46 |
-
function toTagEnd(iter) {
|
47 |
-
for (;;) {
|
48 |
-
var gt = iter.text.indexOf(">", iter.ch);
|
49 |
-
if (gt == -1) { if (nextLine(iter)) continue; else return; }
|
50 |
-
if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; }
|
51 |
-
var lastSlash = iter.text.lastIndexOf("/", gt);
|
52 |
-
var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
|
53 |
-
iter.ch = gt + 1;
|
54 |
-
return selfClose ? "selfClose" : "regular";
|
55 |
-
}
|
56 |
-
}
|
57 |
-
function toTagStart(iter) {
|
58 |
-
for (;;) {
|
59 |
-
var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1;
|
60 |
-
if (lt == -1) { if (prevLine(iter)) continue; else return; }
|
61 |
-
if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; }
|
62 |
-
xmlTagStart.lastIndex = lt;
|
63 |
-
iter.ch = lt;
|
64 |
-
var match = xmlTagStart.exec(iter.text);
|
65 |
-
if (match && match.index == lt) return match;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
function toNextTag(iter) {
|
70 |
-
for (;;) {
|
71 |
-
xmlTagStart.lastIndex = iter.ch;
|
72 |
-
var found = xmlTagStart.exec(iter.text);
|
73 |
-
if (!found) { if (nextLine(iter)) continue; else return; }
|
74 |
-
if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; }
|
75 |
-
iter.ch = found.index + found[0].length;
|
76 |
-
return found;
|
77 |
-
}
|
78 |
-
}
|
79 |
-
function toPrevTag(iter) {
|
80 |
-
for (;;) {
|
81 |
-
var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1;
|
82 |
-
if (gt == -1) { if (prevLine(iter)) continue; else return; }
|
83 |
-
if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; }
|
84 |
-
var lastSlash = iter.text.lastIndexOf("/", gt);
|
85 |
-
var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
|
86 |
-
iter.ch = gt + 1;
|
87 |
-
return selfClose ? "selfClose" : "regular";
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
function findMatchingClose(iter, tag) {
|
92 |
-
var stack = [];
|
93 |
-
for (;;) {
|
94 |
-
var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0);
|
95 |
-
if (!next || !(end = toTagEnd(iter))) return;
|
96 |
-
if (end == "selfClose") continue;
|
97 |
-
if (next[1]) { // closing tag
|
98 |
-
for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {
|
99 |
-
stack.length = i;
|
100 |
-
break;
|
101 |
-
}
|
102 |
-
if (i < 0 && (!tag || tag == next[2])) return {
|
103 |
-
tag: next[2],
|
104 |
-
from: Pos(startLine, startCh),
|
105 |
-
to: Pos(iter.line, iter.ch)
|
106 |
-
};
|
107 |
-
} else { // opening tag
|
108 |
-
stack.push(next[2]);
|
109 |
-
}
|
110 |
-
}
|
111 |
-
}
|
112 |
-
function findMatchingOpen(iter, tag) {
|
113 |
-
var stack = [];
|
114 |
-
for (;;) {
|
115 |
-
var prev = toPrevTag(iter);
|
116 |
-
if (!prev) return;
|
117 |
-
if (prev == "selfClose") { toTagStart(iter); continue; }
|
118 |
-
var endLine = iter.line, endCh = iter.ch;
|
119 |
-
var start = toTagStart(iter);
|
120 |
-
if (!start) return;
|
121 |
-
if (start[1]) { // closing tag
|
122 |
-
stack.push(start[2]);
|
123 |
-
} else { // opening tag
|
124 |
-
for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) {
|
125 |
-
stack.length = i;
|
126 |
-
break;
|
127 |
-
}
|
128 |
-
if (i < 0 && (!tag || tag == start[2])) return {
|
129 |
-
tag: start[2],
|
130 |
-
from: Pos(iter.line, iter.ch),
|
131 |
-
to: Pos(endLine, endCh)
|
132 |
-
};
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
|
137 |
-
CodeMirror.registerHelper("fold", "xml", function(cm, start) {
|
138 |
-
var iter = new Iter(cm, start.line, 0);
|
139 |
-
for (;;) {
|
140 |
-
var openTag = toNextTag(iter)
|
141 |
-
if (!openTag || iter.line != start.line) return
|
142 |
-
var end = toTagEnd(iter)
|
143 |
-
if (!end) return
|
144 |
-
if (!openTag[1] && end != "selfClose") {
|
145 |
-
var startPos = Pos(iter.line, iter.ch);
|
146 |
-
var endPos = findMatchingClose(iter, openTag[2]);
|
147 |
-
return endPos && cmp(endPos.from, startPos) > 0 ? {from: startPos, to: endPos.from} : null
|
148 |
-
}
|
149 |
-
}
|
150 |
-
});
|
151 |
-
CodeMirror.findMatchingTag = function(cm, pos, range) {
|
152 |
-
var iter = new Iter(cm, pos.line, pos.ch, range);
|
153 |
-
if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return;
|
154 |
-
var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch);
|
155 |
-
var start = end && toTagStart(iter);
|
156 |
-
if (!end || !start || cmp(iter, pos) > 0) return;
|
157 |
-
var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]};
|
158 |
-
if (end == "selfClose") return {open: here, close: null, at: "open"};
|
159 |
-
|
160 |
-
if (start[1]) { // closing tag
|
161 |
-
return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"};
|
162 |
-
} else { // opening tag
|
163 |
-
iter = new Iter(cm, to.line, to.ch, range);
|
164 |
-
return {open: here, close: findMatchingClose(iter, start[2]), at: "open"};
|
165 |
-
}
|
166 |
-
};
|
167 |
-
|
168 |
-
CodeMirror.findEnclosingTag = function(cm, pos, range, tag) {
|
169 |
-
var iter = new Iter(cm, pos.line, pos.ch, range);
|
170 |
-
for (;;) {
|
171 |
-
var open = findMatchingOpen(iter, tag);
|
172 |
-
if (!open) break;
|
173 |
-
var forward = new Iter(cm, pos.line, pos.ch, range);
|
174 |
-
var close = findMatchingClose(forward, open.tag);
|
175 |
-
if (close) return {open: open, close: close};
|
176 |
-
}
|
177 |
-
};
|
178 |
-
|
179 |
-
// Used by addon/edit/closetag.js
|
180 |
-
CodeMirror.scanForClosingTag = function(cm, pos, name, end) {
|
181 |
-
var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);
|
182 |
-
return findMatchingClose(iter, name);
|
183 |
-
};
|
184 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/anyword-hint.js
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var WORD = /[\w$]+/, RANGE = 500;
|
15 |
-
|
16 |
-
CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
|
17 |
-
var word = options && options.word || WORD;
|
18 |
-
var range = options && options.range || RANGE;
|
19 |
-
var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
|
20 |
-
var end = cur.ch, start = end;
|
21 |
-
while (start && word.test(curLine.charAt(start - 1))) --start;
|
22 |
-
var curWord = start != end && curLine.slice(start, end);
|
23 |
-
|
24 |
-
var list = options && options.list || [], seen = {};
|
25 |
-
var re = new RegExp(word.source, "g");
|
26 |
-
for (var dir = -1; dir <= 1; dir += 2) {
|
27 |
-
var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
|
28 |
-
for (; line != endLine; line += dir) {
|
29 |
-
var text = editor.getLine(line), m;
|
30 |
-
while (m = re.exec(text)) {
|
31 |
-
if (line == cur.line && m[0] === curWord) continue;
|
32 |
-
if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
|
33 |
-
seen[m[0]] = true;
|
34 |
-
list.push(m[0]);
|
35 |
-
}
|
36 |
-
}
|
37 |
-
}
|
38 |
-
}
|
39 |
-
return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
|
40 |
-
});
|
41 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/css-hint.js
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), require("../../mode/css/css"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror", "../../mode/css/css"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var pseudoClasses = {link: 1, visited: 1, active: 1, hover: 1, focus: 1,
|
15 |
-
"first-letter": 1, "first-line": 1, "first-child": 1,
|
16 |
-
before: 1, after: 1, lang: 1};
|
17 |
-
|
18 |
-
CodeMirror.registerHelper("hint", "css", function(cm) {
|
19 |
-
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
20 |
-
var inner = CodeMirror.innerMode(cm.getMode(), token.state);
|
21 |
-
if (inner.mode.name != "css") return;
|
22 |
-
|
23 |
-
if (token.type == "keyword" && "!important".indexOf(token.string) == 0)
|
24 |
-
return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start),
|
25 |
-
to: CodeMirror.Pos(cur.line, token.end)};
|
26 |
-
|
27 |
-
var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);
|
28 |
-
if (/[^\w$_-]/.test(word)) {
|
29 |
-
word = ""; start = end = cur.ch;
|
30 |
-
}
|
31 |
-
|
32 |
-
var spec = CodeMirror.resolveMode("text/css");
|
33 |
-
|
34 |
-
var result = [];
|
35 |
-
function add(keywords) {
|
36 |
-
for (var name in keywords)
|
37 |
-
if (!word || name.lastIndexOf(word, 0) == 0)
|
38 |
-
result.push(name);
|
39 |
-
}
|
40 |
-
|
41 |
-
var st = inner.state.state;
|
42 |
-
if (st == "pseudo" || token.type == "variable-3") {
|
43 |
-
add(pseudoClasses);
|
44 |
-
} else if (st == "block" || st == "maybeprop") {
|
45 |
-
add(spec.propertyKeywords);
|
46 |
-
} else if (st == "prop" || st == "parens" || st == "at" || st == "params") {
|
47 |
-
add(spec.valueKeywords);
|
48 |
-
add(spec.colorKeywords);
|
49 |
-
} else if (st == "media" || st == "media_parens") {
|
50 |
-
add(spec.mediaTypes);
|
51 |
-
add(spec.mediaFeatures);
|
52 |
-
}
|
53 |
-
|
54 |
-
if (result.length) return {
|
55 |
-
list: result,
|
56 |
-
from: CodeMirror.Pos(cur.line, start),
|
57 |
-
to: CodeMirror.Pos(cur.line, end)
|
58 |
-
};
|
59 |
-
});
|
60 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/html-hint.js
DELETED
@@ -1,350 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), require("./xml-hint"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror", "./xml-hint"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");
|
15 |
-
var targets = ["_blank", "_self", "_top", "_parent"];
|
16 |
-
var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
|
17 |
-
var methods = ["get", "post", "put", "delete"];
|
18 |
-
var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
|
19 |
-
var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
|
20 |
-
"3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
|
21 |
-
"orientation:landscape", "device-height: [X]", "device-width: [X]"];
|
22 |
-
var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags
|
23 |
-
|
24 |
-
var data = {
|
25 |
-
a: {
|
26 |
-
attrs: {
|
27 |
-
href: null, ping: null, type: null,
|
28 |
-
media: media,
|
29 |
-
target: targets,
|
30 |
-
hreflang: langs
|
31 |
-
}
|
32 |
-
},
|
33 |
-
abbr: s,
|
34 |
-
acronym: s,
|
35 |
-
address: s,
|
36 |
-
applet: s,
|
37 |
-
area: {
|
38 |
-
attrs: {
|
39 |
-
alt: null, coords: null, href: null, target: null, ping: null,
|
40 |
-
media: media, hreflang: langs, type: null,
|
41 |
-
shape: ["default", "rect", "circle", "poly"]
|
42 |
-
}
|
43 |
-
},
|
44 |
-
article: s,
|
45 |
-
aside: s,
|
46 |
-
audio: {
|
47 |
-
attrs: {
|
48 |
-
src: null, mediagroup: null,
|
49 |
-
crossorigin: ["anonymous", "use-credentials"],
|
50 |
-
preload: ["none", "metadata", "auto"],
|
51 |
-
autoplay: ["", "autoplay"],
|
52 |
-
loop: ["", "loop"],
|
53 |
-
controls: ["", "controls"]
|
54 |
-
}
|
55 |
-
},
|
56 |
-
b: s,
|
57 |
-
base: { attrs: { href: null, target: targets } },
|
58 |
-
basefont: s,
|
59 |
-
bdi: s,
|
60 |
-
bdo: s,
|
61 |
-
big: s,
|
62 |
-
blockquote: { attrs: { cite: null } },
|
63 |
-
body: s,
|
64 |
-
br: s,
|
65 |
-
button: {
|
66 |
-
attrs: {
|
67 |
-
form: null, formaction: null, name: null, value: null,
|
68 |
-
autofocus: ["", "autofocus"],
|
69 |
-
disabled: ["", "autofocus"],
|
70 |
-
formenctype: encs,
|
71 |
-
formmethod: methods,
|
72 |
-
formnovalidate: ["", "novalidate"],
|
73 |
-
formtarget: targets,
|
74 |
-
type: ["submit", "reset", "button"]
|
75 |
-
}
|
76 |
-
},
|
77 |
-
canvas: { attrs: { width: null, height: null } },
|
78 |
-
caption: s,
|
79 |
-
center: s,
|
80 |
-
cite: s,
|
81 |
-
code: s,
|
82 |
-
col: { attrs: { span: null } },
|
83 |
-
colgroup: { attrs: { span: null } },
|
84 |
-
command: {
|
85 |
-
attrs: {
|
86 |
-
type: ["command", "checkbox", "radio"],
|
87 |
-
label: null, icon: null, radiogroup: null, command: null, title: null,
|
88 |
-
disabled: ["", "disabled"],
|
89 |
-
checked: ["", "checked"]
|
90 |
-
}
|
91 |
-
},
|
92 |
-
data: { attrs: { value: null } },
|
93 |
-
datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } },
|
94 |
-
datalist: { attrs: { data: null } },
|
95 |
-
dd: s,
|
96 |
-
del: { attrs: { cite: null, datetime: null } },
|
97 |
-
details: { attrs: { open: ["", "open"] } },
|
98 |
-
dfn: s,
|
99 |
-
dir: s,
|
100 |
-
div: s,
|
101 |
-
dl: s,
|
102 |
-
dt: s,
|
103 |
-
em: s,
|
104 |
-
embed: { attrs: { src: null, type: null, width: null, height: null } },
|
105 |
-
eventsource: { attrs: { src: null } },
|
106 |
-
fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } },
|
107 |
-
figcaption: s,
|
108 |
-
figure: s,
|
109 |
-
font: s,
|
110 |
-
footer: s,
|
111 |
-
form: {
|
112 |
-
attrs: {
|
113 |
-
action: null, name: null,
|
114 |
-
"accept-charset": charsets,
|
115 |
-
autocomplete: ["on", "off"],
|
116 |
-
enctype: encs,
|
117 |
-
method: methods,
|
118 |
-
novalidate: ["", "novalidate"],
|
119 |
-
target: targets
|
120 |
-
}
|
121 |
-
},
|
122 |
-
frame: s,
|
123 |
-
frameset: s,
|
124 |
-
h1: s, h2: s, h3: s, h4: s, h5: s, h6: s,
|
125 |
-
head: {
|
126 |
-
attrs: {},
|
127 |
-
children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
|
128 |
-
},
|
129 |
-
header: s,
|
130 |
-
hgroup: s,
|
131 |
-
hr: s,
|
132 |
-
html: {
|
133 |
-
attrs: { manifest: null },
|
134 |
-
children: ["head", "body"]
|
135 |
-
},
|
136 |
-
i: s,
|
137 |
-
iframe: {
|
138 |
-
attrs: {
|
139 |
-
src: null, srcdoc: null, name: null, width: null, height: null,
|
140 |
-
sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
|
141 |
-
seamless: ["", "seamless"]
|
142 |
-
}
|
143 |
-
},
|
144 |
-
img: {
|
145 |
-
attrs: {
|
146 |
-
alt: null, src: null, ismap: null, usemap: null, width: null, height: null,
|
147 |
-
crossorigin: ["anonymous", "use-credentials"]
|
148 |
-
}
|
149 |
-
},
|
150 |
-
input: {
|
151 |
-
attrs: {
|
152 |
-
alt: null, dirname: null, form: null, formaction: null,
|
153 |
-
height: null, list: null, max: null, maxlength: null, min: null,
|
154 |
-
name: null, pattern: null, placeholder: null, size: null, src: null,
|
155 |
-
step: null, value: null, width: null,
|
156 |
-
accept: ["audio/*", "video/*", "image/*"],
|
157 |
-
autocomplete: ["on", "off"],
|
158 |
-
autofocus: ["", "autofocus"],
|
159 |
-
checked: ["", "checked"],
|
160 |
-
disabled: ["", "disabled"],
|
161 |
-
formenctype: encs,
|
162 |
-
formmethod: methods,
|
163 |
-
formnovalidate: ["", "novalidate"],
|
164 |
-
formtarget: targets,
|
165 |
-
multiple: ["", "multiple"],
|
166 |
-
readonly: ["", "readonly"],
|
167 |
-
required: ["", "required"],
|
168 |
-
type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
|
169 |
-
"week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
|
170 |
-
"file", "submit", "image", "reset", "button"]
|
171 |
-
}
|
172 |
-
},
|
173 |
-
ins: { attrs: { cite: null, datetime: null } },
|
174 |
-
kbd: s,
|
175 |
-
keygen: {
|
176 |
-
attrs: {
|
177 |
-
challenge: null, form: null, name: null,
|
178 |
-
autofocus: ["", "autofocus"],
|
179 |
-
disabled: ["", "disabled"],
|
180 |
-
keytype: ["RSA"]
|
181 |
-
}
|
182 |
-
},
|
183 |
-
label: { attrs: { "for": null, form: null } },
|
184 |
-
legend: s,
|
185 |
-
li: { attrs: { value: null } },
|
186 |
-
link: {
|
187 |
-
attrs: {
|
188 |
-
href: null, type: null,
|
189 |
-
hreflang: langs,
|
190 |
-
media: media,
|
191 |
-
sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
|
192 |
-
}
|
193 |
-
},
|
194 |
-
map: { attrs: { name: null } },
|
195 |
-
mark: s,
|
196 |
-
menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } },
|
197 |
-
meta: {
|
198 |
-
attrs: {
|
199 |
-
content: null,
|
200 |
-
charset: charsets,
|
201 |
-
name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
|
202 |
-
"http-equiv": ["content-language", "content-type", "default-style", "refresh"]
|
203 |
-
}
|
204 |
-
},
|
205 |
-
meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },
|
206 |
-
nav: s,
|
207 |
-
noframes: s,
|
208 |
-
noscript: s,
|
209 |
-
object: {
|
210 |
-
attrs: {
|
211 |
-
data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,
|
212 |
-
typemustmatch: ["", "typemustmatch"]
|
213 |
-
}
|
214 |
-
},
|
215 |
-
ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } },
|
216 |
-
optgroup: { attrs: { disabled: ["", "disabled"], label: null } },
|
217 |
-
option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } },
|
218 |
-
output: { attrs: { "for": null, form: null, name: null } },
|
219 |
-
p: s,
|
220 |
-
param: { attrs: { name: null, value: null } },
|
221 |
-
pre: s,
|
222 |
-
progress: { attrs: { value: null, max: null } },
|
223 |
-
q: { attrs: { cite: null } },
|
224 |
-
rp: s,
|
225 |
-
rt: s,
|
226 |
-
ruby: s,
|
227 |
-
s: s,
|
228 |
-
samp: s,
|
229 |
-
script: {
|
230 |
-
attrs: {
|
231 |
-
type: ["text/javascript"],
|
232 |
-
src: null,
|
233 |
-
async: ["", "async"],
|
234 |
-
defer: ["", "defer"],
|
235 |
-
charset: charsets
|
236 |
-
}
|
237 |
-
},
|
238 |
-
section: s,
|
239 |
-
select: {
|
240 |
-
attrs: {
|
241 |
-
form: null, name: null, size: null,
|
242 |
-
autofocus: ["", "autofocus"],
|
243 |
-
disabled: ["", "disabled"],
|
244 |
-
multiple: ["", "multiple"]
|
245 |
-
}
|
246 |
-
},
|
247 |
-
small: s,
|
248 |
-
source: { attrs: { src: null, type: null, media: null } },
|
249 |
-
span: s,
|
250 |
-
strike: s,
|
251 |
-
strong: s,
|
252 |
-
style: {
|
253 |
-
attrs: {
|
254 |
-
type: ["text/css"],
|
255 |
-
media: media,
|
256 |
-
scoped: null
|
257 |
-
}
|
258 |
-
},
|
259 |
-
sub: s,
|
260 |
-
summary: s,
|
261 |
-
sup: s,
|
262 |
-
table: s,
|
263 |
-
tbody: s,
|
264 |
-
td: { attrs: { colspan: null, rowspan: null, headers: null } },
|
265 |
-
textarea: {
|
266 |
-
attrs: {
|
267 |
-
dirname: null, form: null, maxlength: null, name: null, placeholder: null,
|
268 |
-
rows: null, cols: null,
|
269 |
-
autofocus: ["", "autofocus"],
|
270 |
-
disabled: ["", "disabled"],
|
271 |
-
readonly: ["", "readonly"],
|
272 |
-
required: ["", "required"],
|
273 |
-
wrap: ["soft", "hard"]
|
274 |
-
}
|
275 |
-
},
|
276 |
-
tfoot: s,
|
277 |
-
th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } },
|
278 |
-
thead: s,
|
279 |
-
time: { attrs: { datetime: null } },
|
280 |
-
title: s,
|
281 |
-
tr: s,
|
282 |
-
track: {
|
283 |
-
attrs: {
|
284 |
-
src: null, label: null, "default": null,
|
285 |
-
kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
|
286 |
-
srclang: langs
|
287 |
-
}
|
288 |
-
},
|
289 |
-
tt: s,
|
290 |
-
u: s,
|
291 |
-
ul: s,
|
292 |
-
"var": s,
|
293 |
-
video: {
|
294 |
-
attrs: {
|
295 |
-
src: null, poster: null, width: null, height: null,
|
296 |
-
crossorigin: ["anonymous", "use-credentials"],
|
297 |
-
preload: ["auto", "metadata", "none"],
|
298 |
-
autoplay: ["", "autoplay"],
|
299 |
-
mediagroup: ["movie"],
|
300 |
-
muted: ["", "muted"],
|
301 |
-
controls: ["", "controls"]
|
302 |
-
}
|
303 |
-
},
|
304 |
-
wbr: s
|
305 |
-
};
|
306 |
-
|
307 |
-
var globalAttrs = {
|
308 |
-
accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
309 |
-
"class": null,
|
310 |
-
contenteditable: ["true", "false"],
|
311 |
-
contextmenu: null,
|
312 |
-
dir: ["ltr", "rtl", "auto"],
|
313 |
-
draggable: ["true", "false", "auto"],
|
314 |
-
dropzone: ["copy", "move", "link", "string:", "file:"],
|
315 |
-
hidden: ["hidden"],
|
316 |
-
id: null,
|
317 |
-
inert: ["inert"],
|
318 |
-
itemid: null,
|
319 |
-
itemprop: null,
|
320 |
-
itemref: null,
|
321 |
-
itemscope: ["itemscope"],
|
322 |
-
itemtype: null,
|
323 |
-
lang: ["en", "es"],
|
324 |
-
spellcheck: ["true", "false"],
|
325 |
-
autocorrect: ["true", "false"],
|
326 |
-
autocapitalize: ["true", "false"],
|
327 |
-
style: null,
|
328 |
-
tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
329 |
-
title: null,
|
330 |
-
translate: ["yes", "no"],
|
331 |
-
onclick: null,
|
332 |
-
rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
|
333 |
-
};
|
334 |
-
function populate(obj) {
|
335 |
-
for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr))
|
336 |
-
obj.attrs[attr] = globalAttrs[attr];
|
337 |
-
}
|
338 |
-
|
339 |
-
populate(s);
|
340 |
-
for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s)
|
341 |
-
populate(data[tag]);
|
342 |
-
|
343 |
-
CodeMirror.htmlSchema = data;
|
344 |
-
function htmlHint(cm, options) {
|
345 |
-
var local = {schemaInfo: data};
|
346 |
-
if (options) for (var opt in options) local[opt] = options[opt];
|
347 |
-
return CodeMirror.hint.xml(cm, local);
|
348 |
-
}
|
349 |
-
CodeMirror.registerHelper("hint", "html", htmlHint);
|
350 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/javascript-hint.js
DELETED
@@ -1,157 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
var Pos = CodeMirror.Pos;
|
13 |
-
|
14 |
-
function forEach(arr, f) {
|
15 |
-
for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
|
16 |
-
}
|
17 |
-
|
18 |
-
function arrayContains(arr, item) {
|
19 |
-
if (!Array.prototype.indexOf) {
|
20 |
-
var i = arr.length;
|
21 |
-
while (i--) {
|
22 |
-
if (arr[i] === item) {
|
23 |
-
return true;
|
24 |
-
}
|
25 |
-
}
|
26 |
-
return false;
|
27 |
-
}
|
28 |
-
return arr.indexOf(item) != -1;
|
29 |
-
}
|
30 |
-
|
31 |
-
function scriptHint(editor, keywords, getToken, options) {
|
32 |
-
// Find the token at the cursor
|
33 |
-
var cur = editor.getCursor(), token = getToken(editor, cur);
|
34 |
-
if (/\b(?:string|comment)\b/.test(token.type)) return;
|
35 |
-
var innerMode = CodeMirror.innerMode(editor.getMode(), token.state);
|
36 |
-
if (innerMode.mode.helperType === "json") return;
|
37 |
-
token.state = innerMode.state;
|
38 |
-
|
39 |
-
// If it's not a 'word-style' token, ignore the token.
|
40 |
-
if (!/^[\w$_]*$/.test(token.string)) {
|
41 |
-
token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
|
42 |
-
type: token.string == "." ? "property" : null};
|
43 |
-
} else if (token.end > cur.ch) {
|
44 |
-
token.end = cur.ch;
|
45 |
-
token.string = token.string.slice(0, cur.ch - token.start);
|
46 |
-
}
|
47 |
-
|
48 |
-
var tprop = token;
|
49 |
-
// If it is a property, find out what it is a property of.
|
50 |
-
while (tprop.type == "property") {
|
51 |
-
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
52 |
-
if (tprop.string != ".") return;
|
53 |
-
tprop = getToken(editor, Pos(cur.line, tprop.start));
|
54 |
-
if (!context) var context = [];
|
55 |
-
context.push(tprop);
|
56 |
-
}
|
57 |
-
return {list: getCompletions(token, context, keywords, options),
|
58 |
-
from: Pos(cur.line, token.start),
|
59 |
-
to: Pos(cur.line, token.end)};
|
60 |
-
}
|
61 |
-
|
62 |
-
function javascriptHint(editor, options) {
|
63 |
-
return scriptHint(editor, javascriptKeywords,
|
64 |
-
function (e, cur) {return e.getTokenAt(cur);},
|
65 |
-
options);
|
66 |
-
};
|
67 |
-
CodeMirror.registerHelper("hint", "javascript", javascriptHint);
|
68 |
-
|
69 |
-
function getCoffeeScriptToken(editor, cur) {
|
70 |
-
// This getToken, it is for coffeescript, imitates the behavior of
|
71 |
-
// getTokenAt method in javascript.js, that is, returning "property"
|
72 |
-
// type and treat "." as indepenent token.
|
73 |
-
var token = editor.getTokenAt(cur);
|
74 |
-
if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
|
75 |
-
token.end = token.start;
|
76 |
-
token.string = '.';
|
77 |
-
token.type = "property";
|
78 |
-
}
|
79 |
-
else if (/^\.[\w$_]*$/.test(token.string)) {
|
80 |
-
token.type = "property";
|
81 |
-
token.start++;
|
82 |
-
token.string = token.string.replace(/\./, '');
|
83 |
-
}
|
84 |
-
return token;
|
85 |
-
}
|
86 |
-
|
87 |
-
function coffeescriptHint(editor, options) {
|
88 |
-
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
|
89 |
-
}
|
90 |
-
CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
|
91 |
-
|
92 |
-
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
|
93 |
-
"toUpperCase toLowerCase split concat match replace search").split(" ");
|
94 |
-
var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
|
95 |
-
"lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
|
96 |
-
var funcProps = "prototype apply call bind".split(" ");
|
97 |
-
var javascriptKeywords = ("break case catch class const continue debugger default delete do else export extends false finally for function " +
|
98 |
-
"if in import instanceof new null return super switch this throw true try typeof var void while with yield").split(" ");
|
99 |
-
var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
|
100 |
-
"if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
|
101 |
-
|
102 |
-
function forAllProps(obj, callback) {
|
103 |
-
if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
|
104 |
-
for (var name in obj) callback(name)
|
105 |
-
} else {
|
106 |
-
for (var o = obj; o; o = Object.getPrototypeOf(o))
|
107 |
-
Object.getOwnPropertyNames(o).forEach(callback)
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
function getCompletions(token, context, keywords, options) {
|
112 |
-
var found = [], start = token.string, global = options && options.globalScope || window;
|
113 |
-
function maybeAdd(str) {
|
114 |
-
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
|
115 |
-
}
|
116 |
-
function gatherCompletions(obj) {
|
117 |
-
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
118 |
-
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
119 |
-
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
120 |
-
forAllProps(obj, maybeAdd)
|
121 |
-
}
|
122 |
-
|
123 |
-
if (context && context.length) {
|
124 |
-
// If this is a property, see if it belongs to some object we can
|
125 |
-
// find in the current environment.
|
126 |
-
var obj = context.pop(), base;
|
127 |
-
if (obj.type && obj.type.indexOf("variable") === 0) {
|
128 |
-
if (options && options.additionalContext)
|
129 |
-
base = options.additionalContext[obj.string];
|
130 |
-
if (!options || options.useGlobalScope !== false)
|
131 |
-
base = base || global[obj.string];
|
132 |
-
} else if (obj.type == "string") {
|
133 |
-
base = "";
|
134 |
-
} else if (obj.type == "atom") {
|
135 |
-
base = 1;
|
136 |
-
} else if (obj.type == "function") {
|
137 |
-
if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
|
138 |
-
(typeof global.jQuery == 'function'))
|
139 |
-
base = global.jQuery();
|
140 |
-
else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
|
141 |
-
base = global._();
|
142 |
-
}
|
143 |
-
while (base != null && context.length)
|
144 |
-
base = base[context.pop().string];
|
145 |
-
if (base != null) gatherCompletions(base);
|
146 |
-
} else {
|
147 |
-
// If not, just look in the global object and any local scope
|
148 |
-
// (reading into JS mode internals to get at the local and global variables)
|
149 |
-
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
150 |
-
for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
|
151 |
-
if (!options || options.useGlobalScope !== false)
|
152 |
-
gatherCompletions(global);
|
153 |
-
forEach(keywords, maybeAdd);
|
154 |
-
}
|
155 |
-
return found;
|
156 |
-
}
|
157 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/show-hint.css
DELETED
@@ -1,36 +0,0 @@
|
|
1 |
-
.CodeMirror-hints {
|
2 |
-
position: absolute;
|
3 |
-
z-index: 10;
|
4 |
-
overflow: hidden;
|
5 |
-
list-style: none;
|
6 |
-
|
7 |
-
margin: 0;
|
8 |
-
padding: 2px;
|
9 |
-
|
10 |
-
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
11 |
-
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
12 |
-
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
13 |
-
border-radius: 3px;
|
14 |
-
border: 1px solid silver;
|
15 |
-
|
16 |
-
background: white;
|
17 |
-
font-size: 90%;
|
18 |
-
font-family: monospace;
|
19 |
-
|
20 |
-
max-height: 20em;
|
21 |
-
overflow-y: auto;
|
22 |
-
}
|
23 |
-
|
24 |
-
.CodeMirror-hint {
|
25 |
-
margin: 0;
|
26 |
-
padding: 0 4px;
|
27 |
-
border-radius: 2px;
|
28 |
-
white-space: pre;
|
29 |
-
color: black;
|
30 |
-
cursor: pointer;
|
31 |
-
}
|
32 |
-
|
33 |
-
li.CodeMirror-hint-active {
|
34 |
-
background: #08f;
|
35 |
-
color: white;
|
36 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/show-hint.js
DELETED
@@ -1,448 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
|
15 |
-
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
|
16 |
-
|
17 |
-
// This is the old interface, kept around for now to stay
|
18 |
-
// backwards-compatible.
|
19 |
-
CodeMirror.showHint = function(cm, getHints, options) {
|
20 |
-
if (!getHints) return cm.showHint(options);
|
21 |
-
if (options && options.async) getHints.async = true;
|
22 |
-
var newOpts = {hint: getHints};
|
23 |
-
if (options) for (var prop in options) newOpts[prop] = options[prop];
|
24 |
-
return cm.showHint(newOpts);
|
25 |
-
};
|
26 |
-
|
27 |
-
CodeMirror.defineExtension("showHint", function(options) {
|
28 |
-
options = parseOptions(this, this.getCursor("start"), options);
|
29 |
-
var selections = this.listSelections()
|
30 |
-
if (selections.length > 1) return;
|
31 |
-
// By default, don't allow completion when something is selected.
|
32 |
-
// A hint function can have a `supportsSelection` property to
|
33 |
-
// indicate that it can handle selections.
|
34 |
-
if (this.somethingSelected()) {
|
35 |
-
if (!options.hint.supportsSelection) return;
|
36 |
-
// Don't try with cross-line selections
|
37 |
-
for (var i = 0; i < selections.length; i++)
|
38 |
-
if (selections[i].head.line != selections[i].anchor.line) return;
|
39 |
-
}
|
40 |
-
|
41 |
-
if (this.state.completionActive) this.state.completionActive.close();
|
42 |
-
var completion = this.state.completionActive = new Completion(this, options);
|
43 |
-
if (!completion.options.hint) return;
|
44 |
-
|
45 |
-
CodeMirror.signal(this, "startCompletion", this);
|
46 |
-
completion.update(true);
|
47 |
-
});
|
48 |
-
|
49 |
-
CodeMirror.defineExtension("closeHint", function() {
|
50 |
-
if (this.state.completionActive) this.state.completionActive.close()
|
51 |
-
})
|
52 |
-
|
53 |
-
function Completion(cm, options) {
|
54 |
-
this.cm = cm;
|
55 |
-
this.options = options;
|
56 |
-
this.widget = null;
|
57 |
-
this.debounce = 0;
|
58 |
-
this.tick = 0;
|
59 |
-
this.startPos = this.cm.getCursor("start");
|
60 |
-
this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
|
61 |
-
|
62 |
-
var self = this;
|
63 |
-
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
|
64 |
-
}
|
65 |
-
|
66 |
-
var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
|
67 |
-
return setTimeout(fn, 1000/60);
|
68 |
-
};
|
69 |
-
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
|
70 |
-
|
71 |
-
Completion.prototype = {
|
72 |
-
close: function() {
|
73 |
-
if (!this.active()) return;
|
74 |
-
this.cm.state.completionActive = null;
|
75 |
-
this.tick = null;
|
76 |
-
this.cm.off("cursorActivity", this.activityFunc);
|
77 |
-
|
78 |
-
if (this.widget && this.data) CodeMirror.signal(this.data, "close");
|
79 |
-
if (this.widget) this.widget.close();
|
80 |
-
CodeMirror.signal(this.cm, "endCompletion", this.cm);
|
81 |
-
},
|
82 |
-
|
83 |
-
active: function() {
|
84 |
-
return this.cm.state.completionActive == this;
|
85 |
-
},
|
86 |
-
|
87 |
-
pick: function(data, i) {
|
88 |
-
var completion = data.list[i];
|
89 |
-
if (completion.hint) completion.hint(this.cm, data, completion);
|
90 |
-
else this.cm.replaceRange(getText(completion), completion.from || data.from,
|
91 |
-
completion.to || data.to, "complete");
|
92 |
-
CodeMirror.signal(data, "pick", completion);
|
93 |
-
this.close();
|
94 |
-
},
|
95 |
-
|
96 |
-
cursorActivity: function() {
|
97 |
-
if (this.debounce) {
|
98 |
-
cancelAnimationFrame(this.debounce);
|
99 |
-
this.debounce = 0;
|
100 |
-
}
|
101 |
-
|
102 |
-
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
|
103 |
-
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
|
104 |
-
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
|
105 |
-
(!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
|
106 |
-
this.close();
|
107 |
-
} else {
|
108 |
-
var self = this;
|
109 |
-
this.debounce = requestAnimationFrame(function() {self.update();});
|
110 |
-
if (this.widget) this.widget.disable();
|
111 |
-
}
|
112 |
-
},
|
113 |
-
|
114 |
-
update: function(first) {
|
115 |
-
if (this.tick == null) return
|
116 |
-
var self = this, myTick = ++this.tick
|
117 |
-
fetchHints(this.options.hint, this.cm, this.options, function(data) {
|
118 |
-
if (self.tick == myTick) self.finishUpdate(data, first)
|
119 |
-
})
|
120 |
-
},
|
121 |
-
|
122 |
-
finishUpdate: function(data, first) {
|
123 |
-
if (this.data) CodeMirror.signal(this.data, "update");
|
124 |
-
|
125 |
-
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
|
126 |
-
if (this.widget) this.widget.close();
|
127 |
-
|
128 |
-
this.data = data;
|
129 |
-
|
130 |
-
if (data && data.list.length) {
|
131 |
-
if (picked && data.list.length == 1) {
|
132 |
-
this.pick(data, 0);
|
133 |
-
} else {
|
134 |
-
this.widget = new Widget(this, data);
|
135 |
-
CodeMirror.signal(data, "shown");
|
136 |
-
}
|
137 |
-
}
|
138 |
-
}
|
139 |
-
};
|
140 |
-
|
141 |
-
function parseOptions(cm, pos, options) {
|
142 |
-
var editor = cm.options.hintOptions;
|
143 |
-
var out = {};
|
144 |
-
for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
|
145 |
-
if (editor) for (var prop in editor)
|
146 |
-
if (editor[prop] !== undefined) out[prop] = editor[prop];
|
147 |
-
if (options) for (var prop in options)
|
148 |
-
if (options[prop] !== undefined) out[prop] = options[prop];
|
149 |
-
if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
|
150 |
-
return out;
|
151 |
-
}
|
152 |
-
|
153 |
-
function getText(completion) {
|
154 |
-
if (typeof completion == "string") return completion;
|
155 |
-
else return completion.text;
|
156 |
-
}
|
157 |
-
|
158 |
-
function buildKeyMap(completion, handle) {
|
159 |
-
var baseMap = {
|
160 |
-
Up: function() {handle.moveFocus(-1);},
|
161 |
-
Down: function() {handle.moveFocus(1);},
|
162 |
-
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
|
163 |
-
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
|
164 |
-
Home: function() {handle.setFocus(0);},
|
165 |
-
End: function() {handle.setFocus(handle.length - 1);},
|
166 |
-
Enter: handle.pick,
|
167 |
-
Tab: handle.pick,
|
168 |
-
Esc: handle.close
|
169 |
-
};
|
170 |
-
|
171 |
-
var mac = /Mac/.test(navigator.platform);
|
172 |
-
|
173 |
-
if (mac) {
|
174 |
-
baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);};
|
175 |
-
baseMap["Ctrl-N"] = function() {handle.moveFocus(1);};
|
176 |
-
}
|
177 |
-
|
178 |
-
var custom = completion.options.customKeys;
|
179 |
-
var ourMap = custom ? {} : baseMap;
|
180 |
-
function addBinding(key, val) {
|
181 |
-
var bound;
|
182 |
-
if (typeof val != "string")
|
183 |
-
bound = function(cm) { return val(cm, handle); };
|
184 |
-
// This mechanism is deprecated
|
185 |
-
else if (baseMap.hasOwnProperty(val))
|
186 |
-
bound = baseMap[val];
|
187 |
-
else
|
188 |
-
bound = val;
|
189 |
-
ourMap[key] = bound;
|
190 |
-
}
|
191 |
-
if (custom)
|
192 |
-
for (var key in custom) if (custom.hasOwnProperty(key))
|
193 |
-
addBinding(key, custom[key]);
|
194 |
-
var extra = completion.options.extraKeys;
|
195 |
-
if (extra)
|
196 |
-
for (var key in extra) if (extra.hasOwnProperty(key))
|
197 |
-
addBinding(key, extra[key]);
|
198 |
-
return ourMap;
|
199 |
-
}
|
200 |
-
|
201 |
-
function getHintElement(hintsElement, el) {
|
202 |
-
while (el && el != hintsElement) {
|
203 |
-
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
|
204 |
-
el = el.parentNode;
|
205 |
-
}
|
206 |
-
}
|
207 |
-
|
208 |
-
function Widget(completion, data) {
|
209 |
-
this.completion = completion;
|
210 |
-
this.data = data;
|
211 |
-
this.picked = false;
|
212 |
-
var widget = this, cm = completion.cm;
|
213 |
-
var ownerDocument = cm.getInputField().ownerDocument;
|
214 |
-
var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow;
|
215 |
-
|
216 |
-
var hints = this.hints = ownerDocument.createElement("ul");
|
217 |
-
var theme = completion.cm.options.theme;
|
218 |
-
hints.className = "CodeMirror-hints " + theme;
|
219 |
-
this.selectedHint = data.selectedHint || 0;
|
220 |
-
|
221 |
-
var completions = data.list;
|
222 |
-
for (var i = 0; i < completions.length; ++i) {
|
223 |
-
var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i];
|
224 |
-
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
|
225 |
-
if (cur.className != null) className = cur.className + " " + className;
|
226 |
-
elt.className = className;
|
227 |
-
if (cur.render) cur.render(elt, data, cur);
|
228 |
-
else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur)));
|
229 |
-
elt.hintId = i;
|
230 |
-
}
|
231 |
-
|
232 |
-
var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
|
233 |
-
var left = pos.left, top = pos.bottom, below = true;
|
234 |
-
hints.style.left = left + "px";
|
235 |
-
hints.style.top = top + "px";
|
236 |
-
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
237 |
-
var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
|
238 |
-
var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
|
239 |
-
(completion.options.container || ownerDocument.body).appendChild(hints);
|
240 |
-
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
|
241 |
-
var scrolls = hints.scrollHeight > hints.clientHeight + 1
|
242 |
-
var startScroll = cm.getScrollInfo();
|
243 |
-
|
244 |
-
if (overlapY > 0) {
|
245 |
-
var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
|
246 |
-
if (curTop - height > 0) { // Fits above cursor
|
247 |
-
hints.style.top = (top = pos.top - height) + "px";
|
248 |
-
below = false;
|
249 |
-
} else if (height > winH) {
|
250 |
-
hints.style.height = (winH - 5) + "px";
|
251 |
-
hints.style.top = (top = pos.bottom - box.top) + "px";
|
252 |
-
var cursor = cm.getCursor();
|
253 |
-
if (data.from.ch != cursor.ch) {
|
254 |
-
pos = cm.cursorCoords(cursor);
|
255 |
-
hints.style.left = (left = pos.left) + "px";
|
256 |
-
box = hints.getBoundingClientRect();
|
257 |
-
}
|
258 |
-
}
|
259 |
-
}
|
260 |
-
var overlapX = box.right - winW;
|
261 |
-
if (overlapX > 0) {
|
262 |
-
if (box.right - box.left > winW) {
|
263 |
-
hints.style.width = (winW - 5) + "px";
|
264 |
-
overlapX -= (box.right - box.left) - winW;
|
265 |
-
}
|
266 |
-
hints.style.left = (left = pos.left - overlapX) + "px";
|
267 |
-
}
|
268 |
-
if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
|
269 |
-
node.style.paddingRight = cm.display.nativeBarWidth + "px"
|
270 |
-
|
271 |
-
cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
|
272 |
-
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
|
273 |
-
setFocus: function(n) { widget.changeActive(n); },
|
274 |
-
menuSize: function() { return widget.screenAmount(); },
|
275 |
-
length: completions.length,
|
276 |
-
close: function() { completion.close(); },
|
277 |
-
pick: function() { widget.pick(); },
|
278 |
-
data: data
|
279 |
-
}));
|
280 |
-
|
281 |
-
if (completion.options.closeOnUnfocus) {
|
282 |
-
var closingOnBlur;
|
283 |
-
cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
|
284 |
-
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
|
285 |
-
}
|
286 |
-
|
287 |
-
cm.on("scroll", this.onScroll = function() {
|
288 |
-
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
|
289 |
-
var newTop = top + startScroll.top - curScroll.top;
|
290 |
-
var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop);
|
291 |
-
if (!below) point += hints.offsetHeight;
|
292 |
-
if (point <= editor.top || point >= editor.bottom) return completion.close();
|
293 |
-
hints.style.top = newTop + "px";
|
294 |
-
hints.style.left = (left + startScroll.left - curScroll.left) + "px";
|
295 |
-
});
|
296 |
-
|
297 |
-
CodeMirror.on(hints, "dblclick", function(e) {
|
298 |
-
var t = getHintElement(hints, e.target || e.srcElement);
|
299 |
-
if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
|
300 |
-
});
|
301 |
-
|
302 |
-
CodeMirror.on(hints, "click", function(e) {
|
303 |
-
var t = getHintElement(hints, e.target || e.srcElement);
|
304 |
-
if (t && t.hintId != null) {
|
305 |
-
widget.changeActive(t.hintId);
|
306 |
-
if (completion.options.completeOnSingleClick) widget.pick();
|
307 |
-
}
|
308 |
-
});
|
309 |
-
|
310 |
-
CodeMirror.on(hints, "mousedown", function() {
|
311 |
-
setTimeout(function(){cm.focus();}, 20);
|
312 |
-
});
|
313 |
-
|
314 |
-
CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
|
315 |
-
return true;
|
316 |
-
}
|
317 |
-
|
318 |
-
Widget.prototype = {
|
319 |
-
close: function() {
|
320 |
-
if (this.completion.widget != this) return;
|
321 |
-
this.completion.widget = null;
|
322 |
-
this.hints.parentNode.removeChild(this.hints);
|
323 |
-
this.completion.cm.removeKeyMap(this.keyMap);
|
324 |
-
|
325 |
-
var cm = this.completion.cm;
|
326 |
-
if (this.completion.options.closeOnUnfocus) {
|
327 |
-
cm.off("blur", this.onBlur);
|
328 |
-
cm.off("focus", this.onFocus);
|
329 |
-
}
|
330 |
-
cm.off("scroll", this.onScroll);
|
331 |
-
},
|
332 |
-
|
333 |
-
disable: function() {
|
334 |
-
this.completion.cm.removeKeyMap(this.keyMap);
|
335 |
-
var widget = this;
|
336 |
-
this.keyMap = {Enter: function() { widget.picked = true; }};
|
337 |
-
this.completion.cm.addKeyMap(this.keyMap);
|
338 |
-
},
|
339 |
-
|
340 |
-
pick: function() {
|
341 |
-
this.completion.pick(this.data, this.selectedHint);
|
342 |
-
},
|
343 |
-
|
344 |
-
changeActive: function(i, avoidWrap) {
|
345 |
-
if (i >= this.data.list.length)
|
346 |
-
i = avoidWrap ? this.data.list.length - 1 : 0;
|
347 |
-
else if (i < 0)
|
348 |
-
i = avoidWrap ? 0 : this.data.list.length - 1;
|
349 |
-
if (this.selectedHint == i) return;
|
350 |
-
var node = this.hints.childNodes[this.selectedHint];
|
351 |
-
if (node) node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
|
352 |
-
node = this.hints.childNodes[this.selectedHint = i];
|
353 |
-
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
|
354 |
-
if (node.offsetTop < this.hints.scrollTop)
|
355 |
-
this.hints.scrollTop = node.offsetTop - 3;
|
356 |
-
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
|
357 |
-
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
|
358 |
-
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
|
359 |
-
},
|
360 |
-
|
361 |
-
screenAmount: function() {
|
362 |
-
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
|
363 |
-
}
|
364 |
-
};
|
365 |
-
|
366 |
-
function applicableHelpers(cm, helpers) {
|
367 |
-
if (!cm.somethingSelected()) return helpers
|
368 |
-
var result = []
|
369 |
-
for (var i = 0; i < helpers.length; i++)
|
370 |
-
if (helpers[i].supportsSelection) result.push(helpers[i])
|
371 |
-
return result
|
372 |
-
}
|
373 |
-
|
374 |
-
function fetchHints(hint, cm, options, callback) {
|
375 |
-
if (hint.async) {
|
376 |
-
hint(cm, callback, options)
|
377 |
-
} else {
|
378 |
-
var result = hint(cm, options)
|
379 |
-
if (result && result.then) result.then(callback)
|
380 |
-
else callback(result)
|
381 |
-
}
|
382 |
-
}
|
383 |
-
|
384 |
-
function resolveAutoHints(cm, pos) {
|
385 |
-
var helpers = cm.getHelpers(pos, "hint"), words
|
386 |
-
if (helpers.length) {
|
387 |
-
var resolved = function(cm, callback, options) {
|
388 |
-
var app = applicableHelpers(cm, helpers);
|
389 |
-
function run(i) {
|
390 |
-
if (i == app.length) return callback(null)
|
391 |
-
fetchHints(app[i], cm, options, function(result) {
|
392 |
-
if (result && result.list.length > 0) callback(result)
|
393 |
-
else run(i + 1)
|
394 |
-
})
|
395 |
-
}
|
396 |
-
run(0)
|
397 |
-
}
|
398 |
-
resolved.async = true
|
399 |
-
resolved.supportsSelection = true
|
400 |
-
return resolved
|
401 |
-
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
|
402 |
-
return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
|
403 |
-
} else if (CodeMirror.hint.anyword) {
|
404 |
-
return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
|
405 |
-
} else {
|
406 |
-
return function() {}
|
407 |
-
}
|
408 |
-
}
|
409 |
-
|
410 |
-
CodeMirror.registerHelper("hint", "auto", {
|
411 |
-
resolve: resolveAutoHints
|
412 |
-
});
|
413 |
-
|
414 |
-
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
|
415 |
-
var cur = cm.getCursor(), token = cm.getTokenAt(cur)
|
416 |
-
var term, from = CodeMirror.Pos(cur.line, token.start), to = cur
|
417 |
-
if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
|
418 |
-
term = token.string.substr(0, cur.ch - token.start)
|
419 |
-
} else {
|
420 |
-
term = ""
|
421 |
-
from = cur
|
422 |
-
}
|
423 |
-
var found = [];
|
424 |
-
for (var i = 0; i < options.words.length; i++) {
|
425 |
-
var word = options.words[i];
|
426 |
-
if (word.slice(0, term.length) == term)
|
427 |
-
found.push(word);
|
428 |
-
}
|
429 |
-
|
430 |
-
if (found.length) return {list: found, from: from, to: to};
|
431 |
-
});
|
432 |
-
|
433 |
-
CodeMirror.commands.autocomplete = CodeMirror.showHint;
|
434 |
-
|
435 |
-
var defaultOptions = {
|
436 |
-
hint: CodeMirror.hint.auto,
|
437 |
-
completeSingle: true,
|
438 |
-
alignWithWord: true,
|
439 |
-
closeCharacters: /[\s()\[\]{};:>,]/,
|
440 |
-
closeOnUnfocus: true,
|
441 |
-
completeOnSingleClick: true,
|
442 |
-
container: null,
|
443 |
-
customKeys: null,
|
444 |
-
extraKeys: null
|
445 |
-
};
|
446 |
-
|
447 |
-
CodeMirror.defineOption("hintOptions", null);
|
448 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/sql-hint.js
DELETED
@@ -1,299 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), require("../../mode/sql/sql"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror", "../../mode/sql/sql"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var tables;
|
15 |
-
var defaultTable;
|
16 |
-
var keywords;
|
17 |
-
var identifierQuote;
|
18 |
-
var CONS = {
|
19 |
-
QUERY_DIV: ";",
|
20 |
-
ALIAS_KEYWORD: "AS"
|
21 |
-
};
|
22 |
-
var Pos = CodeMirror.Pos, cmpPos = CodeMirror.cmpPos;
|
23 |
-
|
24 |
-
function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }
|
25 |
-
|
26 |
-
function getKeywords(editor) {
|
27 |
-
var mode = editor.doc.modeOption;
|
28 |
-
if (mode === "sql") mode = "text/x-sql";
|
29 |
-
return CodeMirror.resolveMode(mode).keywords;
|
30 |
-
}
|
31 |
-
|
32 |
-
function getIdentifierQuote(editor) {
|
33 |
-
var mode = editor.doc.modeOption;
|
34 |
-
if (mode === "sql") mode = "text/x-sql";
|
35 |
-
return CodeMirror.resolveMode(mode).identifierQuote || "`";
|
36 |
-
}
|
37 |
-
|
38 |
-
function getText(item) {
|
39 |
-
return typeof item == "string" ? item : item.text;
|
40 |
-
}
|
41 |
-
|
42 |
-
function wrapTable(name, value) {
|
43 |
-
if (isArray(value)) value = {columns: value}
|
44 |
-
if (!value.text) value.text = name
|
45 |
-
return value
|
46 |
-
}
|
47 |
-
|
48 |
-
function parseTables(input) {
|
49 |
-
var result = {}
|
50 |
-
if (isArray(input)) {
|
51 |
-
for (var i = input.length - 1; i >= 0; i--) {
|
52 |
-
var item = input[i]
|
53 |
-
result[getText(item).toUpperCase()] = wrapTable(getText(item), item)
|
54 |
-
}
|
55 |
-
} else if (input) {
|
56 |
-
for (var name in input)
|
57 |
-
result[name.toUpperCase()] = wrapTable(name, input[name])
|
58 |
-
}
|
59 |
-
return result
|
60 |
-
}
|
61 |
-
|
62 |
-
function getTable(name) {
|
63 |
-
return tables[name.toUpperCase()]
|
64 |
-
}
|
65 |
-
|
66 |
-
function shallowClone(object) {
|
67 |
-
var result = {};
|
68 |
-
for (var key in object) if (object.hasOwnProperty(key))
|
69 |
-
result[key] = object[key];
|
70 |
-
return result;
|
71 |
-
}
|
72 |
-
|
73 |
-
function match(string, word) {
|
74 |
-
var len = string.length;
|
75 |
-
var sub = getText(word).substr(0, len);
|
76 |
-
return string.toUpperCase() === sub.toUpperCase();
|
77 |
-
}
|
78 |
-
|
79 |
-
function addMatches(result, search, wordlist, formatter) {
|
80 |
-
if (isArray(wordlist)) {
|
81 |
-
for (var i = 0; i < wordlist.length; i++)
|
82 |
-
if (match(search, wordlist[i])) result.push(formatter(wordlist[i]))
|
83 |
-
} else {
|
84 |
-
for (var word in wordlist) if (wordlist.hasOwnProperty(word)) {
|
85 |
-
var val = wordlist[word]
|
86 |
-
if (!val || val === true)
|
87 |
-
val = word
|
88 |
-
else
|
89 |
-
val = val.displayText ? {text: val.text, displayText: val.displayText} : val.text
|
90 |
-
if (match(search, val)) result.push(formatter(val))
|
91 |
-
}
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
function cleanName(name) {
|
96 |
-
// Get rid name from identifierQuote and preceding dot(.)
|
97 |
-
if (name.charAt(0) == ".") {
|
98 |
-
name = name.substr(1);
|
99 |
-
}
|
100 |
-
// replace doublicated identifierQuotes with single identifierQuotes
|
101 |
-
// and remove single identifierQuotes
|
102 |
-
var nameParts = name.split(identifierQuote+identifierQuote);
|
103 |
-
for (var i = 0; i < nameParts.length; i++)
|
104 |
-
nameParts[i] = nameParts[i].replace(new RegExp(identifierQuote,"g"), "");
|
105 |
-
return nameParts.join(identifierQuote);
|
106 |
-
}
|
107 |
-
|
108 |
-
function insertIdentifierQuotes(name) {
|
109 |
-
var nameParts = getText(name).split(".");
|
110 |
-
for (var i = 0; i < nameParts.length; i++)
|
111 |
-
nameParts[i] = identifierQuote +
|
112 |
-
// doublicate identifierQuotes
|
113 |
-
nameParts[i].replace(new RegExp(identifierQuote,"g"), identifierQuote+identifierQuote) +
|
114 |
-
identifierQuote;
|
115 |
-
var escaped = nameParts.join(".");
|
116 |
-
if (typeof name == "string") return escaped;
|
117 |
-
name = shallowClone(name);
|
118 |
-
name.text = escaped;
|
119 |
-
return name;
|
120 |
-
}
|
121 |
-
|
122 |
-
function nameCompletion(cur, token, result, editor) {
|
123 |
-
// Try to complete table, column names and return start position of completion
|
124 |
-
var useIdentifierQuotes = false;
|
125 |
-
var nameParts = [];
|
126 |
-
var start = token.start;
|
127 |
-
var cont = true;
|
128 |
-
while (cont) {
|
129 |
-
cont = (token.string.charAt(0) == ".");
|
130 |
-
useIdentifierQuotes = useIdentifierQuotes || (token.string.charAt(0) == identifierQuote);
|
131 |
-
|
132 |
-
start = token.start;
|
133 |
-
nameParts.unshift(cleanName(token.string));
|
134 |
-
|
135 |
-
token = editor.getTokenAt(Pos(cur.line, token.start));
|
136 |
-
if (token.string == ".") {
|
137 |
-
cont = true;
|
138 |
-
token = editor.getTokenAt(Pos(cur.line, token.start));
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
// Try to complete table names
|
143 |
-
var string = nameParts.join(".");
|
144 |
-
addMatches(result, string, tables, function(w) {
|
145 |
-
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
|
146 |
-
});
|
147 |
-
|
148 |
-
// Try to complete columns from defaultTable
|
149 |
-
addMatches(result, string, defaultTable, function(w) {
|
150 |
-
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
|
151 |
-
});
|
152 |
-
|
153 |
-
// Try to complete columns
|
154 |
-
string = nameParts.pop();
|
155 |
-
var table = nameParts.join(".");
|
156 |
-
|
157 |
-
var alias = false;
|
158 |
-
var aliasTable = table;
|
159 |
-
// Check if table is available. If not, find table by Alias
|
160 |
-
if (!getTable(table)) {
|
161 |
-
var oldTable = table;
|
162 |
-
table = findTableByAlias(table, editor);
|
163 |
-
if (table !== oldTable) alias = true;
|
164 |
-
}
|
165 |
-
|
166 |
-
var columns = getTable(table);
|
167 |
-
if (columns && columns.columns)
|
168 |
-
columns = columns.columns;
|
169 |
-
|
170 |
-
if (columns) {
|
171 |
-
addMatches(result, string, columns, function(w) {
|
172 |
-
var tableInsert = table;
|
173 |
-
if (alias == true) tableInsert = aliasTable;
|
174 |
-
if (typeof w == "string") {
|
175 |
-
w = tableInsert + "." + w;
|
176 |
-
} else {
|
177 |
-
w = shallowClone(w);
|
178 |
-
w.text = tableInsert + "." + w.text;
|
179 |
-
}
|
180 |
-
return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
|
181 |
-
});
|
182 |
-
}
|
183 |
-
|
184 |
-
return start;
|
185 |
-
}
|
186 |
-
|
187 |
-
function eachWord(lineText, f) {
|
188 |
-
var words = lineText.split(/\s+/)
|
189 |
-
for (var i = 0; i < words.length; i++)
|
190 |
-
if (words[i]) f(words[i].replace(/[,;]/g, ''))
|
191 |
-
}
|
192 |
-
|
193 |
-
function findTableByAlias(alias, editor) {
|
194 |
-
var doc = editor.doc;
|
195 |
-
var fullQuery = doc.getValue();
|
196 |
-
var aliasUpperCase = alias.toUpperCase();
|
197 |
-
var previousWord = "";
|
198 |
-
var table = "";
|
199 |
-
var separator = [];
|
200 |
-
var validRange = {
|
201 |
-
start: Pos(0, 0),
|
202 |
-
end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length)
|
203 |
-
};
|
204 |
-
|
205 |
-
//add separator
|
206 |
-
var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV);
|
207 |
-
while(indexOfSeparator != -1) {
|
208 |
-
separator.push(doc.posFromIndex(indexOfSeparator));
|
209 |
-
indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator+1);
|
210 |
-
}
|
211 |
-
separator.unshift(Pos(0, 0));
|
212 |
-
separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length));
|
213 |
-
|
214 |
-
//find valid range
|
215 |
-
var prevItem = null;
|
216 |
-
var current = editor.getCursor()
|
217 |
-
for (var i = 0; i < separator.length; i++) {
|
218 |
-
if ((prevItem == null || cmpPos(current, prevItem) > 0) && cmpPos(current, separator[i]) <= 0) {
|
219 |
-
validRange = {start: prevItem, end: separator[i]};
|
220 |
-
break;
|
221 |
-
}
|
222 |
-
prevItem = separator[i];
|
223 |
-
}
|
224 |
-
|
225 |
-
if (validRange.start) {
|
226 |
-
var query = doc.getRange(validRange.start, validRange.end, false);
|
227 |
-
|
228 |
-
for (var i = 0; i < query.length; i++) {
|
229 |
-
var lineText = query[i];
|
230 |
-
eachWord(lineText, function(word) {
|
231 |
-
var wordUpperCase = word.toUpperCase();
|
232 |
-
if (wordUpperCase === aliasUpperCase && getTable(previousWord))
|
233 |
-
table = previousWord;
|
234 |
-
if (wordUpperCase !== CONS.ALIAS_KEYWORD)
|
235 |
-
previousWord = word;
|
236 |
-
});
|
237 |
-
if (table) break;
|
238 |
-
}
|
239 |
-
}
|
240 |
-
return table;
|
241 |
-
}
|
242 |
-
|
243 |
-
CodeMirror.registerHelper("hint", "sql", function(editor, options) {
|
244 |
-
tables = parseTables(options && options.tables)
|
245 |
-
var defaultTableName = options && options.defaultTable;
|
246 |
-
var disableKeywords = options && options.disableKeywords;
|
247 |
-
defaultTable = defaultTableName && getTable(defaultTableName);
|
248 |
-
keywords = getKeywords(editor);
|
249 |
-
identifierQuote = getIdentifierQuote(editor);
|
250 |
-
|
251 |
-
if (defaultTableName && !defaultTable)
|
252 |
-
defaultTable = findTableByAlias(defaultTableName, editor);
|
253 |
-
|
254 |
-
defaultTable = defaultTable || [];
|
255 |
-
|
256 |
-
if (defaultTable.columns)
|
257 |
-
defaultTable = defaultTable.columns;
|
258 |
-
|
259 |
-
var cur = editor.getCursor();
|
260 |
-
var result = [];
|
261 |
-
var token = editor.getTokenAt(cur), start, end, search;
|
262 |
-
if (token.end > cur.ch) {
|
263 |
-
token.end = cur.ch;
|
264 |
-
token.string = token.string.slice(0, cur.ch - token.start);
|
265 |
-
}
|
266 |
-
|
267 |
-
if (token.string.match(/^[.`"\w@]\w*$/)) {
|
268 |
-
search = token.string;
|
269 |
-
start = token.start;
|
270 |
-
end = token.end;
|
271 |
-
} else {
|
272 |
-
start = end = cur.ch;
|
273 |
-
search = "";
|
274 |
-
}
|
275 |
-
if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) {
|
276 |
-
start = nameCompletion(cur, token, result, editor);
|
277 |
-
} else {
|
278 |
-
addMatches(result, search, defaultTable, function(w) {return {text:w, className: "CodeMirror-hint-table CodeMirror-hint-default-table"};});
|
279 |
-
addMatches(
|
280 |
-
result,
|
281 |
-
search,
|
282 |
-
tables,
|
283 |
-
function(w) {
|
284 |
-
if (typeof w === 'object') {
|
285 |
-
w.className = "CodeMirror-hint-table";
|
286 |
-
} else {
|
287 |
-
w = {text: w, className: "CodeMirror-hint-table"};
|
288 |
-
}
|
289 |
-
|
290 |
-
return w;
|
291 |
-
}
|
292 |
-
);
|
293 |
-
if (!disableKeywords)
|
294 |
-
addMatches(result, search, keywords, function(w) {return {text: w.toUpperCase(), className: "CodeMirror-hint-keyword"};});
|
295 |
-
}
|
296 |
-
|
297 |
-
return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
|
298 |
-
});
|
299 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/hint/xml-hint.js
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var Pos = CodeMirror.Pos;
|
15 |
-
|
16 |
-
function getHints(cm, options) {
|
17 |
-
var tags = options && options.schemaInfo;
|
18 |
-
var quote = (options && options.quoteChar) || '"';
|
19 |
-
if (!tags) return;
|
20 |
-
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
21 |
-
if (token.end > cur.ch) {
|
22 |
-
token.end = cur.ch;
|
23 |
-
token.string = token.string.slice(0, cur.ch - token.start);
|
24 |
-
}
|
25 |
-
var inner = CodeMirror.innerMode(cm.getMode(), token.state);
|
26 |
-
if (inner.mode.name != "xml") return;
|
27 |
-
var result = [], replaceToken = false, prefix;
|
28 |
-
var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string);
|
29 |
-
var tagName = tag && /^\w/.test(token.string), tagStart;
|
30 |
-
|
31 |
-
if (tagName) {
|
32 |
-
var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start);
|
33 |
-
var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null;
|
34 |
-
if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1);
|
35 |
-
} else if (tag && token.string == "<") {
|
36 |
-
tagType = "open";
|
37 |
-
} else if (tag && token.string == "</") {
|
38 |
-
tagType = "close";
|
39 |
-
}
|
40 |
-
|
41 |
-
if (!tag && !inner.state.tagName || tagType) {
|
42 |
-
if (tagName)
|
43 |
-
prefix = token.string;
|
44 |
-
replaceToken = tagType;
|
45 |
-
var cx = inner.state.context, curTag = cx && tags[cx.tagName];
|
46 |
-
var childList = cx ? curTag && curTag.children : tags["!top"];
|
47 |
-
if (childList && tagType != "close") {
|
48 |
-
for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i].lastIndexOf(prefix, 0) == 0)
|
49 |
-
result.push("<" + childList[i]);
|
50 |
-
} else if (tagType != "close") {
|
51 |
-
for (var name in tags)
|
52 |
-
if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name.lastIndexOf(prefix, 0) == 0))
|
53 |
-
result.push("<" + name);
|
54 |
-
}
|
55 |
-
if (cx && (!prefix || tagType == "close" && cx.tagName.lastIndexOf(prefix, 0) == 0))
|
56 |
-
result.push("</" + cx.tagName + ">");
|
57 |
-
} else {
|
58 |
-
// Attribute completion
|
59 |
-
var curTag = tags[inner.state.tagName], attrs = curTag && curTag.attrs;
|
60 |
-
var globalAttrs = tags["!attrs"];
|
61 |
-
if (!attrs && !globalAttrs) return;
|
62 |
-
if (!attrs) {
|
63 |
-
attrs = globalAttrs;
|
64 |
-
} else if (globalAttrs) { // Combine tag-local and global attributes
|
65 |
-
var set = {};
|
66 |
-
for (var nm in globalAttrs) if (globalAttrs.hasOwnProperty(nm)) set[nm] = globalAttrs[nm];
|
67 |
-
for (var nm in attrs) if (attrs.hasOwnProperty(nm)) set[nm] = attrs[nm];
|
68 |
-
attrs = set;
|
69 |
-
}
|
70 |
-
if (token.type == "string" || token.string == "=") { // A value
|
71 |
-
var before = cm.getRange(Pos(cur.line, Math.max(0, cur.ch - 60)),
|
72 |
-
Pos(cur.line, token.type == "string" ? token.start : token.end));
|
73 |
-
var atName = before.match(/([^\s\u00a0=<>\"\']+)=$/), atValues;
|
74 |
-
if (!atName || !attrs.hasOwnProperty(atName[1]) || !(atValues = attrs[atName[1]])) return;
|
75 |
-
if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget
|
76 |
-
if (token.type == "string") {
|
77 |
-
prefix = token.string;
|
78 |
-
var n = 0;
|
79 |
-
if (/['"]/.test(token.string.charAt(0))) {
|
80 |
-
quote = token.string.charAt(0);
|
81 |
-
prefix = token.string.slice(1);
|
82 |
-
n++;
|
83 |
-
}
|
84 |
-
var len = token.string.length;
|
85 |
-
if (/['"]/.test(token.string.charAt(len - 1))) {
|
86 |
-
quote = token.string.charAt(len - 1);
|
87 |
-
prefix = token.string.substr(n, len - 2);
|
88 |
-
}
|
89 |
-
replaceToken = true;
|
90 |
-
}
|
91 |
-
for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i].lastIndexOf(prefix, 0) == 0)
|
92 |
-
result.push(quote + atValues[i] + quote);
|
93 |
-
} else { // An attribute name
|
94 |
-
if (token.type == "attribute") {
|
95 |
-
prefix = token.string;
|
96 |
-
replaceToken = true;
|
97 |
-
}
|
98 |
-
for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr.lastIndexOf(prefix, 0) == 0))
|
99 |
-
result.push(attr);
|
100 |
-
}
|
101 |
-
}
|
102 |
-
return {
|
103 |
-
list: result,
|
104 |
-
from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur,
|
105 |
-
to: replaceToken ? Pos(cur.line, token.end) : cur
|
106 |
-
};
|
107 |
-
}
|
108 |
-
|
109 |
-
CodeMirror.registerHelper("hint", "xml", getHints);
|
110 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/coffeescript-lint.js
DELETED
@@ -1,47 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js
|
5 |
-
|
6 |
-
// declare global: coffeelint
|
7 |
-
|
8 |
-
(function(mod) {
|
9 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10 |
-
mod(require("../../lib/codemirror"));
|
11 |
-
else if (typeof define == "function" && define.amd) // AMD
|
12 |
-
define(["../../lib/codemirror"], mod);
|
13 |
-
else // Plain browser env
|
14 |
-
mod(CodeMirror);
|
15 |
-
})(function(CodeMirror) {
|
16 |
-
"use strict";
|
17 |
-
|
18 |
-
CodeMirror.registerHelper("lint", "coffeescript", function(text) {
|
19 |
-
var found = [];
|
20 |
-
if (!window.coffeelint) {
|
21 |
-
if (window.console) {
|
22 |
-
window.console.error("Error: window.coffeelint not defined, CodeMirror CoffeeScript linting cannot run.");
|
23 |
-
}
|
24 |
-
return found;
|
25 |
-
}
|
26 |
-
var parseError = function(err) {
|
27 |
-
var loc = err.lineNumber;
|
28 |
-
found.push({from: CodeMirror.Pos(loc-1, 0),
|
29 |
-
to: CodeMirror.Pos(loc, 0),
|
30 |
-
severity: err.level,
|
31 |
-
message: err.message});
|
32 |
-
};
|
33 |
-
try {
|
34 |
-
var res = coffeelint.lint(text);
|
35 |
-
for(var i = 0; i < res.length; i++) {
|
36 |
-
parseError(res[i]);
|
37 |
-
}
|
38 |
-
} catch(e) {
|
39 |
-
found.push({from: CodeMirror.Pos(e.location.first_line, 0),
|
40 |
-
to: CodeMirror.Pos(e.location.last_line, e.location.last_column),
|
41 |
-
severity: 'error',
|
42 |
-
message: e.message});
|
43 |
-
}
|
44 |
-
return found;
|
45 |
-
});
|
46 |
-
|
47 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/css-lint.js
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Depends on csslint.js from https://github.com/stubbornella/csslint
|
5 |
-
|
6 |
-
// declare global: CSSLint
|
7 |
-
|
8 |
-
(function(mod) {
|
9 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10 |
-
mod(require("../../lib/codemirror"));
|
11 |
-
else if (typeof define == "function" && define.amd) // AMD
|
12 |
-
define(["../../lib/codemirror"], mod);
|
13 |
-
else // Plain browser env
|
14 |
-
mod(CodeMirror);
|
15 |
-
})(function(CodeMirror) {
|
16 |
-
"use strict";
|
17 |
-
|
18 |
-
CodeMirror.registerHelper("lint", "css", function(text, options) {
|
19 |
-
var found = [];
|
20 |
-
if (!window.CSSLint) {
|
21 |
-
if (window.console) {
|
22 |
-
window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run.");
|
23 |
-
}
|
24 |
-
return found;
|
25 |
-
}
|
26 |
-
var results = CSSLint.verify(text, options), messages = results.messages, message = null;
|
27 |
-
for ( var i = 0; i < messages.length; i++) {
|
28 |
-
message = messages[i];
|
29 |
-
var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col;
|
30 |
-
found.push({
|
31 |
-
from: CodeMirror.Pos(startLine, startCol),
|
32 |
-
to: CodeMirror.Pos(endLine, endCol),
|
33 |
-
message: message.message,
|
34 |
-
severity : message.type
|
35 |
-
});
|
36 |
-
}
|
37 |
-
return found;
|
38 |
-
});
|
39 |
-
|
40 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/html-lint.js
DELETED
@@ -1,53 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js
|
5 |
-
|
6 |
-
// declare global: HTMLHint
|
7 |
-
|
8 |
-
(function(mod) {
|
9 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10 |
-
mod(require("../../lib/codemirror"), require("htmlhint"));
|
11 |
-
else if (typeof define == "function" && define.amd) // AMD
|
12 |
-
define(["../../lib/codemirror", "htmlhint"], mod);
|
13 |
-
else // Plain browser env
|
14 |
-
mod(CodeMirror, window.HTMLHint);
|
15 |
-
})(function(CodeMirror, HTMLHint) {
|
16 |
-
"use strict";
|
17 |
-
|
18 |
-
var defaultRules = {
|
19 |
-
"tagname-lowercase": true,
|
20 |
-
"attr-lowercase": true,
|
21 |
-
"attr-value-double-quotes": true,
|
22 |
-
"doctype-first": false,
|
23 |
-
"tag-pair": true,
|
24 |
-
"spec-char-escape": true,
|
25 |
-
"id-unique": true,
|
26 |
-
"src-not-empty": true,
|
27 |
-
"attr-no-duplication": true
|
28 |
-
};
|
29 |
-
|
30 |
-
CodeMirror.registerHelper("lint", "html", function(text, options) {
|
31 |
-
var found = [];
|
32 |
-
if (HTMLHint && !HTMLHint.verify) HTMLHint = HTMLHint.HTMLHint;
|
33 |
-
if (!HTMLHint) HTMLHint = window.HTMLHint;
|
34 |
-
if (!HTMLHint) {
|
35 |
-
if (window.console) {
|
36 |
-
window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.");
|
37 |
-
}
|
38 |
-
return found;
|
39 |
-
}
|
40 |
-
var messages = HTMLHint.verify(text, options && options.rules || defaultRules);
|
41 |
-
for (var i = 0; i < messages.length; i++) {
|
42 |
-
var message = messages[i];
|
43 |
-
var startLine = message.line - 1, endLine = message.line - 1, startCol = message.col - 1, endCol = message.col;
|
44 |
-
found.push({
|
45 |
-
from: CodeMirror.Pos(startLine, startCol),
|
46 |
-
to: CodeMirror.Pos(endLine, endCol),
|
47 |
-
message: message.message,
|
48 |
-
severity : message.type
|
49 |
-
});
|
50 |
-
}
|
51 |
-
return found;
|
52 |
-
});
|
53 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/javascript-lint.js
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
// declare global: JSHINT
|
14 |
-
|
15 |
-
function validator(text, options) {
|
16 |
-
if (!window.JSHINT) {
|
17 |
-
if (window.console) {
|
18 |
-
window.console.error("Error: window.JSHINT not defined, CodeMirror JavaScript linting cannot run.");
|
19 |
-
}
|
20 |
-
return [];
|
21 |
-
}
|
22 |
-
if (!options.indent) // JSHint error.character actually is a column index, this fixes underlining on lines using tabs for indentation
|
23 |
-
options.indent = 1; // JSHint default value is 4
|
24 |
-
JSHINT(text, options, options.globals);
|
25 |
-
var errors = JSHINT.data().errors, result = [];
|
26 |
-
if (errors) parseErrors(errors, result);
|
27 |
-
return result;
|
28 |
-
}
|
29 |
-
|
30 |
-
CodeMirror.registerHelper("lint", "javascript", validator);
|
31 |
-
|
32 |
-
function parseErrors(errors, output) {
|
33 |
-
for ( var i = 0; i < errors.length; i++) {
|
34 |
-
var error = errors[i];
|
35 |
-
if (error) {
|
36 |
-
if (error.line <= 0) {
|
37 |
-
if (window.console) {
|
38 |
-
window.console.warn("Cannot display JSHint error (invalid line " + error.line + ")", error);
|
39 |
-
}
|
40 |
-
continue;
|
41 |
-
}
|
42 |
-
|
43 |
-
var start = error.character - 1, end = start + 1;
|
44 |
-
if (error.evidence) {
|
45 |
-
var index = error.evidence.substring(start).search(/.\b/);
|
46 |
-
if (index > -1) {
|
47 |
-
end += index;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
// Convert to format expected by validation service
|
52 |
-
var hint = {
|
53 |
-
message: error.reason,
|
54 |
-
severity: error.code ? (error.code.startsWith('W') ? "warning" : "error") : "error",
|
55 |
-
from: CodeMirror.Pos(error.line - 1, start),
|
56 |
-
to: CodeMirror.Pos(error.line - 1, end)
|
57 |
-
};
|
58 |
-
|
59 |
-
output.push(hint);
|
60 |
-
}
|
61 |
-
}
|
62 |
-
}
|
63 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/json-lint.js
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
|
5 |
-
|
6 |
-
// declare global: jsonlint
|
7 |
-
|
8 |
-
(function(mod) {
|
9 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
10 |
-
mod(require("../../lib/codemirror"));
|
11 |
-
else if (typeof define == "function" && define.amd) // AMD
|
12 |
-
define(["../../lib/codemirror"], mod);
|
13 |
-
else // Plain browser env
|
14 |
-
mod(CodeMirror);
|
15 |
-
})(function(CodeMirror) {
|
16 |
-
"use strict";
|
17 |
-
|
18 |
-
CodeMirror.registerHelper("lint", "json", function(text) {
|
19 |
-
var found = [];
|
20 |
-
if (!window.jsonlint) {
|
21 |
-
if (window.console) {
|
22 |
-
window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run.");
|
23 |
-
}
|
24 |
-
return found;
|
25 |
-
}
|
26 |
-
// for jsonlint's web dist jsonlint is exported as an object with a single property parser, of which parseError
|
27 |
-
// is a subproperty
|
28 |
-
var jsonlint = window.jsonlint.parser || window.jsonlint
|
29 |
-
jsonlint.parseError = function(str, hash) {
|
30 |
-
var loc = hash.loc;
|
31 |
-
found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
|
32 |
-
to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
|
33 |
-
message: str});
|
34 |
-
};
|
35 |
-
try { jsonlint.parse(text); }
|
36 |
-
catch(e) {}
|
37 |
-
return found;
|
38 |
-
});
|
39 |
-
|
40 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/lint.css
DELETED
@@ -1,73 +0,0 @@
|
|
1 |
-
/* The lint marker gutter */
|
2 |
-
.CodeMirror-lint-markers {
|
3 |
-
width: 16px;
|
4 |
-
}
|
5 |
-
|
6 |
-
.CodeMirror-lint-tooltip {
|
7 |
-
background-color: #ffd;
|
8 |
-
border: 1px solid black;
|
9 |
-
border-radius: 4px 4px 4px 4px;
|
10 |
-
color: black;
|
11 |
-
font-family: monospace;
|
12 |
-
font-size: 10pt;
|
13 |
-
overflow: hidden;
|
14 |
-
padding: 2px 5px;
|
15 |
-
position: fixed;
|
16 |
-
white-space: pre;
|
17 |
-
white-space: pre-wrap;
|
18 |
-
z-index: 100;
|
19 |
-
max-width: 600px;
|
20 |
-
opacity: 0;
|
21 |
-
transition: opacity .4s;
|
22 |
-
-moz-transition: opacity .4s;
|
23 |
-
-webkit-transition: opacity .4s;
|
24 |
-
-o-transition: opacity .4s;
|
25 |
-
-ms-transition: opacity .4s;
|
26 |
-
}
|
27 |
-
|
28 |
-
.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {
|
29 |
-
background-position: left bottom;
|
30 |
-
background-repeat: repeat-x;
|
31 |
-
}
|
32 |
-
|
33 |
-
.CodeMirror-lint-mark-error {
|
34 |
-
background-image:
|
35 |
-
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
|
36 |
-
;
|
37 |
-
}
|
38 |
-
|
39 |
-
.CodeMirror-lint-mark-warning {
|
40 |
-
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
|
41 |
-
}
|
42 |
-
|
43 |
-
.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
|
44 |
-
background-position: center center;
|
45 |
-
background-repeat: no-repeat;
|
46 |
-
cursor: pointer;
|
47 |
-
display: inline-block;
|
48 |
-
height: 16px;
|
49 |
-
width: 16px;
|
50 |
-
vertical-align: middle;
|
51 |
-
position: relative;
|
52 |
-
}
|
53 |
-
|
54 |
-
.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning {
|
55 |
-
padding-left: 18px;
|
56 |
-
background-position: top left;
|
57 |
-
background-repeat: no-repeat;
|
58 |
-
}
|
59 |
-
|
60 |
-
.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
|
61 |
-
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
|
62 |
-
}
|
63 |
-
|
64 |
-
.CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
|
65 |
-
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=");
|
66 |
-
}
|
67 |
-
|
68 |
-
.CodeMirror-lint-marker-multiple {
|
69 |
-
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
|
70 |
-
background-repeat: no-repeat;
|
71 |
-
background-position: right bottom;
|
72 |
-
width: 100%; height: 100%;
|
73 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/lint.js
DELETED
@@ -1,252 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
var GUTTER_ID = "CodeMirror-lint-markers";
|
14 |
-
|
15 |
-
function showTooltip(e, content) {
|
16 |
-
var tt = document.createElement("div");
|
17 |
-
tt.className = "CodeMirror-lint-tooltip";
|
18 |
-
tt.appendChild(content.cloneNode(true));
|
19 |
-
document.body.appendChild(tt);
|
20 |
-
|
21 |
-
function position(e) {
|
22 |
-
if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position);
|
23 |
-
tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px";
|
24 |
-
tt.style.left = (e.clientX + 5) + "px";
|
25 |
-
}
|
26 |
-
CodeMirror.on(document, "mousemove", position);
|
27 |
-
position(e);
|
28 |
-
if (tt.style.opacity != null) tt.style.opacity = 1;
|
29 |
-
return tt;
|
30 |
-
}
|
31 |
-
function rm(elt) {
|
32 |
-
if (elt.parentNode) elt.parentNode.removeChild(elt);
|
33 |
-
}
|
34 |
-
function hideTooltip(tt) {
|
35 |
-
if (!tt.parentNode) return;
|
36 |
-
if (tt.style.opacity == null) rm(tt);
|
37 |
-
tt.style.opacity = 0;
|
38 |
-
setTimeout(function() { rm(tt); }, 600);
|
39 |
-
}
|
40 |
-
|
41 |
-
function showTooltipFor(e, content, node) {
|
42 |
-
var tooltip = showTooltip(e, content);
|
43 |
-
function hide() {
|
44 |
-
CodeMirror.off(node, "mouseout", hide);
|
45 |
-
if (tooltip) { hideTooltip(tooltip); tooltip = null; }
|
46 |
-
}
|
47 |
-
var poll = setInterval(function() {
|
48 |
-
if (tooltip) for (var n = node;; n = n.parentNode) {
|
49 |
-
if (n && n.nodeType == 11) n = n.host;
|
50 |
-
if (n == document.body) return;
|
51 |
-
if (!n) { hide(); break; }
|
52 |
-
}
|
53 |
-
if (!tooltip) return clearInterval(poll);
|
54 |
-
}, 400);
|
55 |
-
CodeMirror.on(node, "mouseout", hide);
|
56 |
-
}
|
57 |
-
|
58 |
-
function LintState(cm, options, hasGutter) {
|
59 |
-
this.marked = [];
|
60 |
-
this.options = options;
|
61 |
-
this.timeout = null;
|
62 |
-
this.hasGutter = hasGutter;
|
63 |
-
this.onMouseOver = function(e) { onMouseOver(cm, e); };
|
64 |
-
this.waitingFor = 0
|
65 |
-
}
|
66 |
-
|
67 |
-
function parseOptions(_cm, options) {
|
68 |
-
if (options instanceof Function) return {getAnnotations: options};
|
69 |
-
if (!options || options === true) options = {};
|
70 |
-
return options;
|
71 |
-
}
|
72 |
-
|
73 |
-
function clearMarks(cm) {
|
74 |
-
var state = cm.state.lint;
|
75 |
-
if (state.hasGutter) cm.clearGutter(GUTTER_ID);
|
76 |
-
for (var i = 0; i < state.marked.length; ++i)
|
77 |
-
state.marked[i].clear();
|
78 |
-
state.marked.length = 0;
|
79 |
-
}
|
80 |
-
|
81 |
-
function makeMarker(labels, severity, multiple, tooltips) {
|
82 |
-
var marker = document.createElement("div"), inner = marker;
|
83 |
-
marker.className = "CodeMirror-lint-marker-" + severity;
|
84 |
-
if (multiple) {
|
85 |
-
inner = marker.appendChild(document.createElement("div"));
|
86 |
-
inner.className = "CodeMirror-lint-marker-multiple";
|
87 |
-
}
|
88 |
-
|
89 |
-
if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
|
90 |
-
showTooltipFor(e, labels, inner);
|
91 |
-
});
|
92 |
-
|
93 |
-
return marker;
|
94 |
-
}
|
95 |
-
|
96 |
-
function getMaxSeverity(a, b) {
|
97 |
-
if (a == "error") return a;
|
98 |
-
else return b;
|
99 |
-
}
|
100 |
-
|
101 |
-
function groupByLine(annotations) {
|
102 |
-
var lines = [];
|
103 |
-
for (var i = 0; i < annotations.length; ++i) {
|
104 |
-
var ann = annotations[i], line = ann.from.line;
|
105 |
-
(lines[line] || (lines[line] = [])).push(ann);
|
106 |
-
}
|
107 |
-
return lines;
|
108 |
-
}
|
109 |
-
|
110 |
-
function annotationTooltip(ann) {
|
111 |
-
var severity = ann.severity;
|
112 |
-
if (!severity) severity = "error";
|
113 |
-
var tip = document.createElement("div");
|
114 |
-
tip.className = "CodeMirror-lint-message-" + severity;
|
115 |
-
if (typeof ann.messageHTML != 'undefined') {
|
116 |
-
tip.innerHTML = ann.messageHTML;
|
117 |
-
} else {
|
118 |
-
tip.appendChild(document.createTextNode(ann.message));
|
119 |
-
}
|
120 |
-
return tip;
|
121 |
-
}
|
122 |
-
|
123 |
-
function lintAsync(cm, getAnnotations, passOptions) {
|
124 |
-
var state = cm.state.lint
|
125 |
-
var id = ++state.waitingFor
|
126 |
-
function abort() {
|
127 |
-
id = -1
|
128 |
-
cm.off("change", abort)
|
129 |
-
}
|
130 |
-
cm.on("change", abort)
|
131 |
-
getAnnotations(cm.getValue(), function(annotations, arg2) {
|
132 |
-
cm.off("change", abort)
|
133 |
-
if (state.waitingFor != id) return
|
134 |
-
if (arg2 && annotations instanceof CodeMirror) annotations = arg2
|
135 |
-
cm.operation(function() {updateLinting(cm, annotations)})
|
136 |
-
}, passOptions, cm);
|
137 |
-
}
|
138 |
-
|
139 |
-
function startLinting(cm) {
|
140 |
-
var state = cm.state.lint, options = state.options;
|
141 |
-
/*
|
142 |
-
* Passing rules in `options` property prevents JSHint (and other linters) from complaining
|
143 |
-
* about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
|
144 |
-
*/
|
145 |
-
var passOptions = options.options || options;
|
146 |
-
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
|
147 |
-
if (!getAnnotations) return;
|
148 |
-
if (options.async || getAnnotations.async) {
|
149 |
-
lintAsync(cm, getAnnotations, passOptions)
|
150 |
-
} else {
|
151 |
-
var annotations = getAnnotations(cm.getValue(), passOptions, cm);
|
152 |
-
if (!annotations) return;
|
153 |
-
if (annotations.then) annotations.then(function(issues) {
|
154 |
-
cm.operation(function() {updateLinting(cm, issues)})
|
155 |
-
});
|
156 |
-
else cm.operation(function() {updateLinting(cm, annotations)})
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
function updateLinting(cm, annotationsNotSorted) {
|
161 |
-
clearMarks(cm);
|
162 |
-
var state = cm.state.lint, options = state.options;
|
163 |
-
|
164 |
-
var annotations = groupByLine(annotationsNotSorted);
|
165 |
-
|
166 |
-
for (var line = 0; line < annotations.length; ++line) {
|
167 |
-
var anns = annotations[line];
|
168 |
-
if (!anns) continue;
|
169 |
-
|
170 |
-
var maxSeverity = null;
|
171 |
-
var tipLabel = state.hasGutter && document.createDocumentFragment();
|
172 |
-
|
173 |
-
for (var i = 0; i < anns.length; ++i) {
|
174 |
-
var ann = anns[i];
|
175 |
-
var severity = ann.severity;
|
176 |
-
if (!severity) severity = "error";
|
177 |
-
maxSeverity = getMaxSeverity(maxSeverity, severity);
|
178 |
-
|
179 |
-
if (options.formatAnnotation) ann = options.formatAnnotation(ann);
|
180 |
-
if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann));
|
181 |
-
|
182 |
-
if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, {
|
183 |
-
className: "CodeMirror-lint-mark-" + severity,
|
184 |
-
__annotation: ann
|
185 |
-
}));
|
186 |
-
}
|
187 |
-
|
188 |
-
if (state.hasGutter)
|
189 |
-
cm.setGutterMarker(line, GUTTER_ID, makeMarker(tipLabel, maxSeverity, anns.length > 1,
|
190 |
-
state.options.tooltips));
|
191 |
-
}
|
192 |
-
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
|
193 |
-
}
|
194 |
-
|
195 |
-
function onChange(cm) {
|
196 |
-
var state = cm.state.lint;
|
197 |
-
if (!state) return;
|
198 |
-
clearTimeout(state.timeout);
|
199 |
-
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);
|
200 |
-
}
|
201 |
-
|
202 |
-
function popupTooltips(annotations, e) {
|
203 |
-
var target = e.target || e.srcElement;
|
204 |
-
var tooltip = document.createDocumentFragment();
|
205 |
-
for (var i = 0; i < annotations.length; i++) {
|
206 |
-
var ann = annotations[i];
|
207 |
-
tooltip.appendChild(annotationTooltip(ann));
|
208 |
-
}
|
209 |
-
showTooltipFor(e, tooltip, target);
|
210 |
-
}
|
211 |
-
|
212 |
-
function onMouseOver(cm, e) {
|
213 |
-
var target = e.target || e.srcElement;
|
214 |
-
if (!/\bCodeMirror-lint-mark-/.test(target.className)) return;
|
215 |
-
var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;
|
216 |
-
var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));
|
217 |
-
|
218 |
-
var annotations = [];
|
219 |
-
for (var i = 0; i < spans.length; ++i) {
|
220 |
-
var ann = spans[i].__annotation;
|
221 |
-
if (ann) annotations.push(ann);
|
222 |
-
}
|
223 |
-
if (annotations.length) popupTooltips(annotations, e);
|
224 |
-
}
|
225 |
-
|
226 |
-
CodeMirror.defineOption("lint", false, function(cm, val, old) {
|
227 |
-
if (old && old != CodeMirror.Init) {
|
228 |
-
clearMarks(cm);
|
229 |
-
if (cm.state.lint.options.lintOnChange !== false)
|
230 |
-
cm.off("change", onChange);
|
231 |
-
CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);
|
232 |
-
clearTimeout(cm.state.lint.timeout);
|
233 |
-
delete cm.state.lint;
|
234 |
-
}
|
235 |
-
|
236 |
-
if (val) {
|
237 |
-
var gutters = cm.getOption("gutters"), hasLintGutter = false;
|
238 |
-
for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;
|
239 |
-
var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter);
|
240 |
-
if (state.options.lintOnChange !== false)
|
241 |
-
cm.on("change", onChange);
|
242 |
-
if (state.options.tooltips != false && state.options.tooltips != "gutter")
|
243 |
-
CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
|
244 |
-
|
245 |
-
startLinting(cm);
|
246 |
-
}
|
247 |
-
});
|
248 |
-
|
249 |
-
CodeMirror.defineExtension("performLint", function() {
|
250 |
-
if (this.state.lint) startLinting(this);
|
251 |
-
});
|
252 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/lint/yaml-lint.js
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
// Depends on js-yaml.js from https://github.com/nodeca/js-yaml
|
15 |
-
|
16 |
-
// declare global: jsyaml
|
17 |
-
|
18 |
-
CodeMirror.registerHelper("lint", "yaml", function(text) {
|
19 |
-
var found = [];
|
20 |
-
if (!window.jsyaml) {
|
21 |
-
if (window.console) {
|
22 |
-
window.console.error("Error: window.jsyaml not defined, CodeMirror YAML linting cannot run.");
|
23 |
-
}
|
24 |
-
return found;
|
25 |
-
}
|
26 |
-
try { jsyaml.loadAll(text); }
|
27 |
-
catch(e) {
|
28 |
-
var loc = e.mark,
|
29 |
-
// js-yaml YAMLException doesn't always provide an accurate lineno
|
30 |
-
// e.g., when there are multiple yaml docs
|
31 |
-
// ---
|
32 |
-
// ---
|
33 |
-
// foo:bar
|
34 |
-
from = loc ? CodeMirror.Pos(loc.line, loc.column) : CodeMirror.Pos(0, 0),
|
35 |
-
to = from;
|
36 |
-
found.push({ from: from, to: to, message: e.message });
|
37 |
-
}
|
38 |
-
return found;
|
39 |
-
});
|
40 |
-
|
41 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/merge/merge.css
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
.CodeMirror-merge {
|
2 |
-
position: relative;
|
3 |
-
border: 1px solid #ddd;
|
4 |
-
white-space: pre;
|
5 |
-
}
|
6 |
-
|
7 |
-
.CodeMirror-merge, .CodeMirror-merge .CodeMirror {
|
8 |
-
height: 350px;
|
9 |
-
}
|
10 |
-
|
11 |
-
.CodeMirror-merge-2pane .CodeMirror-merge-pane { width: 47%; }
|
12 |
-
.CodeMirror-merge-2pane .CodeMirror-merge-gap { width: 6%; }
|
13 |
-
.CodeMirror-merge-3pane .CodeMirror-merge-pane { width: 31%; }
|
14 |
-
.CodeMirror-merge-3pane .CodeMirror-merge-gap { width: 3.5%; }
|
15 |
-
|
16 |
-
.CodeMirror-merge-pane {
|
17 |
-
display: inline-block;
|
18 |
-
white-space: normal;
|
19 |
-
vertical-align: top;
|
20 |
-
}
|
21 |
-
.CodeMirror-merge-pane-rightmost {
|
22 |
-
position: absolute;
|
23 |
-
right: 0px;
|
24 |
-
z-index: 1;
|
25 |
-
}
|
26 |
-
|
27 |
-
.CodeMirror-merge-gap {
|
28 |
-
z-index: 2;
|
29 |
-
display: inline-block;
|
30 |
-
height: 100%;
|
31 |
-
-moz-box-sizing: border-box;
|
32 |
-
box-sizing: border-box;
|
33 |
-
overflow: hidden;
|
34 |
-
border-left: 1px solid #ddd;
|
35 |
-
border-right: 1px solid #ddd;
|
36 |
-
position: relative;
|
37 |
-
background: #f8f8f8;
|
38 |
-
}
|
39 |
-
|
40 |
-
.CodeMirror-merge-scrolllock-wrap {
|
41 |
-
position: absolute;
|
42 |
-
bottom: 0; left: 50%;
|
43 |
-
}
|
44 |
-
.CodeMirror-merge-scrolllock {
|
45 |
-
position: relative;
|
46 |
-
left: -50%;
|
47 |
-
cursor: pointer;
|
48 |
-
color: #555;
|
49 |
-
line-height: 1;
|
50 |
-
}
|
51 |
-
.CodeMirror-merge-scrolllock:after {
|
52 |
-
content: "\21db\00a0\00a0\21da";
|
53 |
-
}
|
54 |
-
.CodeMirror-merge-scrolllock.CodeMirror-merge-scrolllock-enabled:after {
|
55 |
-
content: "\21db\21da";
|
56 |
-
}
|
57 |
-
|
58 |
-
.CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right {
|
59 |
-
position: absolute;
|
60 |
-
left: 0; top: 0;
|
61 |
-
right: 0; bottom: 0;
|
62 |
-
line-height: 1;
|
63 |
-
}
|
64 |
-
|
65 |
-
.CodeMirror-merge-copy {
|
66 |
-
position: absolute;
|
67 |
-
cursor: pointer;
|
68 |
-
color: #44c;
|
69 |
-
z-index: 3;
|
70 |
-
}
|
71 |
-
|
72 |
-
.CodeMirror-merge-copy-reverse {
|
73 |
-
position: absolute;
|
74 |
-
cursor: pointer;
|
75 |
-
color: #44c;
|
76 |
-
}
|
77 |
-
|
78 |
-
.CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy { left: 2px; }
|
79 |
-
.CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy { right: 2px; }
|
80 |
-
|
81 |
-
.CodeMirror-merge-r-inserted, .CodeMirror-merge-l-inserted {
|
82 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12MwuCXy3+CWyH8GBgYGJgYkAABZbAQ9ELXurwAAAABJRU5ErkJggg==);
|
83 |
-
background-position: bottom left;
|
84 |
-
background-repeat: repeat-x;
|
85 |
-
}
|
86 |
-
|
87 |
-
.CodeMirror-merge-r-deleted, .CodeMirror-merge-l-deleted {
|
88 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12M4Kyb2/6yY2H8GBgYGJgYkAABURgPz6Ks7wQAAAABJRU5ErkJggg==);
|
89 |
-
background-position: bottom left;
|
90 |
-
background-repeat: repeat-x;
|
91 |
-
}
|
92 |
-
|
93 |
-
.CodeMirror-merge-r-chunk { background: #ffffe0; }
|
94 |
-
.CodeMirror-merge-r-chunk-start { border-top: 1px solid #ee8; }
|
95 |
-
.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #ee8; }
|
96 |
-
.CodeMirror-merge-r-connect { fill: #ffffe0; stroke: #ee8; stroke-width: 1px; }
|
97 |
-
|
98 |
-
.CodeMirror-merge-l-chunk { background: #eef; }
|
99 |
-
.CodeMirror-merge-l-chunk-start { border-top: 1px solid #88e; }
|
100 |
-
.CodeMirror-merge-l-chunk-end { border-bottom: 1px solid #88e; }
|
101 |
-
.CodeMirror-merge-l-connect { fill: #eef; stroke: #88e; stroke-width: 1px; }
|
102 |
-
|
103 |
-
.CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk { background: #dfd; }
|
104 |
-
.CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start { border-top: 1px solid #4e4; }
|
105 |
-
.CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #4e4; }
|
106 |
-
|
107 |
-
.CodeMirror-merge-collapsed-widget:before {
|
108 |
-
content: "(...)";
|
109 |
-
}
|
110 |
-
.CodeMirror-merge-collapsed-widget {
|
111 |
-
cursor: pointer;
|
112 |
-
color: #88b;
|
113 |
-
background: #eef;
|
114 |
-
border: 1px solid #ddf;
|
115 |
-
font-size: 90%;
|
116 |
-
padding: 0 3px;
|
117 |
-
border-radius: 4px;
|
118 |
-
}
|
119 |
-
.CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt { display: none; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/merge/merge.js
DELETED
@@ -1,1002 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL
|
5 |
-
|
6 |
-
(function(mod) {
|
7 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
8 |
-
mod(require("../../lib/codemirror")); // Note non-packaged dependency diff_match_patch
|
9 |
-
else if (typeof define == "function" && define.amd) // AMD
|
10 |
-
define(["../../lib/codemirror", "diff_match_patch"], mod);
|
11 |
-
else // Plain browser env
|
12 |
-
mod(CodeMirror);
|
13 |
-
})(function(CodeMirror) {
|
14 |
-
"use strict";
|
15 |
-
var Pos = CodeMirror.Pos;
|
16 |
-
var svgNS = "http://www.w3.org/2000/svg";
|
17 |
-
|
18 |
-
function DiffView(mv, type) {
|
19 |
-
this.mv = mv;
|
20 |
-
this.type = type;
|
21 |
-
this.classes = type == "left"
|
22 |
-
? {chunk: "CodeMirror-merge-l-chunk",
|
23 |
-
start: "CodeMirror-merge-l-chunk-start",
|
24 |
-
end: "CodeMirror-merge-l-chunk-end",
|
25 |
-
insert: "CodeMirror-merge-l-inserted",
|
26 |
-
del: "CodeMirror-merge-l-deleted",
|
27 |
-
connect: "CodeMirror-merge-l-connect"}
|
28 |
-
: {chunk: "CodeMirror-merge-r-chunk",
|
29 |
-
start: "CodeMirror-merge-r-chunk-start",
|
30 |
-
end: "CodeMirror-merge-r-chunk-end",
|
31 |
-
insert: "CodeMirror-merge-r-inserted",
|
32 |
-
del: "CodeMirror-merge-r-deleted",
|
33 |
-
connect: "CodeMirror-merge-r-connect"};
|
34 |
-
}
|
35 |
-
|
36 |
-
DiffView.prototype = {
|
37 |
-
constructor: DiffView,
|
38 |
-
init: function(pane, orig, options) {
|
39 |
-
this.edit = this.mv.edit;
|
40 |
-
;(this.edit.state.diffViews || (this.edit.state.diffViews = [])).push(this);
|
41 |
-
this.orig = CodeMirror(pane, copyObj({value: orig, readOnly: !this.mv.options.allowEditingOriginals}, copyObj(options)));
|
42 |
-
if (this.mv.options.connect == "align") {
|
43 |
-
if (!this.edit.state.trackAlignable) this.edit.state.trackAlignable = new TrackAlignable(this.edit)
|
44 |
-
this.orig.state.trackAlignable = new TrackAlignable(this.orig)
|
45 |
-
}
|
46 |
-
this.lockButton.title = this.edit.phrase("Toggle locked scrolling");
|
47 |
-
|
48 |
-
this.orig.state.diffViews = [this];
|
49 |
-
var classLocation = options.chunkClassLocation || "background";
|
50 |
-
if (Object.prototype.toString.call(classLocation) != "[object Array]") classLocation = [classLocation]
|
51 |
-
this.classes.classLocation = classLocation
|
52 |
-
|
53 |
-
this.diff = getDiff(asString(orig), asString(options.value), this.mv.options.ignoreWhitespace);
|
54 |
-
this.chunks = getChunks(this.diff);
|
55 |
-
this.diffOutOfDate = this.dealigned = false;
|
56 |
-
this.needsScrollSync = null
|
57 |
-
|
58 |
-
this.showDifferences = options.showDifferences !== false;
|
59 |
-
},
|
60 |
-
registerEvents: function(otherDv) {
|
61 |
-
this.forceUpdate = registerUpdate(this);
|
62 |
-
setScrollLock(this, true, false);
|
63 |
-
registerScroll(this, otherDv);
|
64 |
-
},
|
65 |
-
setShowDifferences: function(val) {
|
66 |
-
val = val !== false;
|
67 |
-
if (val != this.showDifferences) {
|
68 |
-
this.showDifferences = val;
|
69 |
-
this.forceUpdate("full");
|
70 |
-
}
|
71 |
-
}
|
72 |
-
};
|
73 |
-
|
74 |
-
function ensureDiff(dv) {
|
75 |
-
if (dv.diffOutOfDate) {
|
76 |
-
dv.diff = getDiff(dv.orig.getValue(), dv.edit.getValue(), dv.mv.options.ignoreWhitespace);
|
77 |
-
dv.chunks = getChunks(dv.diff);
|
78 |
-
dv.diffOutOfDate = false;
|
79 |
-
CodeMirror.signal(dv.edit, "updateDiff", dv.diff);
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
var updating = false;
|
84 |
-
function registerUpdate(dv) {
|
85 |
-
var edit = {from: 0, to: 0, marked: []};
|
86 |
-
var orig = {from: 0, to: 0, marked: []};
|
87 |
-
var debounceChange, updatingFast = false;
|
88 |
-
function update(mode) {
|
89 |
-
updating = true;
|
90 |
-
updatingFast = false;
|
91 |
-
if (mode == "full") {
|
92 |
-
if (dv.svg) clear(dv.svg);
|
93 |
-
if (dv.copyButtons) clear(dv.copyButtons);
|
94 |
-
clearMarks(dv.edit, edit.marked, dv.classes);
|
95 |
-
clearMarks(dv.orig, orig.marked, dv.classes);
|
96 |
-
edit.from = edit.to = orig.from = orig.to = 0;
|
97 |
-
}
|
98 |
-
ensureDiff(dv);
|
99 |
-
if (dv.showDifferences) {
|
100 |
-
updateMarks(dv.edit, dv.diff, edit, DIFF_INSERT, dv.classes);
|
101 |
-
updateMarks(dv.orig, dv.diff, orig, DIFF_DELETE, dv.classes);
|
102 |
-
}
|
103 |
-
|
104 |
-
if (dv.mv.options.connect == "align")
|
105 |
-
alignChunks(dv);
|
106 |
-
makeConnections(dv);
|
107 |
-
if (dv.needsScrollSync != null) syncScroll(dv, dv.needsScrollSync)
|
108 |
-
|
109 |
-
updating = false;
|
110 |
-
}
|
111 |
-
function setDealign(fast) {
|
112 |
-
if (updating) return;
|
113 |
-
dv.dealigned = true;
|
114 |
-
set(fast);
|
115 |
-
}
|
116 |
-
function set(fast) {
|
117 |
-
if (updating || updatingFast) return;
|
118 |
-
clearTimeout(debounceChange);
|
119 |
-
if (fast === true) updatingFast = true;
|
120 |
-
debounceChange = setTimeout(update, fast === true ? 20 : 250);
|
121 |
-
}
|
122 |
-
function change(_cm, change) {
|
123 |
-
if (!dv.diffOutOfDate) {
|
124 |
-
dv.diffOutOfDate = true;
|
125 |
-
edit.from = edit.to = orig.from = orig.to = 0;
|
126 |
-
}
|
127 |
-
// Update faster when a line was added/removed
|
128 |
-
setDealign(change.text.length - 1 != change.to.line - change.from.line);
|
129 |
-
}
|
130 |
-
function swapDoc() {
|
131 |
-
dv.diffOutOfDate = true;
|
132 |
-
dv.dealigned = true;
|
133 |
-
update("full");
|
134 |
-
}
|
135 |
-
dv.edit.on("change", change);
|
136 |
-
dv.orig.on("change", change);
|
137 |
-
dv.edit.on("swapDoc", swapDoc);
|
138 |
-
dv.orig.on("swapDoc", swapDoc);
|
139 |
-
if (dv.mv.options.connect == "align") {
|
140 |
-
CodeMirror.on(dv.edit.state.trackAlignable, "realign", setDealign)
|
141 |
-
CodeMirror.on(dv.orig.state.trackAlignable, "realign", setDealign)
|
142 |
-
}
|
143 |
-
dv.edit.on("viewportChange", function() { set(false); });
|
144 |
-
dv.orig.on("viewportChange", function() { set(false); });
|
145 |
-
update();
|
146 |
-
return update;
|
147 |
-
}
|
148 |
-
|
149 |
-
function registerScroll(dv, otherDv) {
|
150 |
-
dv.edit.on("scroll", function() {
|
151 |
-
syncScroll(dv, true) && makeConnections(dv);
|
152 |
-
});
|
153 |
-
dv.orig.on("scroll", function() {
|
154 |
-
syncScroll(dv, false) && makeConnections(dv);
|
155 |
-
if (otherDv) syncScroll(otherDv, true) && makeConnections(otherDv);
|
156 |
-
});
|
157 |
-
}
|
158 |
-
|
159 |
-
function syncScroll(dv, toOrig) {
|
160 |
-
// Change handler will do a refresh after a timeout when diff is out of date
|
161 |
-
if (dv.diffOutOfDate) {
|
162 |
-
if (dv.lockScroll && dv.needsScrollSync == null) dv.needsScrollSync = toOrig
|
163 |
-
return false
|
164 |
-
}
|
165 |
-
dv.needsScrollSync = null
|
166 |
-
if (!dv.lockScroll) return true;
|
167 |
-
var editor, other, now = +new Date;
|
168 |
-
if (toOrig) { editor = dv.edit; other = dv.orig; }
|
169 |
-
else { editor = dv.orig; other = dv.edit; }
|
170 |
-
// Don't take action if the position of this editor was recently set
|
171 |
-
// (to prevent feedback loops)
|
172 |
-
if (editor.state.scrollSetBy == dv && (editor.state.scrollSetAt || 0) + 250 > now) return false;
|
173 |
-
|
174 |
-
var sInfo = editor.getScrollInfo();
|
175 |
-
if (dv.mv.options.connect == "align") {
|
176 |
-
targetPos = sInfo.top;
|
177 |
-
} else {
|
178 |
-
var halfScreen = .5 * sInfo.clientHeight, midY = sInfo.top + halfScreen;
|
179 |
-
var mid = editor.lineAtHeight(midY, "local");
|
180 |
-
var around = chunkBoundariesAround(dv.chunks, mid, toOrig);
|
181 |
-
var off = getOffsets(editor, toOrig ? around.edit : around.orig);
|
182 |
-
var offOther = getOffsets(other, toOrig ? around.orig : around.edit);
|
183 |
-
var ratio = (midY - off.top) / (off.bot - off.top);
|
184 |
-
var targetPos = (offOther.top - halfScreen) + ratio * (offOther.bot - offOther.top);
|
185 |
-
|
186 |
-
var botDist, mix;
|
187 |
-
// Some careful tweaking to make sure no space is left out of view
|
188 |
-
// when scrolling to top or bottom.
|
189 |
-
if (targetPos > sInfo.top && (mix = sInfo.top / halfScreen) < 1) {
|
190 |
-
targetPos = targetPos * mix + sInfo.top * (1 - mix);
|
191 |
-
} else if ((botDist = sInfo.height - sInfo.clientHeight - sInfo.top) < halfScreen) {
|
192 |
-
var otherInfo = other.getScrollInfo();
|
193 |
-
var botDistOther = otherInfo.height - otherInfo.clientHeight - targetPos;
|
194 |
-
if (botDistOther > botDist && (mix = botDist / halfScreen) < 1)
|
195 |
-
targetPos = targetPos * mix + (otherInfo.height - otherInfo.clientHeight - botDist) * (1 - mix);
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
other.scrollTo(sInfo.left, targetPos);
|
200 |
-
other.state.scrollSetAt = now;
|
201 |
-
other.state.scrollSetBy = dv;
|
202 |
-
return true;
|
203 |
-
}
|
204 |
-
|
205 |
-
function getOffsets(editor, around) {
|
206 |
-
var bot = around.after;
|
207 |
-
if (bot == null) bot = editor.lastLine() + 1;
|
208 |
-
return {top: editor.heightAtLine(around.before || 0, "local"),
|
209 |
-
bot: editor.heightAtLine(bot, "local")};
|
210 |
-
}
|
211 |
-
|
212 |
-
function setScrollLock(dv, val, action) {
|
213 |
-
dv.lockScroll = val;
|
214 |
-
if (val && action != false) syncScroll(dv, DIFF_INSERT) && makeConnections(dv);
|
215 |
-
(val ? CodeMirror.addClass : CodeMirror.rmClass)(dv.lockButton, "CodeMirror-merge-scrolllock-enabled");
|
216 |
-
}
|
217 |
-
|
218 |
-
// Updating the marks for editor content
|
219 |
-
|
220 |
-
function removeClass(editor, line, classes) {
|
221 |
-
var locs = classes.classLocation
|
222 |
-
for (var i = 0; i < locs.length; i++) {
|
223 |
-
editor.removeLineClass(line, locs[i], classes.chunk);
|
224 |
-
editor.removeLineClass(line, locs[i], classes.start);
|
225 |
-
editor.removeLineClass(line, locs[i], classes.end);
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
function clearMarks(editor, arr, classes) {
|
230 |
-
for (var i = 0; i < arr.length; ++i) {
|
231 |
-
var mark = arr[i];
|
232 |
-
if (mark instanceof CodeMirror.TextMarker)
|
233 |
-
mark.clear();
|
234 |
-
else if (mark.parent)
|
235 |
-
removeClass(editor, mark, classes);
|
236 |
-
}
|
237 |
-
arr.length = 0;
|
238 |
-
}
|
239 |
-
|
240 |
-
// FIXME maybe add a margin around viewport to prevent too many updates
|
241 |
-
function updateMarks(editor, diff, state, type, classes) {
|
242 |
-
var vp = editor.getViewport();
|
243 |
-
editor.operation(function() {
|
244 |
-
if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
|
245 |
-
clearMarks(editor, state.marked, classes);
|
246 |
-
markChanges(editor, diff, type, state.marked, vp.from, vp.to, classes);
|
247 |
-
state.from = vp.from; state.to = vp.to;
|
248 |
-
} else {
|
249 |
-
if (vp.from < state.from) {
|
250 |
-
markChanges(editor, diff, type, state.marked, vp.from, state.from, classes);
|
251 |
-
state.from = vp.from;
|
252 |
-
}
|
253 |
-
if (vp.to > state.to) {
|
254 |
-
markChanges(editor, diff, type, state.marked, state.to, vp.to, classes);
|
255 |
-
state.to = vp.to;
|
256 |
-
}
|
257 |
-
}
|
258 |
-
});
|
259 |
-
}
|
260 |
-
|
261 |
-
function addClass(editor, lineNr, classes, main, start, end) {
|
262 |
-
var locs = classes.classLocation, line = editor.getLineHandle(lineNr);
|
263 |
-
for (var i = 0; i < locs.length; i++) {
|
264 |
-
if (main) editor.addLineClass(line, locs[i], classes.chunk);
|
265 |
-
if (start) editor.addLineClass(line, locs[i], classes.start);
|
266 |
-
if (end) editor.addLineClass(line, locs[i], classes.end);
|
267 |
-
}
|
268 |
-
return line;
|
269 |
-
}
|
270 |
-
|
271 |
-
function markChanges(editor, diff, type, marks, from, to, classes) {
|
272 |
-
var pos = Pos(0, 0);
|
273 |
-
var top = Pos(from, 0), bot = editor.clipPos(Pos(to - 1));
|
274 |
-
var cls = type == DIFF_DELETE ? classes.del : classes.insert;
|
275 |
-
function markChunk(start, end) {
|
276 |
-
var bfrom = Math.max(from, start), bto = Math.min(to, end);
|
277 |
-
for (var i = bfrom; i < bto; ++i)
|
278 |
-
marks.push(addClass(editor, i, classes, true, i == start, i == end - 1));
|
279 |
-
// When the chunk is empty, make sure a horizontal line shows up
|
280 |
-
if (start == end && bfrom == end && bto == end) {
|
281 |
-
if (bfrom)
|
282 |
-
marks.push(addClass(editor, bfrom - 1, classes, false, false, true));
|
283 |
-
else
|
284 |
-
marks.push(addClass(editor, bfrom, classes, false, true, false));
|
285 |
-
}
|
286 |
-
}
|
287 |
-
|
288 |
-
var chunkStart = 0, pending = false;
|
289 |
-
for (var i = 0; i < diff.length; ++i) {
|
290 |
-
var part = diff[i], tp = part[0], str = part[1];
|
291 |
-
if (tp == DIFF_EQUAL) {
|
292 |
-
var cleanFrom = pos.line + (startOfLineClean(diff, i) ? 0 : 1);
|
293 |
-
moveOver(pos, str);
|
294 |
-
var cleanTo = pos.line + (endOfLineClean(diff, i) ? 1 : 0);
|
295 |
-
if (cleanTo > cleanFrom) {
|
296 |
-
if (pending) { markChunk(chunkStart, cleanFrom); pending = false }
|
297 |
-
chunkStart = cleanTo;
|
298 |
-
}
|
299 |
-
} else {
|
300 |
-
pending = true
|
301 |
-
if (tp == type) {
|
302 |
-
var end = moveOver(pos, str, true);
|
303 |
-
var a = posMax(top, pos), b = posMin(bot, end);
|
304 |
-
if (!posEq(a, b))
|
305 |
-
marks.push(editor.markText(a, b, {className: cls}));
|
306 |
-
pos = end;
|
307 |
-
}
|
308 |
-
}
|
309 |
-
}
|
310 |
-
if (pending) markChunk(chunkStart, pos.line + 1);
|
311 |
-
}
|
312 |
-
|
313 |
-
// Updating the gap between editor and original
|
314 |
-
|
315 |
-
function makeConnections(dv) {
|
316 |
-
if (!dv.showDifferences) return;
|
317 |
-
|
318 |
-
if (dv.svg) {
|
319 |
-
clear(dv.svg);
|
320 |
-
var w = dv.gap.offsetWidth;
|
321 |
-
attrs(dv.svg, "width", w, "height", dv.gap.offsetHeight);
|
322 |
-
}
|
323 |
-
if (dv.copyButtons) clear(dv.copyButtons);
|
324 |
-
|
325 |
-
var vpEdit = dv.edit.getViewport(), vpOrig = dv.orig.getViewport();
|
326 |
-
var outerTop = dv.mv.wrap.getBoundingClientRect().top
|
327 |
-
var sTopEdit = outerTop - dv.edit.getScrollerElement().getBoundingClientRect().top + dv.edit.getScrollInfo().top
|
328 |
-
var sTopOrig = outerTop - dv.orig.getScrollerElement().getBoundingClientRect().top + dv.orig.getScrollInfo().top;
|
329 |
-
for (var i = 0; i < dv.chunks.length; i++) {
|
330 |
-
var ch = dv.chunks[i];
|
331 |
-
if (ch.editFrom <= vpEdit.to && ch.editTo >= vpEdit.from &&
|
332 |
-
ch.origFrom <= vpOrig.to && ch.origTo >= vpOrig.from)
|
333 |
-
drawConnectorsForChunk(dv, ch, sTopOrig, sTopEdit, w);
|
334 |
-
}
|
335 |
-
}
|
336 |
-
|
337 |
-
function getMatchingOrigLine(editLine, chunks) {
|
338 |
-
var editStart = 0, origStart = 0;
|
339 |
-
for (var i = 0; i < chunks.length; i++) {
|
340 |
-
var chunk = chunks[i];
|
341 |
-
if (chunk.editTo > editLine && chunk.editFrom <= editLine) return null;
|
342 |
-
if (chunk.editFrom > editLine) break;
|
343 |
-
editStart = chunk.editTo;
|
344 |
-
origStart = chunk.origTo;
|
345 |
-
}
|
346 |
-
return origStart + (editLine - editStart);
|
347 |
-
}
|
348 |
-
|
349 |
-
// Combines information about chunks and widgets/markers to return
|
350 |
-
// an array of lines, in a single editor, that probably need to be
|
351 |
-
// aligned with their counterparts in the editor next to it.
|
352 |
-
function alignableFor(cm, chunks, isOrig) {
|
353 |
-
var tracker = cm.state.trackAlignable
|
354 |
-
var start = cm.firstLine(), trackI = 0
|
355 |
-
var result = []
|
356 |
-
for (var i = 0;; i++) {
|
357 |
-
var chunk = chunks[i]
|
358 |
-
var chunkStart = !chunk ? 1e9 : isOrig ? chunk.origFrom : chunk.editFrom
|
359 |
-
for (; trackI < tracker.alignable.length; trackI += 2) {
|
360 |
-
var n = tracker.alignable[trackI] + 1
|
361 |
-
if (n <= start) continue
|
362 |
-
if (n <= chunkStart) result.push(n)
|
363 |
-
else break
|
364 |
-
}
|
365 |
-
if (!chunk) break
|
366 |
-
result.push(start = isOrig ? chunk.origTo : chunk.editTo)
|
367 |
-
}
|
368 |
-
return result
|
369 |
-
}
|
370 |
-
|
371 |
-
// Given information about alignable lines in two editors, fill in
|
372 |
-
// the result (an array of three-element arrays) to reflect the
|
373 |
-
// lines that need to be aligned with each other.
|
374 |
-
function mergeAlignable(result, origAlignable, chunks, setIndex) {
|
375 |
-
var rI = 0, origI = 0, chunkI = 0, diff = 0
|
376 |
-
outer: for (;; rI++) {
|
377 |
-
var nextR = result[rI], nextO = origAlignable[origI]
|
378 |
-
if (!nextR && nextO == null) break
|
379 |
-
|
380 |
-
var rLine = nextR ? nextR[0] : 1e9, oLine = nextO == null ? 1e9 : nextO
|
381 |
-
while (chunkI < chunks.length) {
|
382 |
-
var chunk = chunks[chunkI]
|
383 |
-
if (chunk.origFrom <= oLine && chunk.origTo > oLine) {
|
384 |
-
origI++
|
385 |
-
rI--
|
386 |
-
continue outer;
|
387 |
-
}
|
388 |
-
if (chunk.editTo > rLine) {
|
389 |
-
if (chunk.editFrom <= rLine) continue outer;
|
390 |
-
break
|
391 |
-
}
|
392 |
-
diff += (chunk.origTo - chunk.origFrom) - (chunk.editTo - chunk.editFrom)
|
393 |
-
chunkI++
|
394 |
-
}
|
395 |
-
if (rLine == oLine - diff) {
|
396 |
-
nextR[setIndex] = oLine
|
397 |
-
origI++
|
398 |
-
} else if (rLine < oLine - diff) {
|
399 |
-
nextR[setIndex] = rLine + diff
|
400 |
-
} else {
|
401 |
-
var record = [oLine - diff, null, null]
|
402 |
-
record[setIndex] = oLine
|
403 |
-
result.splice(rI, 0, record)
|
404 |
-
origI++
|
405 |
-
}
|
406 |
-
}
|
407 |
-
}
|
408 |
-
|
409 |
-
function findAlignedLines(dv, other) {
|
410 |
-
var alignable = alignableFor(dv.edit, dv.chunks, false), result = []
|
411 |
-
if (other) for (var i = 0, j = 0; i < other.chunks.length; i++) {
|
412 |
-
var n = other.chunks[i].editTo
|
413 |
-
while (j < alignable.length && alignable[j] < n) j++
|
414 |
-
if (j == alignable.length || alignable[j] != n) alignable.splice(j++, 0, n)
|
415 |
-
}
|
416 |
-
for (var i = 0; i < alignable.length; i++)
|
417 |
-
result.push([alignable[i], null, null])
|
418 |
-
|
419 |
-
mergeAlignable(result, alignableFor(dv.orig, dv.chunks, true), dv.chunks, 1)
|
420 |
-
if (other)
|
421 |
-
mergeAlignable(result, alignableFor(other.orig, other.chunks, true), other.chunks, 2)
|
422 |
-
|
423 |
-
return result
|
424 |
-
}
|
425 |
-
|
426 |
-
function alignChunks(dv, force) {
|
427 |
-
if (!dv.dealigned && !force) return;
|
428 |
-
if (!dv.orig.curOp) return dv.orig.operation(function() {
|
429 |
-
alignChunks(dv, force);
|
430 |
-
});
|
431 |
-
|
432 |
-
dv.dealigned = false;
|
433 |
-
var other = dv.mv.left == dv ? dv.mv.right : dv.mv.left;
|
434 |
-
if (other) {
|
435 |
-
ensureDiff(other);
|
436 |
-
other.dealigned = false;
|
437 |
-
}
|
438 |
-
var linesToAlign = findAlignedLines(dv, other);
|
439 |
-
|
440 |
-
// Clear old aligners
|
441 |
-
var aligners = dv.mv.aligners;
|
442 |
-
for (var i = 0; i < aligners.length; i++)
|
443 |
-
aligners[i].clear();
|
444 |
-
aligners.length = 0;
|
445 |
-
|
446 |
-
var cm = [dv.edit, dv.orig], scroll = [];
|
447 |
-
if (other) cm.push(other.orig);
|
448 |
-
for (var i = 0; i < cm.length; i++)
|
449 |
-
scroll.push(cm[i].getScrollInfo().top);
|
450 |
-
|
451 |
-
for (var ln = 0; ln < linesToAlign.length; ln++)
|
452 |
-
alignLines(cm, linesToAlign[ln], aligners);
|
453 |
-
|
454 |
-
for (var i = 0; i < cm.length; i++)
|
455 |
-
cm[i].scrollTo(null, scroll[i]);
|
456 |
-
}
|
457 |
-
|
458 |
-
function alignLines(cm, lines, aligners) {
|
459 |
-
var maxOffset = 0, offset = [];
|
460 |
-
for (var i = 0; i < cm.length; i++) if (lines[i] != null) {
|
461 |
-
var off = cm[i].heightAtLine(lines[i], "local");
|
462 |
-
offset[i] = off;
|
463 |
-
maxOffset = Math.max(maxOffset, off);
|
464 |
-
}
|
465 |
-
for (var i = 0; i < cm.length; i++) if (lines[i] != null) {
|
466 |
-
var diff = maxOffset - offset[i];
|
467 |
-
if (diff > 1)
|
468 |
-
aligners.push(padAbove(cm[i], lines[i], diff));
|
469 |
-
}
|
470 |
-
}
|
471 |
-
|
472 |
-
function padAbove(cm, line, size) {
|
473 |
-
var above = true;
|
474 |
-
if (line > cm.lastLine()) {
|
475 |
-
line--;
|
476 |
-
above = false;
|
477 |
-
}
|
478 |
-
var elt = document.createElement("div");
|
479 |
-
elt.className = "CodeMirror-merge-spacer";
|
480 |
-
elt.style.height = size + "px"; elt.style.minWidth = "1px";
|
481 |
-
return cm.addLineWidget(line, elt, {height: size, above: above, mergeSpacer: true, handleMouseEvents: true});
|
482 |
-
}
|
483 |
-
|
484 |
-
function drawConnectorsForChunk(dv, chunk, sTopOrig, sTopEdit, w) {
|
485 |
-
var flip = dv.type == "left";
|
486 |
-
var top = dv.orig.heightAtLine(chunk.origFrom, "local", true) - sTopOrig;
|
487 |
-
if (dv.svg) {
|
488 |
-
var topLpx = top;
|
489 |
-
var topRpx = dv.edit.heightAtLine(chunk.editFrom, "local", true) - sTopEdit;
|
490 |
-
if (flip) { var tmp = topLpx; topLpx = topRpx; topRpx = tmp; }
|
491 |
-
var botLpx = dv.orig.heightAtLine(chunk.origTo, "local", true) - sTopOrig;
|
492 |
-
var botRpx = dv.edit.heightAtLine(chunk.editTo, "local", true) - sTopEdit;
|
493 |
-
if (flip) { var tmp = botLpx; botLpx = botRpx; botRpx = tmp; }
|
494 |
-
var curveTop = " C " + w/2 + " " + topRpx + " " + w/2 + " " + topLpx + " " + (w + 2) + " " + topLpx;
|
495 |
-
var curveBot = " C " + w/2 + " " + botLpx + " " + w/2 + " " + botRpx + " -1 " + botRpx;
|
496 |
-
attrs(dv.svg.appendChild(document.createElementNS(svgNS, "path")),
|
497 |
-
"d", "M -1 " + topRpx + curveTop + " L " + (w + 2) + " " + botLpx + curveBot + " z",
|
498 |
-
"class", dv.classes.connect);
|
499 |
-
}
|
500 |
-
if (dv.copyButtons) {
|
501 |
-
var copy = dv.copyButtons.appendChild(elt("div", dv.type == "left" ? "\u21dd" : "\u21dc",
|
502 |
-
"CodeMirror-merge-copy"));
|
503 |
-
var editOriginals = dv.mv.options.allowEditingOriginals;
|
504 |
-
copy.title = dv.edit.phrase(editOriginals ? "Push to left" : "Revert chunk");
|
505 |
-
copy.chunk = chunk;
|
506 |
-
copy.style.top = (chunk.origTo > chunk.origFrom ? top : dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit) + "px";
|
507 |
-
|
508 |
-
if (editOriginals) {
|
509 |
-
var topReverse = dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit;
|
510 |
-
var copyReverse = dv.copyButtons.appendChild(elt("div", dv.type == "right" ? "\u21dd" : "\u21dc",
|
511 |
-
"CodeMirror-merge-copy-reverse"));
|
512 |
-
copyReverse.title = "Push to right";
|
513 |
-
copyReverse.chunk = {editFrom: chunk.origFrom, editTo: chunk.origTo,
|
514 |
-
origFrom: chunk.editFrom, origTo: chunk.editTo};
|
515 |
-
copyReverse.style.top = topReverse + "px";
|
516 |
-
dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px";
|
517 |
-
}
|
518 |
-
}
|
519 |
-
}
|
520 |
-
|
521 |
-
function copyChunk(dv, to, from, chunk) {
|
522 |
-
if (dv.diffOutOfDate) return;
|
523 |
-
var origStart = chunk.origTo > from.lastLine() ? Pos(chunk.origFrom - 1) : Pos(chunk.origFrom, 0)
|
524 |
-
var origEnd = Pos(chunk.origTo, 0)
|
525 |
-
var editStart = chunk.editTo > to.lastLine() ? Pos(chunk.editFrom - 1) : Pos(chunk.editFrom, 0)
|
526 |
-
var editEnd = Pos(chunk.editTo, 0)
|
527 |
-
var handler = dv.mv.options.revertChunk
|
528 |
-
if (handler)
|
529 |
-
handler(dv.mv, from, origStart, origEnd, to, editStart, editEnd)
|
530 |
-
else
|
531 |
-
to.replaceRange(from.getRange(origStart, origEnd), editStart, editEnd)
|
532 |
-
}
|
533 |
-
|
534 |
-
// Merge view, containing 0, 1, or 2 diff views.
|
535 |
-
|
536 |
-
var MergeView = CodeMirror.MergeView = function(node, options) {
|
537 |
-
if (!(this instanceof MergeView)) return new MergeView(node, options);
|
538 |
-
|
539 |
-
this.options = options;
|
540 |
-
var origLeft = options.origLeft, origRight = options.origRight == null ? options.orig : options.origRight;
|
541 |
-
|
542 |
-
var hasLeft = origLeft != null, hasRight = origRight != null;
|
543 |
-
var panes = 1 + (hasLeft ? 1 : 0) + (hasRight ? 1 : 0);
|
544 |
-
var wrap = [], left = this.left = null, right = this.right = null;
|
545 |
-
var self = this;
|
546 |
-
|
547 |
-
if (hasLeft) {
|
548 |
-
left = this.left = new DiffView(this, "left");
|
549 |
-
var leftPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-left");
|
550 |
-
wrap.push(leftPane);
|
551 |
-
wrap.push(buildGap(left));
|
552 |
-
}
|
553 |
-
|
554 |
-
var editPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-editor");
|
555 |
-
wrap.push(editPane);
|
556 |
-
|
557 |
-
if (hasRight) {
|
558 |
-
right = this.right = new DiffView(this, "right");
|
559 |
-
wrap.push(buildGap(right));
|
560 |
-
var rightPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-right");
|
561 |
-
wrap.push(rightPane);
|
562 |
-
}
|
563 |
-
|
564 |
-
(hasRight ? rightPane : editPane).className += " CodeMirror-merge-pane-rightmost";
|
565 |
-
|
566 |
-
wrap.push(elt("div", null, null, "height: 0; clear: both;"));
|
567 |
-
|
568 |
-
var wrapElt = this.wrap = node.appendChild(elt("div", wrap, "CodeMirror-merge CodeMirror-merge-" + panes + "pane"));
|
569 |
-
this.edit = CodeMirror(editPane, copyObj(options));
|
570 |
-
|
571 |
-
if (left) left.init(leftPane, origLeft, options);
|
572 |
-
if (right) right.init(rightPane, origRight, options);
|
573 |
-
if (options.collapseIdentical)
|
574 |
-
this.editor().operation(function() {
|
575 |
-
collapseIdenticalStretches(self, options.collapseIdentical);
|
576 |
-
});
|
577 |
-
if (options.connect == "align") {
|
578 |
-
this.aligners = [];
|
579 |
-
alignChunks(this.left || this.right, true);
|
580 |
-
}
|
581 |
-
if (left) left.registerEvents(right)
|
582 |
-
if (right) right.registerEvents(left)
|
583 |
-
|
584 |
-
|
585 |
-
var onResize = function() {
|
586 |
-
if (left) makeConnections(left);
|
587 |
-
if (right) makeConnections(right);
|
588 |
-
};
|
589 |
-
CodeMirror.on(window, "resize", onResize);
|
590 |
-
var resizeInterval = setInterval(function() {
|
591 |
-
for (var p = wrapElt.parentNode; p && p != document.body; p = p.parentNode) {}
|
592 |
-
if (!p) { clearInterval(resizeInterval); CodeMirror.off(window, "resize", onResize); }
|
593 |
-
}, 5000);
|
594 |
-
};
|
595 |
-
|
596 |
-
function buildGap(dv) {
|
597 |
-
var lock = dv.lockButton = elt("div", null, "CodeMirror-merge-scrolllock");
|
598 |
-
var lockWrap = elt("div", [lock], "CodeMirror-merge-scrolllock-wrap");
|
599 |
-
CodeMirror.on(lock, "click", function() { setScrollLock(dv, !dv.lockScroll); });
|
600 |
-
var gapElts = [lockWrap];
|
601 |
-
if (dv.mv.options.revertButtons !== false) {
|
602 |
-
dv.copyButtons = elt("div", null, "CodeMirror-merge-copybuttons-" + dv.type);
|
603 |
-
CodeMirror.on(dv.copyButtons, "click", function(e) {
|
604 |
-
var node = e.target || e.srcElement;
|
605 |
-
if (!node.chunk) return;
|
606 |
-
if (node.className == "CodeMirror-merge-copy-reverse") {
|
607 |
-
copyChunk(dv, dv.orig, dv.edit, node.chunk);
|
608 |
-
return;
|
609 |
-
}
|
610 |
-
copyChunk(dv, dv.edit, dv.orig, node.chunk);
|
611 |
-
});
|
612 |
-
gapElts.unshift(dv.copyButtons);
|
613 |
-
}
|
614 |
-
if (dv.mv.options.connect != "align") {
|
615 |
-
var svg = document.createElementNS && document.createElementNS(svgNS, "svg");
|
616 |
-
if (svg && !svg.createSVGRect) svg = null;
|
617 |
-
dv.svg = svg;
|
618 |
-
if (svg) gapElts.push(svg);
|
619 |
-
}
|
620 |
-
|
621 |
-
return dv.gap = elt("div", gapElts, "CodeMirror-merge-gap");
|
622 |
-
}
|
623 |
-
|
624 |
-
MergeView.prototype = {
|
625 |
-
constructor: MergeView,
|
626 |
-
editor: function() { return this.edit; },
|
627 |
-
rightOriginal: function() { return this.right && this.right.orig; },
|
628 |
-
leftOriginal: function() { return this.left && this.left.orig; },
|
629 |
-
setShowDifferences: function(val) {
|
630 |
-
if (this.right) this.right.setShowDifferences(val);
|
631 |
-
if (this.left) this.left.setShowDifferences(val);
|
632 |
-
},
|
633 |
-
rightChunks: function() {
|
634 |
-
if (this.right) { ensureDiff(this.right); return this.right.chunks; }
|
635 |
-
},
|
636 |
-
leftChunks: function() {
|
637 |
-
if (this.left) { ensureDiff(this.left); return this.left.chunks; }
|
638 |
-
}
|
639 |
-
};
|
640 |
-
|
641 |
-
function asString(obj) {
|
642 |
-
if (typeof obj == "string") return obj;
|
643 |
-
else return obj.getValue();
|
644 |
-
}
|
645 |
-
|
646 |
-
// Operations on diffs
|
647 |
-
var dmp;
|
648 |
-
function getDiff(a, b, ignoreWhitespace) {
|
649 |
-
if (!dmp) dmp = new diff_match_patch();
|
650 |
-
|
651 |
-
var diff = dmp.diff_main(a, b);
|
652 |
-
// The library sometimes leaves in empty parts, which confuse the algorithm
|
653 |
-
for (var i = 0; i < diff.length; ++i) {
|
654 |
-
var part = diff[i];
|
655 |
-
if (ignoreWhitespace ? !/[^ \t]/.test(part[1]) : !part[1]) {
|
656 |
-
diff.splice(i--, 1);
|
657 |
-
} else if (i && diff[i - 1][0] == part[0]) {
|
658 |
-
diff.splice(i--, 1);
|
659 |
-
diff[i][1] += part[1];
|
660 |
-
}
|
661 |
-
}
|
662 |
-
return diff;
|
663 |
-
}
|
664 |
-
|
665 |
-
function getChunks(diff) {
|
666 |
-
var chunks = [];
|
667 |
-
if (!diff.length) return chunks;
|
668 |
-
var startEdit = 0, startOrig = 0;
|
669 |
-
var edit = Pos(0, 0), orig = Pos(0, 0);
|
670 |
-
for (var i = 0; i < diff.length; ++i) {
|
671 |
-
var part = diff[i], tp = part[0];
|
672 |
-
if (tp == DIFF_EQUAL) {
|
673 |
-
var startOff = !startOfLineClean(diff, i) || edit.line < startEdit || orig.line < startOrig ? 1 : 0;
|
674 |
-
var cleanFromEdit = edit.line + startOff, cleanFromOrig = orig.line + startOff;
|
675 |
-
moveOver(edit, part[1], null, orig);
|
676 |
-
var endOff = endOfLineClean(diff, i) ? 1 : 0;
|
677 |
-
var cleanToEdit = edit.line + endOff, cleanToOrig = orig.line + endOff;
|
678 |
-
if (cleanToEdit > cleanFromEdit) {
|
679 |
-
if (i) chunks.push({origFrom: startOrig, origTo: cleanFromOrig,
|
680 |
-
editFrom: startEdit, editTo: cleanFromEdit});
|
681 |
-
startEdit = cleanToEdit; startOrig = cleanToOrig;
|
682 |
-
}
|
683 |
-
} else {
|
684 |
-
moveOver(tp == DIFF_INSERT ? edit : orig, part[1]);
|
685 |
-
}
|
686 |
-
}
|
687 |
-
if (startEdit <= edit.line || startOrig <= orig.line)
|
688 |
-
chunks.push({origFrom: startOrig, origTo: orig.line + 1,
|
689 |
-
editFrom: startEdit, editTo: edit.line + 1});
|
690 |
-
return chunks;
|
691 |
-
}
|
692 |
-
|
693 |
-
function endOfLineClean(diff, i) {
|
694 |
-
if (i == diff.length - 1) return true;
|
695 |
-
var next = diff[i + 1][1];
|
696 |
-
if ((next.length == 1 && i < diff.length - 2) || next.charCodeAt(0) != 10) return false;
|
697 |
-
if (i == diff.length - 2) return true;
|
698 |
-
next = diff[i + 2][1];
|
699 |
-
return (next.length > 1 || i == diff.length - 3) && next.charCodeAt(0) == 10;
|
700 |
-
}
|
701 |
-
|
702 |
-
function startOfLineClean(diff, i) {
|
703 |
-
if (i == 0) return true;
|
704 |
-
var last = diff[i - 1][1];
|
705 |
-
if (last.charCodeAt(last.length - 1) != 10) return false;
|
706 |
-
if (i == 1) return true;
|
707 |
-
last = diff[i - 2][1];
|
708 |
-
return last.charCodeAt(last.length - 1) == 10;
|
709 |
-
}
|
710 |
-
|
711 |
-
function chunkBoundariesAround(chunks, n, nInEdit) {
|
712 |
-
var beforeE, afterE, beforeO, afterO;
|
713 |
-
for (var i = 0; i < chunks.length; i++) {
|
714 |
-
var chunk = chunks[i];
|
715 |
-
var fromLocal = nInEdit ? chunk.editFrom : chunk.origFrom;
|
716 |
-
var toLocal = nInEdit ? chunk.editTo : chunk.origTo;
|
717 |
-
if (afterE == null) {
|
718 |
-
if (fromLocal > n) { afterE = chunk.editFrom; afterO = chunk.origFrom; }
|
719 |
-
else if (toLocal > n) { afterE = chunk.editTo; afterO = chunk.origTo; }
|
720 |
-
}
|
721 |
-
if (toLocal <= n) { beforeE = chunk.editTo; beforeO = chunk.origTo; }
|
722 |
-
else if (fromLocal <= n) { beforeE = chunk.editFrom; beforeO = chunk.origFrom; }
|
723 |
-
}
|
724 |
-
return {edit: {before: beforeE, after: afterE}, orig: {before: beforeO, after: afterO}};
|
725 |
-
}
|
726 |
-
|
727 |
-
function collapseSingle(cm, from, to) {
|
728 |
-
cm.addLineClass(from, "wrap", "CodeMirror-merge-collapsed-line");
|
729 |
-
var widget = document.createElement("span");
|
730 |
-
widget.className = "CodeMirror-merge-collapsed-widget";
|
731 |
-
widget.title = cm.phrase("Identical text collapsed. Click to expand.");
|
732 |
-
var mark = cm.markText(Pos(from, 0), Pos(to - 1), {
|
733 |
-
inclusiveLeft: true,
|
734 |
-
inclusiveRight: true,
|
735 |
-
replacedWith: widget,
|
736 |
-
clearOnEnter: true
|
737 |
-
});
|
738 |
-
function clear() {
|
739 |
-
mark.clear();
|
740 |
-
cm.removeLineClass(from, "wrap", "CodeMirror-merge-collapsed-line");
|
741 |
-
}
|
742 |
-
if (mark.explicitlyCleared) clear();
|
743 |
-
CodeMirror.on(widget, "click", clear);
|
744 |
-
mark.on("clear", clear);
|
745 |
-
CodeMirror.on(widget, "click", clear);
|
746 |
-
return {mark: mark, clear: clear};
|
747 |
-
}
|
748 |
-
|
749 |
-
function collapseStretch(size, editors) {
|
750 |
-
var marks = [];
|
751 |
-
function clear() {
|
752 |
-
for (var i = 0; i < marks.length; i++) marks[i].clear();
|
753 |
-
}
|
754 |
-
for (var i = 0; i < editors.length; i++) {
|
755 |
-
var editor = editors[i];
|
756 |
-
var mark = collapseSingle(editor.cm, editor.line, editor.line + size);
|
757 |
-
marks.push(mark);
|
758 |
-
mark.mark.on("clear", clear);
|
759 |
-
}
|
760 |
-
return marks[0].mark;
|
761 |
-
}
|
762 |
-
|
763 |
-
function unclearNearChunks(dv, margin, off, clear) {
|
764 |
-
for (var i = 0; i < dv.chunks.length; i++) {
|
765 |
-
var chunk = dv.chunks[i];
|
766 |
-
for (var l = chunk.editFrom - margin; l < chunk.editTo + margin; l++) {
|
767 |
-
var pos = l + off;
|
768 |
-
if (pos >= 0 && pos < clear.length) clear[pos] = false;
|
769 |
-
}
|
770 |
-
}
|
771 |
-
}
|
772 |
-
|
773 |
-
function collapseIdenticalStretches(mv, margin) {
|
774 |
-
if (typeof margin != "number") margin = 2;
|
775 |
-
var clear = [], edit = mv.editor(), off = edit.firstLine();
|
776 |
-
for (var l = off, e = edit.lastLine(); l <= e; l++) clear.push(true);
|
777 |
-
if (mv.left) unclearNearChunks(mv.left, margin, off, clear);
|
778 |
-
if (mv.right) unclearNearChunks(mv.right, margin, off, clear);
|
779 |
-
|
780 |
-
for (var i = 0; i < clear.length; i++) {
|
781 |
-
if (clear[i]) {
|
782 |
-
var line = i + off;
|
783 |
-
for (var size = 1; i < clear.length - 1 && clear[i + 1]; i++, size++) {}
|
784 |
-
if (size > margin) {
|
785 |
-
var editors = [{line: line, cm: edit}];
|
786 |
-
if (mv.left) editors.push({line: getMatchingOrigLine(line, mv.left.chunks), cm: mv.left.orig});
|
787 |
-
if (mv.right) editors.push({line: getMatchingOrigLine(line, mv.right.chunks), cm: mv.right.orig});
|
788 |
-
var mark = collapseStretch(size, editors);
|
789 |
-
if (mv.options.onCollapse) mv.options.onCollapse(mv, line, size, mark);
|
790 |
-
}
|
791 |
-
}
|
792 |
-
}
|
793 |
-
}
|
794 |
-
|
795 |
-
// General utilities
|
796 |
-
|
797 |
-
function elt(tag, content, className, style) {
|
798 |
-
var e = document.createElement(tag);
|
799 |
-
if (className) e.className = className;
|
800 |
-
if (style) e.style.cssText = style;
|
801 |
-
if (typeof content == "string") e.appendChild(document.createTextNode(content));
|
802 |
-
else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
|
803 |
-
return e;
|
804 |
-
}
|
805 |
-
|
806 |
-
function clear(node) {
|
807 |
-
for (var count = node.childNodes.length; count > 0; --count)
|
808 |
-
node.removeChild(node.firstChild);
|
809 |
-
}
|
810 |
-
|
811 |
-
function attrs(elt) {
|
812 |
-
for (var i = 1; i < arguments.length; i += 2)
|
813 |
-
elt.setAttribute(arguments[i], arguments[i+1]);
|
814 |
-
}
|
815 |
-
|
816 |
-
function copyObj(obj, target) {
|
817 |
-
if (!target) target = {};
|
818 |
-
for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop];
|
819 |
-
return target;
|
820 |
-
}
|
821 |
-
|
822 |
-
function moveOver(pos, str, copy, other) {
|
823 |
-
var out = copy ? Pos(pos.line, pos.ch) : pos, at = 0;
|
824 |
-
for (;;) {
|
825 |
-
var nl = str.indexOf("\n", at);
|
826 |
-
if (nl == -1) break;
|
827 |
-
++out.line;
|
828 |
-
if (other) ++other.line;
|
829 |
-
at = nl + 1;
|
830 |
-
}
|
831 |
-
out.ch = (at ? 0 : out.ch) + (str.length - at);
|
832 |
-
if (other) other.ch = (at ? 0 : other.ch) + (str.length - at);
|
833 |
-
return out;
|
834 |
-
}
|
835 |
-
|
836 |
-
// Tracks collapsed markers and line widgets, in order to be able to
|
837 |
-
// accurately align the content of two editors.
|
838 |
-
|
839 |
-
var F_WIDGET = 1, F_WIDGET_BELOW = 2, F_MARKER = 4
|
840 |
-
|
841 |
-
function TrackAlignable(cm) {
|
842 |
-
this.cm = cm
|
843 |
-
this.alignable = []
|
844 |
-
this.height = cm.doc.height
|
845 |
-
var self = this
|
846 |
-
cm.on("markerAdded", function(_, marker) {
|
847 |
-
if (!marker.collapsed) return
|
848 |
-
var found = marker.find(1)
|
849 |
-
if (found != null) self.set(found.line, F_MARKER)
|
850 |
-
})
|
851 |
-
cm.on("markerCleared", function(_, marker, _min, max) {
|
852 |
-
if (max != null && marker.collapsed)
|
853 |
-
self.check(max, F_MARKER, self.hasMarker)
|
854 |
-
})
|
855 |
-
cm.on("markerChanged", this.signal.bind(this))
|
856 |
-
cm.on("lineWidgetAdded", function(_, widget, lineNo) {
|
857 |
-
if (widget.mergeSpacer) return
|
858 |
-
if (widget.above) self.set(lineNo - 1, F_WIDGET_BELOW)
|
859 |
-
else self.set(lineNo, F_WIDGET)
|
860 |
-
})
|
861 |
-
cm.on("lineWidgetCleared", function(_, widget, lineNo) {
|
862 |
-
if (widget.mergeSpacer) return
|
863 |
-
if (widget.above) self.check(lineNo - 1, F_WIDGET_BELOW, self.hasWidgetBelow)
|
864 |
-
else self.check(lineNo, F_WIDGET, self.hasWidget)
|
865 |
-
})
|
866 |
-
cm.on("lineWidgetChanged", this.signal.bind(this))
|
867 |
-
cm.on("change", function(_, change) {
|
868 |
-
var start = change.from.line, nBefore = change.to.line - change.from.line
|
869 |
-
var nAfter = change.text.length - 1, end = start + nAfter
|
870 |
-
if (nBefore || nAfter) self.map(start, nBefore, nAfter)
|
871 |
-
self.check(end, F_MARKER, self.hasMarker)
|
872 |
-
if (nBefore || nAfter) self.check(change.from.line, F_MARKER, self.hasMarker)
|
873 |
-
})
|
874 |
-
cm.on("viewportChange", function() {
|
875 |
-
if (self.cm.doc.height != self.height) self.signal()
|
876 |
-
})
|
877 |
-
}
|
878 |
-
|
879 |
-
TrackAlignable.prototype = {
|
880 |
-
signal: function() {
|
881 |
-
CodeMirror.signal(this, "realign")
|
882 |
-
this.height = this.cm.doc.height
|
883 |
-
},
|
884 |
-
|
885 |
-
set: function(n, flags) {
|
886 |
-
var pos = -1
|
887 |
-
for (; pos < this.alignable.length; pos += 2) {
|
888 |
-
var diff = this.alignable[pos] - n
|
889 |
-
if (diff == 0) {
|
890 |
-
if ((this.alignable[pos + 1] & flags) == flags) return
|
891 |
-
this.alignable[pos + 1] |= flags
|
892 |
-
this.signal()
|
893 |
-
return
|
894 |
-
}
|
895 |
-
if (diff > 0) break
|
896 |
-
}
|
897 |
-
this.signal()
|
898 |
-
this.alignable.splice(pos, 0, n, flags)
|
899 |
-
},
|
900 |
-
|
901 |
-
find: function(n) {
|
902 |
-
for (var i = 0; i < this.alignable.length; i += 2)
|
903 |
-
if (this.alignable[i] == n) return i
|
904 |
-
return -1
|
905 |
-
},
|
906 |
-
|
907 |
-
check: function(n, flag, pred) {
|
908 |
-
var found = this.find(n)
|
909 |
-
if (found == -1 || !(this.alignable[found + 1] & flag)) return
|
910 |
-
if (!pred.call(this, n)) {
|
911 |
-
this.signal()
|
912 |
-
var flags = this.alignable[found + 1] & ~flag
|
913 |
-
if (flags) this.alignable[found + 1] = flags
|
914 |
-
else this.alignable.splice(found, 2)
|
915 |
-
}
|
916 |
-
},
|
917 |
-
|
918 |
-
hasMarker: function(n) {
|
919 |
-
var handle = this.cm.getLineHandle(n)
|
920 |
-
if (handle.markedSpans) for (var i = 0; i < handle.markedSpans.length; i++)
|
921 |
-
if (handle.markedSpans[i].mark.collapsed && handle.markedSpans[i].to != null)
|
922 |
-
return true
|
923 |
-
return false
|
924 |
-
},
|
925 |
-
|
926 |
-
hasWidget: function(n) {
|
927 |
-
var handle = this.cm.getLineHandle(n)
|
928 |
-
if (handle.widgets) for (var i = 0; i < handle.widgets.length; i++)
|
929 |
-
if (!handle.widgets[i].above && !handle.widgets[i].mergeSpacer) return true
|
930 |
-
return false
|
931 |
-
},
|
932 |
-
|
933 |
-
hasWidgetBelow: function(n) {
|
934 |
-
if (n == this.cm.lastLine()) return false
|
935 |
-
var handle = this.cm.getLineHandle(n + 1)
|
936 |
-
if (handle.widgets) for (var i = 0; i < handle.widgets.length; i++)
|
937 |
-
if (handle.widgets[i].above && !handle.widgets[i].mergeSpacer) return true
|
938 |
-
return false
|
939 |
-
},
|
940 |
-
|
941 |
-
map: function(from, nBefore, nAfter) {
|
942 |
-
var diff = nAfter - nBefore, to = from + nBefore, widgetFrom = -1, widgetTo = -1
|
943 |
-
for (var i = 0; i < this.alignable.length; i += 2) {
|
944 |
-
var n = this.alignable[i]
|
945 |
-
if (n == from && (this.alignable[i + 1] & F_WIDGET_BELOW)) widgetFrom = i
|
946 |
-
if (n == to && (this.alignable[i + 1] & F_WIDGET_BELOW)) widgetTo = i
|
947 |
-
if (n <= from) continue
|
948 |
-
else if (n < to) this.alignable.splice(i--, 2)
|
949 |
-
else this.alignable[i] += diff
|
950 |
-
}
|
951 |
-
if (widgetFrom > -1) {
|
952 |
-
var flags = this.alignable[widgetFrom + 1]
|
953 |
-
if (flags == F_WIDGET_BELOW) this.alignable.splice(widgetFrom, 2)
|
954 |
-
else this.alignable[widgetFrom + 1] = flags & ~F_WIDGET_BELOW
|
955 |
-
}
|
956 |
-
if (widgetTo > -1 && nAfter)
|
957 |
-
this.set(from + nAfter, F_WIDGET_BELOW)
|
958 |
-
}
|
959 |
-
}
|
960 |
-
|
961 |
-
function posMin(a, b) { return (a.line - b.line || a.ch - b.ch) < 0 ? a : b; }
|
962 |
-
function posMax(a, b) { return (a.line - b.line || a.ch - b.ch) > 0 ? a : b; }
|
963 |
-
function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }
|
964 |
-
|
965 |
-
function findPrevDiff(chunks, start, isOrig) {
|
966 |
-
for (var i = chunks.length - 1; i >= 0; i--) {
|
967 |
-
var chunk = chunks[i];
|
968 |
-
var to = (isOrig ? chunk.origTo : chunk.editTo) - 1;
|
969 |
-
if (to < start) return to;
|
970 |
-
}
|
971 |
-
}
|
972 |
-
|
973 |
-
function findNextDiff(chunks, start, isOrig) {
|
974 |
-
for (var i = 0; i < chunks.length; i++) {
|
975 |
-
var chunk = chunks[i];
|
976 |
-
var from = (isOrig ? chunk.origFrom : chunk.editFrom);
|
977 |
-
if (from > start) return from;
|
978 |
-
}
|
979 |
-
}
|
980 |
-
|
981 |
-
function goNearbyDiff(cm, dir) {
|
982 |
-
var found = null, views = cm.state.diffViews, line = cm.getCursor().line;
|
983 |
-
if (views) for (var i = 0; i < views.length; i++) {
|
984 |
-
var dv = views[i], isOrig = cm == dv.orig;
|
985 |
-
ensureDiff(dv);
|
986 |
-
var pos = dir < 0 ? findPrevDiff(dv.chunks, line, isOrig) : findNextDiff(dv.chunks, line, isOrig);
|
987 |
-
if (pos != null && (found == null || (dir < 0 ? pos > found : pos < found)))
|
988 |
-
found = pos;
|
989 |
-
}
|
990 |
-
if (found != null)
|
991 |
-
cm.setCursor(found, 0);
|
992 |
-
else
|
993 |
-
return CodeMirror.Pass;
|
994 |
-
}
|
995 |
-
|
996 |
-
CodeMirror.commands.goNextDiff = function(cm) {
|
997 |
-
return goNearbyDiff(cm, 1);
|
998 |
-
};
|
999 |
-
CodeMirror.commands.goPrevDiff = function(cm) {
|
1000 |
-
return goNearbyDiff(cm, -1);
|
1001 |
-
};
|
1002 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/mode/loadmode.js
DELETED
@@ -1,64 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), "cjs");
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], function(CM) { mod(CM, "amd"); });
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror, "plain");
|
11 |
-
})(function(CodeMirror, env) {
|
12 |
-
if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
|
13 |
-
|
14 |
-
var loading = {};
|
15 |
-
function splitCallback(cont, n) {
|
16 |
-
var countDown = n;
|
17 |
-
return function() { if (--countDown == 0) cont(); };
|
18 |
-
}
|
19 |
-
function ensureDeps(mode, cont) {
|
20 |
-
var deps = CodeMirror.modes[mode].dependencies;
|
21 |
-
if (!deps) return cont();
|
22 |
-
var missing = [];
|
23 |
-
for (var i = 0; i < deps.length; ++i) {
|
24 |
-
if (!CodeMirror.modes.hasOwnProperty(deps[i]))
|
25 |
-
missing.push(deps[i]);
|
26 |
-
}
|
27 |
-
if (!missing.length) return cont();
|
28 |
-
var split = splitCallback(cont, missing.length);
|
29 |
-
for (var i = 0; i < missing.length; ++i)
|
30 |
-
CodeMirror.requireMode(missing[i], split);
|
31 |
-
}
|
32 |
-
|
33 |
-
CodeMirror.requireMode = function(mode, cont) {
|
34 |
-
if (typeof mode != "string") mode = mode.name;
|
35 |
-
if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
|
36 |
-
if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
|
37 |
-
|
38 |
-
var file = CodeMirror.modeURL.replace(/%N/g, mode);
|
39 |
-
if (env == "plain") {
|
40 |
-
var script = document.createElement("script");
|
41 |
-
script.src = file;
|
42 |
-
var others = document.getElementsByTagName("script")[0];
|
43 |
-
var list = loading[mode] = [cont];
|
44 |
-
CodeMirror.on(script, "load", function() {
|
45 |
-
ensureDeps(mode, function() {
|
46 |
-
for (var i = 0; i < list.length; ++i) list[i]();
|
47 |
-
});
|
48 |
-
});
|
49 |
-
others.parentNode.insertBefore(script, others);
|
50 |
-
} else if (env == "cjs") {
|
51 |
-
require(file);
|
52 |
-
cont();
|
53 |
-
} else if (env == "amd") {
|
54 |
-
requirejs([file], cont);
|
55 |
-
}
|
56 |
-
};
|
57 |
-
|
58 |
-
CodeMirror.autoLoadMode = function(instance, mode) {
|
59 |
-
if (!CodeMirror.modes.hasOwnProperty(mode))
|
60 |
-
CodeMirror.requireMode(mode, function() {
|
61 |
-
instance.setOption("mode", instance.getOption("mode"));
|
62 |
-
});
|
63 |
-
};
|
64 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/mode/multiplex.js
DELETED
@@ -1,131 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.multiplexingMode = function(outer /*, others */) {
|
15 |
-
// Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects
|
16 |
-
var others = Array.prototype.slice.call(arguments, 1);
|
17 |
-
|
18 |
-
function indexOf(string, pattern, from, returnEnd) {
|
19 |
-
if (typeof pattern == "string") {
|
20 |
-
var found = string.indexOf(pattern, from);
|
21 |
-
return returnEnd && found > -1 ? found + pattern.length : found;
|
22 |
-
}
|
23 |
-
var m = pattern.exec(from ? string.slice(from) : string);
|
24 |
-
return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1;
|
25 |
-
}
|
26 |
-
|
27 |
-
return {
|
28 |
-
startState: function() {
|
29 |
-
return {
|
30 |
-
outer: CodeMirror.startState(outer),
|
31 |
-
innerActive: null,
|
32 |
-
inner: null
|
33 |
-
};
|
34 |
-
},
|
35 |
-
|
36 |
-
copyState: function(state) {
|
37 |
-
return {
|
38 |
-
outer: CodeMirror.copyState(outer, state.outer),
|
39 |
-
innerActive: state.innerActive,
|
40 |
-
inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
|
41 |
-
};
|
42 |
-
},
|
43 |
-
|
44 |
-
token: function(stream, state) {
|
45 |
-
if (!state.innerActive) {
|
46 |
-
var cutOff = Infinity, oldContent = stream.string;
|
47 |
-
for (var i = 0; i < others.length; ++i) {
|
48 |
-
var other = others[i];
|
49 |
-
var found = indexOf(oldContent, other.open, stream.pos);
|
50 |
-
if (found == stream.pos) {
|
51 |
-
if (!other.parseDelimiters) stream.match(other.open);
|
52 |
-
state.innerActive = other;
|
53 |
-
|
54 |
-
// Get the outer indent, making sure to handle CodeMirror.Pass
|
55 |
-
var outerIndent = 0;
|
56 |
-
if (outer.indent) {
|
57 |
-
var possibleOuterIndent = outer.indent(state.outer, "", "");
|
58 |
-
if (possibleOuterIndent !== CodeMirror.Pass) outerIndent = possibleOuterIndent;
|
59 |
-
}
|
60 |
-
|
61 |
-
state.inner = CodeMirror.startState(other.mode, outerIndent);
|
62 |
-
return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
|
63 |
-
} else if (found != -1 && found < cutOff) {
|
64 |
-
cutOff = found;
|
65 |
-
}
|
66 |
-
}
|
67 |
-
if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
|
68 |
-
var outerToken = outer.token(stream, state.outer);
|
69 |
-
if (cutOff != Infinity) stream.string = oldContent;
|
70 |
-
return outerToken;
|
71 |
-
} else {
|
72 |
-
var curInner = state.innerActive, oldContent = stream.string;
|
73 |
-
if (!curInner.close && stream.sol()) {
|
74 |
-
state.innerActive = state.inner = null;
|
75 |
-
return this.token(stream, state);
|
76 |
-
}
|
77 |
-
var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1;
|
78 |
-
if (found == stream.pos && !curInner.parseDelimiters) {
|
79 |
-
stream.match(curInner.close);
|
80 |
-
state.innerActive = state.inner = null;
|
81 |
-
return curInner.delimStyle && (curInner.delimStyle + " " + curInner.delimStyle + "-close");
|
82 |
-
}
|
83 |
-
if (found > -1) stream.string = oldContent.slice(0, found);
|
84 |
-
var innerToken = curInner.mode.token(stream, state.inner);
|
85 |
-
if (found > -1) stream.string = oldContent;
|
86 |
-
|
87 |
-
if (found == stream.pos && curInner.parseDelimiters)
|
88 |
-
state.innerActive = state.inner = null;
|
89 |
-
|
90 |
-
if (curInner.innerStyle) {
|
91 |
-
if (innerToken) innerToken = innerToken + " " + curInner.innerStyle;
|
92 |
-
else innerToken = curInner.innerStyle;
|
93 |
-
}
|
94 |
-
|
95 |
-
return innerToken;
|
96 |
-
}
|
97 |
-
},
|
98 |
-
|
99 |
-
indent: function(state, textAfter, line) {
|
100 |
-
var mode = state.innerActive ? state.innerActive.mode : outer;
|
101 |
-
if (!mode.indent) return CodeMirror.Pass;
|
102 |
-
return mode.indent(state.innerActive ? state.inner : state.outer, textAfter, line);
|
103 |
-
},
|
104 |
-
|
105 |
-
blankLine: function(state) {
|
106 |
-
var mode = state.innerActive ? state.innerActive.mode : outer;
|
107 |
-
if (mode.blankLine) {
|
108 |
-
mode.blankLine(state.innerActive ? state.inner : state.outer);
|
109 |
-
}
|
110 |
-
if (!state.innerActive) {
|
111 |
-
for (var i = 0; i < others.length; ++i) {
|
112 |
-
var other = others[i];
|
113 |
-
if (other.open === "\n") {
|
114 |
-
state.innerActive = other;
|
115 |
-
state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "", "") : 0);
|
116 |
-
}
|
117 |
-
}
|
118 |
-
} else if (state.innerActive.close === "\n") {
|
119 |
-
state.innerActive = state.inner = null;
|
120 |
-
}
|
121 |
-
},
|
122 |
-
|
123 |
-
electricChars: outer.electricChars,
|
124 |
-
|
125 |
-
innerMode: function(state) {
|
126 |
-
return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
|
127 |
-
}
|
128 |
-
};
|
129 |
-
};
|
130 |
-
|
131 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/mode/multiplex_test.js
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function() {
|
5 |
-
CodeMirror.defineMode("markdown_with_stex", function(){
|
6 |
-
var inner = CodeMirror.getMode({}, "stex");
|
7 |
-
var outer = CodeMirror.getMode({}, "markdown");
|
8 |
-
|
9 |
-
var innerOptions = {
|
10 |
-
open: '$',
|
11 |
-
close: '$',
|
12 |
-
mode: inner,
|
13 |
-
delimStyle: 'delim',
|
14 |
-
innerStyle: 'inner'
|
15 |
-
};
|
16 |
-
|
17 |
-
return CodeMirror.multiplexingMode(outer, innerOptions);
|
18 |
-
});
|
19 |
-
|
20 |
-
var mode = CodeMirror.getMode({}, "markdown_with_stex");
|
21 |
-
|
22 |
-
function MT(name) {
|
23 |
-
test.mode(
|
24 |
-
name,
|
25 |
-
mode,
|
26 |
-
Array.prototype.slice.call(arguments, 1),
|
27 |
-
'multiplexing');
|
28 |
-
}
|
29 |
-
|
30 |
-
MT(
|
31 |
-
"stexInsideMarkdown",
|
32 |
-
"[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]");
|
33 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/mode/overlay.js
DELETED
@@ -1,90 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Utility function that allows modes to be combined. The mode given
|
5 |
-
// as the base argument takes care of most of the normal mode
|
6 |
-
// functionality, but a second (typically simple) mode is used, which
|
7 |
-
// can override the style of text. Both modes get to parse all of the
|
8 |
-
// text, but when both assign a non-null style to a piece of code, the
|
9 |
-
// overlay wins, unless the combine argument was true and not overridden,
|
10 |
-
// or state.overlay.combineTokens was true, in which case the styles are
|
11 |
-
// combined.
|
12 |
-
|
13 |
-
(function(mod) {
|
14 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
15 |
-
mod(require("../../lib/codemirror"));
|
16 |
-
else if (typeof define == "function" && define.amd) // AMD
|
17 |
-
define(["../../lib/codemirror"], mod);
|
18 |
-
else // Plain browser env
|
19 |
-
mod(CodeMirror);
|
20 |
-
})(function(CodeMirror) {
|
21 |
-
"use strict";
|
22 |
-
|
23 |
-
CodeMirror.overlayMode = function(base, overlay, combine) {
|
24 |
-
return {
|
25 |
-
startState: function() {
|
26 |
-
return {
|
27 |
-
base: CodeMirror.startState(base),
|
28 |
-
overlay: CodeMirror.startState(overlay),
|
29 |
-
basePos: 0, baseCur: null,
|
30 |
-
overlayPos: 0, overlayCur: null,
|
31 |
-
streamSeen: null
|
32 |
-
};
|
33 |
-
},
|
34 |
-
copyState: function(state) {
|
35 |
-
return {
|
36 |
-
base: CodeMirror.copyState(base, state.base),
|
37 |
-
overlay: CodeMirror.copyState(overlay, state.overlay),
|
38 |
-
basePos: state.basePos, baseCur: null,
|
39 |
-
overlayPos: state.overlayPos, overlayCur: null
|
40 |
-
};
|
41 |
-
},
|
42 |
-
|
43 |
-
token: function(stream, state) {
|
44 |
-
if (stream != state.streamSeen ||
|
45 |
-
Math.min(state.basePos, state.overlayPos) < stream.start) {
|
46 |
-
state.streamSeen = stream;
|
47 |
-
state.basePos = state.overlayPos = stream.start;
|
48 |
-
}
|
49 |
-
|
50 |
-
if (stream.start == state.basePos) {
|
51 |
-
state.baseCur = base.token(stream, state.base);
|
52 |
-
state.basePos = stream.pos;
|
53 |
-
}
|
54 |
-
if (stream.start == state.overlayPos) {
|
55 |
-
stream.pos = stream.start;
|
56 |
-
state.overlayCur = overlay.token(stream, state.overlay);
|
57 |
-
state.overlayPos = stream.pos;
|
58 |
-
}
|
59 |
-
stream.pos = Math.min(state.basePos, state.overlayPos);
|
60 |
-
|
61 |
-
// state.overlay.combineTokens always takes precedence over combine,
|
62 |
-
// unless set to null
|
63 |
-
if (state.overlayCur == null) return state.baseCur;
|
64 |
-
else if (state.baseCur != null &&
|
65 |
-
state.overlay.combineTokens ||
|
66 |
-
combine && state.overlay.combineTokens == null)
|
67 |
-
return state.baseCur + " " + state.overlayCur;
|
68 |
-
else return state.overlayCur;
|
69 |
-
},
|
70 |
-
|
71 |
-
indent: base.indent && function(state, textAfter, line) {
|
72 |
-
return base.indent(state.base, textAfter, line);
|
73 |
-
},
|
74 |
-
electricChars: base.electricChars,
|
75 |
-
|
76 |
-
innerMode: function(state) { return {state: state.base, mode: base}; },
|
77 |
-
|
78 |
-
blankLine: function(state) {
|
79 |
-
var baseToken, overlayToken;
|
80 |
-
if (base.blankLine) baseToken = base.blankLine(state.base);
|
81 |
-
if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay);
|
82 |
-
|
83 |
-
return overlayToken == null ?
|
84 |
-
baseToken :
|
85 |
-
(combine && baseToken != null ? baseToken + " " + overlayToken : overlayToken);
|
86 |
-
}
|
87 |
-
};
|
88 |
-
};
|
89 |
-
|
90 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/mode/simple.js
DELETED
@@ -1,216 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineSimpleMode = function(name, states) {
|
15 |
-
CodeMirror.defineMode(name, function(config) {
|
16 |
-
return CodeMirror.simpleMode(config, states);
|
17 |
-
});
|
18 |
-
};
|
19 |
-
|
20 |
-
CodeMirror.simpleMode = function(config, states) {
|
21 |
-
ensureState(states, "start");
|
22 |
-
var states_ = {}, meta = states.meta || {}, hasIndentation = false;
|
23 |
-
for (var state in states) if (state != meta && states.hasOwnProperty(state)) {
|
24 |
-
var list = states_[state] = [], orig = states[state];
|
25 |
-
for (var i = 0; i < orig.length; i++) {
|
26 |
-
var data = orig[i];
|
27 |
-
list.push(new Rule(data, states));
|
28 |
-
if (data.indent || data.dedent) hasIndentation = true;
|
29 |
-
}
|
30 |
-
}
|
31 |
-
var mode = {
|
32 |
-
startState: function() {
|
33 |
-
return {state: "start", pending: null,
|
34 |
-
local: null, localState: null,
|
35 |
-
indent: hasIndentation ? [] : null};
|
36 |
-
},
|
37 |
-
copyState: function(state) {
|
38 |
-
var s = {state: state.state, pending: state.pending,
|
39 |
-
local: state.local, localState: null,
|
40 |
-
indent: state.indent && state.indent.slice(0)};
|
41 |
-
if (state.localState)
|
42 |
-
s.localState = CodeMirror.copyState(state.local.mode, state.localState);
|
43 |
-
if (state.stack)
|
44 |
-
s.stack = state.stack.slice(0);
|
45 |
-
for (var pers = state.persistentStates; pers; pers = pers.next)
|
46 |
-
s.persistentStates = {mode: pers.mode,
|
47 |
-
spec: pers.spec,
|
48 |
-
state: pers.state == state.localState ? s.localState : CodeMirror.copyState(pers.mode, pers.state),
|
49 |
-
next: s.persistentStates};
|
50 |
-
return s;
|
51 |
-
},
|
52 |
-
token: tokenFunction(states_, config),
|
53 |
-
innerMode: function(state) { return state.local && {mode: state.local.mode, state: state.localState}; },
|
54 |
-
indent: indentFunction(states_, meta)
|
55 |
-
};
|
56 |
-
if (meta) for (var prop in meta) if (meta.hasOwnProperty(prop))
|
57 |
-
mode[prop] = meta[prop];
|
58 |
-
return mode;
|
59 |
-
};
|
60 |
-
|
61 |
-
function ensureState(states, name) {
|
62 |
-
if (!states.hasOwnProperty(name))
|
63 |
-
throw new Error("Undefined state " + name + " in simple mode");
|
64 |
-
}
|
65 |
-
|
66 |
-
function toRegex(val, caret) {
|
67 |
-
if (!val) return /(?:)/;
|
68 |
-
var flags = "";
|
69 |
-
if (val instanceof RegExp) {
|
70 |
-
if (val.ignoreCase) flags = "i";
|
71 |
-
val = val.source;
|
72 |
-
} else {
|
73 |
-
val = String(val);
|
74 |
-
}
|
75 |
-
return new RegExp((caret === false ? "" : "^") + "(?:" + val + ")", flags);
|
76 |
-
}
|
77 |
-
|
78 |
-
function asToken(val) {
|
79 |
-
if (!val) return null;
|
80 |
-
if (val.apply) return val
|
81 |
-
if (typeof val == "string") return val.replace(/\./g, " ");
|
82 |
-
var result = [];
|
83 |
-
for (var i = 0; i < val.length; i++)
|
84 |
-
result.push(val[i] && val[i].replace(/\./g, " "));
|
85 |
-
return result;
|
86 |
-
}
|
87 |
-
|
88 |
-
function Rule(data, states) {
|
89 |
-
if (data.next || data.push) ensureState(states, data.next || data.push);
|
90 |
-
this.regex = toRegex(data.regex);
|
91 |
-
this.token = asToken(data.token);
|
92 |
-
this.data = data;
|
93 |
-
}
|
94 |
-
|
95 |
-
function tokenFunction(states, config) {
|
96 |
-
return function(stream, state) {
|
97 |
-
if (state.pending) {
|
98 |
-
var pend = state.pending.shift();
|
99 |
-
if (state.pending.length == 0) state.pending = null;
|
100 |
-
stream.pos += pend.text.length;
|
101 |
-
return pend.token;
|
102 |
-
}
|
103 |
-
|
104 |
-
if (state.local) {
|
105 |
-
if (state.local.end && stream.match(state.local.end)) {
|
106 |
-
var tok = state.local.endToken || null;
|
107 |
-
state.local = state.localState = null;
|
108 |
-
return tok;
|
109 |
-
} else {
|
110 |
-
var tok = state.local.mode.token(stream, state.localState), m;
|
111 |
-
if (state.local.endScan && (m = state.local.endScan.exec(stream.current())))
|
112 |
-
stream.pos = stream.start + m.index;
|
113 |
-
return tok;
|
114 |
-
}
|
115 |
-
}
|
116 |
-
|
117 |
-
var curState = states[state.state];
|
118 |
-
for (var i = 0; i < curState.length; i++) {
|
119 |
-
var rule = curState[i];
|
120 |
-
var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);
|
121 |
-
if (matches) {
|
122 |
-
if (rule.data.next) {
|
123 |
-
state.state = rule.data.next;
|
124 |
-
} else if (rule.data.push) {
|
125 |
-
(state.stack || (state.stack = [])).push(state.state);
|
126 |
-
state.state = rule.data.push;
|
127 |
-
} else if (rule.data.pop && state.stack && state.stack.length) {
|
128 |
-
state.state = state.stack.pop();
|
129 |
-
}
|
130 |
-
|
131 |
-
if (rule.data.mode)
|
132 |
-
enterLocalMode(config, state, rule.data.mode, rule.token);
|
133 |
-
if (rule.data.indent)
|
134 |
-
state.indent.push(stream.indentation() + config.indentUnit);
|
135 |
-
if (rule.data.dedent)
|
136 |
-
state.indent.pop();
|
137 |
-
var token = rule.token
|
138 |
-
if (token && token.apply) token = token(matches)
|
139 |
-
if (matches.length > 2 && rule.token && typeof rule.token != "string") {
|
140 |
-
state.pending = [];
|
141 |
-
for (var j = 2; j < matches.length; j++)
|
142 |
-
if (matches[j])
|
143 |
-
state.pending.push({text: matches[j], token: rule.token[j - 1]});
|
144 |
-
stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));
|
145 |
-
return token[0];
|
146 |
-
} else if (token && token.join) {
|
147 |
-
return token[0];
|
148 |
-
} else {
|
149 |
-
return token;
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
stream.next();
|
154 |
-
return null;
|
155 |
-
};
|
156 |
-
}
|
157 |
-
|
158 |
-
function cmp(a, b) {
|
159 |
-
if (a === b) return true;
|
160 |
-
if (!a || typeof a != "object" || !b || typeof b != "object") return false;
|
161 |
-
var props = 0;
|
162 |
-
for (var prop in a) if (a.hasOwnProperty(prop)) {
|
163 |
-
if (!b.hasOwnProperty(prop) || !cmp(a[prop], b[prop])) return false;
|
164 |
-
props++;
|
165 |
-
}
|
166 |
-
for (var prop in b) if (b.hasOwnProperty(prop)) props--;
|
167 |
-
return props == 0;
|
168 |
-
}
|
169 |
-
|
170 |
-
function enterLocalMode(config, state, spec, token) {
|
171 |
-
var pers;
|
172 |
-
if (spec.persistent) for (var p = state.persistentStates; p && !pers; p = p.next)
|
173 |
-
if (spec.spec ? cmp(spec.spec, p.spec) : spec.mode == p.mode) pers = p;
|
174 |
-
var mode = pers ? pers.mode : spec.mode || CodeMirror.getMode(config, spec.spec);
|
175 |
-
var lState = pers ? pers.state : CodeMirror.startState(mode);
|
176 |
-
if (spec.persistent && !pers)
|
177 |
-
state.persistentStates = {mode: mode, spec: spec.spec, state: lState, next: state.persistentStates};
|
178 |
-
|
179 |
-
state.localState = lState;
|
180 |
-
state.local = {mode: mode,
|
181 |
-
end: spec.end && toRegex(spec.end),
|
182 |
-
endScan: spec.end && spec.forceEnd !== false && toRegex(spec.end, false),
|
183 |
-
endToken: token && token.join ? token[token.length - 1] : token};
|
184 |
-
}
|
185 |
-
|
186 |
-
function indexOf(val, arr) {
|
187 |
-
for (var i = 0; i < arr.length; i++) if (arr[i] === val) return true;
|
188 |
-
}
|
189 |
-
|
190 |
-
function indentFunction(states, meta) {
|
191 |
-
return function(state, textAfter, line) {
|
192 |
-
if (state.local && state.local.mode.indent)
|
193 |
-
return state.local.mode.indent(state.localState, textAfter, line);
|
194 |
-
if (state.indent == null || state.local || meta.dontIndentStates && indexOf(state.state, meta.dontIndentStates) > -1)
|
195 |
-
return CodeMirror.Pass;
|
196 |
-
|
197 |
-
var pos = state.indent.length - 1, rules = states[state.state];
|
198 |
-
scan: for (;;) {
|
199 |
-
for (var i = 0; i < rules.length; i++) {
|
200 |
-
var rule = rules[i];
|
201 |
-
if (rule.data.dedent && rule.data.dedentIfLineStart !== false) {
|
202 |
-
var m = rule.regex.exec(textAfter);
|
203 |
-
if (m && m[0]) {
|
204 |
-
pos--;
|
205 |
-
if (rule.next || rule.push) rules = states[rule.next || rule.push];
|
206 |
-
textAfter = textAfter.slice(m[0].length);
|
207 |
-
continue scan;
|
208 |
-
}
|
209 |
-
}
|
210 |
-
}
|
211 |
-
break;
|
212 |
-
}
|
213 |
-
return pos < 0 ? 0 : state.indent[pos];
|
214 |
-
};
|
215 |
-
}
|
216 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/runmode/colorize.js
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), require("./runmode"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror", "./runmode"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
|
15 |
-
|
16 |
-
function textContent(node, out) {
|
17 |
-
if (node.nodeType == 3) return out.push(node.nodeValue);
|
18 |
-
for (var ch = node.firstChild; ch; ch = ch.nextSibling) {
|
19 |
-
textContent(ch, out);
|
20 |
-
if (isBlock.test(node.nodeType)) out.push("\n");
|
21 |
-
}
|
22 |
-
}
|
23 |
-
|
24 |
-
CodeMirror.colorize = function(collection, defaultMode) {
|
25 |
-
if (!collection) collection = document.body.getElementsByTagName("pre");
|
26 |
-
|
27 |
-
for (var i = 0; i < collection.length; ++i) {
|
28 |
-
var node = collection[i];
|
29 |
-
var mode = node.getAttribute("data-lang") || defaultMode;
|
30 |
-
if (!mode) continue;
|
31 |
-
|
32 |
-
var text = [];
|
33 |
-
textContent(node, text);
|
34 |
-
node.innerHTML = "";
|
35 |
-
CodeMirror.runMode(text.join(""), mode, node);
|
36 |
-
|
37 |
-
node.className += " cm-s-default";
|
38 |
-
}
|
39 |
-
};
|
40 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/runmode/runmode-standalone.js
DELETED
@@ -1,158 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
window.CodeMirror = {};
|
5 |
-
|
6 |
-
(function() {
|
7 |
-
"use strict";
|
8 |
-
|
9 |
-
function splitLines(string){ return string.split(/\r?\n|\r/); };
|
10 |
-
|
11 |
-
function StringStream(string) {
|
12 |
-
this.pos = this.start = 0;
|
13 |
-
this.string = string;
|
14 |
-
this.lineStart = 0;
|
15 |
-
}
|
16 |
-
StringStream.prototype = {
|
17 |
-
eol: function() {return this.pos >= this.string.length;},
|
18 |
-
sol: function() {return this.pos == 0;},
|
19 |
-
peek: function() {return this.string.charAt(this.pos) || null;},
|
20 |
-
next: function() {
|
21 |
-
if (this.pos < this.string.length)
|
22 |
-
return this.string.charAt(this.pos++);
|
23 |
-
},
|
24 |
-
eat: function(match) {
|
25 |
-
var ch = this.string.charAt(this.pos);
|
26 |
-
if (typeof match == "string") var ok = ch == match;
|
27 |
-
else var ok = ch && (match.test ? match.test(ch) : match(ch));
|
28 |
-
if (ok) {++this.pos; return ch;}
|
29 |
-
},
|
30 |
-
eatWhile: function(match) {
|
31 |
-
var start = this.pos;
|
32 |
-
while (this.eat(match)){}
|
33 |
-
return this.pos > start;
|
34 |
-
},
|
35 |
-
eatSpace: function() {
|
36 |
-
var start = this.pos;
|
37 |
-
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
|
38 |
-
return this.pos > start;
|
39 |
-
},
|
40 |
-
skipToEnd: function() {this.pos = this.string.length;},
|
41 |
-
skipTo: function(ch) {
|
42 |
-
var found = this.string.indexOf(ch, this.pos);
|
43 |
-
if (found > -1) {this.pos = found; return true;}
|
44 |
-
},
|
45 |
-
backUp: function(n) {this.pos -= n;},
|
46 |
-
column: function() {return this.start - this.lineStart;},
|
47 |
-
indentation: function() {return 0;},
|
48 |
-
match: function(pattern, consume, caseInsensitive) {
|
49 |
-
if (typeof pattern == "string") {
|
50 |
-
var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
|
51 |
-
var substr = this.string.substr(this.pos, pattern.length);
|
52 |
-
if (cased(substr) == cased(pattern)) {
|
53 |
-
if (consume !== false) this.pos += pattern.length;
|
54 |
-
return true;
|
55 |
-
}
|
56 |
-
} else {
|
57 |
-
var match = this.string.slice(this.pos).match(pattern);
|
58 |
-
if (match && match.index > 0) return null;
|
59 |
-
if (match && consume !== false) this.pos += match[0].length;
|
60 |
-
return match;
|
61 |
-
}
|
62 |
-
},
|
63 |
-
current: function(){return this.string.slice(this.start, this.pos);},
|
64 |
-
hideFirstChars: function(n, inner) {
|
65 |
-
this.lineStart += n;
|
66 |
-
try { return inner(); }
|
67 |
-
finally { this.lineStart -= n; }
|
68 |
-
},
|
69 |
-
lookAhead: function() { return null }
|
70 |
-
};
|
71 |
-
CodeMirror.StringStream = StringStream;
|
72 |
-
|
73 |
-
CodeMirror.startState = function (mode, a1, a2) {
|
74 |
-
return mode.startState ? mode.startState(a1, a2) : true;
|
75 |
-
};
|
76 |
-
|
77 |
-
var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
|
78 |
-
CodeMirror.defineMode = function (name, mode) {
|
79 |
-
if (arguments.length > 2)
|
80 |
-
mode.dependencies = Array.prototype.slice.call(arguments, 2);
|
81 |
-
modes[name] = mode;
|
82 |
-
};
|
83 |
-
CodeMirror.defineMIME = function (mime, spec) { mimeModes[mime] = spec; };
|
84 |
-
CodeMirror.resolveMode = function(spec) {
|
85 |
-
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
86 |
-
spec = mimeModes[spec];
|
87 |
-
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
88 |
-
spec = mimeModes[spec.name];
|
89 |
-
}
|
90 |
-
if (typeof spec == "string") return {name: spec};
|
91 |
-
else return spec || {name: "null"};
|
92 |
-
};
|
93 |
-
CodeMirror.getMode = function (options, spec) {
|
94 |
-
spec = CodeMirror.resolveMode(spec);
|
95 |
-
var mfactory = modes[spec.name];
|
96 |
-
if (!mfactory) throw new Error("Unknown mode: " + spec);
|
97 |
-
return mfactory(options, spec);
|
98 |
-
};
|
99 |
-
CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min;
|
100 |
-
CodeMirror.defineMode("null", function() {
|
101 |
-
return {token: function(stream) {stream.skipToEnd();}};
|
102 |
-
});
|
103 |
-
CodeMirror.defineMIME("text/plain", "null");
|
104 |
-
|
105 |
-
CodeMirror.runMode = function (string, modespec, callback, options) {
|
106 |
-
var mode = CodeMirror.getMode({ indentUnit: 2 }, modespec);
|
107 |
-
|
108 |
-
if (callback.nodeType == 1) {
|
109 |
-
var tabSize = (options && options.tabSize) || 4;
|
110 |
-
var node = callback, col = 0;
|
111 |
-
node.innerHTML = "";
|
112 |
-
callback = function (text, style) {
|
113 |
-
if (text == "\n") {
|
114 |
-
node.appendChild(document.createElement("br"));
|
115 |
-
col = 0;
|
116 |
-
return;
|
117 |
-
}
|
118 |
-
var content = "";
|
119 |
-
// replace tabs
|
120 |
-
for (var pos = 0; ;) {
|
121 |
-
var idx = text.indexOf("\t", pos);
|
122 |
-
if (idx == -1) {
|
123 |
-
content += text.slice(pos);
|
124 |
-
col += text.length - pos;
|
125 |
-
break;
|
126 |
-
} else {
|
127 |
-
col += idx - pos;
|
128 |
-
content += text.slice(pos, idx);
|
129 |
-
var size = tabSize - col % tabSize;
|
130 |
-
col += size;
|
131 |
-
for (var i = 0; i < size; ++i) content += " ";
|
132 |
-
pos = idx + 1;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
if (style) {
|
137 |
-
var sp = node.appendChild(document.createElement("span"));
|
138 |
-
sp.className = "cm-" + style.replace(/ +/g, " cm-");
|
139 |
-
sp.appendChild(document.createTextNode(content));
|
140 |
-
} else {
|
141 |
-
node.appendChild(document.createTextNode(content));
|
142 |
-
}
|
143 |
-
};
|
144 |
-
}
|
145 |
-
|
146 |
-
var lines = splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
|
147 |
-
for (var i = 0, e = lines.length; i < e; ++i) {
|
148 |
-
if (i) callback("\n");
|
149 |
-
var stream = new CodeMirror.StringStream(lines[i]);
|
150 |
-
if (!stream.string && mode.blankLine) mode.blankLine(state);
|
151 |
-
while (!stream.eol()) {
|
152 |
-
var style = mode.token(stream, state);
|
153 |
-
callback(stream.current(), style, i, stream.start, state);
|
154 |
-
stream.start = stream.pos;
|
155 |
-
}
|
156 |
-
}
|
157 |
-
};
|
158 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/runmode/runmode.js
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.runMode = function(string, modespec, callback, options) {
|
15 |
-
var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
|
16 |
-
var ie = /MSIE \d/.test(navigator.userAgent);
|
17 |
-
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
|
18 |
-
|
19 |
-
if (callback.appendChild) {
|
20 |
-
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
|
21 |
-
var node = callback, col = 0;
|
22 |
-
node.innerHTML = "";
|
23 |
-
callback = function(text, style) {
|
24 |
-
if (text == "\n") {
|
25 |
-
// Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
|
26 |
-
// Emitting a carriage return makes everything ok.
|
27 |
-
node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
|
28 |
-
col = 0;
|
29 |
-
return;
|
30 |
-
}
|
31 |
-
var content = "";
|
32 |
-
// replace tabs
|
33 |
-
for (var pos = 0;;) {
|
34 |
-
var idx = text.indexOf("\t", pos);
|
35 |
-
if (idx == -1) {
|
36 |
-
content += text.slice(pos);
|
37 |
-
col += text.length - pos;
|
38 |
-
break;
|
39 |
-
} else {
|
40 |
-
col += idx - pos;
|
41 |
-
content += text.slice(pos, idx);
|
42 |
-
var size = tabSize - col % tabSize;
|
43 |
-
col += size;
|
44 |
-
for (var i = 0; i < size; ++i) content += " ";
|
45 |
-
pos = idx + 1;
|
46 |
-
}
|
47 |
-
}
|
48 |
-
|
49 |
-
if (style) {
|
50 |
-
var sp = node.appendChild(document.createElement("span"));
|
51 |
-
sp.className = "cm-" + style.replace(/ +/g, " cm-");
|
52 |
-
sp.appendChild(document.createTextNode(content));
|
53 |
-
} else {
|
54 |
-
node.appendChild(document.createTextNode(content));
|
55 |
-
}
|
56 |
-
};
|
57 |
-
}
|
58 |
-
|
59 |
-
var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
|
60 |
-
for (var i = 0, e = lines.length; i < e; ++i) {
|
61 |
-
if (i) callback("\n");
|
62 |
-
var stream = new CodeMirror.StringStream(lines[i]);
|
63 |
-
if (!stream.string && mode.blankLine) mode.blankLine(state);
|
64 |
-
while (!stream.eol()) {
|
65 |
-
var style = mode.token(stream, state);
|
66 |
-
callback(stream.current(), style, i, stream.start, state);
|
67 |
-
stream.start = stream.pos;
|
68 |
-
}
|
69 |
-
}
|
70 |
-
};
|
71 |
-
|
72 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/runmode/runmode.node.js
DELETED
@@ -1,197 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
/* Just enough of CodeMirror to run runMode under node.js */
|
5 |
-
|
6 |
-
function splitLines(string){return string.split(/\r\n?|\n/);};
|
7 |
-
|
8 |
-
// Counts the column offset in a string, taking tabs into account.
|
9 |
-
// Used mostly to find indentation.
|
10 |
-
var countColumn = exports.countColumn = function(string, end, tabSize, startIndex, startValue) {
|
11 |
-
if (end == null) {
|
12 |
-
end = string.search(/[^\s\u00a0]/);
|
13 |
-
if (end == -1) end = string.length;
|
14 |
-
}
|
15 |
-
for (var i = startIndex || 0, n = startValue || 0;;) {
|
16 |
-
var nextTab = string.indexOf("\t", i);
|
17 |
-
if (nextTab < 0 || nextTab >= end)
|
18 |
-
return n + (end - i);
|
19 |
-
n += nextTab - i;
|
20 |
-
n += tabSize - (n % tabSize);
|
21 |
-
i = nextTab + 1;
|
22 |
-
}
|
23 |
-
};
|
24 |
-
|
25 |
-
function StringStream(string, tabSize, context) {
|
26 |
-
this.pos = this.start = 0;
|
27 |
-
this.string = string;
|
28 |
-
this.tabSize = tabSize || 8;
|
29 |
-
this.lastColumnPos = this.lastColumnValue = 0;
|
30 |
-
this.lineStart = 0;
|
31 |
-
this.context = context
|
32 |
-
};
|
33 |
-
|
34 |
-
StringStream.prototype = {
|
35 |
-
eol: function() {return this.pos >= this.string.length;},
|
36 |
-
sol: function() {return this.pos == this.lineStart;},
|
37 |
-
peek: function() {return this.string.charAt(this.pos) || undefined;},
|
38 |
-
next: function() {
|
39 |
-
if (this.pos < this.string.length)
|
40 |
-
return this.string.charAt(this.pos++);
|
41 |
-
},
|
42 |
-
eat: function(match) {
|
43 |
-
var ch = this.string.charAt(this.pos);
|
44 |
-
if (typeof match == "string") var ok = ch == match;
|
45 |
-
else var ok = ch && (match.test ? match.test(ch) : match(ch));
|
46 |
-
if (ok) {++this.pos; return ch;}
|
47 |
-
},
|
48 |
-
eatWhile: function(match) {
|
49 |
-
var start = this.pos;
|
50 |
-
while (this.eat(match)){}
|
51 |
-
return this.pos > start;
|
52 |
-
},
|
53 |
-
eatSpace: function() {
|
54 |
-
var start = this.pos;
|
55 |
-
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
|
56 |
-
return this.pos > start;
|
57 |
-
},
|
58 |
-
skipToEnd: function() {this.pos = this.string.length;},
|
59 |
-
skipTo: function(ch) {
|
60 |
-
var found = this.string.indexOf(ch, this.pos);
|
61 |
-
if (found > -1) {this.pos = found; return true;}
|
62 |
-
},
|
63 |
-
backUp: function(n) {this.pos -= n;},
|
64 |
-
column: function() {
|
65 |
-
if (this.lastColumnPos < this.start) {
|
66 |
-
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
|
67 |
-
this.lastColumnPos = this.start;
|
68 |
-
}
|
69 |
-
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
|
70 |
-
},
|
71 |
-
indentation: function() {
|
72 |
-
return countColumn(this.string, null, this.tabSize) -
|
73 |
-
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0);
|
74 |
-
},
|
75 |
-
match: function(pattern, consume, caseInsensitive) {
|
76 |
-
if (typeof pattern == "string") {
|
77 |
-
var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
|
78 |
-
var substr = this.string.substr(this.pos, pattern.length);
|
79 |
-
if (cased(substr) == cased(pattern)) {
|
80 |
-
if (consume !== false) this.pos += pattern.length;
|
81 |
-
return true;
|
82 |
-
}
|
83 |
-
} else {
|
84 |
-
var match = this.string.slice(this.pos).match(pattern);
|
85 |
-
if (match && match.index > 0) return null;
|
86 |
-
if (match && consume !== false) this.pos += match[0].length;
|
87 |
-
return match;
|
88 |
-
}
|
89 |
-
},
|
90 |
-
current: function(){return this.string.slice(this.start, this.pos);},
|
91 |
-
hideFirstChars: function(n, inner) {
|
92 |
-
this.lineStart += n;
|
93 |
-
try { return inner(); }
|
94 |
-
finally { this.lineStart -= n; }
|
95 |
-
},
|
96 |
-
lookAhead: function(n) {
|
97 |
-
var line = this.context.line + n
|
98 |
-
return line >= this.context.lines.length ? null : this.context.lines[line]
|
99 |
-
}
|
100 |
-
};
|
101 |
-
exports.StringStream = StringStream;
|
102 |
-
|
103 |
-
exports.startState = function(mode, a1, a2) {
|
104 |
-
return mode.startState ? mode.startState(a1, a2) : true;
|
105 |
-
};
|
106 |
-
|
107 |
-
var modes = exports.modes = {}, mimeModes = exports.mimeModes = {};
|
108 |
-
exports.defineMode = function(name, mode) {
|
109 |
-
if (arguments.length > 2)
|
110 |
-
mode.dependencies = Array.prototype.slice.call(arguments, 2);
|
111 |
-
modes[name] = mode;
|
112 |
-
};
|
113 |
-
exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; };
|
114 |
-
|
115 |
-
exports.defineMode("null", function() {
|
116 |
-
return {token: function(stream) {stream.skipToEnd();}};
|
117 |
-
});
|
118 |
-
exports.defineMIME("text/plain", "null");
|
119 |
-
|
120 |
-
exports.resolveMode = function(spec) {
|
121 |
-
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
122 |
-
spec = mimeModes[spec];
|
123 |
-
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
124 |
-
spec = mimeModes[spec.name];
|
125 |
-
}
|
126 |
-
if (typeof spec == "string") return {name: spec};
|
127 |
-
else return spec || {name: "null"};
|
128 |
-
};
|
129 |
-
|
130 |
-
function copyObj(obj, target, overwrite) {
|
131 |
-
if (!target) target = {};
|
132 |
-
for (var prop in obj)
|
133 |
-
if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
|
134 |
-
target[prop] = obj[prop];
|
135 |
-
return target;
|
136 |
-
}
|
137 |
-
|
138 |
-
// This can be used to attach properties to mode objects from
|
139 |
-
// outside the actual mode definition.
|
140 |
-
var modeExtensions = exports.modeExtensions = {};
|
141 |
-
exports.extendMode = function(mode, properties) {
|
142 |
-
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
|
143 |
-
copyObj(properties, exts);
|
144 |
-
};
|
145 |
-
|
146 |
-
exports.getMode = function(options, spec) {
|
147 |
-
var spec = exports.resolveMode(spec);
|
148 |
-
var mfactory = modes[spec.name];
|
149 |
-
if (!mfactory) return exports.getMode(options, "text/plain");
|
150 |
-
var modeObj = mfactory(options, spec);
|
151 |
-
if (modeExtensions.hasOwnProperty(spec.name)) {
|
152 |
-
var exts = modeExtensions[spec.name];
|
153 |
-
for (var prop in exts) {
|
154 |
-
if (!exts.hasOwnProperty(prop)) continue;
|
155 |
-
if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
|
156 |
-
modeObj[prop] = exts[prop];
|
157 |
-
}
|
158 |
-
}
|
159 |
-
modeObj.name = spec.name;
|
160 |
-
if (spec.helperType) modeObj.helperType = spec.helperType;
|
161 |
-
if (spec.modeProps) for (var prop in spec.modeProps)
|
162 |
-
modeObj[prop] = spec.modeProps[prop];
|
163 |
-
|
164 |
-
return modeObj;
|
165 |
-
};
|
166 |
-
|
167 |
-
exports.innerMode = function(mode, state) {
|
168 |
-
var info;
|
169 |
-
while (mode.innerMode) {
|
170 |
-
info = mode.innerMode(state);
|
171 |
-
if (!info || info.mode == mode) break;
|
172 |
-
state = info.state;
|
173 |
-
mode = info.mode;
|
174 |
-
}
|
175 |
-
return info || {mode: mode, state: state};
|
176 |
-
}
|
177 |
-
|
178 |
-
exports.registerHelper = exports.registerGlobalHelper = Math.min;
|
179 |
-
|
180 |
-
exports.runMode = function(string, modespec, callback, options) {
|
181 |
-
var mode = exports.getMode({indentUnit: 2}, modespec);
|
182 |
-
var lines = splitLines(string), state = (options && options.state) || exports.startState(mode);
|
183 |
-
var context = {lines: lines, line: 0}
|
184 |
-
for (var i = 0, e = lines.length; i < e; ++i, ++context.line) {
|
185 |
-
if (i) callback("\n");
|
186 |
-
var stream = new exports.StringStream(lines[i], 4, context);
|
187 |
-
if (!stream.string && mode.blankLine) mode.blankLine(state);
|
188 |
-
while (!stream.eol()) {
|
189 |
-
var style = mode.token(stream, state);
|
190 |
-
callback(stream.current(), style, i, stream.start, state);
|
191 |
-
stream.start = stream.pos;
|
192 |
-
}
|
193 |
-
}
|
194 |
-
};
|
195 |
-
|
196 |
-
require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];
|
197 |
-
require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/scroll/annotatescrollbar.js
DELETED
@@ -1,122 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineExtension("annotateScrollbar", function(options) {
|
15 |
-
if (typeof options == "string") options = {className: options};
|
16 |
-
return new Annotation(this, options);
|
17 |
-
});
|
18 |
-
|
19 |
-
CodeMirror.defineOption("scrollButtonHeight", 0);
|
20 |
-
|
21 |
-
function Annotation(cm, options) {
|
22 |
-
this.cm = cm;
|
23 |
-
this.options = options;
|
24 |
-
this.buttonHeight = options.scrollButtonHeight || cm.getOption("scrollButtonHeight");
|
25 |
-
this.annotations = [];
|
26 |
-
this.doRedraw = this.doUpdate = null;
|
27 |
-
this.div = cm.getWrapperElement().appendChild(document.createElement("div"));
|
28 |
-
this.div.style.cssText = "position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none";
|
29 |
-
this.computeScale();
|
30 |
-
|
31 |
-
function scheduleRedraw(delay) {
|
32 |
-
clearTimeout(self.doRedraw);
|
33 |
-
self.doRedraw = setTimeout(function() { self.redraw(); }, delay);
|
34 |
-
}
|
35 |
-
|
36 |
-
var self = this;
|
37 |
-
cm.on("refresh", this.resizeHandler = function() {
|
38 |
-
clearTimeout(self.doUpdate);
|
39 |
-
self.doUpdate = setTimeout(function() {
|
40 |
-
if (self.computeScale()) scheduleRedraw(20);
|
41 |
-
}, 100);
|
42 |
-
});
|
43 |
-
cm.on("markerAdded", this.resizeHandler);
|
44 |
-
cm.on("markerCleared", this.resizeHandler);
|
45 |
-
if (options.listenForChanges !== false)
|
46 |
-
cm.on("change", this.changeHandler = function() {
|
47 |
-
scheduleRedraw(250);
|
48 |
-
});
|
49 |
-
}
|
50 |
-
|
51 |
-
Annotation.prototype.computeScale = function() {
|
52 |
-
var cm = this.cm;
|
53 |
-
var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) /
|
54 |
-
cm.getScrollerElement().scrollHeight
|
55 |
-
if (hScale != this.hScale) {
|
56 |
-
this.hScale = hScale;
|
57 |
-
return true;
|
58 |
-
}
|
59 |
-
};
|
60 |
-
|
61 |
-
Annotation.prototype.update = function(annotations) {
|
62 |
-
this.annotations = annotations;
|
63 |
-
this.redraw();
|
64 |
-
};
|
65 |
-
|
66 |
-
Annotation.prototype.redraw = function(compute) {
|
67 |
-
if (compute !== false) this.computeScale();
|
68 |
-
var cm = this.cm, hScale = this.hScale;
|
69 |
-
|
70 |
-
var frag = document.createDocumentFragment(), anns = this.annotations;
|
71 |
-
|
72 |
-
var wrapping = cm.getOption("lineWrapping");
|
73 |
-
var singleLineH = wrapping && cm.defaultTextHeight() * 1.5;
|
74 |
-
var curLine = null, curLineObj = null;
|
75 |
-
function getY(pos, top) {
|
76 |
-
if (curLine != pos.line) {
|
77 |
-
curLine = pos.line;
|
78 |
-
curLineObj = cm.getLineHandle(curLine);
|
79 |
-
}
|
80 |
-
if ((curLineObj.widgets && curLineObj.widgets.length) ||
|
81 |
-
(wrapping && curLineObj.height > singleLineH))
|
82 |
-
return cm.charCoords(pos, "local")[top ? "top" : "bottom"];
|
83 |
-
var topY = cm.heightAtLine(curLineObj, "local");
|
84 |
-
return topY + (top ? 0 : curLineObj.height);
|
85 |
-
}
|
86 |
-
|
87 |
-
var lastLine = cm.lastLine()
|
88 |
-
if (cm.display.barWidth) for (var i = 0, nextTop; i < anns.length; i++) {
|
89 |
-
var ann = anns[i];
|
90 |
-
if (ann.to.line > lastLine) continue;
|
91 |
-
var top = nextTop || getY(ann.from, true) * hScale;
|
92 |
-
var bottom = getY(ann.to, false) * hScale;
|
93 |
-
while (i < anns.length - 1) {
|
94 |
-
if (anns[i + 1].to.line > lastLine) break;
|
95 |
-
nextTop = getY(anns[i + 1].from, true) * hScale;
|
96 |
-
if (nextTop > bottom + .9) break;
|
97 |
-
ann = anns[++i];
|
98 |
-
bottom = getY(ann.to, false) * hScale;
|
99 |
-
}
|
100 |
-
if (bottom == top) continue;
|
101 |
-
var height = Math.max(bottom - top, 3);
|
102 |
-
|
103 |
-
var elt = frag.appendChild(document.createElement("div"));
|
104 |
-
elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 2) + "px; top: "
|
105 |
-
+ (top + this.buttonHeight) + "px; height: " + height + "px";
|
106 |
-
elt.className = this.options.className;
|
107 |
-
if (ann.id) {
|
108 |
-
elt.setAttribute("annotation-id", ann.id);
|
109 |
-
}
|
110 |
-
}
|
111 |
-
this.div.textContent = "";
|
112 |
-
this.div.appendChild(frag);
|
113 |
-
};
|
114 |
-
|
115 |
-
Annotation.prototype.clear = function() {
|
116 |
-
this.cm.off("refresh", this.resizeHandler);
|
117 |
-
this.cm.off("markerAdded", this.resizeHandler);
|
118 |
-
this.cm.off("markerCleared", this.resizeHandler);
|
119 |
-
if (this.changeHandler) this.cm.off("change", this.changeHandler);
|
120 |
-
this.div.parentNode.removeChild(this.div);
|
121 |
-
};
|
122 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/scroll/scrollpastend.js
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) {
|
15 |
-
if (old && old != CodeMirror.Init) {
|
16 |
-
cm.off("change", onChange);
|
17 |
-
cm.off("refresh", updateBottomMargin);
|
18 |
-
cm.display.lineSpace.parentNode.style.paddingBottom = "";
|
19 |
-
cm.state.scrollPastEndPadding = null;
|
20 |
-
}
|
21 |
-
if (val) {
|
22 |
-
cm.on("change", onChange);
|
23 |
-
cm.on("refresh", updateBottomMargin);
|
24 |
-
updateBottomMargin(cm);
|
25 |
-
}
|
26 |
-
});
|
27 |
-
|
28 |
-
function onChange(cm, change) {
|
29 |
-
if (CodeMirror.changeEnd(change).line == cm.lastLine())
|
30 |
-
updateBottomMargin(cm);
|
31 |
-
}
|
32 |
-
|
33 |
-
function updateBottomMargin(cm) {
|
34 |
-
var padding = "";
|
35 |
-
if (cm.lineCount() > 1) {
|
36 |
-
var totalH = cm.display.scroller.clientHeight - 30,
|
37 |
-
lastLineH = cm.getLineHandle(cm.lastLine()).height;
|
38 |
-
padding = (totalH - lastLineH) + "px";
|
39 |
-
}
|
40 |
-
if (cm.state.scrollPastEndPadding != padding) {
|
41 |
-
cm.state.scrollPastEndPadding = padding;
|
42 |
-
cm.display.lineSpace.parentNode.style.paddingBottom = padding;
|
43 |
-
cm.off("refresh", updateBottomMargin);
|
44 |
-
cm.setSize();
|
45 |
-
cm.on("refresh", updateBottomMargin);
|
46 |
-
}
|
47 |
-
}
|
48 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/scroll/simplescrollbars.css
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div {
|
2 |
-
position: absolute;
|
3 |
-
background: #ccc;
|
4 |
-
-moz-box-sizing: border-box;
|
5 |
-
box-sizing: border-box;
|
6 |
-
border: 1px solid #bbb;
|
7 |
-
border-radius: 2px;
|
8 |
-
}
|
9 |
-
|
10 |
-
.CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical {
|
11 |
-
position: absolute;
|
12 |
-
z-index: 6;
|
13 |
-
background: #eee;
|
14 |
-
}
|
15 |
-
|
16 |
-
.CodeMirror-simplescroll-horizontal {
|
17 |
-
bottom: 0; left: 0;
|
18 |
-
height: 8px;
|
19 |
-
}
|
20 |
-
.CodeMirror-simplescroll-horizontal div {
|
21 |
-
bottom: 0;
|
22 |
-
height: 100%;
|
23 |
-
}
|
24 |
-
|
25 |
-
.CodeMirror-simplescroll-vertical {
|
26 |
-
right: 0; top: 0;
|
27 |
-
width: 8px;
|
28 |
-
}
|
29 |
-
.CodeMirror-simplescroll-vertical div {
|
30 |
-
right: 0;
|
31 |
-
width: 100%;
|
32 |
-
}
|
33 |
-
|
34 |
-
|
35 |
-
.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler {
|
36 |
-
display: none;
|
37 |
-
}
|
38 |
-
|
39 |
-
.CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div {
|
40 |
-
position: absolute;
|
41 |
-
background: #bcd;
|
42 |
-
border-radius: 3px;
|
43 |
-
}
|
44 |
-
|
45 |
-
.CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical {
|
46 |
-
position: absolute;
|
47 |
-
z-index: 6;
|
48 |
-
}
|
49 |
-
|
50 |
-
.CodeMirror-overlayscroll-horizontal {
|
51 |
-
bottom: 0; left: 0;
|
52 |
-
height: 6px;
|
53 |
-
}
|
54 |
-
.CodeMirror-overlayscroll-horizontal div {
|
55 |
-
bottom: 0;
|
56 |
-
height: 100%;
|
57 |
-
}
|
58 |
-
|
59 |
-
.CodeMirror-overlayscroll-vertical {
|
60 |
-
right: 0; top: 0;
|
61 |
-
width: 6px;
|
62 |
-
}
|
63 |
-
.CodeMirror-overlayscroll-vertical div {
|
64 |
-
right: 0;
|
65 |
-
width: 100%;
|
66 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/scroll/simplescrollbars.js
DELETED
@@ -1,152 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
function Bar(cls, orientation, scroll) {
|
15 |
-
this.orientation = orientation;
|
16 |
-
this.scroll = scroll;
|
17 |
-
this.screen = this.total = this.size = 1;
|
18 |
-
this.pos = 0;
|
19 |
-
|
20 |
-
this.node = document.createElement("div");
|
21 |
-
this.node.className = cls + "-" + orientation;
|
22 |
-
this.inner = this.node.appendChild(document.createElement("div"));
|
23 |
-
|
24 |
-
var self = this;
|
25 |
-
CodeMirror.on(this.inner, "mousedown", function(e) {
|
26 |
-
if (e.which != 1) return;
|
27 |
-
CodeMirror.e_preventDefault(e);
|
28 |
-
var axis = self.orientation == "horizontal" ? "pageX" : "pageY";
|
29 |
-
var start = e[axis], startpos = self.pos;
|
30 |
-
function done() {
|
31 |
-
CodeMirror.off(document, "mousemove", move);
|
32 |
-
CodeMirror.off(document, "mouseup", done);
|
33 |
-
}
|
34 |
-
function move(e) {
|
35 |
-
if (e.which != 1) return done();
|
36 |
-
self.moveTo(startpos + (e[axis] - start) * (self.total / self.size));
|
37 |
-
}
|
38 |
-
CodeMirror.on(document, "mousemove", move);
|
39 |
-
CodeMirror.on(document, "mouseup", done);
|
40 |
-
});
|
41 |
-
|
42 |
-
CodeMirror.on(this.node, "click", function(e) {
|
43 |
-
CodeMirror.e_preventDefault(e);
|
44 |
-
var innerBox = self.inner.getBoundingClientRect(), where;
|
45 |
-
if (self.orientation == "horizontal")
|
46 |
-
where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0;
|
47 |
-
else
|
48 |
-
where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0;
|
49 |
-
self.moveTo(self.pos + where * self.screen);
|
50 |
-
});
|
51 |
-
|
52 |
-
function onWheel(e) {
|
53 |
-
var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"];
|
54 |
-
var oldPos = self.pos;
|
55 |
-
self.moveTo(self.pos + moved);
|
56 |
-
if (self.pos != oldPos) CodeMirror.e_preventDefault(e);
|
57 |
-
}
|
58 |
-
CodeMirror.on(this.node, "mousewheel", onWheel);
|
59 |
-
CodeMirror.on(this.node, "DOMMouseScroll", onWheel);
|
60 |
-
}
|
61 |
-
|
62 |
-
Bar.prototype.setPos = function(pos, force) {
|
63 |
-
if (pos < 0) pos = 0;
|
64 |
-
if (pos > this.total - this.screen) pos = this.total - this.screen;
|
65 |
-
if (!force && pos == this.pos) return false;
|
66 |
-
this.pos = pos;
|
67 |
-
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
|
68 |
-
(pos * (this.size / this.total)) + "px";
|
69 |
-
return true
|
70 |
-
};
|
71 |
-
|
72 |
-
Bar.prototype.moveTo = function(pos) {
|
73 |
-
if (this.setPos(pos)) this.scroll(pos, this.orientation);
|
74 |
-
}
|
75 |
-
|
76 |
-
var minButtonSize = 10;
|
77 |
-
|
78 |
-
Bar.prototype.update = function(scrollSize, clientSize, barSize) {
|
79 |
-
var sizeChanged = this.screen != clientSize || this.total != scrollSize || this.size != barSize
|
80 |
-
if (sizeChanged) {
|
81 |
-
this.screen = clientSize;
|
82 |
-
this.total = scrollSize;
|
83 |
-
this.size = barSize;
|
84 |
-
}
|
85 |
-
|
86 |
-
var buttonSize = this.screen * (this.size / this.total);
|
87 |
-
if (buttonSize < minButtonSize) {
|
88 |
-
this.size -= minButtonSize - buttonSize;
|
89 |
-
buttonSize = minButtonSize;
|
90 |
-
}
|
91 |
-
this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
|
92 |
-
buttonSize + "px";
|
93 |
-
this.setPos(this.pos, sizeChanged);
|
94 |
-
};
|
95 |
-
|
96 |
-
function SimpleScrollbars(cls, place, scroll) {
|
97 |
-
this.addClass = cls;
|
98 |
-
this.horiz = new Bar(cls, "horizontal", scroll);
|
99 |
-
place(this.horiz.node);
|
100 |
-
this.vert = new Bar(cls, "vertical", scroll);
|
101 |
-
place(this.vert.node);
|
102 |
-
this.width = null;
|
103 |
-
}
|
104 |
-
|
105 |
-
SimpleScrollbars.prototype.update = function(measure) {
|
106 |
-
if (this.width == null) {
|
107 |
-
var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle;
|
108 |
-
if (style) this.width = parseInt(style.height);
|
109 |
-
}
|
110 |
-
var width = this.width || 0;
|
111 |
-
|
112 |
-
var needsH = measure.scrollWidth > measure.clientWidth + 1;
|
113 |
-
var needsV = measure.scrollHeight > measure.clientHeight + 1;
|
114 |
-
this.vert.node.style.display = needsV ? "block" : "none";
|
115 |
-
this.horiz.node.style.display = needsH ? "block" : "none";
|
116 |
-
|
117 |
-
if (needsV) {
|
118 |
-
this.vert.update(measure.scrollHeight, measure.clientHeight,
|
119 |
-
measure.viewHeight - (needsH ? width : 0));
|
120 |
-
this.vert.node.style.bottom = needsH ? width + "px" : "0";
|
121 |
-
}
|
122 |
-
if (needsH) {
|
123 |
-
this.horiz.update(measure.scrollWidth, measure.clientWidth,
|
124 |
-
measure.viewWidth - (needsV ? width : 0) - measure.barLeft);
|
125 |
-
this.horiz.node.style.right = needsV ? width + "px" : "0";
|
126 |
-
this.horiz.node.style.left = measure.barLeft + "px";
|
127 |
-
}
|
128 |
-
|
129 |
-
return {right: needsV ? width : 0, bottom: needsH ? width : 0};
|
130 |
-
};
|
131 |
-
|
132 |
-
SimpleScrollbars.prototype.setScrollTop = function(pos) {
|
133 |
-
this.vert.setPos(pos);
|
134 |
-
};
|
135 |
-
|
136 |
-
SimpleScrollbars.prototype.setScrollLeft = function(pos) {
|
137 |
-
this.horiz.setPos(pos);
|
138 |
-
};
|
139 |
-
|
140 |
-
SimpleScrollbars.prototype.clear = function() {
|
141 |
-
var parent = this.horiz.node.parentNode;
|
142 |
-
parent.removeChild(this.horiz.node);
|
143 |
-
parent.removeChild(this.vert.node);
|
144 |
-
};
|
145 |
-
|
146 |
-
CodeMirror.scrollbarModel.simple = function(place, scroll) {
|
147 |
-
return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll);
|
148 |
-
};
|
149 |
-
CodeMirror.scrollbarModel.overlay = function(place, scroll) {
|
150 |
-
return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll);
|
151 |
-
};
|
152 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/search/jump-to-line.js
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Defines jumpToLine command. Uses dialog.js if present.
|
5 |
-
|
6 |
-
(function(mod) {
|
7 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
8 |
-
mod(require("../../lib/codemirror"), require("../dialog/dialog"));
|
9 |
-
else if (typeof define == "function" && define.amd) // AMD
|
10 |
-
define(["../../lib/codemirror", "../dialog/dialog"], mod);
|
11 |
-
else // Plain browser env
|
12 |
-
mod(CodeMirror);
|
13 |
-
})(function(CodeMirror) {
|
14 |
-
"use strict";
|
15 |
-
|
16 |
-
function dialog(cm, text, shortText, deflt, f) {
|
17 |
-
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
|
18 |
-
else f(prompt(shortText, deflt));
|
19 |
-
}
|
20 |
-
|
21 |
-
function getJumpDialog(cm) {
|
22 |
-
return cm.phrase("Jump to line:") + ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use line:column or scroll% syntax)") + '</span>';
|
23 |
-
}
|
24 |
-
|
25 |
-
function interpretLine(cm, string) {
|
26 |
-
var num = Number(string)
|
27 |
-
if (/^[-+]/.test(string)) return cm.getCursor().line + num
|
28 |
-
else return num - 1
|
29 |
-
}
|
30 |
-
|
31 |
-
CodeMirror.commands.jumpToLine = function(cm) {
|
32 |
-
var cur = cm.getCursor();
|
33 |
-
dialog(cm, getJumpDialog(cm), cm.phrase("Jump to line:"), (cur.line + 1) + ":" + cur.ch, function(posStr) {
|
34 |
-
if (!posStr) return;
|
35 |
-
|
36 |
-
var match;
|
37 |
-
if (match = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(posStr)) {
|
38 |
-
cm.setCursor(interpretLine(cm, match[1]), Number(match[2]))
|
39 |
-
} else if (match = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(posStr)) {
|
40 |
-
var line = Math.round(cm.lineCount() * Number(match[1]) / 100);
|
41 |
-
if (/^[-+]/.test(match[1])) line = cur.line + line + 1;
|
42 |
-
cm.setCursor(line - 1, cur.ch);
|
43 |
-
} else if (match = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr)) {
|
44 |
-
cm.setCursor(interpretLine(cm, match[1]), cur.ch);
|
45 |
-
}
|
46 |
-
});
|
47 |
-
};
|
48 |
-
|
49 |
-
CodeMirror.keyMap["default"]["Alt-G"] = "jumpToLine";
|
50 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/search/match-highlighter.js
DELETED
@@ -1,165 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Highlighting text that matches the selection
|
5 |
-
//
|
6 |
-
// Defines an option highlightSelectionMatches, which, when enabled,
|
7 |
-
// will style strings that match the selection throughout the
|
8 |
-
// document.
|
9 |
-
//
|
10 |
-
// The option can be set to true to simply enable it, or to a
|
11 |
-
// {minChars, style, wordsOnly, showToken, delay} object to explicitly
|
12 |
-
// configure it. minChars is the minimum amount of characters that should be
|
13 |
-
// selected for the behavior to occur, and style is the token style to
|
14 |
-
// apply to the matches. This will be prefixed by "cm-" to create an
|
15 |
-
// actual CSS class name. If wordsOnly is enabled, the matches will be
|
16 |
-
// highlighted only if the selected text is a word. showToken, when enabled,
|
17 |
-
// will cause the current token to be highlighted when nothing is selected.
|
18 |
-
// delay is used to specify how much time to wait, in milliseconds, before
|
19 |
-
// highlighting the matches. If annotateScrollbar is enabled, the occurences
|
20 |
-
// will be highlighted on the scrollbar via the matchesonscrollbar addon.
|
21 |
-
|
22 |
-
(function(mod) {
|
23 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
24 |
-
mod(require("../../lib/codemirror"), require("./matchesonscrollbar"));
|
25 |
-
else if (typeof define == "function" && define.amd) // AMD
|
26 |
-
define(["../../lib/codemirror", "./matchesonscrollbar"], mod);
|
27 |
-
else // Plain browser env
|
28 |
-
mod(CodeMirror);
|
29 |
-
})(function(CodeMirror) {
|
30 |
-
"use strict";
|
31 |
-
|
32 |
-
var defaults = {
|
33 |
-
style: "matchhighlight",
|
34 |
-
minChars: 2,
|
35 |
-
delay: 100,
|
36 |
-
wordsOnly: false,
|
37 |
-
annotateScrollbar: false,
|
38 |
-
showToken: false,
|
39 |
-
trim: true
|
40 |
-
}
|
41 |
-
|
42 |
-
function State(options) {
|
43 |
-
this.options = {}
|
44 |
-
for (var name in defaults)
|
45 |
-
this.options[name] = (options && options.hasOwnProperty(name) ? options : defaults)[name]
|
46 |
-
this.overlay = this.timeout = null;
|
47 |
-
this.matchesonscroll = null;
|
48 |
-
this.active = false;
|
49 |
-
}
|
50 |
-
|
51 |
-
CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {
|
52 |
-
if (old && old != CodeMirror.Init) {
|
53 |
-
removeOverlay(cm);
|
54 |
-
clearTimeout(cm.state.matchHighlighter.timeout);
|
55 |
-
cm.state.matchHighlighter = null;
|
56 |
-
cm.off("cursorActivity", cursorActivity);
|
57 |
-
cm.off("focus", onFocus)
|
58 |
-
}
|
59 |
-
if (val) {
|
60 |
-
var state = cm.state.matchHighlighter = new State(val);
|
61 |
-
if (cm.hasFocus()) {
|
62 |
-
state.active = true
|
63 |
-
highlightMatches(cm)
|
64 |
-
} else {
|
65 |
-
cm.on("focus", onFocus)
|
66 |
-
}
|
67 |
-
cm.on("cursorActivity", cursorActivity);
|
68 |
-
}
|
69 |
-
});
|
70 |
-
|
71 |
-
function cursorActivity(cm) {
|
72 |
-
var state = cm.state.matchHighlighter;
|
73 |
-
if (state.active || cm.hasFocus()) scheduleHighlight(cm, state)
|
74 |
-
}
|
75 |
-
|
76 |
-
function onFocus(cm) {
|
77 |
-
var state = cm.state.matchHighlighter
|
78 |
-
if (!state.active) {
|
79 |
-
state.active = true
|
80 |
-
scheduleHighlight(cm, state)
|
81 |
-
}
|
82 |
-
}
|
83 |
-
|
84 |
-
function scheduleHighlight(cm, state) {
|
85 |
-
clearTimeout(state.timeout);
|
86 |
-
state.timeout = setTimeout(function() {highlightMatches(cm);}, state.options.delay);
|
87 |
-
}
|
88 |
-
|
89 |
-
function addOverlay(cm, query, hasBoundary, style) {
|
90 |
-
var state = cm.state.matchHighlighter;
|
91 |
-
cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style));
|
92 |
-
if (state.options.annotateScrollbar && cm.showMatchesOnScrollbar) {
|
93 |
-
var searchFor = hasBoundary ? new RegExp("\\b" + query.replace(/[\\\[.+*?(){|^$]/g, "\\$&") + "\\b") : query;
|
94 |
-
state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, false,
|
95 |
-
{className: "CodeMirror-selection-highlight-scrollbar"});
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
function removeOverlay(cm) {
|
100 |
-
var state = cm.state.matchHighlighter;
|
101 |
-
if (state.overlay) {
|
102 |
-
cm.removeOverlay(state.overlay);
|
103 |
-
state.overlay = null;
|
104 |
-
if (state.matchesonscroll) {
|
105 |
-
state.matchesonscroll.clear();
|
106 |
-
state.matchesonscroll = null;
|
107 |
-
}
|
108 |
-
}
|
109 |
-
}
|
110 |
-
|
111 |
-
function highlightMatches(cm) {
|
112 |
-
cm.operation(function() {
|
113 |
-
var state = cm.state.matchHighlighter;
|
114 |
-
removeOverlay(cm);
|
115 |
-
if (!cm.somethingSelected() && state.options.showToken) {
|
116 |
-
var re = state.options.showToken === true ? /[\w$]/ : state.options.showToken;
|
117 |
-
var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start;
|
118 |
-
while (start && re.test(line.charAt(start - 1))) --start;
|
119 |
-
while (end < line.length && re.test(line.charAt(end))) ++end;
|
120 |
-
if (start < end)
|
121 |
-
addOverlay(cm, line.slice(start, end), re, state.options.style);
|
122 |
-
return;
|
123 |
-
}
|
124 |
-
var from = cm.getCursor("from"), to = cm.getCursor("to");
|
125 |
-
if (from.line != to.line) return;
|
126 |
-
if (state.options.wordsOnly && !isWord(cm, from, to)) return;
|
127 |
-
var selection = cm.getRange(from, to)
|
128 |
-
if (state.options.trim) selection = selection.replace(/^\s+|\s+$/g, "")
|
129 |
-
if (selection.length >= state.options.minChars)
|
130 |
-
addOverlay(cm, selection, false, state.options.style);
|
131 |
-
});
|
132 |
-
}
|
133 |
-
|
134 |
-
function isWord(cm, from, to) {
|
135 |
-
var str = cm.getRange(from, to);
|
136 |
-
if (str.match(/^\w+$/) !== null) {
|
137 |
-
if (from.ch > 0) {
|
138 |
-
var pos = {line: from.line, ch: from.ch - 1};
|
139 |
-
var chr = cm.getRange(pos, from);
|
140 |
-
if (chr.match(/\W/) === null) return false;
|
141 |
-
}
|
142 |
-
if (to.ch < cm.getLine(from.line).length) {
|
143 |
-
var pos = {line: to.line, ch: to.ch + 1};
|
144 |
-
var chr = cm.getRange(to, pos);
|
145 |
-
if (chr.match(/\W/) === null) return false;
|
146 |
-
}
|
147 |
-
return true;
|
148 |
-
} else return false;
|
149 |
-
}
|
150 |
-
|
151 |
-
function boundariesAround(stream, re) {
|
152 |
-
return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) &&
|
153 |
-
(stream.pos == stream.string.length || !re.test(stream.string.charAt(stream.pos)));
|
154 |
-
}
|
155 |
-
|
156 |
-
function makeOverlay(query, hasBoundary, style) {
|
157 |
-
return {token: function(stream) {
|
158 |
-
if (stream.match(query) &&
|
159 |
-
(!hasBoundary || boundariesAround(stream, hasBoundary)))
|
160 |
-
return style;
|
161 |
-
stream.next();
|
162 |
-
stream.skipTo(query.charAt(0)) || stream.skipToEnd();
|
163 |
-
}};
|
164 |
-
}
|
165 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/search/matchesonscrollbar.css
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
.CodeMirror-search-match {
|
2 |
-
background: gold;
|
3 |
-
border-top: 1px solid orange;
|
4 |
-
border-bottom: 1px solid orange;
|
5 |
-
-moz-box-sizing: border-box;
|
6 |
-
box-sizing: border-box;
|
7 |
-
opacity: .5;
|
8 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/search/matchesonscrollbar.js
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"), require("./searchcursor"), require("../scroll/annotatescrollbar"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror", "./searchcursor", "../scroll/annotatescrollbar"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineExtension("showMatchesOnScrollbar", function(query, caseFold, options) {
|
15 |
-
if (typeof options == "string") options = {className: options};
|
16 |
-
if (!options) options = {};
|
17 |
-
return new SearchAnnotation(this, query, caseFold, options);
|
18 |
-
});
|
19 |
-
|
20 |
-
function SearchAnnotation(cm, query, caseFold, options) {
|
21 |
-
this.cm = cm;
|
22 |
-
this.options = options;
|
23 |
-
var annotateOptions = {listenForChanges: false};
|
24 |
-
for (var prop in options) annotateOptions[prop] = options[prop];
|
25 |
-
if (!annotateOptions.className) annotateOptions.className = "CodeMirror-search-match";
|
26 |
-
this.annotation = cm.annotateScrollbar(annotateOptions);
|
27 |
-
this.query = query;
|
28 |
-
this.caseFold = caseFold;
|
29 |
-
this.gap = {from: cm.firstLine(), to: cm.lastLine() + 1};
|
30 |
-
this.matches = [];
|
31 |
-
this.update = null;
|
32 |
-
|
33 |
-
this.findMatches();
|
34 |
-
this.annotation.update(this.matches);
|
35 |
-
|
36 |
-
var self = this;
|
37 |
-
cm.on("change", this.changeHandler = function(_cm, change) { self.onChange(change); });
|
38 |
-
}
|
39 |
-
|
40 |
-
var MAX_MATCHES = 1000;
|
41 |
-
|
42 |
-
SearchAnnotation.prototype.findMatches = function() {
|
43 |
-
if (!this.gap) return;
|
44 |
-
for (var i = 0; i < this.matches.length; i++) {
|
45 |
-
var match = this.matches[i];
|
46 |
-
if (match.from.line >= this.gap.to) break;
|
47 |
-
if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);
|
48 |
-
}
|
49 |
-
var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), this.caseFold);
|
50 |
-
var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES;
|
51 |
-
while (cursor.findNext()) {
|
52 |
-
var match = {from: cursor.from(), to: cursor.to()};
|
53 |
-
if (match.from.line >= this.gap.to) break;
|
54 |
-
this.matches.splice(i++, 0, match);
|
55 |
-
if (this.matches.length > maxMatches) break;
|
56 |
-
}
|
57 |
-
this.gap = null;
|
58 |
-
};
|
59 |
-
|
60 |
-
function offsetLine(line, changeStart, sizeChange) {
|
61 |
-
if (line <= changeStart) return line;
|
62 |
-
return Math.max(changeStart, line + sizeChange);
|
63 |
-
}
|
64 |
-
|
65 |
-
SearchAnnotation.prototype.onChange = function(change) {
|
66 |
-
var startLine = change.from.line;
|
67 |
-
var endLine = CodeMirror.changeEnd(change).line;
|
68 |
-
var sizeChange = endLine - change.to.line;
|
69 |
-
if (this.gap) {
|
70 |
-
this.gap.from = Math.min(offsetLine(this.gap.from, startLine, sizeChange), change.from.line);
|
71 |
-
this.gap.to = Math.max(offsetLine(this.gap.to, startLine, sizeChange), change.from.line);
|
72 |
-
} else {
|
73 |
-
this.gap = {from: change.from.line, to: endLine + 1};
|
74 |
-
}
|
75 |
-
|
76 |
-
if (sizeChange) for (var i = 0; i < this.matches.length; i++) {
|
77 |
-
var match = this.matches[i];
|
78 |
-
var newFrom = offsetLine(match.from.line, startLine, sizeChange);
|
79 |
-
if (newFrom != match.from.line) match.from = CodeMirror.Pos(newFrom, match.from.ch);
|
80 |
-
var newTo = offsetLine(match.to.line, startLine, sizeChange);
|
81 |
-
if (newTo != match.to.line) match.to = CodeMirror.Pos(newTo, match.to.ch);
|
82 |
-
}
|
83 |
-
clearTimeout(this.update);
|
84 |
-
var self = this;
|
85 |
-
this.update = setTimeout(function() { self.updateAfterChange(); }, 250);
|
86 |
-
};
|
87 |
-
|
88 |
-
SearchAnnotation.prototype.updateAfterChange = function() {
|
89 |
-
this.findMatches();
|
90 |
-
this.annotation.update(this.matches);
|
91 |
-
};
|
92 |
-
|
93 |
-
SearchAnnotation.prototype.clear = function() {
|
94 |
-
this.cm.off("change", this.changeHandler);
|
95 |
-
this.annotation.clear();
|
96 |
-
};
|
97 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/search/search.js
DELETED
@@ -1,258 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Define search commands. Depends on dialog.js or another
|
5 |
-
// implementation of the openDialog method.
|
6 |
-
|
7 |
-
// Replace works a little oddly -- it will do the replace on the next
|
8 |
-
// Ctrl-G (or whatever is bound to findNext) press. You prevent a
|
9 |
-
// replace by making sure the match is no longer selected when hitting
|
10 |
-
// Ctrl-G.
|
11 |
-
|
12 |
-
(function(mod) {
|
13 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
14 |
-
mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog"));
|
15 |
-
else if (typeof define == "function" && define.amd) // AMD
|
16 |
-
define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod);
|
17 |
-
else // Plain browser env
|
18 |
-
mod(CodeMirror);
|
19 |
-
})(function(CodeMirror) {
|
20 |
-
"use strict";
|
21 |
-
|
22 |
-
function searchOverlay(query, caseInsensitive) {
|
23 |
-
if (typeof query == "string")
|
24 |
-
query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g");
|
25 |
-
else if (!query.global)
|
26 |
-
query = new RegExp(query.source, query.ignoreCase ? "gi" : "g");
|
27 |
-
|
28 |
-
return {token: function(stream) {
|
29 |
-
query.lastIndex = stream.pos;
|
30 |
-
var match = query.exec(stream.string);
|
31 |
-
if (match && match.index == stream.pos) {
|
32 |
-
stream.pos += match[0].length || 1;
|
33 |
-
return "searching";
|
34 |
-
} else if (match) {
|
35 |
-
stream.pos = match.index;
|
36 |
-
} else {
|
37 |
-
stream.skipToEnd();
|
38 |
-
}
|
39 |
-
}};
|
40 |
-
}
|
41 |
-
|
42 |
-
function SearchState() {
|
43 |
-
this.posFrom = this.posTo = this.lastQuery = this.query = null;
|
44 |
-
this.overlay = null;
|
45 |
-
}
|
46 |
-
|
47 |
-
function getSearchState(cm) {
|
48 |
-
return cm.state.search || (cm.state.search = new SearchState());
|
49 |
-
}
|
50 |
-
|
51 |
-
function queryCaseInsensitive(query) {
|
52 |
-
return typeof query == "string" && query == query.toLowerCase();
|
53 |
-
}
|
54 |
-
|
55 |
-
function getSearchCursor(cm, query, pos) {
|
56 |
-
// Heuristic: if the query string is all lowercase, do a case insensitive search.
|
57 |
-
return cm.getSearchCursor(query, pos, {caseFold: queryCaseInsensitive(query), multiline: true});
|
58 |
-
}
|
59 |
-
|
60 |
-
function persistentDialog(cm, text, deflt, onEnter, onKeyDown) {
|
61 |
-
cm.openDialog(text, onEnter, {
|
62 |
-
value: deflt,
|
63 |
-
selectValueOnOpen: true,
|
64 |
-
closeOnEnter: false,
|
65 |
-
onClose: function() { clearSearch(cm); },
|
66 |
-
onKeyDown: onKeyDown
|
67 |
-
});
|
68 |
-
}
|
69 |
-
|
70 |
-
function dialog(cm, text, shortText, deflt, f) {
|
71 |
-
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
|
72 |
-
else f(prompt(shortText, deflt));
|
73 |
-
}
|
74 |
-
|
75 |
-
function confirmDialog(cm, text, shortText, fs) {
|
76 |
-
if (cm.openConfirm) cm.openConfirm(text, fs);
|
77 |
-
else if (confirm(shortText)) fs[0]();
|
78 |
-
}
|
79 |
-
|
80 |
-
function parseString(string) {
|
81 |
-
return string.replace(/\\(.)/g, function(_, ch) {
|
82 |
-
if (ch == "n") return "\n"
|
83 |
-
if (ch == "r") return "\r"
|
84 |
-
return ch
|
85 |
-
})
|
86 |
-
}
|
87 |
-
|
88 |
-
function parseQuery(query) {
|
89 |
-
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
|
90 |
-
if (isRE) {
|
91 |
-
try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }
|
92 |
-
catch(e) {} // Not a regular expression after all, do a string search
|
93 |
-
} else {
|
94 |
-
query = parseString(query)
|
95 |
-
}
|
96 |
-
if (typeof query == "string" ? query == "" : query.test(""))
|
97 |
-
query = /x^/;
|
98 |
-
return query;
|
99 |
-
}
|
100 |
-
|
101 |
-
function startSearch(cm, state, query) {
|
102 |
-
state.queryText = query;
|
103 |
-
state.query = parseQuery(query);
|
104 |
-
cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
|
105 |
-
state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
|
106 |
-
cm.addOverlay(state.overlay);
|
107 |
-
if (cm.showMatchesOnScrollbar) {
|
108 |
-
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
|
109 |
-
state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));
|
110 |
-
}
|
111 |
-
}
|
112 |
-
|
113 |
-
function doSearch(cm, rev, persistent, immediate) {
|
114 |
-
var state = getSearchState(cm);
|
115 |
-
if (state.query) return findNext(cm, rev);
|
116 |
-
var q = cm.getSelection() || state.lastQuery;
|
117 |
-
if (q instanceof RegExp && q.source == "x^") q = null
|
118 |
-
if (persistent && cm.openDialog) {
|
119 |
-
var hiding = null
|
120 |
-
var searchNext = function(query, event) {
|
121 |
-
CodeMirror.e_stop(event);
|
122 |
-
if (!query) return;
|
123 |
-
if (query != state.queryText) {
|
124 |
-
startSearch(cm, state, query);
|
125 |
-
state.posFrom = state.posTo = cm.getCursor();
|
126 |
-
}
|
127 |
-
if (hiding) hiding.style.opacity = 1
|
128 |
-
findNext(cm, event.shiftKey, function(_, to) {
|
129 |
-
var dialog
|
130 |
-
if (to.line < 3 && document.querySelector &&
|
131 |
-
(dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&
|
132 |
-
dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top)
|
133 |
-
(hiding = dialog).style.opacity = .4
|
134 |
-
})
|
135 |
-
};
|
136 |
-
persistentDialog(cm, getQueryDialog(cm), q, searchNext, function(event, query) {
|
137 |
-
var keyName = CodeMirror.keyName(event)
|
138 |
-
var extra = cm.getOption('extraKeys'), cmd = (extra && extra[keyName]) || CodeMirror.keyMap[cm.getOption("keyMap")][keyName]
|
139 |
-
if (cmd == "findNext" || cmd == "findPrev" ||
|
140 |
-
cmd == "findPersistentNext" || cmd == "findPersistentPrev") {
|
141 |
-
CodeMirror.e_stop(event);
|
142 |
-
startSearch(cm, getSearchState(cm), query);
|
143 |
-
cm.execCommand(cmd);
|
144 |
-
} else if (cmd == "find" || cmd == "findPersistent") {
|
145 |
-
CodeMirror.e_stop(event);
|
146 |
-
searchNext(query, event);
|
147 |
-
}
|
148 |
-
});
|
149 |
-
if (immediate && q) {
|
150 |
-
startSearch(cm, state, q);
|
151 |
-
findNext(cm, rev);
|
152 |
-
}
|
153 |
-
} else {
|
154 |
-
dialog(cm, getQueryDialog(cm), "Search for:", q, function(query) {
|
155 |
-
if (query && !state.query) cm.operation(function() {
|
156 |
-
startSearch(cm, state, query);
|
157 |
-
state.posFrom = state.posTo = cm.getCursor();
|
158 |
-
findNext(cm, rev);
|
159 |
-
});
|
160 |
-
});
|
161 |
-
}
|
162 |
-
}
|
163 |
-
|
164 |
-
function findNext(cm, rev, callback) {cm.operation(function() {
|
165 |
-
var state = getSearchState(cm);
|
166 |
-
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
|
167 |
-
if (!cursor.find(rev)) {
|
168 |
-
cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
|
169 |
-
if (!cursor.find(rev)) return;
|
170 |
-
}
|
171 |
-
cm.setSelection(cursor.from(), cursor.to());
|
172 |
-
cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);
|
173 |
-
state.posFrom = cursor.from(); state.posTo = cursor.to();
|
174 |
-
if (callback) callback(cursor.from(), cursor.to())
|
175 |
-
});}
|
176 |
-
|
177 |
-
function clearSearch(cm) {cm.operation(function() {
|
178 |
-
var state = getSearchState(cm);
|
179 |
-
state.lastQuery = state.query;
|
180 |
-
if (!state.query) return;
|
181 |
-
state.query = state.queryText = null;
|
182 |
-
cm.removeOverlay(state.overlay);
|
183 |
-
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
|
184 |
-
});}
|
185 |
-
|
186 |
-
|
187 |
-
function getQueryDialog(cm) {
|
188 |
-
return '<span class="CodeMirror-search-label">' + cm.phrase("Search:") + '</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use /re/ syntax for regexp search)") + '</span>';
|
189 |
-
}
|
190 |
-
function getReplaceQueryDialog(cm) {
|
191 |
-
return ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use /re/ syntax for regexp search)") + '</span>';
|
192 |
-
}
|
193 |
-
function getReplacementQueryDialog(cm) {
|
194 |
-
return '<span class="CodeMirror-search-label">' + cm.phrase("With:") + '</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
|
195 |
-
}
|
196 |
-
function getDoReplaceConfirm(cm) {
|
197 |
-
return '<span class="CodeMirror-search-label">' + cm.phrase("Replace?") + '</span> <button>' + cm.phrase("Yes") + '</button> <button>' + cm.phrase("No") + '</button> <button>' + cm.phrase("All") + '</button> <button>' + cm.phrase("Stop") + '</button> ';
|
198 |
-
}
|
199 |
-
|
200 |
-
function replaceAll(cm, query, text) {
|
201 |
-
cm.operation(function() {
|
202 |
-
for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
|
203 |
-
if (typeof query != "string") {
|
204 |
-
var match = cm.getRange(cursor.from(), cursor.to()).match(query);
|
205 |
-
cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
|
206 |
-
} else cursor.replace(text);
|
207 |
-
}
|
208 |
-
});
|
209 |
-
}
|
210 |
-
|
211 |
-
function replace(cm, all) {
|
212 |
-
if (cm.getOption("readOnly")) return;
|
213 |
-
var query = cm.getSelection() || getSearchState(cm).lastQuery;
|
214 |
-
var dialogText = '<span class="CodeMirror-search-label">' + (all ? cm.phrase("Replace all:") : cm.phrase("Replace:")) + '</span>';
|
215 |
-
dialog(cm, dialogText + getReplaceQueryDialog(cm), dialogText, query, function(query) {
|
216 |
-
if (!query) return;
|
217 |
-
query = parseQuery(query);
|
218 |
-
dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) {
|
219 |
-
text = parseString(text)
|
220 |
-
if (all) {
|
221 |
-
replaceAll(cm, query, text)
|
222 |
-
} else {
|
223 |
-
clearSearch(cm);
|
224 |
-
var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
|
225 |
-
var advance = function() {
|
226 |
-
var start = cursor.from(), match;
|
227 |
-
if (!(match = cursor.findNext())) {
|
228 |
-
cursor = getSearchCursor(cm, query);
|
229 |
-
if (!(match = cursor.findNext()) ||
|
230 |
-
(start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
|
231 |
-
}
|
232 |
-
cm.setSelection(cursor.from(), cursor.to());
|
233 |
-
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
|
234 |
-
confirmDialog(cm, getDoReplaceConfirm(cm), cm.phrase("Replace?"),
|
235 |
-
[function() {doReplace(match);}, advance,
|
236 |
-
function() {replaceAll(cm, query, text)}]);
|
237 |
-
};
|
238 |
-
var doReplace = function(match) {
|
239 |
-
cursor.replace(typeof query == "string" ? text :
|
240 |
-
text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
|
241 |
-
advance();
|
242 |
-
};
|
243 |
-
advance();
|
244 |
-
}
|
245 |
-
});
|
246 |
-
});
|
247 |
-
}
|
248 |
-
|
249 |
-
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
|
250 |
-
CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);};
|
251 |
-
CodeMirror.commands.findPersistentNext = function(cm) {doSearch(cm, false, true, true);};
|
252 |
-
CodeMirror.commands.findPersistentPrev = function(cm) {doSearch(cm, true, true, true);};
|
253 |
-
CodeMirror.commands.findNext = doSearch;
|
254 |
-
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
|
255 |
-
CodeMirror.commands.clearSearch = clearSearch;
|
256 |
-
CodeMirror.commands.replace = replace;
|
257 |
-
CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
|
258 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/search/searchcursor.js
DELETED
@@ -1,293 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"))
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod)
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror)
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict"
|
13 |
-
var Pos = CodeMirror.Pos
|
14 |
-
|
15 |
-
function regexpFlags(regexp) {
|
16 |
-
var flags = regexp.flags
|
17 |
-
return flags != null ? flags : (regexp.ignoreCase ? "i" : "")
|
18 |
-
+ (regexp.global ? "g" : "")
|
19 |
-
+ (regexp.multiline ? "m" : "")
|
20 |
-
}
|
21 |
-
|
22 |
-
function ensureFlags(regexp, flags) {
|
23 |
-
var current = regexpFlags(regexp), target = current
|
24 |
-
for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1)
|
25 |
-
target += flags.charAt(i)
|
26 |
-
return current == target ? regexp : new RegExp(regexp.source, target)
|
27 |
-
}
|
28 |
-
|
29 |
-
function maybeMultiline(regexp) {
|
30 |
-
return /\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source)
|
31 |
-
}
|
32 |
-
|
33 |
-
function searchRegexpForward(doc, regexp, start) {
|
34 |
-
regexp = ensureFlags(regexp, "g")
|
35 |
-
for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) {
|
36 |
-
regexp.lastIndex = ch
|
37 |
-
var string = doc.getLine(line), match = regexp.exec(string)
|
38 |
-
if (match)
|
39 |
-
return {from: Pos(line, match.index),
|
40 |
-
to: Pos(line, match.index + match[0].length),
|
41 |
-
match: match}
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
function searchRegexpForwardMultiline(doc, regexp, start) {
|
46 |
-
if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start)
|
47 |
-
|
48 |
-
regexp = ensureFlags(regexp, "gm")
|
49 |
-
var string, chunk = 1
|
50 |
-
for (var line = start.line, last = doc.lastLine(); line <= last;) {
|
51 |
-
// This grows the search buffer in exponentially-sized chunks
|
52 |
-
// between matches, so that nearby matches are fast and don't
|
53 |
-
// require concatenating the whole document (in case we're
|
54 |
-
// searching for something that has tons of matches), but at the
|
55 |
-
// same time, the amount of retries is limited.
|
56 |
-
for (var i = 0; i < chunk; i++) {
|
57 |
-
if (line > last) break
|
58 |
-
var curLine = doc.getLine(line++)
|
59 |
-
string = string == null ? curLine : string + "\n" + curLine
|
60 |
-
}
|
61 |
-
chunk = chunk * 2
|
62 |
-
regexp.lastIndex = start.ch
|
63 |
-
var match = regexp.exec(string)
|
64 |
-
if (match) {
|
65 |
-
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
66 |
-
var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length
|
67 |
-
return {from: Pos(startLine, startCh),
|
68 |
-
to: Pos(startLine + inside.length - 1,
|
69 |
-
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
70 |
-
match: match}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
function lastMatchIn(string, regexp) {
|
76 |
-
var cutOff = 0, match
|
77 |
-
for (;;) {
|
78 |
-
regexp.lastIndex = cutOff
|
79 |
-
var newMatch = regexp.exec(string)
|
80 |
-
if (!newMatch) return match
|
81 |
-
match = newMatch
|
82 |
-
cutOff = match.index + (match[0].length || 1)
|
83 |
-
if (cutOff == string.length) return match
|
84 |
-
}
|
85 |
-
}
|
86 |
-
|
87 |
-
function searchRegexpBackward(doc, regexp, start) {
|
88 |
-
regexp = ensureFlags(regexp, "g")
|
89 |
-
for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) {
|
90 |
-
var string = doc.getLine(line)
|
91 |
-
if (ch > -1) string = string.slice(0, ch)
|
92 |
-
var match = lastMatchIn(string, regexp)
|
93 |
-
if (match)
|
94 |
-
return {from: Pos(line, match.index),
|
95 |
-
to: Pos(line, match.index + match[0].length),
|
96 |
-
match: match}
|
97 |
-
}
|
98 |
-
}
|
99 |
-
|
100 |
-
function searchRegexpBackwardMultiline(doc, regexp, start) {
|
101 |
-
regexp = ensureFlags(regexp, "gm")
|
102 |
-
var string, chunk = 1
|
103 |
-
for (var line = start.line, first = doc.firstLine(); line >= first;) {
|
104 |
-
for (var i = 0; i < chunk; i++) {
|
105 |
-
var curLine = doc.getLine(line--)
|
106 |
-
string = string == null ? curLine.slice(0, start.ch) : curLine + "\n" + string
|
107 |
-
}
|
108 |
-
chunk *= 2
|
109 |
-
|
110 |
-
var match = lastMatchIn(string, regexp)
|
111 |
-
if (match) {
|
112 |
-
var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
|
113 |
-
var startLine = line + before.length, startCh = before[before.length - 1].length
|
114 |
-
return {from: Pos(startLine, startCh),
|
115 |
-
to: Pos(startLine + inside.length - 1,
|
116 |
-
inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
|
117 |
-
match: match}
|
118 |
-
}
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
var doFold, noFold
|
123 |
-
if (String.prototype.normalize) {
|
124 |
-
doFold = function(str) { return str.normalize("NFD").toLowerCase() }
|
125 |
-
noFold = function(str) { return str.normalize("NFD") }
|
126 |
-
} else {
|
127 |
-
doFold = function(str) { return str.toLowerCase() }
|
128 |
-
noFold = function(str) { return str }
|
129 |
-
}
|
130 |
-
|
131 |
-
// Maps a position in a case-folded line back to a position in the original line
|
132 |
-
// (compensating for codepoints increasing in number during folding)
|
133 |
-
function adjustPos(orig, folded, pos, foldFunc) {
|
134 |
-
if (orig.length == folded.length) return pos
|
135 |
-
for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) {
|
136 |
-
if (min == max) return min
|
137 |
-
var mid = (min + max) >> 1
|
138 |
-
var len = foldFunc(orig.slice(0, mid)).length
|
139 |
-
if (len == pos) return mid
|
140 |
-
else if (len > pos) max = mid
|
141 |
-
else min = mid + 1
|
142 |
-
}
|
143 |
-
}
|
144 |
-
|
145 |
-
function searchStringForward(doc, query, start, caseFold) {
|
146 |
-
// Empty string would match anything and never progress, so we
|
147 |
-
// define it to match nothing instead.
|
148 |
-
if (!query.length) return null
|
149 |
-
var fold = caseFold ? doFold : noFold
|
150 |
-
var lines = fold(query).split(/\r|\n\r?/)
|
151 |
-
|
152 |
-
search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) {
|
153 |
-
var orig = doc.getLine(line).slice(ch), string = fold(orig)
|
154 |
-
if (lines.length == 1) {
|
155 |
-
var found = string.indexOf(lines[0])
|
156 |
-
if (found == -1) continue search
|
157 |
-
var start = adjustPos(orig, string, found, fold) + ch
|
158 |
-
return {from: Pos(line, adjustPos(orig, string, found, fold) + ch),
|
159 |
-
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)}
|
160 |
-
} else {
|
161 |
-
var cutFrom = string.length - lines[0].length
|
162 |
-
if (string.slice(cutFrom) != lines[0]) continue search
|
163 |
-
for (var i = 1; i < lines.length - 1; i++)
|
164 |
-
if (fold(doc.getLine(line + i)) != lines[i]) continue search
|
165 |
-
var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
|
166 |
-
if (endString.slice(0, lastLine.length) != lastLine) continue search
|
167 |
-
return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
|
168 |
-
to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
|
169 |
-
}
|
170 |
-
}
|
171 |
-
}
|
172 |
-
|
173 |
-
function searchStringBackward(doc, query, start, caseFold) {
|
174 |
-
if (!query.length) return null
|
175 |
-
var fold = caseFold ? doFold : noFold
|
176 |
-
var lines = fold(query).split(/\r|\n\r?/)
|
177 |
-
|
178 |
-
search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) {
|
179 |
-
var orig = doc.getLine(line)
|
180 |
-
if (ch > -1) orig = orig.slice(0, ch)
|
181 |
-
var string = fold(orig)
|
182 |
-
if (lines.length == 1) {
|
183 |
-
var found = string.lastIndexOf(lines[0])
|
184 |
-
if (found == -1) continue search
|
185 |
-
return {from: Pos(line, adjustPos(orig, string, found, fold)),
|
186 |
-
to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))}
|
187 |
-
} else {
|
188 |
-
var lastLine = lines[lines.length - 1]
|
189 |
-
if (string.slice(0, lastLine.length) != lastLine) continue search
|
190 |
-
for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++)
|
191 |
-
if (fold(doc.getLine(start + i)) != lines[i]) continue search
|
192 |
-
var top = doc.getLine(line + 1 - lines.length), topString = fold(top)
|
193 |
-
if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search
|
194 |
-
return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)),
|
195 |
-
to: Pos(line, adjustPos(orig, string, lastLine.length, fold))}
|
196 |
-
}
|
197 |
-
}
|
198 |
-
}
|
199 |
-
|
200 |
-
function SearchCursor(doc, query, pos, options) {
|
201 |
-
this.atOccurrence = false
|
202 |
-
this.doc = doc
|
203 |
-
pos = pos ? doc.clipPos(pos) : Pos(0, 0)
|
204 |
-
this.pos = {from: pos, to: pos}
|
205 |
-
|
206 |
-
var caseFold
|
207 |
-
if (typeof options == "object") {
|
208 |
-
caseFold = options.caseFold
|
209 |
-
} else { // Backwards compat for when caseFold was the 4th argument
|
210 |
-
caseFold = options
|
211 |
-
options = null
|
212 |
-
}
|
213 |
-
|
214 |
-
if (typeof query == "string") {
|
215 |
-
if (caseFold == null) caseFold = false
|
216 |
-
this.matches = function(reverse, pos) {
|
217 |
-
return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold)
|
218 |
-
}
|
219 |
-
} else {
|
220 |
-
query = ensureFlags(query, "gm")
|
221 |
-
if (!options || options.multiline !== false)
|
222 |
-
this.matches = function(reverse, pos) {
|
223 |
-
return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos)
|
224 |
-
}
|
225 |
-
else
|
226 |
-
this.matches = function(reverse, pos) {
|
227 |
-
return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos)
|
228 |
-
}
|
229 |
-
}
|
230 |
-
}
|
231 |
-
|
232 |
-
SearchCursor.prototype = {
|
233 |
-
findNext: function() {return this.find(false)},
|
234 |
-
findPrevious: function() {return this.find(true)},
|
235 |
-
|
236 |
-
find: function(reverse) {
|
237 |
-
var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to))
|
238 |
-
|
239 |
-
// Implements weird auto-growing behavior on null-matches for
|
240 |
-
// backwards-compatiblity with the vim code (unfortunately)
|
241 |
-
while (result && CodeMirror.cmpPos(result.from, result.to) == 0) {
|
242 |
-
if (reverse) {
|
243 |
-
if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1)
|
244 |
-
else if (result.from.line == this.doc.firstLine()) result = null
|
245 |
-
else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1)))
|
246 |
-
} else {
|
247 |
-
if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1)
|
248 |
-
else if (result.to.line == this.doc.lastLine()) result = null
|
249 |
-
else result = this.matches(reverse, Pos(result.to.line + 1, 0))
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
-
if (result) {
|
254 |
-
this.pos = result
|
255 |
-
this.atOccurrence = true
|
256 |
-
return this.pos.match || true
|
257 |
-
} else {
|
258 |
-
var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0)
|
259 |
-
this.pos = {from: end, to: end}
|
260 |
-
return this.atOccurrence = false
|
261 |
-
}
|
262 |
-
},
|
263 |
-
|
264 |
-
from: function() {if (this.atOccurrence) return this.pos.from},
|
265 |
-
to: function() {if (this.atOccurrence) return this.pos.to},
|
266 |
-
|
267 |
-
replace: function(newText, origin) {
|
268 |
-
if (!this.atOccurrence) return
|
269 |
-
var lines = CodeMirror.splitLines(newText)
|
270 |
-
this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin)
|
271 |
-
this.pos.to = Pos(this.pos.from.line + lines.length - 1,
|
272 |
-
lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0))
|
273 |
-
}
|
274 |
-
}
|
275 |
-
|
276 |
-
CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
|
277 |
-
return new SearchCursor(this.doc, query, pos, caseFold)
|
278 |
-
})
|
279 |
-
CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
|
280 |
-
return new SearchCursor(this, query, pos, caseFold)
|
281 |
-
})
|
282 |
-
|
283 |
-
CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
|
284 |
-
var ranges = []
|
285 |
-
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold)
|
286 |
-
while (cur.findNext()) {
|
287 |
-
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break
|
288 |
-
ranges.push({anchor: cur.from(), head: cur.to()})
|
289 |
-
}
|
290 |
-
if (ranges.length)
|
291 |
-
this.setSelections(ranges, 0)
|
292 |
-
})
|
293 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/selection/active-line.js
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
var WRAP_CLASS = "CodeMirror-activeline";
|
14 |
-
var BACK_CLASS = "CodeMirror-activeline-background";
|
15 |
-
var GUTT_CLASS = "CodeMirror-activeline-gutter";
|
16 |
-
|
17 |
-
CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
|
18 |
-
var prev = old == CodeMirror.Init ? false : old;
|
19 |
-
if (val == prev) return
|
20 |
-
if (prev) {
|
21 |
-
cm.off("beforeSelectionChange", selectionChange);
|
22 |
-
clearActiveLines(cm);
|
23 |
-
delete cm.state.activeLines;
|
24 |
-
}
|
25 |
-
if (val) {
|
26 |
-
cm.state.activeLines = [];
|
27 |
-
updateActiveLines(cm, cm.listSelections());
|
28 |
-
cm.on("beforeSelectionChange", selectionChange);
|
29 |
-
}
|
30 |
-
});
|
31 |
-
|
32 |
-
function clearActiveLines(cm) {
|
33 |
-
for (var i = 0; i < cm.state.activeLines.length; i++) {
|
34 |
-
cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
|
35 |
-
cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
|
36 |
-
cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
|
37 |
-
}
|
38 |
-
}
|
39 |
-
|
40 |
-
function sameArray(a, b) {
|
41 |
-
if (a.length != b.length) return false;
|
42 |
-
for (var i = 0; i < a.length; i++)
|
43 |
-
if (a[i] != b[i]) return false;
|
44 |
-
return true;
|
45 |
-
}
|
46 |
-
|
47 |
-
function updateActiveLines(cm, ranges) {
|
48 |
-
var active = [];
|
49 |
-
for (var i = 0; i < ranges.length; i++) {
|
50 |
-
var range = ranges[i];
|
51 |
-
var option = cm.getOption("styleActiveLine");
|
52 |
-
if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
|
53 |
-
continue
|
54 |
-
var line = cm.getLineHandleVisualStart(range.head.line);
|
55 |
-
if (active[active.length - 1] != line) active.push(line);
|
56 |
-
}
|
57 |
-
if (sameArray(cm.state.activeLines, active)) return;
|
58 |
-
cm.operation(function() {
|
59 |
-
clearActiveLines(cm);
|
60 |
-
for (var i = 0; i < active.length; i++) {
|
61 |
-
cm.addLineClass(active[i], "wrap", WRAP_CLASS);
|
62 |
-
cm.addLineClass(active[i], "background", BACK_CLASS);
|
63 |
-
cm.addLineClass(active[i], "gutter", GUTT_CLASS);
|
64 |
-
}
|
65 |
-
cm.state.activeLines = active;
|
66 |
-
});
|
67 |
-
}
|
68 |
-
|
69 |
-
function selectionChange(cm, sel) {
|
70 |
-
updateActiveLines(cm, sel.ranges);
|
71 |
-
}
|
72 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/selection/mark-selection.js
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Because sometimes you need to mark the selected *text*.
|
5 |
-
//
|
6 |
-
// Adds an option 'styleSelectedText' which, when enabled, gives
|
7 |
-
// selected text the CSS class given as option value, or
|
8 |
-
// "CodeMirror-selectedtext" when the value is not a string.
|
9 |
-
|
10 |
-
(function(mod) {
|
11 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
12 |
-
mod(require("../../lib/codemirror"));
|
13 |
-
else if (typeof define == "function" && define.amd) // AMD
|
14 |
-
define(["../../lib/codemirror"], mod);
|
15 |
-
else // Plain browser env
|
16 |
-
mod(CodeMirror);
|
17 |
-
})(function(CodeMirror) {
|
18 |
-
"use strict";
|
19 |
-
|
20 |
-
CodeMirror.defineOption("styleSelectedText", false, function(cm, val, old) {
|
21 |
-
var prev = old && old != CodeMirror.Init;
|
22 |
-
if (val && !prev) {
|
23 |
-
cm.state.markedSelection = [];
|
24 |
-
cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext";
|
25 |
-
reset(cm);
|
26 |
-
cm.on("cursorActivity", onCursorActivity);
|
27 |
-
cm.on("change", onChange);
|
28 |
-
} else if (!val && prev) {
|
29 |
-
cm.off("cursorActivity", onCursorActivity);
|
30 |
-
cm.off("change", onChange);
|
31 |
-
clear(cm);
|
32 |
-
cm.state.markedSelection = cm.state.markedSelectionStyle = null;
|
33 |
-
}
|
34 |
-
});
|
35 |
-
|
36 |
-
function onCursorActivity(cm) {
|
37 |
-
if (cm.state.markedSelection)
|
38 |
-
cm.operation(function() { update(cm); });
|
39 |
-
}
|
40 |
-
|
41 |
-
function onChange(cm) {
|
42 |
-
if (cm.state.markedSelection && cm.state.markedSelection.length)
|
43 |
-
cm.operation(function() { clear(cm); });
|
44 |
-
}
|
45 |
-
|
46 |
-
var CHUNK_SIZE = 8;
|
47 |
-
var Pos = CodeMirror.Pos;
|
48 |
-
var cmp = CodeMirror.cmpPos;
|
49 |
-
|
50 |
-
function coverRange(cm, from, to, addAt) {
|
51 |
-
if (cmp(from, to) == 0) return;
|
52 |
-
var array = cm.state.markedSelection;
|
53 |
-
var cls = cm.state.markedSelectionStyle;
|
54 |
-
for (var line = from.line;;) {
|
55 |
-
var start = line == from.line ? from : Pos(line, 0);
|
56 |
-
var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line;
|
57 |
-
var end = atEnd ? to : Pos(endLine, 0);
|
58 |
-
var mark = cm.markText(start, end, {className: cls});
|
59 |
-
if (addAt == null) array.push(mark);
|
60 |
-
else array.splice(addAt++, 0, mark);
|
61 |
-
if (atEnd) break;
|
62 |
-
line = endLine;
|
63 |
-
}
|
64 |
-
}
|
65 |
-
|
66 |
-
function clear(cm) {
|
67 |
-
var array = cm.state.markedSelection;
|
68 |
-
for (var i = 0; i < array.length; ++i) array[i].clear();
|
69 |
-
array.length = 0;
|
70 |
-
}
|
71 |
-
|
72 |
-
function reset(cm) {
|
73 |
-
clear(cm);
|
74 |
-
var ranges = cm.listSelections();
|
75 |
-
for (var i = 0; i < ranges.length; i++)
|
76 |
-
coverRange(cm, ranges[i].from(), ranges[i].to());
|
77 |
-
}
|
78 |
-
|
79 |
-
function update(cm) {
|
80 |
-
if (!cm.somethingSelected()) return clear(cm);
|
81 |
-
if (cm.listSelections().length > 1) return reset(cm);
|
82 |
-
|
83 |
-
var from = cm.getCursor("start"), to = cm.getCursor("end");
|
84 |
-
|
85 |
-
var array = cm.state.markedSelection;
|
86 |
-
if (!array.length) return coverRange(cm, from, to);
|
87 |
-
|
88 |
-
var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
|
89 |
-
if (!coverStart || !coverEnd || to.line - from.line <= CHUNK_SIZE ||
|
90 |
-
cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
|
91 |
-
return reset(cm);
|
92 |
-
|
93 |
-
while (cmp(from, coverStart.from) > 0) {
|
94 |
-
array.shift().clear();
|
95 |
-
coverStart = array[0].find();
|
96 |
-
}
|
97 |
-
if (cmp(from, coverStart.from) < 0) {
|
98 |
-
if (coverStart.to.line - from.line < CHUNK_SIZE) {
|
99 |
-
array.shift().clear();
|
100 |
-
coverRange(cm, from, coverStart.to, 0);
|
101 |
-
} else {
|
102 |
-
coverRange(cm, from, coverStart.from, 0);
|
103 |
-
}
|
104 |
-
}
|
105 |
-
|
106 |
-
while (cmp(to, coverEnd.to) < 0) {
|
107 |
-
array.pop().clear();
|
108 |
-
coverEnd = array[array.length - 1].find();
|
109 |
-
}
|
110 |
-
if (cmp(to, coverEnd.to) > 0) {
|
111 |
-
if (to.line - coverEnd.from.line < CHUNK_SIZE) {
|
112 |
-
array.pop().clear();
|
113 |
-
coverRange(cm, coverEnd.from, to);
|
114 |
-
} else {
|
115 |
-
coverRange(cm, coverEnd.to, to);
|
116 |
-
}
|
117 |
-
}
|
118 |
-
}
|
119 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/selection/selection-pointer.js
DELETED
@@ -1,98 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
CodeMirror.defineOption("selectionPointer", false, function(cm, val) {
|
15 |
-
var data = cm.state.selectionPointer;
|
16 |
-
if (data) {
|
17 |
-
CodeMirror.off(cm.getWrapperElement(), "mousemove", data.mousemove);
|
18 |
-
CodeMirror.off(cm.getWrapperElement(), "mouseout", data.mouseout);
|
19 |
-
CodeMirror.off(window, "scroll", data.windowScroll);
|
20 |
-
cm.off("cursorActivity", reset);
|
21 |
-
cm.off("scroll", reset);
|
22 |
-
cm.state.selectionPointer = null;
|
23 |
-
cm.display.lineDiv.style.cursor = "";
|
24 |
-
}
|
25 |
-
if (val) {
|
26 |
-
data = cm.state.selectionPointer = {
|
27 |
-
value: typeof val == "string" ? val : "default",
|
28 |
-
mousemove: function(event) { mousemove(cm, event); },
|
29 |
-
mouseout: function(event) { mouseout(cm, event); },
|
30 |
-
windowScroll: function() { reset(cm); },
|
31 |
-
rects: null,
|
32 |
-
mouseX: null, mouseY: null,
|
33 |
-
willUpdate: false
|
34 |
-
};
|
35 |
-
CodeMirror.on(cm.getWrapperElement(), "mousemove", data.mousemove);
|
36 |
-
CodeMirror.on(cm.getWrapperElement(), "mouseout", data.mouseout);
|
37 |
-
CodeMirror.on(window, "scroll", data.windowScroll);
|
38 |
-
cm.on("cursorActivity", reset);
|
39 |
-
cm.on("scroll", reset);
|
40 |
-
}
|
41 |
-
});
|
42 |
-
|
43 |
-
function mousemove(cm, event) {
|
44 |
-
var data = cm.state.selectionPointer;
|
45 |
-
if (event.buttons == null ? event.which : event.buttons) {
|
46 |
-
data.mouseX = data.mouseY = null;
|
47 |
-
} else {
|
48 |
-
data.mouseX = event.clientX;
|
49 |
-
data.mouseY = event.clientY;
|
50 |
-
}
|
51 |
-
scheduleUpdate(cm);
|
52 |
-
}
|
53 |
-
|
54 |
-
function mouseout(cm, event) {
|
55 |
-
if (!cm.getWrapperElement().contains(event.relatedTarget)) {
|
56 |
-
var data = cm.state.selectionPointer;
|
57 |
-
data.mouseX = data.mouseY = null;
|
58 |
-
scheduleUpdate(cm);
|
59 |
-
}
|
60 |
-
}
|
61 |
-
|
62 |
-
function reset(cm) {
|
63 |
-
cm.state.selectionPointer.rects = null;
|
64 |
-
scheduleUpdate(cm);
|
65 |
-
}
|
66 |
-
|
67 |
-
function scheduleUpdate(cm) {
|
68 |
-
if (!cm.state.selectionPointer.willUpdate) {
|
69 |
-
cm.state.selectionPointer.willUpdate = true;
|
70 |
-
setTimeout(function() {
|
71 |
-
update(cm);
|
72 |
-
cm.state.selectionPointer.willUpdate = false;
|
73 |
-
}, 50);
|
74 |
-
}
|
75 |
-
}
|
76 |
-
|
77 |
-
function update(cm) {
|
78 |
-
var data = cm.state.selectionPointer;
|
79 |
-
if (!data) return;
|
80 |
-
if (data.rects == null && data.mouseX != null) {
|
81 |
-
data.rects = [];
|
82 |
-
if (cm.somethingSelected()) {
|
83 |
-
for (var sel = cm.display.selectionDiv.firstChild; sel; sel = sel.nextSibling)
|
84 |
-
data.rects.push(sel.getBoundingClientRect());
|
85 |
-
}
|
86 |
-
}
|
87 |
-
var inside = false;
|
88 |
-
if (data.mouseX != null) for (var i = 0; i < data.rects.length; i++) {
|
89 |
-
var rect = data.rects[i];
|
90 |
-
if (rect.left <= data.mouseX && rect.right >= data.mouseX &&
|
91 |
-
rect.top <= data.mouseY && rect.bottom >= data.mouseY)
|
92 |
-
inside = true;
|
93 |
-
}
|
94 |
-
var cursor = inside ? data.value : "";
|
95 |
-
if (cm.display.lineDiv.style.cursor != cursor)
|
96 |
-
cm.display.lineDiv.style.cursor = cursor;
|
97 |
-
}
|
98 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/tern/tern.css
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
.CodeMirror-Tern-completion {
|
2 |
-
padding-left: 22px;
|
3 |
-
position: relative;
|
4 |
-
line-height: 1.5;
|
5 |
-
}
|
6 |
-
.CodeMirror-Tern-completion:before {
|
7 |
-
position: absolute;
|
8 |
-
left: 2px;
|
9 |
-
bottom: 2px;
|
10 |
-
border-radius: 50%;
|
11 |
-
font-size: 12px;
|
12 |
-
font-weight: bold;
|
13 |
-
height: 15px;
|
14 |
-
width: 15px;
|
15 |
-
line-height: 16px;
|
16 |
-
text-align: center;
|
17 |
-
color: white;
|
18 |
-
-moz-box-sizing: border-box;
|
19 |
-
box-sizing: border-box;
|
20 |
-
}
|
21 |
-
.CodeMirror-Tern-completion-unknown:before {
|
22 |
-
content: "?";
|
23 |
-
background: #4bb;
|
24 |
-
}
|
25 |
-
.CodeMirror-Tern-completion-object:before {
|
26 |
-
content: "O";
|
27 |
-
background: #77c;
|
28 |
-
}
|
29 |
-
.CodeMirror-Tern-completion-fn:before {
|
30 |
-
content: "F";
|
31 |
-
background: #7c7;
|
32 |
-
}
|
33 |
-
.CodeMirror-Tern-completion-array:before {
|
34 |
-
content: "A";
|
35 |
-
background: #c66;
|
36 |
-
}
|
37 |
-
.CodeMirror-Tern-completion-number:before {
|
38 |
-
content: "1";
|
39 |
-
background: #999;
|
40 |
-
}
|
41 |
-
.CodeMirror-Tern-completion-string:before {
|
42 |
-
content: "S";
|
43 |
-
background: #999;
|
44 |
-
}
|
45 |
-
.CodeMirror-Tern-completion-bool:before {
|
46 |
-
content: "B";
|
47 |
-
background: #999;
|
48 |
-
}
|
49 |
-
|
50 |
-
.CodeMirror-Tern-completion-guess {
|
51 |
-
color: #999;
|
52 |
-
}
|
53 |
-
|
54 |
-
.CodeMirror-Tern-tooltip {
|
55 |
-
border: 1px solid silver;
|
56 |
-
border-radius: 3px;
|
57 |
-
color: #444;
|
58 |
-
padding: 2px 5px;
|
59 |
-
font-size: 90%;
|
60 |
-
font-family: monospace;
|
61 |
-
background-color: white;
|
62 |
-
white-space: pre-wrap;
|
63 |
-
|
64 |
-
max-width: 40em;
|
65 |
-
position: absolute;
|
66 |
-
z-index: 10;
|
67 |
-
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
68 |
-
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
69 |
-
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
70 |
-
|
71 |
-
transition: opacity 1s;
|
72 |
-
-moz-transition: opacity 1s;
|
73 |
-
-webkit-transition: opacity 1s;
|
74 |
-
-o-transition: opacity 1s;
|
75 |
-
-ms-transition: opacity 1s;
|
76 |
-
}
|
77 |
-
|
78 |
-
.CodeMirror-Tern-hint-doc {
|
79 |
-
max-width: 25em;
|
80 |
-
margin-top: -3px;
|
81 |
-
}
|
82 |
-
|
83 |
-
.CodeMirror-Tern-fname { color: black; }
|
84 |
-
.CodeMirror-Tern-farg { color: #70a; }
|
85 |
-
.CodeMirror-Tern-farg-current { text-decoration: underline; }
|
86 |
-
.CodeMirror-Tern-type { color: #07c; }
|
87 |
-
.CodeMirror-Tern-fhint-guess { opacity: .7; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/tern/tern.js
DELETED
@@ -1,718 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// Glue code between CodeMirror and Tern.
|
5 |
-
//
|
6 |
-
// Create a CodeMirror.TernServer to wrap an actual Tern server,
|
7 |
-
// register open documents (CodeMirror.Doc instances) with it, and
|
8 |
-
// call its methods to activate the assisting functions that Tern
|
9 |
-
// provides.
|
10 |
-
//
|
11 |
-
// Options supported (all optional):
|
12 |
-
// * defs: An array of JSON definition data structures.
|
13 |
-
// * plugins: An object mapping plugin names to configuration
|
14 |
-
// options.
|
15 |
-
// * getFile: A function(name, c) that can be used to access files in
|
16 |
-
// the project that haven't been loaded yet. Simply do c(null) to
|
17 |
-
// indicate that a file is not available.
|
18 |
-
// * fileFilter: A function(value, docName, doc) that will be applied
|
19 |
-
// to documents before passing them on to Tern.
|
20 |
-
// * switchToDoc: A function(name, doc) that should, when providing a
|
21 |
-
// multi-file view, switch the view or focus to the named file.
|
22 |
-
// * showError: A function(editor, message) that can be used to
|
23 |
-
// override the way errors are displayed.
|
24 |
-
// * completionTip: Customize the content in tooltips for completions.
|
25 |
-
// Is passed a single argument—the completion's data as returned by
|
26 |
-
// Tern—and may return a string, DOM node, or null to indicate that
|
27 |
-
// no tip should be shown. By default the docstring is shown.
|
28 |
-
// * typeTip: Like completionTip, but for the tooltips shown for type
|
29 |
-
// queries.
|
30 |
-
// * responseFilter: A function(doc, query, request, error, data) that
|
31 |
-
// will be applied to the Tern responses before treating them
|
32 |
-
//
|
33 |
-
//
|
34 |
-
// It is possible to run the Tern server in a web worker by specifying
|
35 |
-
// these additional options:
|
36 |
-
// * useWorker: Set to true to enable web worker mode. You'll probably
|
37 |
-
// want to feature detect the actual value you use here, for example
|
38 |
-
// !!window.Worker.
|
39 |
-
// * workerScript: The main script of the worker. Point this to
|
40 |
-
// wherever you are hosting worker.js from this directory.
|
41 |
-
// * workerDeps: An array of paths pointing (relative to workerScript)
|
42 |
-
// to the Acorn and Tern libraries and any Tern plugins you want to
|
43 |
-
// load. Or, if you minified those into a single script and included
|
44 |
-
// them in the workerScript, simply leave this undefined.
|
45 |
-
|
46 |
-
(function(mod) {
|
47 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
48 |
-
mod(require("../../lib/codemirror"));
|
49 |
-
else if (typeof define == "function" && define.amd) // AMD
|
50 |
-
define(["../../lib/codemirror"], mod);
|
51 |
-
else // Plain browser env
|
52 |
-
mod(CodeMirror);
|
53 |
-
})(function(CodeMirror) {
|
54 |
-
"use strict";
|
55 |
-
// declare global: tern
|
56 |
-
|
57 |
-
CodeMirror.TernServer = function(options) {
|
58 |
-
var self = this;
|
59 |
-
this.options = options || {};
|
60 |
-
var plugins = this.options.plugins || (this.options.plugins = {});
|
61 |
-
if (!plugins.doc_comment) plugins.doc_comment = true;
|
62 |
-
this.docs = Object.create(null);
|
63 |
-
if (this.options.useWorker) {
|
64 |
-
this.server = new WorkerServer(this);
|
65 |
-
} else {
|
66 |
-
this.server = new tern.Server({
|
67 |
-
getFile: function(name, c) { return getFile(self, name, c); },
|
68 |
-
async: true,
|
69 |
-
defs: this.options.defs || [],
|
70 |
-
plugins: plugins
|
71 |
-
});
|
72 |
-
}
|
73 |
-
this.trackChange = function(doc, change) { trackChange(self, doc, change); };
|
74 |
-
|
75 |
-
this.cachedArgHints = null;
|
76 |
-
this.activeArgHints = null;
|
77 |
-
this.jumpStack = [];
|
78 |
-
|
79 |
-
this.getHint = function(cm, c) { return hint(self, cm, c); };
|
80 |
-
this.getHint.async = true;
|
81 |
-
};
|
82 |
-
|
83 |
-
CodeMirror.TernServer.prototype = {
|
84 |
-
addDoc: function(name, doc) {
|
85 |
-
var data = {doc: doc, name: name, changed: null};
|
86 |
-
this.server.addFile(name, docValue(this, data));
|
87 |
-
CodeMirror.on(doc, "change", this.trackChange);
|
88 |
-
return this.docs[name] = data;
|
89 |
-
},
|
90 |
-
|
91 |
-
delDoc: function(id) {
|
92 |
-
var found = resolveDoc(this, id);
|
93 |
-
if (!found) return;
|
94 |
-
CodeMirror.off(found.doc, "change", this.trackChange);
|
95 |
-
delete this.docs[found.name];
|
96 |
-
this.server.delFile(found.name);
|
97 |
-
},
|
98 |
-
|
99 |
-
hideDoc: function(id) {
|
100 |
-
closeArgHints(this);
|
101 |
-
var found = resolveDoc(this, id);
|
102 |
-
if (found && found.changed) sendDoc(this, found);
|
103 |
-
},
|
104 |
-
|
105 |
-
complete: function(cm) {
|
106 |
-
cm.showHint({hint: this.getHint});
|
107 |
-
},
|
108 |
-
|
109 |
-
showType: function(cm, pos, c) { showContextInfo(this, cm, pos, "type", c); },
|
110 |
-
|
111 |
-
showDocs: function(cm, pos, c) { showContextInfo(this, cm, pos, "documentation", c); },
|
112 |
-
|
113 |
-
updateArgHints: function(cm) { updateArgHints(this, cm); },
|
114 |
-
|
115 |
-
jumpToDef: function(cm) { jumpToDef(this, cm); },
|
116 |
-
|
117 |
-
jumpBack: function(cm) { jumpBack(this, cm); },
|
118 |
-
|
119 |
-
rename: function(cm) { rename(this, cm); },
|
120 |
-
|
121 |
-
selectName: function(cm) { selectName(this, cm); },
|
122 |
-
|
123 |
-
request: function (cm, query, c, pos) {
|
124 |
-
var self = this;
|
125 |
-
var doc = findDoc(this, cm.getDoc());
|
126 |
-
var request = buildRequest(this, doc, query, pos);
|
127 |
-
var extraOptions = request.query && this.options.queryOptions && this.options.queryOptions[request.query.type]
|
128 |
-
if (extraOptions) for (var prop in extraOptions) request.query[prop] = extraOptions[prop];
|
129 |
-
|
130 |
-
this.server.request(request, function (error, data) {
|
131 |
-
if (!error && self.options.responseFilter)
|
132 |
-
data = self.options.responseFilter(doc, query, request, error, data);
|
133 |
-
c(error, data);
|
134 |
-
});
|
135 |
-
},
|
136 |
-
|
137 |
-
destroy: function () {
|
138 |
-
closeArgHints(this)
|
139 |
-
if (this.worker) {
|
140 |
-
this.worker.terminate();
|
141 |
-
this.worker = null;
|
142 |
-
}
|
143 |
-
}
|
144 |
-
};
|
145 |
-
|
146 |
-
var Pos = CodeMirror.Pos;
|
147 |
-
var cls = "CodeMirror-Tern-";
|
148 |
-
var bigDoc = 250;
|
149 |
-
|
150 |
-
function getFile(ts, name, c) {
|
151 |
-
var buf = ts.docs[name];
|
152 |
-
if (buf)
|
153 |
-
c(docValue(ts, buf));
|
154 |
-
else if (ts.options.getFile)
|
155 |
-
ts.options.getFile(name, c);
|
156 |
-
else
|
157 |
-
c(null);
|
158 |
-
}
|
159 |
-
|
160 |
-
function findDoc(ts, doc, name) {
|
161 |
-
for (var n in ts.docs) {
|
162 |
-
var cur = ts.docs[n];
|
163 |
-
if (cur.doc == doc) return cur;
|
164 |
-
}
|
165 |
-
if (!name) for (var i = 0;; ++i) {
|
166 |
-
n = "[doc" + (i || "") + "]";
|
167 |
-
if (!ts.docs[n]) { name = n; break; }
|
168 |
-
}
|
169 |
-
return ts.addDoc(name, doc);
|
170 |
-
}
|
171 |
-
|
172 |
-
function resolveDoc(ts, id) {
|
173 |
-
if (typeof id == "string") return ts.docs[id];
|
174 |
-
if (id instanceof CodeMirror) id = id.getDoc();
|
175 |
-
if (id instanceof CodeMirror.Doc) return findDoc(ts, id);
|
176 |
-
}
|
177 |
-
|
178 |
-
function trackChange(ts, doc, change) {
|
179 |
-
var data = findDoc(ts, doc);
|
180 |
-
|
181 |
-
var argHints = ts.cachedArgHints;
|
182 |
-
if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) >= 0)
|
183 |
-
ts.cachedArgHints = null;
|
184 |
-
|
185 |
-
var changed = data.changed;
|
186 |
-
if (changed == null)
|
187 |
-
data.changed = changed = {from: change.from.line, to: change.from.line};
|
188 |
-
var end = change.from.line + (change.text.length - 1);
|
189 |
-
if (change.from.line < changed.to) changed.to = changed.to - (change.to.line - end);
|
190 |
-
if (end >= changed.to) changed.to = end + 1;
|
191 |
-
if (changed.from > change.from.line) changed.from = change.from.line;
|
192 |
-
|
193 |
-
if (doc.lineCount() > bigDoc && change.to - changed.from > 100) setTimeout(function() {
|
194 |
-
if (data.changed && data.changed.to - data.changed.from > 100) sendDoc(ts, data);
|
195 |
-
}, 200);
|
196 |
-
}
|
197 |
-
|
198 |
-
function sendDoc(ts, doc) {
|
199 |
-
ts.server.request({files: [{type: "full", name: doc.name, text: docValue(ts, doc)}]}, function(error) {
|
200 |
-
if (error) window.console.error(error);
|
201 |
-
else doc.changed = null;
|
202 |
-
});
|
203 |
-
}
|
204 |
-
|
205 |
-
// Completion
|
206 |
-
|
207 |
-
function hint(ts, cm, c) {
|
208 |
-
ts.request(cm, {type: "completions", types: true, docs: true, urls: true}, function(error, data) {
|
209 |
-
if (error) return showError(ts, cm, error);
|
210 |
-
var completions = [], after = "";
|
211 |
-
var from = data.start, to = data.end;
|
212 |
-
if (cm.getRange(Pos(from.line, from.ch - 2), from) == "[\"" &&
|
213 |
-
cm.getRange(to, Pos(to.line, to.ch + 2)) != "\"]")
|
214 |
-
after = "\"]";
|
215 |
-
|
216 |
-
for (var i = 0; i < data.completions.length; ++i) {
|
217 |
-
var completion = data.completions[i], className = typeToIcon(completion.type);
|
218 |
-
if (data.guess) className += " " + cls + "guess";
|
219 |
-
completions.push({text: completion.name + after,
|
220 |
-
displayText: completion.displayName || completion.name,
|
221 |
-
className: className,
|
222 |
-
data: completion});
|
223 |
-
}
|
224 |
-
|
225 |
-
var obj = {from: from, to: to, list: completions};
|
226 |
-
var tooltip = null;
|
227 |
-
CodeMirror.on(obj, "close", function() { remove(tooltip); });
|
228 |
-
CodeMirror.on(obj, "update", function() { remove(tooltip); });
|
229 |
-
CodeMirror.on(obj, "select", function(cur, node) {
|
230 |
-
remove(tooltip);
|
231 |
-
var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc;
|
232 |
-
if (content) {
|
233 |
-
tooltip = makeTooltip(node.parentNode.getBoundingClientRect().right + window.pageXOffset,
|
234 |
-
node.getBoundingClientRect().top + window.pageYOffset, content);
|
235 |
-
tooltip.className += " " + cls + "hint-doc";
|
236 |
-
}
|
237 |
-
});
|
238 |
-
c(obj);
|
239 |
-
});
|
240 |
-
}
|
241 |
-
|
242 |
-
function typeToIcon(type) {
|
243 |
-
var suffix;
|
244 |
-
if (type == "?") suffix = "unknown";
|
245 |
-
else if (type == "number" || type == "string" || type == "bool") suffix = type;
|
246 |
-
else if (/^fn\(/.test(type)) suffix = "fn";
|
247 |
-
else if (/^\[/.test(type)) suffix = "array";
|
248 |
-
else suffix = "object";
|
249 |
-
return cls + "completion " + cls + "completion-" + suffix;
|
250 |
-
}
|
251 |
-
|
252 |
-
// Type queries
|
253 |
-
|
254 |
-
function showContextInfo(ts, cm, pos, queryName, c) {
|
255 |
-
ts.request(cm, queryName, function(error, data) {
|
256 |
-
if (error) return showError(ts, cm, error);
|
257 |
-
if (ts.options.typeTip) {
|
258 |
-
var tip = ts.options.typeTip(data);
|
259 |
-
} else {
|
260 |
-
var tip = elt("span", null, elt("strong", null, data.type || "not found"));
|
261 |
-
if (data.doc)
|
262 |
-
tip.appendChild(document.createTextNode(" — " + data.doc));
|
263 |
-
if (data.url) {
|
264 |
-
tip.appendChild(document.createTextNode(" "));
|
265 |
-
var child = tip.appendChild(elt("a", null, "[docs]"));
|
266 |
-
child.href = data.url;
|
267 |
-
child.target = "_blank";
|
268 |
-
}
|
269 |
-
}
|
270 |
-
tempTooltip(cm, tip, ts);
|
271 |
-
if (c) c();
|
272 |
-
}, pos);
|
273 |
-
}
|
274 |
-
|
275 |
-
// Maintaining argument hints
|
276 |
-
|
277 |
-
function updateArgHints(ts, cm) {
|
278 |
-
closeArgHints(ts);
|
279 |
-
|
280 |
-
if (cm.somethingSelected()) return;
|
281 |
-
var state = cm.getTokenAt(cm.getCursor()).state;
|
282 |
-
var inner = CodeMirror.innerMode(cm.getMode(), state);
|
283 |
-
if (inner.mode.name != "javascript") return;
|
284 |
-
var lex = inner.state.lexical;
|
285 |
-
if (lex.info != "call") return;
|
286 |
-
|
287 |
-
var ch, argPos = lex.pos || 0, tabSize = cm.getOption("tabSize");
|
288 |
-
for (var line = cm.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line) {
|
289 |
-
var str = cm.getLine(line), extra = 0;
|
290 |
-
for (var pos = 0;;) {
|
291 |
-
var tab = str.indexOf("\t", pos);
|
292 |
-
if (tab == -1) break;
|
293 |
-
extra += tabSize - (tab + extra) % tabSize - 1;
|
294 |
-
pos = tab + 1;
|
295 |
-
}
|
296 |
-
ch = lex.column - extra;
|
297 |
-
if (str.charAt(ch) == "(") {found = true; break;}
|
298 |
-
}
|
299 |
-
if (!found) return;
|
300 |
-
|
301 |
-
var start = Pos(line, ch);
|
302 |
-
var cache = ts.cachedArgHints;
|
303 |
-
if (cache && cache.doc == cm.getDoc() && cmpPos(start, cache.start) == 0)
|
304 |
-
return showArgHints(ts, cm, argPos);
|
305 |
-
|
306 |
-
ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) {
|
307 |
-
if (error || !data.type || !(/^fn\(/).test(data.type)) return;
|
308 |
-
ts.cachedArgHints = {
|
309 |
-
start: start,
|
310 |
-
type: parseFnType(data.type),
|
311 |
-
name: data.exprName || data.name || "fn",
|
312 |
-
guess: data.guess,
|
313 |
-
doc: cm.getDoc()
|
314 |
-
};
|
315 |
-
showArgHints(ts, cm, argPos);
|
316 |
-
});
|
317 |
-
}
|
318 |
-
|
319 |
-
function showArgHints(ts, cm, pos) {
|
320 |
-
closeArgHints(ts);
|
321 |
-
|
322 |
-
var cache = ts.cachedArgHints, tp = cache.type;
|
323 |
-
var tip = elt("span", cache.guess ? cls + "fhint-guess" : null,
|
324 |
-
elt("span", cls + "fname", cache.name), "(");
|
325 |
-
for (var i = 0; i < tp.args.length; ++i) {
|
326 |
-
if (i) tip.appendChild(document.createTextNode(", "));
|
327 |
-
var arg = tp.args[i];
|
328 |
-
tip.appendChild(elt("span", cls + "farg" + (i == pos ? " " + cls + "farg-current" : ""), arg.name || "?"));
|
329 |
-
if (arg.type != "?") {
|
330 |
-
tip.appendChild(document.createTextNode(":\u00a0"));
|
331 |
-
tip.appendChild(elt("span", cls + "type", arg.type));
|
332 |
-
}
|
333 |
-
}
|
334 |
-
tip.appendChild(document.createTextNode(tp.rettype ? ") ->\u00a0" : ")"));
|
335 |
-
if (tp.rettype) tip.appendChild(elt("span", cls + "type", tp.rettype));
|
336 |
-
var place = cm.cursorCoords(null, "page");
|
337 |
-
var tooltip = ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip)
|
338 |
-
setTimeout(function() {
|
339 |
-
tooltip.clear = onEditorActivity(cm, function() {
|
340 |
-
if (ts.activeArgHints == tooltip) closeArgHints(ts) })
|
341 |
-
}, 20)
|
342 |
-
}
|
343 |
-
|
344 |
-
function parseFnType(text) {
|
345 |
-
var args = [], pos = 3;
|
346 |
-
|
347 |
-
function skipMatching(upto) {
|
348 |
-
var depth = 0, start = pos;
|
349 |
-
for (;;) {
|
350 |
-
var next = text.charAt(pos);
|
351 |
-
if (upto.test(next) && !depth) return text.slice(start, pos);
|
352 |
-
if (/[{\[\(]/.test(next)) ++depth;
|
353 |
-
else if (/[}\]\)]/.test(next)) --depth;
|
354 |
-
++pos;
|
355 |
-
}
|
356 |
-
}
|
357 |
-
|
358 |
-
// Parse arguments
|
359 |
-
if (text.charAt(pos) != ")") for (;;) {
|
360 |
-
var name = text.slice(pos).match(/^([^, \(\[\{]+): /);
|
361 |
-
if (name) {
|
362 |
-
pos += name[0].length;
|
363 |
-
name = name[1];
|
364 |
-
}
|
365 |
-
args.push({name: name, type: skipMatching(/[\),]/)});
|
366 |
-
if (text.charAt(pos) == ")") break;
|
367 |
-
pos += 2;
|
368 |
-
}
|
369 |
-
|
370 |
-
var rettype = text.slice(pos).match(/^\) -> (.*)$/);
|
371 |
-
|
372 |
-
return {args: args, rettype: rettype && rettype[1]};
|
373 |
-
}
|
374 |
-
|
375 |
-
// Moving to the definition of something
|
376 |
-
|
377 |
-
function jumpToDef(ts, cm) {
|
378 |
-
function inner(varName) {
|
379 |
-
var req = {type: "definition", variable: varName || null};
|
380 |
-
var doc = findDoc(ts, cm.getDoc());
|
381 |
-
ts.server.request(buildRequest(ts, doc, req), function(error, data) {
|
382 |
-
if (error) return showError(ts, cm, error);
|
383 |
-
if (!data.file && data.url) { window.open(data.url); return; }
|
384 |
-
|
385 |
-
if (data.file) {
|
386 |
-
var localDoc = ts.docs[data.file], found;
|
387 |
-
if (localDoc && (found = findContext(localDoc.doc, data))) {
|
388 |
-
ts.jumpStack.push({file: doc.name,
|
389 |
-
start: cm.getCursor("from"),
|
390 |
-
end: cm.getCursor("to")});
|
391 |
-
moveTo(ts, doc, localDoc, found.start, found.end);
|
392 |
-
return;
|
393 |
-
}
|
394 |
-
}
|
395 |
-
showError(ts, cm, "Could not find a definition.");
|
396 |
-
});
|
397 |
-
}
|
398 |
-
|
399 |
-
if (!atInterestingExpression(cm))
|
400 |
-
dialog(cm, "Jump to variable", function(name) { if (name) inner(name); });
|
401 |
-
else
|
402 |
-
inner();
|
403 |
-
}
|
404 |
-
|
405 |
-
function jumpBack(ts, cm) {
|
406 |
-
var pos = ts.jumpStack.pop(), doc = pos && ts.docs[pos.file];
|
407 |
-
if (!doc) return;
|
408 |
-
moveTo(ts, findDoc(ts, cm.getDoc()), doc, pos.start, pos.end);
|
409 |
-
}
|
410 |
-
|
411 |
-
function moveTo(ts, curDoc, doc, start, end) {
|
412 |
-
doc.doc.setSelection(start, end);
|
413 |
-
if (curDoc != doc && ts.options.switchToDoc) {
|
414 |
-
closeArgHints(ts);
|
415 |
-
ts.options.switchToDoc(doc.name, doc.doc);
|
416 |
-
}
|
417 |
-
}
|
418 |
-
|
419 |
-
// The {line,ch} representation of positions makes this rather awkward.
|
420 |
-
function findContext(doc, data) {
|
421 |
-
var before = data.context.slice(0, data.contextOffset).split("\n");
|
422 |
-
var startLine = data.start.line - (before.length - 1);
|
423 |
-
var start = Pos(startLine, (before.length == 1 ? data.start.ch : doc.getLine(startLine).length) - before[0].length);
|
424 |
-
|
425 |
-
var text = doc.getLine(startLine).slice(start.ch);
|
426 |
-
for (var cur = startLine + 1; cur < doc.lineCount() && text.length < data.context.length; ++cur)
|
427 |
-
text += "\n" + doc.getLine(cur);
|
428 |
-
if (text.slice(0, data.context.length) == data.context) return data;
|
429 |
-
|
430 |
-
var cursor = doc.getSearchCursor(data.context, 0, false);
|
431 |
-
var nearest, nearestDist = Infinity;
|
432 |
-
while (cursor.findNext()) {
|
433 |
-
var from = cursor.from(), dist = Math.abs(from.line - start.line) * 10000;
|
434 |
-
if (!dist) dist = Math.abs(from.ch - start.ch);
|
435 |
-
if (dist < nearestDist) { nearest = from; nearestDist = dist; }
|
436 |
-
}
|
437 |
-
if (!nearest) return null;
|
438 |
-
|
439 |
-
if (before.length == 1)
|
440 |
-
nearest.ch += before[0].length;
|
441 |
-
else
|
442 |
-
nearest = Pos(nearest.line + (before.length - 1), before[before.length - 1].length);
|
443 |
-
if (data.start.line == data.end.line)
|
444 |
-
var end = Pos(nearest.line, nearest.ch + (data.end.ch - data.start.ch));
|
445 |
-
else
|
446 |
-
var end = Pos(nearest.line + (data.end.line - data.start.line), data.end.ch);
|
447 |
-
return {start: nearest, end: end};
|
448 |
-
}
|
449 |
-
|
450 |
-
function atInterestingExpression(cm) {
|
451 |
-
var pos = cm.getCursor("end"), tok = cm.getTokenAt(pos);
|
452 |
-
if (tok.start < pos.ch && tok.type == "comment") return false;
|
453 |
-
return /[\w)\]]/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1));
|
454 |
-
}
|
455 |
-
|
456 |
-
// Variable renaming
|
457 |
-
|
458 |
-
function rename(ts, cm) {
|
459 |
-
var token = cm.getTokenAt(cm.getCursor());
|
460 |
-
if (!/\w/.test(token.string)) return showError(ts, cm, "Not at a variable");
|
461 |
-
dialog(cm, "New name for " + token.string, function(newName) {
|
462 |
-
ts.request(cm, {type: "rename", newName: newName, fullDocs: true}, function(error, data) {
|
463 |
-
if (error) return showError(ts, cm, error);
|
464 |
-
applyChanges(ts, data.changes);
|
465 |
-
});
|
466 |
-
});
|
467 |
-
}
|
468 |
-
|
469 |
-
function selectName(ts, cm) {
|
470 |
-
var name = findDoc(ts, cm.doc).name;
|
471 |
-
ts.request(cm, {type: "refs"}, function(error, data) {
|
472 |
-
if (error) return showError(ts, cm, error);
|
473 |
-
var ranges = [], cur = 0;
|
474 |
-
var curPos = cm.getCursor();
|
475 |
-
for (var i = 0; i < data.refs.length; i++) {
|
476 |
-
var ref = data.refs[i];
|
477 |
-
if (ref.file == name) {
|
478 |
-
ranges.push({anchor: ref.start, head: ref.end});
|
479 |
-
if (cmpPos(curPos, ref.start) >= 0 && cmpPos(curPos, ref.end) <= 0)
|
480 |
-
cur = ranges.length - 1;
|
481 |
-
}
|
482 |
-
}
|
483 |
-
cm.setSelections(ranges, cur);
|
484 |
-
});
|
485 |
-
}
|
486 |
-
|
487 |
-
var nextChangeOrig = 0;
|
488 |
-
function applyChanges(ts, changes) {
|
489 |
-
var perFile = Object.create(null);
|
490 |
-
for (var i = 0; i < changes.length; ++i) {
|
491 |
-
var ch = changes[i];
|
492 |
-
(perFile[ch.file] || (perFile[ch.file] = [])).push(ch);
|
493 |
-
}
|
494 |
-
for (var file in perFile) {
|
495 |
-
var known = ts.docs[file], chs = perFile[file];;
|
496 |
-
if (!known) continue;
|
497 |
-
chs.sort(function(a, b) { return cmpPos(b.start, a.start); });
|
498 |
-
var origin = "*rename" + (++nextChangeOrig);
|
499 |
-
for (var i = 0; i < chs.length; ++i) {
|
500 |
-
var ch = chs[i];
|
501 |
-
known.doc.replaceRange(ch.text, ch.start, ch.end, origin);
|
502 |
-
}
|
503 |
-
}
|
504 |
-
}
|
505 |
-
|
506 |
-
// Generic request-building helper
|
507 |
-
|
508 |
-
function buildRequest(ts, doc, query, pos) {
|
509 |
-
var files = [], offsetLines = 0, allowFragments = !query.fullDocs;
|
510 |
-
if (!allowFragments) delete query.fullDocs;
|
511 |
-
if (typeof query == "string") query = {type: query};
|
512 |
-
query.lineCharPositions = true;
|
513 |
-
if (query.end == null) {
|
514 |
-
query.end = pos || doc.doc.getCursor("end");
|
515 |
-
if (doc.doc.somethingSelected())
|
516 |
-
query.start = doc.doc.getCursor("start");
|
517 |
-
}
|
518 |
-
var startPos = query.start || query.end;
|
519 |
-
|
520 |
-
if (doc.changed) {
|
521 |
-
if (doc.doc.lineCount() > bigDoc && allowFragments !== false &&
|
522 |
-
doc.changed.to - doc.changed.from < 100 &&
|
523 |
-
doc.changed.from <= startPos.line && doc.changed.to > query.end.line) {
|
524 |
-
files.push(getFragmentAround(doc, startPos, query.end));
|
525 |
-
query.file = "#0";
|
526 |
-
var offsetLines = files[0].offsetLines;
|
527 |
-
if (query.start != null) query.start = Pos(query.start.line - -offsetLines, query.start.ch);
|
528 |
-
query.end = Pos(query.end.line - offsetLines, query.end.ch);
|
529 |
-
} else {
|
530 |
-
files.push({type: "full",
|
531 |
-
name: doc.name,
|
532 |
-
text: docValue(ts, doc)});
|
533 |
-
query.file = doc.name;
|
534 |
-
doc.changed = null;
|
535 |
-
}
|
536 |
-
} else {
|
537 |
-
query.file = doc.name;
|
538 |
-
}
|
539 |
-
for (var name in ts.docs) {
|
540 |
-
var cur = ts.docs[name];
|
541 |
-
if (cur.changed && cur != doc) {
|
542 |
-
files.push({type: "full", name: cur.name, text: docValue(ts, cur)});
|
543 |
-
cur.changed = null;
|
544 |
-
}
|
545 |
-
}
|
546 |
-
|
547 |
-
return {query: query, files: files};
|
548 |
-
}
|
549 |
-
|
550 |
-
function getFragmentAround(data, start, end) {
|
551 |
-
var doc = data.doc;
|
552 |
-
var minIndent = null, minLine = null, endLine, tabSize = 4;
|
553 |
-
for (var p = start.line - 1, min = Math.max(0, p - 50); p >= min; --p) {
|
554 |
-
var line = doc.getLine(p), fn = line.search(/\bfunction\b/);
|
555 |
-
if (fn < 0) continue;
|
556 |
-
var indent = CodeMirror.countColumn(line, null, tabSize);
|
557 |
-
if (minIndent != null && minIndent <= indent) continue;
|
558 |
-
minIndent = indent;
|
559 |
-
minLine = p;
|
560 |
-
}
|
561 |
-
if (minLine == null) minLine = min;
|
562 |
-
var max = Math.min(doc.lastLine(), end.line + 20);
|
563 |
-
if (minIndent == null || minIndent == CodeMirror.countColumn(doc.getLine(start.line), null, tabSize))
|
564 |
-
endLine = max;
|
565 |
-
else for (endLine = end.line + 1; endLine < max; ++endLine) {
|
566 |
-
var indent = CodeMirror.countColumn(doc.getLine(endLine), null, tabSize);
|
567 |
-
if (indent <= minIndent) break;
|
568 |
-
}
|
569 |
-
var from = Pos(minLine, 0);
|
570 |
-
|
571 |
-
return {type: "part",
|
572 |
-
name: data.name,
|
573 |
-
offsetLines: from.line,
|
574 |
-
text: doc.getRange(from, Pos(endLine, end.line == endLine ? null : 0))};
|
575 |
-
}
|
576 |
-
|
577 |
-
// Generic utilities
|
578 |
-
|
579 |
-
var cmpPos = CodeMirror.cmpPos;
|
580 |
-
|
581 |
-
function elt(tagname, cls /*, ... elts*/) {
|
582 |
-
var e = document.createElement(tagname);
|
583 |
-
if (cls) e.className = cls;
|
584 |
-
for (var i = 2; i < arguments.length; ++i) {
|
585 |
-
var elt = arguments[i];
|
586 |
-
if (typeof elt == "string") elt = document.createTextNode(elt);
|
587 |
-
e.appendChild(elt);
|
588 |
-
}
|
589 |
-
return e;
|
590 |
-
}
|
591 |
-
|
592 |
-
function dialog(cm, text, f) {
|
593 |
-
if (cm.openDialog)
|
594 |
-
cm.openDialog(text + ": <input type=text>", f);
|
595 |
-
else
|
596 |
-
f(prompt(text, ""));
|
597 |
-
}
|
598 |
-
|
599 |
-
// Tooltips
|
600 |
-
|
601 |
-
function tempTooltip(cm, content, ts) {
|
602 |
-
if (cm.state.ternTooltip) remove(cm.state.ternTooltip);
|
603 |
-
var where = cm.cursorCoords();
|
604 |
-
var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content);
|
605 |
-
function maybeClear() {
|
606 |
-
old = true;
|
607 |
-
if (!mouseOnTip) clear();
|
608 |
-
}
|
609 |
-
function clear() {
|
610 |
-
cm.state.ternTooltip = null;
|
611 |
-
if (tip.parentNode) fadeOut(tip)
|
612 |
-
clearActivity()
|
613 |
-
}
|
614 |
-
var mouseOnTip = false, old = false;
|
615 |
-
CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; });
|
616 |
-
CodeMirror.on(tip, "mouseout", function(e) {
|
617 |
-
var related = e.relatedTarget || e.toElement
|
618 |
-
if (!related || !CodeMirror.contains(tip, related)) {
|
619 |
-
if (old) clear();
|
620 |
-
else mouseOnTip = false;
|
621 |
-
}
|
622 |
-
});
|
623 |
-
setTimeout(maybeClear, ts.options.hintDelay ? ts.options.hintDelay : 1700);
|
624 |
-
var clearActivity = onEditorActivity(cm, clear)
|
625 |
-
}
|
626 |
-
|
627 |
-
function onEditorActivity(cm, f) {
|
628 |
-
cm.on("cursorActivity", f)
|
629 |
-
cm.on("blur", f)
|
630 |
-
cm.on("scroll", f)
|
631 |
-
cm.on("setDoc", f)
|
632 |
-
return function() {
|
633 |
-
cm.off("cursorActivity", f)
|
634 |
-
cm.off("blur", f)
|
635 |
-
cm.off("scroll", f)
|
636 |
-
cm.off("setDoc", f)
|
637 |
-
}
|
638 |
-
}
|
639 |
-
|
640 |
-
function makeTooltip(x, y, content) {
|
641 |
-
var node = elt("div", cls + "tooltip", content);
|
642 |
-
node.style.left = x + "px";
|
643 |
-
node.style.top = y + "px";
|
644 |
-
document.body.appendChild(node);
|
645 |
-
return node;
|
646 |
-
}
|
647 |
-
|
648 |
-
function remove(node) {
|
649 |
-
var p = node && node.parentNode;
|
650 |
-
if (p) p.removeChild(node);
|
651 |
-
}
|
652 |
-
|
653 |
-
function fadeOut(tooltip) {
|
654 |
-
tooltip.style.opacity = "0";
|
655 |
-
setTimeout(function() { remove(tooltip); }, 1100);
|
656 |
-
}
|
657 |
-
|
658 |
-
function showError(ts, cm, msg) {
|
659 |
-
if (ts.options.showError)
|
660 |
-
ts.options.showError(cm, msg);
|
661 |
-
else
|
662 |
-
tempTooltip(cm, String(msg), ts);
|
663 |
-
}
|
664 |
-
|
665 |
-
function closeArgHints(ts) {
|
666 |
-
if (ts.activeArgHints) {
|
667 |
-
if (ts.activeArgHints.clear) ts.activeArgHints.clear()
|
668 |
-
remove(ts.activeArgHints)
|
669 |
-
ts.activeArgHints = null
|
670 |
-
}
|
671 |
-
}
|
672 |
-
|
673 |
-
function docValue(ts, doc) {
|
674 |
-
var val = doc.doc.getValue();
|
675 |
-
if (ts.options.fileFilter) val = ts.options.fileFilter(val, doc.name, doc.doc);
|
676 |
-
return val;
|
677 |
-
}
|
678 |
-
|
679 |
-
// Worker wrapper
|
680 |
-
|
681 |
-
function WorkerServer(ts) {
|
682 |
-
var worker = ts.worker = new Worker(ts.options.workerScript);
|
683 |
-
worker.postMessage({type: "init",
|
684 |
-
defs: ts.options.defs,
|
685 |
-
plugins: ts.options.plugins,
|
686 |
-
scripts: ts.options.workerDeps});
|
687 |
-
var msgId = 0, pending = {};
|
688 |
-
|
689 |
-
function send(data, c) {
|
690 |
-
if (c) {
|
691 |
-
data.id = ++msgId;
|
692 |
-
pending[msgId] = c;
|
693 |
-
}
|
694 |
-
worker.postMessage(data);
|
695 |
-
}
|
696 |
-
worker.onmessage = function(e) {
|
697 |
-
var data = e.data;
|
698 |
-
if (data.type == "getFile") {
|
699 |
-
getFile(ts, data.name, function(err, text) {
|
700 |
-
send({type: "getFile", err: String(err), text: text, id: data.id});
|
701 |
-
});
|
702 |
-
} else if (data.type == "debug") {
|
703 |
-
window.console.log(data.message);
|
704 |
-
} else if (data.id && pending[data.id]) {
|
705 |
-
pending[data.id](data.err, data.body);
|
706 |
-
delete pending[data.id];
|
707 |
-
}
|
708 |
-
};
|
709 |
-
worker.onerror = function(e) {
|
710 |
-
for (var id in pending) pending[id](e);
|
711 |
-
pending = {};
|
712 |
-
};
|
713 |
-
|
714 |
-
this.addFile = function(name, text) { send({type: "add", name: name, text: text}); };
|
715 |
-
this.delFile = function(name) { send({type: "del", name: name}); };
|
716 |
-
this.request = function(body, c) { send({type: "req", body: body}, c); };
|
717 |
-
}
|
718 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/tern/worker.js
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
// declare global: tern, server
|
5 |
-
|
6 |
-
var server;
|
7 |
-
|
8 |
-
this.onmessage = function(e) {
|
9 |
-
var data = e.data;
|
10 |
-
switch (data.type) {
|
11 |
-
case "init": return startServer(data.defs, data.plugins, data.scripts);
|
12 |
-
case "add": return server.addFile(data.name, data.text);
|
13 |
-
case "del": return server.delFile(data.name);
|
14 |
-
case "req": return server.request(data.body, function(err, reqData) {
|
15 |
-
postMessage({id: data.id, body: reqData, err: err && String(err)});
|
16 |
-
});
|
17 |
-
case "getFile":
|
18 |
-
var c = pending[data.id];
|
19 |
-
delete pending[data.id];
|
20 |
-
return c(data.err, data.text);
|
21 |
-
default: throw new Error("Unknown message type: " + data.type);
|
22 |
-
}
|
23 |
-
};
|
24 |
-
|
25 |
-
var nextId = 0, pending = {};
|
26 |
-
function getFile(file, c) {
|
27 |
-
postMessage({type: "getFile", name: file, id: ++nextId});
|
28 |
-
pending[nextId] = c;
|
29 |
-
}
|
30 |
-
|
31 |
-
function startServer(defs, plugins, scripts) {
|
32 |
-
if (scripts) importScripts.apply(null, scripts);
|
33 |
-
|
34 |
-
server = new tern.Server({
|
35 |
-
getFile: getFile,
|
36 |
-
async: true,
|
37 |
-
defs: defs,
|
38 |
-
plugins: plugins
|
39 |
-
});
|
40 |
-
}
|
41 |
-
|
42 |
-
this.console = {
|
43 |
-
log: function(v) { postMessage({type: "debug", message: v}); }
|
44 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/addon/wrap/hardwrap.js
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
-
|
4 |
-
(function(mod) {
|
5 |
-
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6 |
-
mod(require("../../lib/codemirror"));
|
7 |
-
else if (typeof define == "function" && define.amd) // AMD
|
8 |
-
define(["../../lib/codemirror"], mod);
|
9 |
-
else // Plain browser env
|
10 |
-
mod(CodeMirror);
|
11 |
-
})(function(CodeMirror) {
|
12 |
-
"use strict";
|
13 |
-
|
14 |
-
var Pos = CodeMirror.Pos;
|
15 |
-
|
16 |
-
function findParagraph(cm, pos, options) {
|
17 |
-
var startRE = options.paragraphStart || cm.getHelper(pos, "paragraphStart");
|
18 |
-
for (var start = pos.line, first = cm.firstLine(); start > first; --start) {
|
19 |
-
var line = cm.getLine(start);
|
20 |
-
if (startRE && startRE.test(line)) break;
|
21 |
-
if (!/\S/.test(line)) { ++start; break; }
|
22 |
-
}
|
23 |
-
var endRE = options.paragraphEnd || cm.getHelper(pos, "paragraphEnd");
|
24 |
-
for (var end = pos.line + 1, last = cm.lastLine(); end <= last; ++end) {
|
25 |
-
var line = cm.getLine(end);
|
26 |
-
if (endRE && endRE.test(line)) { ++end; break; }
|
27 |
-
if (!/\S/.test(line)) break;
|
28 |
-
}
|
29 |
-
return {from: start, to: end};
|
30 |
-
}
|
31 |
-
|
32 |
-
function findBreakPoint(text, column, wrapOn, killTrailingSpace) {
|
33 |
-
var at = column
|
34 |
-
while (at < text.length && text.charAt(at) == " ") at++
|
35 |
-
for (; at > 0; --at)
|
36 |
-
if (wrapOn.test(text.slice(at - 1, at + 1))) break;
|
37 |
-
for (var first = true;; first = false) {
|
38 |
-
var endOfText = at;
|
39 |
-
if (killTrailingSpace)
|
40 |
-
while (text.charAt(endOfText - 1) == " ") --endOfText;
|
41 |
-
if (endOfText == 0 && first) at = column;
|
42 |
-
else return {from: endOfText, to: at};
|
43 |
-
}
|
44 |
-
}
|
45 |
-
|
46 |
-
function wrapRange(cm, from, to, options) {
|
47 |
-
from = cm.clipPos(from); to = cm.clipPos(to);
|
48 |
-
var column = options.column || 80;
|
49 |
-
var wrapOn = options.wrapOn || /\s\S|-[^\.\d]/;
|
50 |
-
var killTrailing = options.killTrailingSpace !== false;
|
51 |
-
var changes = [], curLine = "", curNo = from.line;
|
52 |
-
var lines = cm.getRange(from, to, false);
|
53 |
-
if (!lines.length) return null;
|
54 |
-
var leadingSpace = lines[0].match(/^[ \t]*/)[0];
|
55 |
-
if (leadingSpace.length >= column) column = leadingSpace.length + 1
|
56 |
-
|
57 |
-
for (var i = 0; i < lines.length; ++i) {
|
58 |
-
var text = lines[i], oldLen = curLine.length, spaceInserted = 0;
|
59 |
-
if (curLine && text && !wrapOn.test(curLine.charAt(curLine.length - 1) + text.charAt(0))) {
|
60 |
-
curLine += " ";
|
61 |
-
spaceInserted = 1;
|
62 |
-
}
|
63 |
-
var spaceTrimmed = "";
|
64 |
-
if (i) {
|
65 |
-
spaceTrimmed = text.match(/^\s*/)[0];
|
66 |
-
text = text.slice(spaceTrimmed.length);
|
67 |
-
}
|
68 |
-
curLine += text;
|
69 |
-
if (i) {
|
70 |
-
var firstBreak = curLine.length > column && leadingSpace == spaceTrimmed &&
|
71 |
-
findBreakPoint(curLine, column, wrapOn, killTrailing);
|
72 |
-
// If this isn't broken, or is broken at a different point, remove old break
|
73 |
-
if (!firstBreak || firstBreak.from != oldLen || firstBreak.to != oldLen + spaceInserted) {
|
74 |
-
changes.push({text: [spaceInserted ? " " : ""],
|
75 |
-
from: Pos(curNo, oldLen),
|
76 |
-
to: Pos(curNo + 1, spaceTrimmed.length)});
|
77 |
-
} else {
|
78 |
-
curLine = leadingSpace + text;
|
79 |
-
++curNo;
|
80 |
-
}
|
81 |
-
}
|
82 |
-
while (curLine.length > column) {
|
83 |
-
var bp = findBreakPoint(curLine, column, wrapOn, killTrailing);
|
84 |
-
changes.push({text: ["", leadingSpace],
|
85 |
-
from: Pos(curNo, bp.from),
|
86 |
-
to: Pos(curNo, bp.to)});
|
87 |
-
curLine = leadingSpace + curLine.slice(bp.to);
|
88 |
-
++curNo;
|
89 |
-
}
|
90 |
-
}
|
91 |
-
if (changes.length) cm.operation(function() {
|
92 |
-
for (var i = 0; i < changes.length; ++i) {
|
93 |
-
var change = changes[i];
|
94 |
-
if (change.text || CodeMirror.cmpPos(change.from, change.to))
|
95 |
-
cm.replaceRange(change.text, change.from, change.to);
|
96 |
-
}
|
97 |
-
});
|
98 |
-
return changes.length ? {from: changes[0].from, to: CodeMirror.changeEnd(changes[changes.length - 1])} : null;
|
99 |
-
}
|
100 |
-
|
101 |
-
CodeMirror.defineExtension("wrapParagraph", function(pos, options) {
|
102 |
-
options = options || {};
|
103 |
-
if (!pos) pos = this.getCursor();
|
104 |
-
var para = findParagraph(this, pos, options);
|
105 |
-
return wrapRange(this, Pos(para.from, 0), Pos(para.to - 1), options);
|
106 |
-
});
|
107 |
-
|
108 |
-
CodeMirror.commands.wrapLines = function(cm) {
|
109 |
-
cm.operation(function() {
|
110 |
-
var ranges = cm.listSelections(), at = cm.lastLine() + 1;
|
111 |
-
for (var i = ranges.length - 1; i >= 0; i--) {
|
112 |
-
var range = ranges[i], span;
|
113 |
-
if (range.empty()) {
|
114 |
-
var para = findParagraph(cm, range.head, {});
|
115 |
-
span = {from: Pos(para.from, 0), to: Pos(para.to - 1)};
|
116 |
-
} else {
|
117 |
-
span = {from: range.from(), to: range.to()};
|
118 |
-
}
|
119 |
-
if (span.to.line >= at) continue;
|
120 |
-
at = span.from.line;
|
121 |
-
wrapRange(cm, span.from, span.to, {});
|
122 |
-
}
|
123 |
-
});
|
124 |
-
};
|
125 |
-
|
126 |
-
CodeMirror.defineExtension("wrapRange", function(from, to, options) {
|
127 |
-
return wrapRange(this, from, to, options || {});
|
128 |
-
});
|
129 |
-
|
130 |
-
CodeMirror.defineExtension("wrapParagraphsInRange", function(from, to, options) {
|
131 |
-
options = options || {};
|
132 |
-
var cm = this, paras = [];
|
133 |
-
for (var line = from.line; line <= to.line;) {
|
134 |
-
var para = findParagraph(cm, Pos(line, 0), options);
|
135 |
-
paras.push(para);
|
136 |
-
line = para.to;
|
137 |
-
}
|
138 |
-
var madeChange = false;
|
139 |
-
if (paras.length) cm.operation(function() {
|
140 |
-
for (var i = paras.length - 1; i >= 0; --i)
|
141 |
-
madeChange = madeChange || wrapRange(cm, Pos(paras[i].from, 0), Pos(paras[i].to - 1), options);
|
142 |
-
});
|
143 |
-
return madeChange;
|
144 |
-
});
|
145 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/bin/authors.sh
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
# Combine existing list of authors with everyone known in git, sort, add header.
|
2 |
-
tail --lines=+3 AUTHORS > AUTHORS.tmp
|
3 |
-
git log --format='%aN' | grep -v "Piët Delport" >> AUTHORS.tmp
|
4 |
-
echo -e "List of CodeMirror contributors. Updated before every release.\n" > AUTHORS
|
5 |
-
sort -u AUTHORS.tmp | sed 's/Google Inc\./Google LLC/' >> AUTHORS
|
6 |
-
rm -f AUTHORS.tmp
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/bin/lint
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
#!/usr/bin/env node
|
2 |
-
|
3 |
-
process.exit(require("../test/lint").ok ? 0 : 1);
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/bin/release
DELETED
@@ -1,38 +0,0 @@
|
|
1 |
-
#!/usr/bin/env node
|
2 |
-
|
3 |
-
var fs = require("fs"), child = require("child_process");
|
4 |
-
|
5 |
-
var number, bumpOnly;
|
6 |
-
|
7 |
-
for (var i = 2; i < process.argv.length; i++) {
|
8 |
-
if (process.argv[i] == "-bump") bumpOnly = true;
|
9 |
-
else if (/^\d+\.\d+\.\d+$/.test(process.argv[i])) number = process.argv[i];
|
10 |
-
else { console.log("Bogus command line arg: " + process.argv[i]); process.exit(1); }
|
11 |
-
}
|
12 |
-
|
13 |
-
if (!number) { console.log("Must give a version"); process.exit(1); }
|
14 |
-
|
15 |
-
function rewrite(file, f) {
|
16 |
-
fs.writeFileSync(file, f(fs.readFileSync(file, "utf8")), "utf8");
|
17 |
-
}
|
18 |
-
|
19 |
-
rewrite("src/edit/main.js", function(lib) {
|
20 |
-
return lib.replace(/CodeMirror\.version = "\d+\.\d+\.\d+"/,
|
21 |
-
"CodeMirror.version = \"" + number + "\"");
|
22 |
-
});
|
23 |
-
function rewriteJSON(pack) {
|
24 |
-
return pack.replace(/"version":\s*"\d+\.\d+\.\d+"/, "\"version\": \"" + number + "\"");
|
25 |
-
}
|
26 |
-
rewrite("package.json", rewriteJSON);
|
27 |
-
rewrite("doc/manual.html", function(manual) {
|
28 |
-
return manual.replace(/>version \d+\.\d+\.\d+<\/span>/, ">version " + number + "</span>");
|
29 |
-
});
|
30 |
-
|
31 |
-
if (bumpOnly) process.exit(0);
|
32 |
-
|
33 |
-
child.exec("bash bin/authors.sh", function(){});
|
34 |
-
|
35 |
-
rewrite("index.html", function(index) {
|
36 |
-
return index.replace(/\.zip">\d+\.\d+\.\d+<\/a>/,
|
37 |
-
".zip\">" + number + "</a>");
|
38 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/bin/source-highlight
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
#!/usr/bin/env node
|
2 |
-
|
3 |
-
// Simple command-line code highlighting tool. Reads code from stdin,
|
4 |
-
// spits html to stdout. For example:
|
5 |
-
//
|
6 |
-
// echo 'function foo(a) { return a; }' | bin/source-highlight -s javascript
|
7 |
-
// bin/source-highlight -s
|
8 |
-
|
9 |
-
var fs = require("fs");
|
10 |
-
|
11 |
-
var CodeMirror = require("../addon/runmode/runmode.node.js");
|
12 |
-
require("../mode/meta.js");
|
13 |
-
|
14 |
-
var sPos = process.argv.indexOf("-s");
|
15 |
-
if (sPos == -1 || sPos == process.argv.length - 1) {
|
16 |
-
console.error("Usage: source-highlight -s language");
|
17 |
-
process.exit(1);
|
18 |
-
}
|
19 |
-
var lang = process.argv[sPos + 1].toLowerCase(), modeName = lang;
|
20 |
-
var found = CodeMirror.findModeByMIME(lang) || CodeMirror.findModeByName(lang)
|
21 |
-
if (found) {
|
22 |
-
modeName = found.mode
|
23 |
-
lang = found.mime
|
24 |
-
}
|
25 |
-
|
26 |
-
if (!CodeMirror.modes[modeName])
|
27 |
-
require("../mode/" + modeName + "/" + modeName + ".js");
|
28 |
-
|
29 |
-
function esc(str) {
|
30 |
-
return str.replace(/[<&]/g, function(ch) { return ch == "&" ? "&" : "<"; });
|
31 |
-
}
|
32 |
-
|
33 |
-
var code = fs.readFileSync("/dev/stdin", "utf8");
|
34 |
-
var curStyle = null, accum = "";
|
35 |
-
function flush() {
|
36 |
-
if (curStyle) process.stdout.write("<span class=\"" + curStyle.replace(/(^|\s+)/g, "$1cm-") + "\">" + esc(accum) + "</span>");
|
37 |
-
else process.stdout.write(esc(accum));
|
38 |
-
}
|
39 |
-
|
40 |
-
CodeMirror.runMode(code, lang, function(text, style) {
|
41 |
-
if (style != curStyle) {
|
42 |
-
flush();
|
43 |
-
curStyle = style; accum = text;
|
44 |
-
} else {
|
45 |
-
accum += text;
|
46 |
-
}
|
47 |
-
});
|
48 |
-
flush();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/bin/upload-release.js
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
"use strict"
|
2 |
-
|
3 |
-
let version = process.argv[2]
|
4 |
-
let auth = process.argv[3]
|
5 |
-
|
6 |
-
if (!auth) {
|
7 |
-
console.log("Usage: upload-release.js [TAG] [github-user:password]")
|
8 |
-
process.exit(1)
|
9 |
-
}
|
10 |
-
|
11 |
-
require('child_process').exec("git --no-pager show -s --format='%s' " + version, (error, stdout) => {
|
12 |
-
if (error) throw error
|
13 |
-
let message = stdout.split("\n").slice(2)
|
14 |
-
message = message.slice(0, message.indexOf("-----BEGIN PGP SIGNATURE-----")).join("\n")
|
15 |
-
|
16 |
-
let req = require("https").request({
|
17 |
-
host: "api.github.com",
|
18 |
-
auth: auth,
|
19 |
-
headers: {"user-agent": "Release uploader"},
|
20 |
-
path: "/repos/codemirror/codemirror/releases",
|
21 |
-
method: "POST"
|
22 |
-
}, res => {
|
23 |
-
if (res.statusCode >= 300) {
|
24 |
-
console.error(res.statusMessage)
|
25 |
-
res.on("data", d => console.log(d.toString()))
|
26 |
-
res.on("end", process.exit(1))
|
27 |
-
}
|
28 |
-
})
|
29 |
-
req.write(JSON.stringify({
|
30 |
-
tag_name: version,
|
31 |
-
name: version,
|
32 |
-
body: message
|
33 |
-
}))
|
34 |
-
req.end()
|
35 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/activeline.html
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Active Line Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/xml/xml.js"></script>
|
10 |
-
<script src="../addon/selection/active-line.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Active Line</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Active Line Demo</h2>
|
29 |
-
<form><textarea id="code" name="code">
|
30 |
-
<?xml version="1.0" encoding="UTF-8"?>
|
31 |
-
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
|
32 |
-
xmlns:georss="http://www.georss.org/georss"
|
33 |
-
xmlns:twitter="http://api.twitter.com">
|
34 |
-
<channel>
|
35 |
-
<title>Twitter / codemirror</title>
|
36 |
-
<link>http://twitter.com/codemirror</link>
|
37 |
-
<atom:link type="application/rss+xml"
|
38 |
-
href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/>
|
39 |
-
<description>Twitter updates from CodeMirror / codemirror.</description>
|
40 |
-
<language>en-us</language>
|
41 |
-
<ttl>40</ttl>
|
42 |
-
<item>
|
43 |
-
<title>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This one
|
44 |
-
uses CodeMirror as its editor.</title>
|
45 |
-
<description>codemirror: http://cloud-ide.com — they're springing up like mushrooms. This
|
46 |
-
one uses CodeMirror as its editor.</description>
|
47 |
-
<pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate>
|
48 |
-
<guid>http://twitter.com/codemirror/statuses/48527733722058752</guid>
|
49 |
-
<link>http://twitter.com/codemirror/statuses/48527733722058752</link>
|
50 |
-
<twitter:source>web</twitter:source>
|
51 |
-
<twitter:place/>
|
52 |
-
</item>
|
53 |
-
<item>
|
54 |
-
<title>codemirror: Posted a description of the CodeMirror 2 internals at
|
55 |
-
https://codemirror.net/2/internals.html</title>
|
56 |
-
<description>codemirror: Posted a description of the CodeMirror 2 internals at
|
57 |
-
https://codemirror.net/2/internals.html</description>
|
58 |
-
<pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate>
|
59 |
-
<guid>http://twitter.com/codemirror/statuses/42920879788789760</guid>
|
60 |
-
<link>http://twitter.com/codemirror/statuses/42920879788789760</link>
|
61 |
-
<twitter:source>web</twitter:source>
|
62 |
-
<twitter:place/>
|
63 |
-
</item>
|
64 |
-
</channel>
|
65 |
-
</rss></textarea></form>
|
66 |
-
|
67 |
-
<script>
|
68 |
-
var nonEmpty = false;
|
69 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
70 |
-
mode: "application/xml",
|
71 |
-
styleActiveLine: true,
|
72 |
-
lineNumbers: true,
|
73 |
-
lineWrapping: true
|
74 |
-
});
|
75 |
-
|
76 |
-
function toggleSelProp() {
|
77 |
-
nonEmpty = !nonEmpty;
|
78 |
-
editor.setOption("styleActiveLine", {nonEmpty: nonEmpty});
|
79 |
-
var label = nonEmpty ? 'Disable nonEmpty option' : 'Enable nonEmpty option';
|
80 |
-
document.getElementById('toggleButton').innerText = label;
|
81 |
-
}
|
82 |
-
</script>
|
83 |
-
|
84 |
-
<p>Styling the current cursor line.</p>
|
85 |
-
|
86 |
-
<button onclick="toggleSelProp()" id="toggleButton">Enable <code>nonEmpty</code> option</button>
|
87 |
-
|
88 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/anywordhint.html
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Any Word Completion Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/hint/show-hint.css">
|
9 |
-
<script src="../lib/codemirror.js"></script>
|
10 |
-
<script src="../addon/hint/show-hint.js"></script>
|
11 |
-
<script src="../addon/hint/anyword-hint.js"></script>
|
12 |
-
<script src="../mode/javascript/javascript.js"></script>
|
13 |
-
<div id=nav>
|
14 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
15 |
-
|
16 |
-
<ul>
|
17 |
-
<li><a href="../index.html">Home</a>
|
18 |
-
<li><a href="../doc/manual.html">Manual</a>
|
19 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
20 |
-
</ul>
|
21 |
-
<ul>
|
22 |
-
<li><a class=active href="#">Any Word Completion</a>
|
23 |
-
</ul>
|
24 |
-
</div>
|
25 |
-
|
26 |
-
<article>
|
27 |
-
<h2>Any Word Completion Demo</h2>
|
28 |
-
<form><textarea id="code" name="code">
|
29 |
-
(function() {
|
30 |
-
"use strict";
|
31 |
-
|
32 |
-
var WORD = /[\w$]+/g, RANGE = 500;
|
33 |
-
|
34 |
-
CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
|
35 |
-
var word = options && options.word || WORD;
|
36 |
-
var range = options && options.range || RANGE;
|
37 |
-
var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
|
38 |
-
var start = cur.ch, end = start;
|
39 |
-
while (end < curLine.length && word.test(curLine.charAt(end))) ++end;
|
40 |
-
while (start && word.test(curLine.charAt(start - 1))) --start;
|
41 |
-
var curWord = start != end && curLine.slice(start, end);
|
42 |
-
|
43 |
-
var list = [], seen = {};
|
44 |
-
function scan(dir) {
|
45 |
-
var line = cur.line, end = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
|
46 |
-
for (; line != end; line += dir) {
|
47 |
-
var text = editor.getLine(line), m;
|
48 |
-
word.lastIndex = 0;
|
49 |
-
while (m = word.exec(text)) {
|
50 |
-
if ((!curWord || m[0].indexOf(curWord) == 0) && !seen.hasOwnProperty(m[0])) {
|
51 |
-
seen[m[0]] = true;
|
52 |
-
list.push(m[0]);
|
53 |
-
}
|
54 |
-
}
|
55 |
-
}
|
56 |
-
}
|
57 |
-
scan(-1);
|
58 |
-
scan(1);
|
59 |
-
return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
|
60 |
-
});
|
61 |
-
})();
|
62 |
-
</textarea></form>
|
63 |
-
|
64 |
-
<p>Press <strong>ctrl-space</strong> to activate autocompletion. The
|
65 |
-
completion uses
|
66 |
-
the <a href="../doc/manual.html#addon_anyword-hint">anyword-hint.js</a>
|
67 |
-
module, which simply looks at nearby words in the buffer and completes
|
68 |
-
to those.</p>
|
69 |
-
|
70 |
-
<script>
|
71 |
-
CodeMirror.commands.autocomplete = function(cm) {
|
72 |
-
cm.showHint({hint: CodeMirror.hint.anyword});
|
73 |
-
}
|
74 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
75 |
-
lineNumbers: true,
|
76 |
-
extraKeys: {"Ctrl-Space": "autocomplete"}
|
77 |
-
});
|
78 |
-
</script>
|
79 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/bidi.html
DELETED
@@ -1,106 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Bi-directional Text Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/xml/xml.js"></script>
|
10 |
-
<style>
|
11 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
12 |
-
fieldset {border: none}
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Bi-directional Text</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Bi-directional Text Demo</h2>
|
29 |
-
<form><textarea id="code" name="code"><!-- Piece of the CodeMirror manual, 'translated' into Arabic by Google Translate -->
|
30 |
-
<!-- قطعة من دليل CodeMirror، "ترجم" إلى العربية بواسطة جوجل ترجمة -->
|
31 |
-
|
32 |
-
<dl>
|
33 |
-
<dt id=option_value><code>value (string or Doc)</code></dt>
|
34 |
-
<dd>قيمة البداية المحرر. يمكن أن تكون سلسلة، أو. كائن مستند.</dd>
|
35 |
-
<dt id=option_mode><code>mode (string or object)</code></dt>
|
36 |
-
<dd>وضع الاستخدام. عندما لا تعطى، وهذا الافتراضي إلى الطريقة الاولى
|
37 |
-
التي تم تحميلها. قد يكون من سلسلة، والتي إما أسماء أو ببساطة هو وضع
|
38 |
-
MIME نوع المرتبطة اسطة. بدلا من ذلك، قد يكون من كائن يحتوي على
|
39 |
-
خيارات التكوين لواسطة، مع <code>name</code> الخاصية التي وضع أسماء
|
40 |
-
(على سبيل المثال <code>{name: "javascript", json: true}</code>).
|
41 |
-
صفحات التجريبي لكل وضع تحتوي على معلومات حول ما معلمات تكوين وضع
|
42 |
-
يدعمها. يمكنك أن تطلب CodeMirror التي تم تعريفها طرق وأنواع MIME
|
43 |
-
الكشف على <code>CodeMirror.modes</code>
|
44 |
-
و <code>CodeMirror.mimeModes</code> الكائنات. وضع خرائط الأسماء
|
45 |
-
الأولى لمنشئات الخاصة بهم، وخرائط لأنواع MIME 2 المواصفات
|
46 |
-
واسطة.</dd>
|
47 |
-
<dt id=option_theme><code>theme (string)</code></dt>
|
48 |
-
<dd>موضوع لنمط المحرر مع. يجب عليك التأكد من الملف CSS تحديد
|
49 |
-
المقابلة <code>.cm-s-[name]</code> يتم تحميل أنماط (انظر
|
50 |
-
<a href="../theme/"><code>theme</code></a> الدليل في التوزيع).
|
51 |
-
الافتراضي هو <code>"default"</code> ، والتي تم تضمينها في
|
52 |
-
الألوان <code>codemirror.css</code>. فمن الممكن استخدام فئات متعددة
|
53 |
-
في تطبيق السمات مرة واحدة على سبيل المثال <code>"foo bar"</code>
|
54 |
-
سيتم تعيين كل من <code>cm-s-foo</code> و <code>cm-s-bar</code>
|
55 |
-
الطبقات إلى المحرر.</dd>
|
56 |
-
</dl>
|
57 |
-
</textarea>
|
58 |
-
<fieldset>
|
59 |
-
Editor default direction:
|
60 |
-
<input type="radio" id="ltr" name="direction"/><label for="ltr">LTR</label>
|
61 |
-
<input type="radio" id="rtl" name="direction"/><label for="rtl">RTL</label>
|
62 |
-
</fieldset>
|
63 |
-
<fieldset>
|
64 |
-
HTML document direction:
|
65 |
-
<input type="radio" id="htmlltr" name="htmldirection"/><label for="htmlltr">LTR</label>
|
66 |
-
<input type="radio" id="htmlrtl" name="htmldirection"/><label for="htmlrtl">RTL</label>
|
67 |
-
</fieldset>
|
68 |
-
<fieldset>
|
69 |
-
<input type="checkbox" id="rtlMoveVisually"/><label for="rtlMoveVisually">Use visual order for arrow key movement.</label>
|
70 |
-
</fieldset>
|
71 |
-
</form>
|
72 |
-
|
73 |
-
<script>
|
74 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
75 |
-
mode: "text/html",
|
76 |
-
lineNumbers: true,
|
77 |
-
lineWrapping: true,
|
78 |
-
direction: "rtl"
|
79 |
-
});
|
80 |
-
|
81 |
-
var dirRadios = {ltr: document.getElementById("ltr"),
|
82 |
-
rtl: document.getElementById("rtl")};
|
83 |
-
dirRadios[editor.getOption("direction")].checked = true;
|
84 |
-
dirRadios["rtl"].onchange = dirRadios["ltr"].onchange = function() {
|
85 |
-
editor.setOption("direction", dirRadios["rtl"].checked ? "rtl" : "ltr");
|
86 |
-
};
|
87 |
-
|
88 |
-
var HtmlDirRadios = {ltr: document.getElementById("htmlltr"),
|
89 |
-
rtl: document.getElementById("htmlrtl")};
|
90 |
-
HtmlDirRadios["ltr"].checked = true;
|
91 |
-
HtmlDirRadios["rtl"].onchange = HtmlDirRadios["ltr"].onchange = function() {
|
92 |
-
document.dir = (HtmlDirRadios["rtl"].checked ? "rtl" : "ltr");
|
93 |
-
};
|
94 |
-
|
95 |
-
var moveCheckbox = document.getElementById("rtlMoveVisually");
|
96 |
-
moveCheckbox.checked = editor.getOption("rtlMoveVisually");
|
97 |
-
moveCheckbox.onchange = function() {
|
98 |
-
editor.setOption("rtlMoveVisually", moveCheckbox.checked);
|
99 |
-
};
|
100 |
-
</script>
|
101 |
-
|
102 |
-
<p>Demonstration of bi-directional text support. See
|
103 |
-
the <a href="http://marijnhaverbeke.nl/blog/cursor-in-bidi-text.html">related
|
104 |
-
blog post</a> for more background.</p>
|
105 |
-
|
106 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/btree.html
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: B-Tree visualization</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<style>
|
10 |
-
.lineblock { display: inline-block; margin: 1px; height: 5px; }
|
11 |
-
.CodeMirror {border: 1px solid #aaa; height: 400px}
|
12 |
-
</style>
|
13 |
-
<div id=nav>
|
14 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
15 |
-
|
16 |
-
<ul>
|
17 |
-
<li><a href="../index.html">Home</a>
|
18 |
-
<li><a href="../doc/manual.html">Manual</a>
|
19 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
20 |
-
</ul>
|
21 |
-
<ul>
|
22 |
-
<li><a class=active href="#">B-Tree visualization</a>
|
23 |
-
</ul>
|
24 |
-
</div>
|
25 |
-
|
26 |
-
<article>
|
27 |
-
<h2>B-Tree visualization</h2>
|
28 |
-
<form><textarea id="code" name="code">type here, see a summary of the document b-tree below</textarea></form>
|
29 |
-
<div style="display: inline-block; height: 402px; overflow-y: auto" id="output"></div>
|
30 |
-
|
31 |
-
<script id="me">
|
32 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
33 |
-
lineNumbers: true,
|
34 |
-
lineWrapping: true
|
35 |
-
});
|
36 |
-
var updateTimeout;
|
37 |
-
editor.on("change", function(cm) {
|
38 |
-
clearTimeout(updateTimeout);
|
39 |
-
updateTimeout = setTimeout(updateVisual, 200);
|
40 |
-
});
|
41 |
-
updateVisual();
|
42 |
-
|
43 |
-
function updateVisual() {
|
44 |
-
var out = document.getElementById("output");
|
45 |
-
out.innerHTML = "";
|
46 |
-
|
47 |
-
function drawTree(out, node) {
|
48 |
-
if (node.lines) {
|
49 |
-
out.appendChild(document.createElement("div")).innerHTML =
|
50 |
-
"<b>leaf</b>: " + node.lines.length + " lines, " + Math.round(node.height) + " px";
|
51 |
-
var lines = out.appendChild(document.createElement("div"));
|
52 |
-
lines.style.lineHeight = "6px"; lines.style.marginLeft = "10px";
|
53 |
-
for (var i = 0; i < node.lines.length; ++i) {
|
54 |
-
var line = node.lines[i], lineElt = lines.appendChild(document.createElement("div"));
|
55 |
-
lineElt.className = "lineblock";
|
56 |
-
var gray = Math.min(line.text.length * 3, 230), col = gray.toString(16);
|
57 |
-
if (col.length == 1) col = "0" + col;
|
58 |
-
lineElt.style.background = "#" + col + col + col;
|
59 |
-
lineElt.style.width = Math.max(Math.round(line.height / 3), 1) + "px";
|
60 |
-
}
|
61 |
-
} else {
|
62 |
-
out.appendChild(document.createElement("div")).innerHTML =
|
63 |
-
"<b>node</b>: " + node.size + " lines, " + Math.round(node.height) + " px";
|
64 |
-
var sub = out.appendChild(document.createElement("div"));
|
65 |
-
sub.style.paddingLeft = "20px";
|
66 |
-
for (var i = 0; i < node.children.length; ++i)
|
67 |
-
drawTree(sub, node.children[i]);
|
68 |
-
}
|
69 |
-
}
|
70 |
-
drawTree(out, editor.getDoc());
|
71 |
-
}
|
72 |
-
|
73 |
-
function fillEditor() {
|
74 |
-
var sc = document.getElementById("me");
|
75 |
-
var doc = (sc.textContent || sc.innerText || sc.innerHTML).replace(/^\s*/, "") + "\n";
|
76 |
-
doc += doc; doc += doc; doc += doc; doc += doc; doc += doc; doc += doc;
|
77 |
-
editor.setValue(doc);
|
78 |
-
}
|
79 |
-
</script>
|
80 |
-
|
81 |
-
<p><button onclick="fillEditor()">Add a lot of content</button></p>
|
82 |
-
|
83 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/buffers.html
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Multiple Buffer & Split View Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/javascript/javascript.js"></script>
|
10 |
-
<script src="../mode/css/css.js"></script>
|
11 |
-
<style id=style>
|
12 |
-
.CodeMirror {border: 1px solid black; height: 250px;}
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Multiple Buffer & Split View</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Multiple Buffer & Split View Demo</h2>
|
29 |
-
|
30 |
-
|
31 |
-
<div id=code_top></div>
|
32 |
-
<div>
|
33 |
-
Select buffer: <select id=buffers_top></select>
|
34 |
-
<button onclick="newBuf('top')">New buffer</button>
|
35 |
-
</div>
|
36 |
-
<div id=code_bot></div>
|
37 |
-
<div>
|
38 |
-
Select buffer: <select id=buffers_bot></select>
|
39 |
-
<button onclick="newBuf('bot')">New buffer</button>
|
40 |
-
</div>
|
41 |
-
|
42 |
-
<script id=script>
|
43 |
-
var sel_top = document.getElementById("buffers_top");
|
44 |
-
CodeMirror.on(sel_top, "change", function() {
|
45 |
-
selectBuffer(ed_top, sel_top.options[sel_top.selectedIndex].value);
|
46 |
-
});
|
47 |
-
|
48 |
-
var sel_bot = document.getElementById("buffers_bot");
|
49 |
-
CodeMirror.on(sel_bot, "change", function() {
|
50 |
-
selectBuffer(ed_bot, sel_bot.options[sel_bot.selectedIndex].value);
|
51 |
-
});
|
52 |
-
|
53 |
-
var buffers = {};
|
54 |
-
|
55 |
-
function openBuffer(name, text, mode) {
|
56 |
-
buffers[name] = CodeMirror.Doc(text, mode);
|
57 |
-
var opt = document.createElement("option");
|
58 |
-
opt.appendChild(document.createTextNode(name));
|
59 |
-
sel_top.appendChild(opt);
|
60 |
-
sel_bot.appendChild(opt.cloneNode(true));
|
61 |
-
}
|
62 |
-
|
63 |
-
function newBuf(where) {
|
64 |
-
var name = prompt("Name for the buffer", "*scratch*");
|
65 |
-
if (name == null) return;
|
66 |
-
if (buffers.hasOwnProperty(name)) {
|
67 |
-
alert("There's already a buffer by that name.");
|
68 |
-
return;
|
69 |
-
}
|
70 |
-
openBuffer(name, "", "javascript");
|
71 |
-
selectBuffer(where == "top" ? ed_top : ed_bot, name);
|
72 |
-
var sel = where == "top" ? sel_top : sel_bot;
|
73 |
-
sel.value = name;
|
74 |
-
}
|
75 |
-
|
76 |
-
function selectBuffer(editor, name) {
|
77 |
-
var buf = buffers[name];
|
78 |
-
if (buf.getEditor()) buf = buf.linkedDoc({sharedHist: true});
|
79 |
-
var old = editor.swapDoc(buf);
|
80 |
-
var linked = old.iterLinkedDocs(function(doc) {linked = doc;});
|
81 |
-
if (linked) {
|
82 |
-
// Make sure the document in buffers is the one the other view is looking at
|
83 |
-
for (var name in buffers) if (buffers[name] == old) buffers[name] = linked;
|
84 |
-
old.unlinkDoc(linked);
|
85 |
-
}
|
86 |
-
editor.focus();
|
87 |
-
}
|
88 |
-
|
89 |
-
function nodeContent(id) {
|
90 |
-
var node = document.getElementById(id), val = node.textContent || node.innerText;
|
91 |
-
val = val.slice(val.match(/^\s*/)[0].length, val.length - val.match(/\s*$/)[0].length) + "\n";
|
92 |
-
return val;
|
93 |
-
}
|
94 |
-
openBuffer("js", nodeContent("script"), "javascript");
|
95 |
-
openBuffer("css", nodeContent("style"), "css");
|
96 |
-
|
97 |
-
var ed_top = CodeMirror(document.getElementById("code_top"), {lineNumbers: true});
|
98 |
-
selectBuffer(ed_top, "js");
|
99 |
-
var ed_bot = CodeMirror(document.getElementById("code_bot"), {lineNumbers: true});
|
100 |
-
selectBuffer(ed_bot, "js");
|
101 |
-
</script>
|
102 |
-
|
103 |
-
<p>Demonstration of
|
104 |
-
using <a href="../doc/manual.html#linkedDoc">linked documents</a>
|
105 |
-
to provide a split view on a document, and
|
106 |
-
using <a href="../doc/manual.html#swapDoc"><code>swapDoc</code></a>
|
107 |
-
to use a single editor to display multiple documents.</p>
|
108 |
-
|
109 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/changemode.html
DELETED
@@ -1,58 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Mode-Changing Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/javascript/javascript.js"></script>
|
10 |
-
<script src="../mode/scheme/scheme.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border: 1px solid black;}
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Mode-Changing</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Mode-Changing Demo</h2>
|
29 |
-
<form><textarea id="code" name="code">
|
30 |
-
;; If there is Scheme code in here, the editor will be in Scheme mode.
|
31 |
-
;; If you put in JS instead, it'll switch to JS mode.
|
32 |
-
|
33 |
-
(define (double x)
|
34 |
-
(* x x))
|
35 |
-
</textarea></form>
|
36 |
-
|
37 |
-
<p>On changes to the content of the above editor, a (crude) script
|
38 |
-
tries to auto-detect the language used, and switches the editor to
|
39 |
-
either JavaScript or Scheme mode based on that.</p>
|
40 |
-
|
41 |
-
<script>
|
42 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
43 |
-
mode: "scheme",
|
44 |
-
lineNumbers: true
|
45 |
-
});
|
46 |
-
var pending;
|
47 |
-
editor.on("change", function() {
|
48 |
-
clearTimeout(pending);
|
49 |
-
pending = setTimeout(update, 400);
|
50 |
-
});
|
51 |
-
function looksLikeScheme(code) {
|
52 |
-
return !/^\s*\(\s*function\b/.test(code) && /^\s*[;\(]/.test(code);
|
53 |
-
}
|
54 |
-
function update() {
|
55 |
-
editor.setOption("mode", looksLikeScheme(editor.getValue()) ? "scheme" : "javascript");
|
56 |
-
}
|
57 |
-
</script>
|
58 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/closebrackets.html
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Closebrackets Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/edit/closebrackets.js"></script>
|
10 |
-
<script src="../mode/javascript/javascript.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Closebrackets</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Closebrackets Demo</h2>
|
29 |
-
<form><textarea id="code" name="code">function Grid(width, height) {
|
30 |
-
this.width = width;
|
31 |
-
this.height = height;
|
32 |
-
this.cells = new Array(width * height);
|
33 |
-
}
|
34 |
-
Grid.prototype.valueAt = function(point) {
|
35 |
-
return this.cells[point.y * this.width + point.x];
|
36 |
-
};
|
37 |
-
Grid.prototype.setValueAt = function(point, value) {
|
38 |
-
this.cells[point.y * this.width + point.x] = value;
|
39 |
-
};
|
40 |
-
Grid.prototype.isInside = function(point) {
|
41 |
-
return point.x >= 0 && point.y >= 0 &&
|
42 |
-
point.x < this.width && point.y < this.height;
|
43 |
-
};
|
44 |
-
Grid.prototype.moveValue = function(from, to) {
|
45 |
-
this.setValueAt(to, this.valueAt(from));
|
46 |
-
this.setValueAt(from, undefined);
|
47 |
-
};</textarea></form>
|
48 |
-
|
49 |
-
<script>
|
50 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {autoCloseBrackets: true});
|
51 |
-
</script>
|
52 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/closetag.html
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Close-Tag Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/edit/closetag.js"></script>
|
10 |
-
<script src="../addon/fold/xml-fold.js"></script>
|
11 |
-
<script src="../mode/xml/xml.js"></script>
|
12 |
-
<script src="../mode/javascript/javascript.js"></script>
|
13 |
-
<script src="../mode/css/css.js"></script>
|
14 |
-
<script src="../mode/htmlmixed/htmlmixed.js"></script>
|
15 |
-
<style>
|
16 |
-
.CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
|
17 |
-
</style>
|
18 |
-
<div id=nav>
|
19 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
20 |
-
|
21 |
-
<ul>
|
22 |
-
<li><a href="../index.html">Home</a>
|
23 |
-
<li><a href="../doc/manual.html">Manual</a>
|
24 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
25 |
-
</ul>
|
26 |
-
<ul>
|
27 |
-
<li><a class=active href="#">Close-Tag</a>
|
28 |
-
</ul>
|
29 |
-
</div>
|
30 |
-
|
31 |
-
<article>
|
32 |
-
<h2>Close-Tag Demo</h2>
|
33 |
-
<form><textarea id="code" name="code"><html</textarea></form>
|
34 |
-
|
35 |
-
<script>
|
36 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
37 |
-
mode: 'text/html',
|
38 |
-
autoCloseTags: true
|
39 |
-
});
|
40 |
-
</script>
|
41 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/complete.html
DELETED
@@ -1,126 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Autocomplete Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/hint/show-hint.css">
|
9 |
-
<script src="../lib/codemirror.js"></script>
|
10 |
-
<script src="../addon/hint/show-hint.js"></script>
|
11 |
-
<script src="../addon/hint/javascript-hint.js"></script>
|
12 |
-
<script src="../mode/javascript/javascript.js"></script>
|
13 |
-
<script src="../mode/markdown/markdown.js"></script>
|
14 |
-
|
15 |
-
<div id=nav>
|
16 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
17 |
-
|
18 |
-
<ul>
|
19 |
-
<li><a href="../index.html">Home</a>
|
20 |
-
<li><a href="../doc/manual.html">Manual</a>
|
21 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
22 |
-
</ul>
|
23 |
-
<ul>
|
24 |
-
<li><a class=active href="#">Autocomplete</a>
|
25 |
-
</ul>
|
26 |
-
</div>
|
27 |
-
|
28 |
-
<article>
|
29 |
-
<h2>Autocomplete Demo</h2>
|
30 |
-
<form><textarea id="code" name="code">
|
31 |
-
function getCompletions(token, context) {
|
32 |
-
var found = [], start = token.string;
|
33 |
-
function maybeAdd(str) {
|
34 |
-
if (str.indexOf(start) == 0) found.push(str);
|
35 |
-
}
|
36 |
-
function gatherCompletions(obj) {
|
37 |
-
if (typeof obj == "string") forEach(stringProps, maybeAdd);
|
38 |
-
else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
|
39 |
-
else if (obj instanceof Function) forEach(funcProps, maybeAdd);
|
40 |
-
for (var name in obj) maybeAdd(name);
|
41 |
-
}
|
42 |
-
|
43 |
-
if (context) {
|
44 |
-
// If this is a property, see if it belongs to some object we can
|
45 |
-
// find in the current environment.
|
46 |
-
var obj = context.pop(), base;
|
47 |
-
if (obj.className == "js-variable")
|
48 |
-
base = window[obj.string];
|
49 |
-
else if (obj.className == "js-string")
|
50 |
-
base = "";
|
51 |
-
else if (obj.className == "js-atom")
|
52 |
-
base = 1;
|
53 |
-
while (base != null && context.length)
|
54 |
-
base = base[context.pop().string];
|
55 |
-
if (base != null) gatherCompletions(base);
|
56 |
-
}
|
57 |
-
else {
|
58 |
-
// If not, just look in the window object and any local scope
|
59 |
-
// (reading into JS mode internals to get at the local variables)
|
60 |
-
for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
|
61 |
-
gatherCompletions(window);
|
62 |
-
forEach(keywords, maybeAdd);
|
63 |
-
}
|
64 |
-
return found;
|
65 |
-
}
|
66 |
-
</textarea></form>
|
67 |
-
|
68 |
-
<p>Press <strong>ctrl-space</strong> to activate autocompletion. Built
|
69 |
-
on top of the <a href="../doc/manual.html#addon_show-hint"><code>show-hint</code></a>
|
70 |
-
and <a href="../doc/manual.html#addon_javascript-hint"><code>javascript-hint</code></a>
|
71 |
-
addons.</p>
|
72 |
-
|
73 |
-
<form><textarea style="display: none" id="synonyms" name="synonyms">
|
74 |
-
Here, the completion use an asynchronous hinting functions to provide
|
75 |
-
synonyms for each words. If your browser support `Promises`, the
|
76 |
-
hinting function can also return one.
|
77 |
-
</textarea></form>
|
78 |
-
|
79 |
-
<script>
|
80 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
81 |
-
lineNumbers: true,
|
82 |
-
extraKeys: {"Ctrl-Space": "autocomplete"},
|
83 |
-
mode: {name: "javascript", globalVars: true}
|
84 |
-
});
|
85 |
-
|
86 |
-
if (typeof Promise !== "undefined") {
|
87 |
-
var comp = [
|
88 |
-
["here", "hither"],
|
89 |
-
["asynchronous", "nonsynchronous"],
|
90 |
-
["completion", "achievement", "conclusion", "culmination", "expirations"],
|
91 |
-
["hinting", "advive", "broach", "imply"],
|
92 |
-
["function","action"],
|
93 |
-
["provide", "add", "bring", "give"],
|
94 |
-
["synonyms", "equivalents"],
|
95 |
-
["words", "token"],
|
96 |
-
["each", "every"],
|
97 |
-
]
|
98 |
-
|
99 |
-
function synonyms(cm, option) {
|
100 |
-
return new Promise(function(accept) {
|
101 |
-
setTimeout(function() {
|
102 |
-
var cursor = cm.getCursor(), line = cm.getLine(cursor.line)
|
103 |
-
var start = cursor.ch, end = cursor.ch
|
104 |
-
while (start && /\w/.test(line.charAt(start - 1))) --start
|
105 |
-
while (end < line.length && /\w/.test(line.charAt(end))) ++end
|
106 |
-
var word = line.slice(start, end).toLowerCase()
|
107 |
-
for (var i = 0; i < comp.length; i++) if (comp[i].indexOf(word) != -1)
|
108 |
-
return accept({list: comp[i],
|
109 |
-
from: CodeMirror.Pos(cursor.line, start),
|
110 |
-
to: CodeMirror.Pos(cursor.line, end)})
|
111 |
-
return accept(null)
|
112 |
-
}, 100)
|
113 |
-
})
|
114 |
-
}
|
115 |
-
|
116 |
-
var editor2 = CodeMirror.fromTextArea(document.getElementById("synonyms"), {
|
117 |
-
extraKeys: {"Ctrl-Space": "autocomplete"},
|
118 |
-
lineNumbers: true,
|
119 |
-
lineWrapping: true,
|
120 |
-
mode: "text/x-markdown",
|
121 |
-
hintOptions: {hint: synonyms}
|
122 |
-
})
|
123 |
-
}
|
124 |
-
</script>
|
125 |
-
|
126 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/emacs.html
DELETED
@@ -1,76 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Emacs bindings demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/dialog/dialog.css">
|
9 |
-
<script src="../lib/codemirror.js"></script>
|
10 |
-
<script src="../mode/clike/clike.js"></script>
|
11 |
-
<script src="../keymap/emacs.js"></script>
|
12 |
-
<script src="../addon/edit/matchbrackets.js"></script>
|
13 |
-
<script src="../addon/comment/comment.js"></script>
|
14 |
-
<script src="../addon/dialog/dialog.js"></script>
|
15 |
-
<script src="../addon/search/searchcursor.js"></script>
|
16 |
-
<script src="../addon/search/search.js"></script>
|
17 |
-
<style>
|
18 |
-
.CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
|
19 |
-
</style>
|
20 |
-
<div id=nav>
|
21 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
22 |
-
|
23 |
-
<ul>
|
24 |
-
<li><a href="../index.html">Home</a>
|
25 |
-
<li><a href="../doc/manual.html">Manual</a>
|
26 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
27 |
-
</ul>
|
28 |
-
<ul>
|
29 |
-
<li><a class=active href="#">Emacs bindings</a>
|
30 |
-
</ul>
|
31 |
-
</div>
|
32 |
-
|
33 |
-
<article>
|
34 |
-
<h2>Emacs bindings demo</h2>
|
35 |
-
<form><textarea id="code" name="code">
|
36 |
-
#include "syscalls.h"
|
37 |
-
/* getchar: simple buffered version */
|
38 |
-
int getchar(void)
|
39 |
-
{
|
40 |
-
static char buf[BUFSIZ];
|
41 |
-
static char *bufp = buf;
|
42 |
-
static int n = 0;
|
43 |
-
if (n == 0) { /* buffer is empty */
|
44 |
-
n = read(0, buf, sizeof buf);
|
45 |
-
bufp = buf;
|
46 |
-
}
|
47 |
-
return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
|
48 |
-
}
|
49 |
-
</textarea></form>
|
50 |
-
|
51 |
-
<p>The emacs keybindings are enabled by
|
52 |
-
including <a href="../keymap/emacs.js">keymap/emacs.js</a> and setting
|
53 |
-
the <code>keyMap</code> option to <code>"emacs"</code>. Because
|
54 |
-
CodeMirror's internal API is quite different from Emacs, they are only
|
55 |
-
a loose approximation of actual emacs bindings, though.</p>
|
56 |
-
|
57 |
-
<p>Also note that a lot of browsers disallow certain keys from being
|
58 |
-
captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the
|
59 |
-
result that idiomatic use of Emacs keys will constantly close your tab
|
60 |
-
or open a new window.</p>
|
61 |
-
|
62 |
-
<script>
|
63 |
-
CodeMirror.commands.save = function() {
|
64 |
-
var elt = editor.getWrapperElement();
|
65 |
-
elt.style.background = "#def";
|
66 |
-
setTimeout(function() { elt.style.background = ""; }, 300);
|
67 |
-
};
|
68 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
69 |
-
lineNumbers: true,
|
70 |
-
mode: "text/x-csrc",
|
71 |
-
matchBrackets: true,
|
72 |
-
keyMap: "emacs"
|
73 |
-
});
|
74 |
-
</script>
|
75 |
-
|
76 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/folding.html
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror: Code Folding Demo</title>
|
5 |
-
<meta charset="utf-8"/>
|
6 |
-
<link rel=stylesheet href="../doc/docs.css">
|
7 |
-
|
8 |
-
<style>
|
9 |
-
.some-css {
|
10 |
-
color: red;
|
11 |
-
line-height: 2;
|
12 |
-
}
|
13 |
-
</style>
|
14 |
-
|
15 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
16 |
-
<link rel="stylesheet" href="../addon/fold/foldgutter.css" />
|
17 |
-
<script src="../lib/codemirror.js"></script>
|
18 |
-
<script src="../addon/fold/foldcode.js"></script>
|
19 |
-
<script src="../addon/fold/foldgutter.js"></script>
|
20 |
-
<script src="../addon/fold/brace-fold.js"></script>
|
21 |
-
<script src="../addon/fold/xml-fold.js"></script>
|
22 |
-
<script src="../addon/fold/indent-fold.js"></script>
|
23 |
-
<script src="../addon/fold/markdown-fold.js"></script>
|
24 |
-
<script src="../addon/fold/comment-fold.js"></script>
|
25 |
-
<script src="../mode/javascript/javascript.js"></script>
|
26 |
-
<script src="../mode/xml/xml.js"></script>
|
27 |
-
<script src="../mode/css/css.js"></script>
|
28 |
-
<script src="../mode/htmlmixed/htmlmixed.js"></script>
|
29 |
-
<script src="../mode/python/python.js"></script>
|
30 |
-
<script src="../mode/markdown/markdown.js"></script>
|
31 |
-
<style>
|
32 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
33 |
-
</style>
|
34 |
-
</head>
|
35 |
-
|
36 |
-
<body>
|
37 |
-
<div id=nav>
|
38 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
39 |
-
|
40 |
-
<ul>
|
41 |
-
<li><a href="../index.html">Home</a>
|
42 |
-
<li><a href="../doc/manual.html">Manual</a>
|
43 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
44 |
-
</ul>
|
45 |
-
<ul>
|
46 |
-
<li><a class=active href="#">Code Folding</a>
|
47 |
-
</ul>
|
48 |
-
</div>
|
49 |
-
|
50 |
-
<article>
|
51 |
-
<h2>Code Folding Demo</h2>
|
52 |
-
<form>
|
53 |
-
<div style="max-width: 50em; margin-bottom: 1em">JavaScript:<br>
|
54 |
-
<textarea id="code" name="code"></textarea></div>
|
55 |
-
<div style="max-width: 50em; margin-bottom: 1em">HTML:<br>
|
56 |
-
<textarea id="code-html" name="code-html"></textarea></div>
|
57 |
-
<div style="max-width: 50em">Python:<br>
|
58 |
-
<textarea id="code-python" name="code">
|
59 |
-
def foo():
|
60 |
-
do_some_stuff()
|
61 |
-
here
|
62 |
-
return None
|
63 |
-
|
64 |
-
class Bar:
|
65 |
-
__init__(self):
|
66 |
-
if True:
|
67 |
-
print("True")
|
68 |
-
else:
|
69 |
-
print("False")
|
70 |
-
|
71 |
-
this_code_makes_no_sense():
|
72 |
-
pass
|
73 |
-
|
74 |
-
# A comment</textarea></div>
|
75 |
-
<div style="max-width: 50em">Markdown:<br>
|
76 |
-
<textarea id="code-markdown" name="code"></textarea></div>
|
77 |
-
</form>
|
78 |
-
<script id="script">
|
79 |
-
/*
|
80 |
-
* Demonstration of code folding
|
81 |
-
*/
|
82 |
-
window.onload = function() {
|
83 |
-
var te = document.getElementById("code");
|
84 |
-
var sc = document.getElementById("script");
|
85 |
-
te.value = (sc.textContent || sc.innerText || sc.innerHTML).replace(/^\s*/, "");
|
86 |
-
sc.innerHTML = "";
|
87 |
-
var te_html = document.getElementById("code-html");
|
88 |
-
te_html.value = document.documentElement.innerHTML;
|
89 |
-
var te_python = document.getElementById("code-python");
|
90 |
-
var te_markdown = document.getElementById("code-markdown");
|
91 |
-
te_markdown.value = "# Foo\n## Bar\n\nblah blah\n\n## Baz\n\nblah blah\n\n# Quux\n\nblah blah\n"
|
92 |
-
|
93 |
-
window.editor = CodeMirror.fromTextArea(te, {
|
94 |
-
mode: "javascript",
|
95 |
-
lineNumbers: true,
|
96 |
-
lineWrapping: true,
|
97 |
-
extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
98 |
-
foldGutter: true,
|
99 |
-
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
100 |
-
});
|
101 |
-
editor.foldCode(CodeMirror.Pos(13, 0));
|
102 |
-
|
103 |
-
window.editor_html = CodeMirror.fromTextArea(te_html, {
|
104 |
-
mode: "text/html",
|
105 |
-
lineNumbers: true,
|
106 |
-
lineWrapping: true,
|
107 |
-
extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
108 |
-
foldGutter: true,
|
109 |
-
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
110 |
-
});
|
111 |
-
editor_html.foldCode(CodeMirror.Pos(0, 0));
|
112 |
-
editor_html.foldCode(CodeMirror.Pos(34, 0));
|
113 |
-
|
114 |
-
window.editor_python = CodeMirror.fromTextArea(te_python, {
|
115 |
-
mode: "python",
|
116 |
-
lineNumbers: true,
|
117 |
-
extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
118 |
-
foldGutter: true,
|
119 |
-
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
120 |
-
});
|
121 |
-
|
122 |
-
window.editor_markdown = CodeMirror.fromTextArea(te_markdown, {
|
123 |
-
mode: "markdown",
|
124 |
-
lineNumbers: true,
|
125 |
-
lineWrapping: true,
|
126 |
-
extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
|
127 |
-
foldGutter: true,
|
128 |
-
gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
|
129 |
-
});
|
130 |
-
};
|
131 |
-
</script>
|
132 |
-
</article>
|
133 |
-
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/fullscreen.html
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Full Screen Editing</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/display/fullscreen.css">
|
9 |
-
<link rel="stylesheet" href="../theme/night.css">
|
10 |
-
<script src="../lib/codemirror.js"></script>
|
11 |
-
<script src="../mode/xml/xml.js"></script>
|
12 |
-
<script src="../addon/display/fullscreen.js"></script>
|
13 |
-
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Full Screen Editing</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Full Screen Editing</h2>
|
29 |
-
<form><textarea id="code" name="code" rows="5">
|
30 |
-
<dl>
|
31 |
-
<dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
|
32 |
-
<dd>Whether, when indenting, the first N*<code>tabSize</code>
|
33 |
-
spaces should be replaced by N tabs. Default is false.</dd>
|
34 |
-
|
35 |
-
<dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
|
36 |
-
<dd>Configures whether the editor should re-indent the current
|
37 |
-
line when a character is typed that might change its proper
|
38 |
-
indentation (only works if the mode supports indentation).
|
39 |
-
Default is true.</dd>
|
40 |
-
|
41 |
-
<dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
|
42 |
-
<dd>A regular expression used to determine which characters
|
43 |
-
should be replaced by a
|
44 |
-
special <a href="#option_specialCharPlaceholder">placeholder</a>.
|
45 |
-
Mostly useful for non-printing special characters. The default
|
46 |
-
is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
|
47 |
-
<dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
|
48 |
-
<dd>A function that, given a special character identified by
|
49 |
-
the <a href="#option_specialChars"><code>specialChars</code></a>
|
50 |
-
option, produces a DOM node that is used to represent the
|
51 |
-
character. By default, a red dot (<span style="color: red">•</span>)
|
52 |
-
is shown, with a title tooltip to indicate the character code.</dd>
|
53 |
-
|
54 |
-
<dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
|
55 |
-
<dd>Determines whether horizontal cursor movement through
|
56 |
-
right-to-left (Arabic, Hebrew) text is visual (pressing the left
|
57 |
-
arrow moves the cursor left) or logical (pressing the left arrow
|
58 |
-
moves to the next lower index in the string, which is visually
|
59 |
-
right in right-to-left text). The default is <code>false</code>
|
60 |
-
on Windows, and <code>true</code> on other platforms.</dd>
|
61 |
-
</dl>
|
62 |
-
</textarea></form>
|
63 |
-
<script>
|
64 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
65 |
-
lineNumbers: true,
|
66 |
-
theme: "night",
|
67 |
-
extraKeys: {
|
68 |
-
"F11": function(cm) {
|
69 |
-
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
|
70 |
-
},
|
71 |
-
"Esc": function(cm) {
|
72 |
-
if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
|
73 |
-
}
|
74 |
-
}
|
75 |
-
});
|
76 |
-
</script>
|
77 |
-
|
78 |
-
<p>Demonstration of
|
79 |
-
the <a href="../doc/manual.html#addon_fullscreen">fullscreen</a>
|
80 |
-
addon. Press <strong>F11</strong> when cursor is in the editor to
|
81 |
-
toggle full screen editing. <strong>Esc</strong> can also be used
|
82 |
-
to <i>exit</i> full screen editing.</p>
|
83 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/hardwrap.html
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Hard-wrapping Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/markdown/markdown.js"></script>
|
10 |
-
<script src="../addon/wrap/hardwrap.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Hard-wrapping</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Hard-wrapping Demo</h2>
|
29 |
-
<form><textarea id="code" name="code">Lorem ipsum dolor sit amet, vim augue dictas constituto ex,
|
30 |
-
sit falli simul viderer te. Graeco scaevola maluisset sit
|
31 |
-
ut, in idque viris praesent sea. Ea sea eirmod indoctum
|
32 |
-
repudiare. Vel noluisse suscipit pericula ut. In ius nulla
|
33 |
-
alienum molestie. Mei essent discere democritum id.
|
34 |
-
|
35 |
-
Equidem ponderum expetendis ius in, mea an erroribus
|
36 |
-
constituto, congue timeam perfecto ad est. Ius ut primis
|
37 |
-
timeam, per in ullum mediocrem. An case vero labitur pri,
|
38 |
-
vel dicit laoreet et. An qui prompta conclusionemque, eam
|
39 |
-
timeam sapientem in, cum dictas epicurei eu.
|
40 |
-
|
41 |
-
Usu cu vide dictas deseruisse, eum choro graece adipiscing
|
42 |
-
ut. Cibo qualisque ius ad, et dicat scripta mea, eam nihil
|
43 |
-
mentitum aliquando cu. Debet aperiam splendide at quo, ad
|
44 |
-
paulo nostro commodo duo. Sea adhuc utinam conclusionemque
|
45 |
-
id, quas doming malorum nec ad. Tollit eruditi vivendum ad
|
46 |
-
ius, eos soleat ignota ad.
|
47 |
-
</textarea></form>
|
48 |
-
|
49 |
-
<p>Demonstration of
|
50 |
-
the <a href="../doc/manual.html#addon_hardwrap">hardwrap</a> addon.
|
51 |
-
The above editor has its change event hooked up to
|
52 |
-
the <code>wrapParagraphsInRange</code> method, so that the paragraphs
|
53 |
-
are reflown as you are typing.</p>
|
54 |
-
|
55 |
-
<script>
|
56 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
57 |
-
mode: "markdown",
|
58 |
-
lineNumbers: true,
|
59 |
-
extraKeys: {
|
60 |
-
"Ctrl-Q": function(cm) { cm.wrapParagraph(cm.getCursor(), options); }
|
61 |
-
}
|
62 |
-
});
|
63 |
-
var wait, options = {column: 60}, changing = false;
|
64 |
-
editor.on("change", function(cm, change) {
|
65 |
-
if (changing) return;
|
66 |
-
clearTimeout(wait);
|
67 |
-
wait = setTimeout(function() {
|
68 |
-
changing = true;
|
69 |
-
cm.wrapParagraphsInRange(change.from, CodeMirror.changeEnd(change), options);
|
70 |
-
changing = false;
|
71 |
-
}, 200);
|
72 |
-
});
|
73 |
-
</script>
|
74 |
-
|
75 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/html5complete.html
DELETED
@@ -1,56 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror: HTML completion demo</title>
|
5 |
-
<meta charset="utf-8"/>
|
6 |
-
<link rel=stylesheet href="../doc/docs.css">
|
7 |
-
|
8 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
9 |
-
<link rel="stylesheet" href="../addon/hint/show-hint.css">
|
10 |
-
<script src="../lib/codemirror.js"></script>
|
11 |
-
<script src="../addon/hint/show-hint.js"></script>
|
12 |
-
<script src="../addon/hint/xml-hint.js"></script>
|
13 |
-
<script src="../addon/hint/html-hint.js"></script>
|
14 |
-
<script src="../mode/xml/xml.js"></script>
|
15 |
-
<script src="../mode/javascript/javascript.js"></script>
|
16 |
-
<script src="../mode/css/css.js"></script>
|
17 |
-
<script src="../mode/htmlmixed/htmlmixed.js"></script>
|
18 |
-
<style>
|
19 |
-
.CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
|
20 |
-
</style>
|
21 |
-
</head>
|
22 |
-
|
23 |
-
<body>
|
24 |
-
<div id=nav>
|
25 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
26 |
-
|
27 |
-
<ul>
|
28 |
-
<li><a href="../index.html">Home</a>
|
29 |
-
<li><a href="../doc/manual.html">Manual</a>
|
30 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
31 |
-
</ul>
|
32 |
-
<ul>
|
33 |
-
<li><a class=active href="#">HTML completion</a>
|
34 |
-
</ul>
|
35 |
-
</div>
|
36 |
-
|
37 |
-
<article>
|
38 |
-
<h2>HTML completion demo</h2>
|
39 |
-
|
40 |
-
<p>Shows the <a href="xmlcomplete.html">XML completer</a>
|
41 |
-
parameterized with information about the tags in HTML.
|
42 |
-
Press <strong>ctrl-space</strong> to activate completion.</p>
|
43 |
-
|
44 |
-
<div id="code"></div>
|
45 |
-
|
46 |
-
<script>
|
47 |
-
window.onload = function() {
|
48 |
-
editor = CodeMirror(document.getElementById("code"), {
|
49 |
-
mode: "text/html",
|
50 |
-
extraKeys: {"Ctrl-Space": "autocomplete"},
|
51 |
-
value: document.documentElement.innerHTML
|
52 |
-
});
|
53 |
-
};
|
54 |
-
</script>
|
55 |
-
</article>
|
56 |
-
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/indentwrap.html
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Indented wrapped line demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/xml/xml.js"></script>
|
10 |
-
<style>
|
11 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
12 |
-
.CodeMirror pre > * { text-indent: 0px; }
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Indented wrapped line</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Indented wrapped line demo</h2>
|
29 |
-
<form><textarea id="code" name="code">
|
30 |
-
<!doctype html>
|
31 |
-
<body>
|
32 |
-
<h2 id="overview">Overview</h2>
|
33 |
-
|
34 |
-
<p>CodeMirror is a code-editor component that can be embedded in Web pages. The core library provides <em>only</em> the editor component, no accompanying buttons, auto-completion, or other IDE functionality. It does provide a rich API on top of which such functionality can be straightforwardly implemented. See the <a href="#addons">add-ons</a> included in the distribution, and the <a href="https://github.com/jagthedrummer/codemirror-ui">CodeMirror UI</a> project, for reusable implementations of extra features.</p>
|
35 |
-
|
36 |
-
<p>CodeMirror works with language-specific modes. Modes are JavaScript programs that help color (and optionally indent) text written in a given language. The distribution comes with a number of modes (see the <a href="../mode/"><code>mode/</code></a> directory), and it isn't hard to <a href="#modeapi">write new ones</a> for other languages.</p>
|
37 |
-
</body>
|
38 |
-
</textarea></form>
|
39 |
-
|
40 |
-
<p>This page uses a hack on top of the <code>"renderLine"</code>
|
41 |
-
event to make wrapped text line up with the base indentation of
|
42 |
-
the line.</p>
|
43 |
-
|
44 |
-
<script>
|
45 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
46 |
-
lineNumbers: true,
|
47 |
-
lineWrapping: true,
|
48 |
-
mode: "text/html"
|
49 |
-
});
|
50 |
-
var charWidth = editor.defaultCharWidth(), basePadding = 4;
|
51 |
-
editor.on("renderLine", function(cm, line, elt) {
|
52 |
-
var off = CodeMirror.countColumn(line.text, null, cm.getOption("tabSize")) * charWidth;
|
53 |
-
elt.style.textIndent = "-" + off + "px";
|
54 |
-
elt.style.paddingLeft = (basePadding + off) + "px";
|
55 |
-
});
|
56 |
-
editor.refresh();
|
57 |
-
</script>
|
58 |
-
|
59 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/lint.html
DELETED
@@ -1,171 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Linter Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/lint/lint.css">
|
9 |
-
<script src="../lib/codemirror.js"></script>
|
10 |
-
<script src="../mode/javascript/javascript.js"></script>
|
11 |
-
<script src="../mode/css/css.js"></script>
|
12 |
-
<script src="https://unpkg.com/jshint@2.9.6/dist/jshint.js"></script>
|
13 |
-
<script src="https://unpkg.com/jsonlint@1.6.3/web/jsonlint.js"></script>
|
14 |
-
<script src="https://unpkg.com/csslint@1.0.5/dist/csslint.js"></script>
|
15 |
-
<script src="../addon/lint/lint.js"></script>
|
16 |
-
<script src="../addon/lint/javascript-lint.js"></script>
|
17 |
-
<script src="../addon/lint/json-lint.js"></script>
|
18 |
-
<script src="../addon/lint/css-lint.js"></script>
|
19 |
-
<style>
|
20 |
-
.CodeMirror {border: 1px solid black;}
|
21 |
-
</style>
|
22 |
-
<div id=nav>
|
23 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
24 |
-
|
25 |
-
<ul>
|
26 |
-
<li><a href="../index.html">Home</a>
|
27 |
-
<li><a href="../doc/manual.html">Manual</a>
|
28 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
29 |
-
</ul>
|
30 |
-
<ul>
|
31 |
-
<li><a class=active href="#">Linter</a>
|
32 |
-
</ul>
|
33 |
-
</div>
|
34 |
-
|
35 |
-
<article>
|
36 |
-
<h2>Linter Demo</h2>
|
37 |
-
|
38 |
-
|
39 |
-
<p><textarea id="code-js">var widgets = []
|
40 |
-
function updateHints() {
|
41 |
-
editor.operation(function(){
|
42 |
-
for (var i = 0; i < widgets.length.; ++i)
|
43 |
-
editor.removeLineWidget(widgets[i]);
|
44 |
-
widgets.length = 0;
|
45 |
-
|
46 |
-
JSHINT(editor.getValue());
|
47 |
-
for (var i = 0; i < JSHINT.errors.length; ++i) {
|
48 |
-
var err = JSHINT.errors[i];
|
49 |
-
if (!err) continue;
|
50 |
-
var msg = document.createElement("div");
|
51 |
-
var icon = msg.appendChild(document.createElement("span"));
|
52 |
-
icon.innerHTML = "!!";
|
53 |
-
icon.className = "lint-error-icon";
|
54 |
-
msg.appendChild(document.createTextNode(err.reason));
|
55 |
-
msg.className = "lint-error";
|
56 |
-
widgets.push(editor.addLineWidget(err.line - 1, msg, {coverGutter: false, noHScroll: true}));
|
57 |
-
}
|
58 |
-
});
|
59 |
-
var info = editor.getScrollInfo();
|
60 |
-
var after = editor.charCoords({line: editor.getCursor().line + 1, ch: 0}, "local").top;
|
61 |
-
if (info.top + info.clientHeight < after)
|
62 |
-
editor.scrollTo(null, after - info.clientHeight + 3);
|
63 |
-
}
|
64 |
-
</textarea></p>
|
65 |
-
|
66 |
-
<p><textarea id="code-json">[
|
67 |
-
{
|
68 |
-
_id: "post 1",
|
69 |
-
"author": "Bob",
|
70 |
-
"content": "...",
|
71 |
-
"page_views": 5
|
72 |
-
},
|
73 |
-
{
|
74 |
-
"_id": "post 2",
|
75 |
-
"author": "Bob",
|
76 |
-
"content": "...",
|
77 |
-
"page_views": 9
|
78 |
-
},
|
79 |
-
{
|
80 |
-
"_id": "post 3",
|
81 |
-
"author": "Bob",
|
82 |
-
"content": "...",
|
83 |
-
"page_views": 8
|
84 |
-
}
|
85 |
-
]
|
86 |
-
</textarea></p>
|
87 |
-
|
88 |
-
<p><textarea id="code-css">@charset "UTF-8";
|
89 |
-
|
90 |
-
@import url("booya.css") print, screen;
|
91 |
-
@import "whatup.css" screen;
|
92 |
-
@import "wicked.css";
|
93 |
-
|
94 |
-
/*Error*/
|
95 |
-
@charset "UTF-8";
|
96 |
-
|
97 |
-
|
98 |
-
@namespace "http://www.w3.org/1999/xhtml";
|
99 |
-
@namespace svg "http://www.w3.org/2000/svg";
|
100 |
-
|
101 |
-
/*Warning: empty ruleset */
|
102 |
-
.foo {
|
103 |
-
}
|
104 |
-
|
105 |
-
h1 {
|
106 |
-
font-weight: bold;
|
107 |
-
}
|
108 |
-
|
109 |
-
/*Warning: qualified heading */
|
110 |
-
.foo h1 {
|
111 |
-
font-weight: bold;
|
112 |
-
}
|
113 |
-
|
114 |
-
/*Warning: adjoining classes */
|
115 |
-
.foo.bar {
|
116 |
-
zoom: 1;
|
117 |
-
}
|
118 |
-
|
119 |
-
li.inline {
|
120 |
-
width: 100%; /*Warning: 100% can be problematic*/
|
121 |
-
}
|
122 |
-
|
123 |
-
li.last {
|
124 |
-
display: inline;
|
125 |
-
padding-left: 3px !important;
|
126 |
-
padding-right: 3px;
|
127 |
-
border-right: 0px;
|
128 |
-
}
|
129 |
-
|
130 |
-
@media print {
|
131 |
-
li.inline {
|
132 |
-
color: black;
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
@page {
|
137 |
-
margin: 10%;
|
138 |
-
counter-increment: page;
|
139 |
-
|
140 |
-
@top-center {
|
141 |
-
font-family: sans-serif;
|
142 |
-
font-weight: bold;
|
143 |
-
font-size: 2em;
|
144 |
-
content: counter(page);
|
145 |
-
}
|
146 |
-
}
|
147 |
-
</textarea></p>
|
148 |
-
<script>
|
149 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code-js"), {
|
150 |
-
lineNumbers: true,
|
151 |
-
mode: "javascript",
|
152 |
-
gutters: ["CodeMirror-lint-markers"],
|
153 |
-
lint: true
|
154 |
-
});
|
155 |
-
|
156 |
-
var editor_json = CodeMirror.fromTextArea(document.getElementById("code-json"), {
|
157 |
-
lineNumbers: true,
|
158 |
-
mode: "application/json",
|
159 |
-
gutters: ["CodeMirror-lint-markers"],
|
160 |
-
lint: true
|
161 |
-
});
|
162 |
-
|
163 |
-
var editor_css = CodeMirror.fromTextArea(document.getElementById("code-css"), {
|
164 |
-
lineNumbers: true,
|
165 |
-
mode: "css",
|
166 |
-
gutters: ["CodeMirror-lint-markers"],
|
167 |
-
lint: true
|
168 |
-
});
|
169 |
-
</script>
|
170 |
-
|
171 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/loadmode.html
DELETED
@@ -1,72 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Lazy Mode Loading Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/mode/loadmode.js"></script>
|
10 |
-
<script src="../mode/meta.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
13 |
-
</style>
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Lazy Mode Loading</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Lazy Mode Loading Demo</h2>
|
29 |
-
<p style="color: gray">Current mode: <span id="modeinfo">text/plain</span></p>
|
30 |
-
<form><textarea id="code" name="code">This is the editor.
|
31 |
-
// It starts out in plain text mode,
|
32 |
-
# use the control below to load and apply a mode
|
33 |
-
"you'll see the highlighting of" this text /*change*/.
|
34 |
-
</textarea></form>
|
35 |
-
<p>Filename, mime, or mode name: <input type=text value=foo.js id=mode> <button type=button onclick="change()">change mode</button></p>
|
36 |
-
|
37 |
-
<script>
|
38 |
-
CodeMirror.modeURL = "../mode/%N/%N.js";
|
39 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
40 |
-
lineNumbers: true
|
41 |
-
});
|
42 |
-
var modeInput = document.getElementById("mode");
|
43 |
-
CodeMirror.on(modeInput, "keypress", function(e) {
|
44 |
-
if (e.keyCode == 13) change();
|
45 |
-
});
|
46 |
-
function change() {
|
47 |
-
var val = modeInput.value, m, mode, spec;
|
48 |
-
if (m = /.+\.([^.]+)$/.exec(val)) {
|
49 |
-
var info = CodeMirror.findModeByExtension(m[1]);
|
50 |
-
if (info) {
|
51 |
-
mode = info.mode;
|
52 |
-
spec = info.mime;
|
53 |
-
}
|
54 |
-
} else if (/\//.test(val)) {
|
55 |
-
var info = CodeMirror.findModeByMIME(val);
|
56 |
-
if (info) {
|
57 |
-
mode = info.mode;
|
58 |
-
spec = val;
|
59 |
-
}
|
60 |
-
} else {
|
61 |
-
mode = spec = val;
|
62 |
-
}
|
63 |
-
if (mode) {
|
64 |
-
editor.setOption("mode", spec);
|
65 |
-
CodeMirror.autoLoadMode(editor, mode);
|
66 |
-
document.getElementById("modeinfo").textContent = spec;
|
67 |
-
} else {
|
68 |
-
alert("Could not find a mode corresponding to " + val);
|
69 |
-
}
|
70 |
-
}
|
71 |
-
</script>
|
72 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/marker.html
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Breakpoint Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/javascript/javascript.js"></script>
|
10 |
-
<style>
|
11 |
-
.breakpoints {width: .8em;}
|
12 |
-
.breakpoint { color: #822; }
|
13 |
-
.CodeMirror {border: 1px solid #aaa;}
|
14 |
-
</style>
|
15 |
-
<div id=nav>
|
16 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
17 |
-
|
18 |
-
<ul>
|
19 |
-
<li><a href="../index.html">Home</a>
|
20 |
-
<li><a href="../doc/manual.html">Manual</a>
|
21 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
22 |
-
</ul>
|
23 |
-
<ul>
|
24 |
-
<li><a class=active href="#">Breakpoint</a>
|
25 |
-
</ul>
|
26 |
-
</div>
|
27 |
-
|
28 |
-
<article>
|
29 |
-
<h2>Breakpoint Demo</h2>
|
30 |
-
<form><textarea id="code" name="code">
|
31 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
32 |
-
lineNumbers: true,
|
33 |
-
gutters: ["CodeMirror-linenumbers", "breakpoints"]
|
34 |
-
});
|
35 |
-
editor.on("gutterClick", function(cm, n) {
|
36 |
-
var info = cm.lineInfo(n);
|
37 |
-
cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker());
|
38 |
-
});
|
39 |
-
|
40 |
-
function makeMarker() {
|
41 |
-
var marker = document.createElement("div");
|
42 |
-
marker.style.color = "#822";
|
43 |
-
marker.innerHTML = "●";
|
44 |
-
return marker;
|
45 |
-
}
|
46 |
-
</textarea></form>
|
47 |
-
|
48 |
-
<p>Click the line-number gutter to add or remove 'breakpoints'.</p>
|
49 |
-
|
50 |
-
<script>eval(document.getElementById("code").value);</script>
|
51 |
-
|
52 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/markselection.html
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Selection Marking Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/search/searchcursor.js"></script>
|
10 |
-
<script src="../addon/selection/mark-selection.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
13 |
-
.CodeMirror-selected { background-color: blue !important; }
|
14 |
-
.CodeMirror-selectedtext { color: white; }
|
15 |
-
.styled-background { background-color: #ff7; }
|
16 |
-
</style>
|
17 |
-
<div id=nav>
|
18 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
19 |
-
|
20 |
-
<ul>
|
21 |
-
<li><a href="../index.html">Home</a>
|
22 |
-
<li><a href="../doc/manual.html">Manual</a>
|
23 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
24 |
-
</ul>
|
25 |
-
<ul>
|
26 |
-
<li><a class=active href="#">Selection Marking</a>
|
27 |
-
</ul>
|
28 |
-
</div>
|
29 |
-
|
30 |
-
<article>
|
31 |
-
<h2>Selection Marking Demo</h2>
|
32 |
-
<form><textarea id="code" name="code">
|
33 |
-
Select something from here. You'll see that the selection's foreground
|
34 |
-
color changes to white! Since, by default, CodeMirror only puts an
|
35 |
-
independent "marker" layer behind the text, you'll need something like
|
36 |
-
this to change its colour.
|
37 |
-
|
38 |
-
Also notice that turning this addon on (with the default style) allows
|
39 |
-
you to safely give text a background color without screwing up the
|
40 |
-
visibility of the selection.</textarea></form>
|
41 |
-
|
42 |
-
<script>
|
43 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
44 |
-
lineNumbers: true,
|
45 |
-
styleSelectedText: true
|
46 |
-
});
|
47 |
-
editor.markText({line: 6, ch: 26}, {line: 6, ch: 42}, {className: "styled-background"});
|
48 |
-
</script>
|
49 |
-
|
50 |
-
<p>Simple addon to easily mark (and style) selected text. <a href="../doc/manual.html#addon_mark-selection">Docs</a>.</p>
|
51 |
-
|
52 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/matchhighlighter.html
DELETED
@@ -1,103 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Match Highlighter Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/scroll/annotatescrollbar.js"></script>
|
10 |
-
<script src="../addon/search/matchesonscrollbar.js"></script>
|
11 |
-
<script src="../addon/search/searchcursor.js"></script>
|
12 |
-
<script src="../addon/search/match-highlighter.js"></script>
|
13 |
-
<style>
|
14 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
15 |
-
.CodeMirror-focused .cm-matchhighlight {
|
16 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);
|
17 |
-
background-position: bottom;
|
18 |
-
background-repeat: repeat-x;
|
19 |
-
}
|
20 |
-
.cm-matchhighlight {background-color: lightgreen}
|
21 |
-
.CodeMirror-selection-highlight-scrollbar {background-color: green}
|
22 |
-
</style>
|
23 |
-
<div id=nav>
|
24 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
25 |
-
|
26 |
-
<ul>
|
27 |
-
<li><a href="../index.html">Home</a>
|
28 |
-
<li><a href="../doc/manual.html">Manual</a>
|
29 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
30 |
-
</ul>
|
31 |
-
<ul>
|
32 |
-
<li><a class=active href="#">Match Highlighter</a>
|
33 |
-
</ul>
|
34 |
-
</div>
|
35 |
-
|
36 |
-
<article>
|
37 |
-
<h2>Match Highlighter Demo</h2>
|
38 |
-
<form><textarea id="code" name="code">Select this text: hardtospot
|
39 |
-
And everywhere else in your code where hardtospot appears will
|
40 |
-
automatically illuminate. Give it a try! No more hard to spot
|
41 |
-
variables - stay in context of your code all the time.
|
42 |
-
|
43 |
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pharetra
|
44 |
-
interdum dui eu pulvinar. Mauris maximus ligula venenatis tempus
|
45 |
-
interdum. Cras hendrerit, ipsum sed ultrices pharetra, ligula diam
|
46 |
-
porttitor lacus, ac tempor eros est a massa. Nam orci elit, vulputate
|
47 |
-
in tristique quis, consectetur vitae metus. Pellentesque et enim
|
48 |
-
elementum, lobortis augue in, lacinia sapien. Morbi eu nunc semper,
|
49 |
-
sagittis felis a, pellentesque mauris. Lorem ipsum dolor sit amet,
|
50 |
-
consectetur adipiscing elit. Aenean quis diam turpis.
|
51 |
-
|
52 |
-
Fusce lobortis nisl quis aliquet euismod. Aenean vitae nulla non ipsum
|
53 |
-
efficitur scelerisque. Curabitur auctor, lorem non rhoncus porttitor,
|
54 |
-
augue ligula lacinia dolor, et vehicula magna lorem imperdiet velit.
|
55 |
-
Fusce risus sem, hardtospot commodo eleifend hendrerit vitae, mollis
|
56 |
-
quis risus. Cras tincidunt, justo vitae hendrerit venenatis, urna
|
57 |
-
dolor placerat tortor, eu lobortis lectus dolor in ligula. Nullam non
|
58 |
-
erat non nisl vulputate ultrices sit amet vestibulum dolor. Quisque in
|
59 |
-
tortor porta, pellentesque odio nec, malesuada nibh.
|
60 |
-
|
61 |
-
In a dui feugiat, ullamcorper urna in, accumsan magna. Donec egestas
|
62 |
-
sem nec eros rhoncus, vel gravida purus ornare. Nulla orci mauris,
|
63 |
-
porta nec pharetra sed, ornare et lorem. Donec luctus turpis nunc,
|
64 |
-
eget dictum felis mollis et. Sed sodales hardtospot nunc vitae leo
|
65 |
-
rhoncus imperdiet. Donec elementum malesuada velit quis placerat.
|
66 |
-
Proin accumsan lorem id nisi volutpat ullamcorper. Vivamus laoreet
|
67 |
-
dolor ac sem malesuada, ac scelerisque ex efficitur. Aliquam tempus
|
68 |
-
libero velit, vel tristique augue vulputate nec.
|
69 |
-
|
70 |
-
Mauris ultrices leo felis, sit amet congue augue aliquam condimentum.
|
71 |
-
Vivamus purus leo, mattis vitae dignissim vel, ultricies ac ex. Mauris
|
72 |
-
eu dolor eu purus ultricies ultrices. Sed euismod feugiat ex et
|
73 |
-
mattis. Morbi cursus laoreet pharetra. Donec eu dolor sodales,
|
74 |
-
ultricies nisi et, malesuada urna. Praesent sit amet fringilla felis.
|
75 |
-
Nam rhoncus, est blandit auctor auctor, lorem ipsum laoreet ipsum,
|
76 |
-
quis sodales libero odio in lorem. Phasellus odio dolor, elementum
|
77 |
-
sagittis nibh non, fermentum semper libero. Mauris hendrerit
|
78 |
-
hardtospot lectus sit amet commodo eleifend. Morbi pulvinar eget nisl
|
79 |
-
at eleifend. Fusce eget porta erat, vitae lobortis libero.
|
80 |
-
|
81 |
-
Phasellus sit amet massa in massa pharetra malesuada. Vestibulum at
|
82 |
-
quam vel libero aliquam volutpat at ut dui. Praesent scelerisque vel
|
83 |
-
mauris sit amet vehicula. Phasellus at mi nec ligula cursus interdum
|
84 |
-
sit amet non quam. Aliquam tempus sollicitudin euismod. Nulla euismod
|
85 |
-
mollis enim tincidunt placerat. Proin ac scelerisque enim, quis
|
86 |
-
sollicitudin metus. Pellentesque congue nec sapien ut rhoncus. Sed
|
87 |
-
eget ornare diam, ut consectetur ante. Aenean eleifend mauris quis
|
88 |
-
ornare accumsan. In hac habitasse hardtospot platea dictumst.
|
89 |
-
|
90 |
-
</textarea></form>
|
91 |
-
|
92 |
-
<script>
|
93 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
94 |
-
lineNumbers: true,
|
95 |
-
// To highlight on scrollbars as well, pass annotateScrollbar in options
|
96 |
-
// as below.
|
97 |
-
highlightSelectionMatches: {showToken: /\w/, annotateScrollbar: true}
|
98 |
-
});
|
99 |
-
</script>
|
100 |
-
|
101 |
-
<p>Search and highlight occurences of the selected text.</p>
|
102 |
-
|
103 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/matchtags.html
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Tag Matcher Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/fold/xml-fold.js"></script>
|
10 |
-
<script src="../addon/edit/matchtags.js"></script>
|
11 |
-
<script src="../mode/xml/xml.js"></script>
|
12 |
-
<style>
|
13 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
14 |
-
</style>
|
15 |
-
<div id=nav>
|
16 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
17 |
-
|
18 |
-
<ul>
|
19 |
-
<li><a href="../index.html">Home</a>
|
20 |
-
<li><a href="../doc/manual.html">Manual</a>
|
21 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
22 |
-
</ul>
|
23 |
-
<ul>
|
24 |
-
<li><a class=active href="#">Tag Matcher</a>
|
25 |
-
</ul>
|
26 |
-
</div>
|
27 |
-
|
28 |
-
<article>
|
29 |
-
<h2>Tag Matcher Demo</h2>
|
30 |
-
|
31 |
-
|
32 |
-
<div id="editor"></div>
|
33 |
-
|
34 |
-
<script>
|
35 |
-
window.onload = function() {
|
36 |
-
editor = CodeMirror(document.getElementById("editor"), {
|
37 |
-
value: "<html>\n " + document.documentElement.innerHTML + "\n</html>",
|
38 |
-
mode: "text/html",
|
39 |
-
matchTags: {bothTags: true},
|
40 |
-
extraKeys: {"Ctrl-J": "toMatchingTag"}
|
41 |
-
});
|
42 |
-
};
|
43 |
-
</script>
|
44 |
-
|
45 |
-
<p>Put the cursor on or inside a pair of tags to highlight them.
|
46 |
-
Press Ctrl-J to jump to the tag that matches the one under the
|
47 |
-
cursor.</p>
|
48 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/merge.html
DELETED
@@ -1,123 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: merge view demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel=stylesheet href="../lib/codemirror.css">
|
8 |
-
<link rel=stylesheet href="../addon/merge/merge.css">
|
9 |
-
<script src="../lib/codemirror.js"></script>
|
10 |
-
<script src="../mode/xml/xml.js"></script>
|
11 |
-
<script src="../mode/css/css.js"></script>
|
12 |
-
<script src="../mode/javascript/javascript.js"></script>
|
13 |
-
<script src="../mode/htmlmixed/htmlmixed.js"></script>
|
14 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/diff_match_patch/20121119/diff_match_patch.js"></script>
|
15 |
-
<script src="../addon/merge/merge.js"></script>
|
16 |
-
<style>
|
17 |
-
.CodeMirror { line-height: 1.2; }
|
18 |
-
@media screen and (min-width: 1300px) {
|
19 |
-
article { max-width: 1000px; }
|
20 |
-
#nav { border-right: 499px solid transparent; }
|
21 |
-
}
|
22 |
-
span.clicky {
|
23 |
-
cursor: pointer;
|
24 |
-
background: #d70;
|
25 |
-
color: white;
|
26 |
-
padding: 0 3px;
|
27 |
-
border-radius: 3px;
|
28 |
-
}
|
29 |
-
</style>
|
30 |
-
<div id=nav>
|
31 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
32 |
-
|
33 |
-
<ul>
|
34 |
-
<li><a href="../index.html">Home</a>
|
35 |
-
<li><a href="../doc/manual.html">Manual</a>
|
36 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
37 |
-
</ul>
|
38 |
-
<ul>
|
39 |
-
<li><a class=active href="#">merge view</a>
|
40 |
-
</ul>
|
41 |
-
</div>
|
42 |
-
|
43 |
-
<article>
|
44 |
-
<h2>merge view demo</h2>
|
45 |
-
|
46 |
-
|
47 |
-
<div id=view></div>
|
48 |
-
|
49 |
-
<p>The <a href="../doc/manual.html#addon_merge"><code>merge</code></a>
|
50 |
-
addon provides an interface for displaying and merging diffs,
|
51 |
-
either <span class=clicky onclick="panes = 2; initUI()">two-way</span>
|
52 |
-
or <span class=clicky onclick="panes = 3; initUI()">three-way</span>.
|
53 |
-
The left (or center) pane is editable, and the differences with the
|
54 |
-
other pane(s) are <span class=clicky
|
55 |
-
onclick="toggleDifferences()">optionally</span> shown live as you edit
|
56 |
-
it. In the two-way configuration, there are also options to pad changed
|
57 |
-
sections to <span class=clicky onclick="connect = connect ? null :
|
58 |
-
'align'; initUI()">align</span> them, and to <span class=clicky
|
59 |
-
onclick="collapse = !collapse; initUI()">collapse</span> unchanged
|
60 |
-
stretches of text.</p>
|
61 |
-
|
62 |
-
<p>This addon depends on
|
63 |
-
the <a href="https://code.google.com/p/google-diff-match-patch/">google-diff-match-patch</a>
|
64 |
-
library to compute the diffs.</p>
|
65 |
-
|
66 |
-
<script>
|
67 |
-
var value, orig1, orig2, dv, panes = 2, highlight = true, connect = "align", collapse = false;
|
68 |
-
function initUI() {
|
69 |
-
if (value == null) return;
|
70 |
-
var target = document.getElementById("view");
|
71 |
-
target.innerHTML = "";
|
72 |
-
dv = CodeMirror.MergeView(target, {
|
73 |
-
value: value,
|
74 |
-
origLeft: panes == 3 ? orig1 : null,
|
75 |
-
orig: orig2,
|
76 |
-
lineNumbers: true,
|
77 |
-
mode: "text/html",
|
78 |
-
highlightDifferences: highlight,
|
79 |
-
connect: connect,
|
80 |
-
collapseIdentical: collapse
|
81 |
-
});
|
82 |
-
}
|
83 |
-
|
84 |
-
function toggleDifferences() {
|
85 |
-
dv.setShowDifferences(highlight = !highlight);
|
86 |
-
}
|
87 |
-
|
88 |
-
window.onload = function() {
|
89 |
-
value = document.documentElement.innerHTML;
|
90 |
-
orig1 = "<!doctype html>\n\n" + value.replace(/\.\.\//g, "codemirror/").replace("yellow", "orange");
|
91 |
-
orig2 = value.replace(/\u003cscript/g, "\u003cscript type=text/javascript ")
|
92 |
-
.replace("white", "purple;\n font: comic sans;\n text-decoration: underline;\n height: 15em");
|
93 |
-
initUI();
|
94 |
-
let d = document.createElement("div"); d.style.cssText = "width: 50px; margin: 7px; height: 14px"; dv.editor().addLineWidget(57, d)
|
95 |
-
};
|
96 |
-
|
97 |
-
function mergeViewHeight(mergeView) {
|
98 |
-
function editorHeight(editor) {
|
99 |
-
if (!editor) return 0;
|
100 |
-
return editor.getScrollInfo().height;
|
101 |
-
}
|
102 |
-
return Math.max(editorHeight(mergeView.leftOriginal()),
|
103 |
-
editorHeight(mergeView.editor()),
|
104 |
-
editorHeight(mergeView.rightOriginal()));
|
105 |
-
}
|
106 |
-
|
107 |
-
function resize(mergeView) {
|
108 |
-
var height = mergeViewHeight(mergeView);
|
109 |
-
for(;;) {
|
110 |
-
if (mergeView.leftOriginal())
|
111 |
-
mergeView.leftOriginal().setSize(null, height);
|
112 |
-
mergeView.editor().setSize(null, height);
|
113 |
-
if (mergeView.rightOriginal())
|
114 |
-
mergeView.rightOriginal().setSize(null, height);
|
115 |
-
|
116 |
-
var newHeight = mergeViewHeight(mergeView);
|
117 |
-
if (newHeight >= height) break;
|
118 |
-
else height = newHeight;
|
119 |
-
}
|
120 |
-
mergeView.wrap.style.height = height + "px";
|
121 |
-
}
|
122 |
-
</script>
|
123 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/multiplex.html
DELETED
@@ -1,75 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Multiplexing Parser Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/mode/multiplex.js"></script>
|
10 |
-
<script src="../mode/xml/xml.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border: 1px solid black;}
|
13 |
-
.cm-delimit {color: #fa4;}
|
14 |
-
</style>
|
15 |
-
<div id=nav>
|
16 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
17 |
-
|
18 |
-
<ul>
|
19 |
-
<li><a href="../index.html">Home</a>
|
20 |
-
<li><a href="../doc/manual.html">Manual</a>
|
21 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
22 |
-
</ul>
|
23 |
-
<ul>
|
24 |
-
<li><a class=active href="#">Multiplexing Parser</a>
|
25 |
-
</ul>
|
26 |
-
</div>
|
27 |
-
|
28 |
-
<article>
|
29 |
-
<h2>Multiplexing Parser Demo</h2>
|
30 |
-
<form><textarea id="code" name="code">
|
31 |
-
<html>
|
32 |
-
<body style="<<magic>>">
|
33 |
-
<h1><< this is not <html >></h1>
|
34 |
-
<<
|
35 |
-
multiline
|
36 |
-
not html
|
37 |
-
at all : &amp; <link/>
|
38 |
-
>>
|
39 |
-
<p>this is html again</p>
|
40 |
-
</body>
|
41 |
-
</html>
|
42 |
-
</textarea></form>
|
43 |
-
|
44 |
-
<script>
|
45 |
-
CodeMirror.defineMode("demo", function(config) {
|
46 |
-
return CodeMirror.multiplexingMode(
|
47 |
-
CodeMirror.getMode(config, "text/html"),
|
48 |
-
{open: "<<", close: ">>",
|
49 |
-
mode: CodeMirror.getMode(config, "text/plain"),
|
50 |
-
delimStyle: "delimit"}
|
51 |
-
// .. more multiplexed styles can follow here
|
52 |
-
);
|
53 |
-
});
|
54 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
55 |
-
mode: "demo",
|
56 |
-
lineNumbers: true,
|
57 |
-
lineWrapping: true
|
58 |
-
});
|
59 |
-
</script>
|
60 |
-
|
61 |
-
<p>Demonstration of a multiplexing mode, which, at certain
|
62 |
-
boundary strings, switches to one or more inner modes. The out
|
63 |
-
(HTML) mode does not get fed the content of the <code><<
|
64 |
-
>></code> blocks. See
|
65 |
-
the <a href="../doc/manual.html#addon_multiplex">manual</a> and
|
66 |
-
the <a href="../addon/mode/multiplex.js">source</a> for more
|
67 |
-
information.</p>
|
68 |
-
|
69 |
-
<p>
|
70 |
-
<strong>Parsing/Highlighting Tests:</strong>
|
71 |
-
<a href="../test/index.html#multiplexing_*">normal</a>,
|
72 |
-
<a href="../test/index.html#verbose,multiplexing_*">verbose</a>.
|
73 |
-
</p>
|
74 |
-
|
75 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/mustache.html
DELETED
@@ -1,69 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Overlay Parser Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/mode/overlay.js"></script>
|
10 |
-
<script src="../mode/xml/xml.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border: 1px solid black;}
|
13 |
-
.cm-mustache {color: #0ca;}
|
14 |
-
</style>
|
15 |
-
<div id=nav>
|
16 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
17 |
-
|
18 |
-
<ul>
|
19 |
-
<li><a href="../index.html">Home</a>
|
20 |
-
<li><a href="../doc/manual.html">Manual</a>
|
21 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
22 |
-
</ul>
|
23 |
-
<ul>
|
24 |
-
<li><a class=active href="#">Overlay Parser</a>
|
25 |
-
</ul>
|
26 |
-
</div>
|
27 |
-
|
28 |
-
<article>
|
29 |
-
<h2>Overlay Parser Demo</h2>
|
30 |
-
<form><textarea id="code" name="code">
|
31 |
-
<html>
|
32 |
-
<body>
|
33 |
-
<h1>{{title}}</h1>
|
34 |
-
<p>These are links to {{things}}:</p>
|
35 |
-
<ul>{{#links}}
|
36 |
-
<li><a href="{{url}}">{{text}}</a></li>
|
37 |
-
{{/links}}</ul>
|
38 |
-
</body>
|
39 |
-
</html>
|
40 |
-
</textarea></form>
|
41 |
-
|
42 |
-
<script>
|
43 |
-
CodeMirror.defineMode("mustache", function(config, parserConfig) {
|
44 |
-
var mustacheOverlay = {
|
45 |
-
token: function(stream, state) {
|
46 |
-
var ch;
|
47 |
-
if (stream.match("{{")) {
|
48 |
-
while ((ch = stream.next()) != null)
|
49 |
-
if (ch == "}" && stream.next() == "}") {
|
50 |
-
stream.eat("}");
|
51 |
-
return "mustache";
|
52 |
-
}
|
53 |
-
}
|
54 |
-
while (stream.next() != null && !stream.match("{{", false)) {}
|
55 |
-
return null;
|
56 |
-
}
|
57 |
-
};
|
58 |
-
return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
|
59 |
-
});
|
60 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "mustache"});
|
61 |
-
</script>
|
62 |
-
|
63 |
-
<p>Demonstration of a mode that parses HTML, highlighting
|
64 |
-
the <a href="http://mustache.github.com/">Mustache</a> templating
|
65 |
-
directives inside of it by using the code
|
66 |
-
in <a href="../addon/mode/overlay.js"><code>overlay.js</code></a>. View
|
67 |
-
source to see the 15 lines of code needed to accomplish this.</p>
|
68 |
-
|
69 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/panel.html
DELETED
@@ -1,137 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Panel Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/javascript/javascript.js"></script>
|
10 |
-
<script src="../mode/xml/xml.js"></script>
|
11 |
-
<script src="../mode/htmlmixed/htmlmixed.js"></script>
|
12 |
-
<script src="../addon/display/panel.js"></script>
|
13 |
-
<style>
|
14 |
-
.border {
|
15 |
-
border: 1px solid #f7f7f7;
|
16 |
-
}
|
17 |
-
.add-panel {
|
18 |
-
background: orange;
|
19 |
-
padding: 3px 6px;
|
20 |
-
color: white !important;
|
21 |
-
border-radius: 3px;
|
22 |
-
}
|
23 |
-
.add-panel, .remove-panel {
|
24 |
-
cursor: pointer;
|
25 |
-
}
|
26 |
-
.remove-panel {
|
27 |
-
float: right;
|
28 |
-
}
|
29 |
-
.panel {
|
30 |
-
background: #f7f7f7;
|
31 |
-
padding: 3px 7px;
|
32 |
-
font-size: 0.85em;
|
33 |
-
}
|
34 |
-
.panel.top, .panel.after-top {
|
35 |
-
border-bottom: 1px solid #ddd;
|
36 |
-
}
|
37 |
-
.panel.bottom, .panel.before-bottom {
|
38 |
-
border-top: 1px solid #ddd;
|
39 |
-
}
|
40 |
-
</style>
|
41 |
-
|
42 |
-
<div id=nav>
|
43 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
44 |
-
|
45 |
-
<ul>
|
46 |
-
<li><a href="../index.html">Home</a>
|
47 |
-
<li><a href="../doc/manual.html">Manual</a>
|
48 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
49 |
-
</ul>
|
50 |
-
<ul>
|
51 |
-
<li><a class=active href="#">Panel</a>
|
52 |
-
</ul>
|
53 |
-
</div>
|
54 |
-
|
55 |
-
<article>
|
56 |
-
|
57 |
-
<h2>Panel Demo</h2>
|
58 |
-
|
59 |
-
<div class="border">
|
60 |
-
<textarea id="code" name="code"></textarea>
|
61 |
-
</div>
|
62 |
-
|
63 |
-
<p>
|
64 |
-
The <a href="../doc/manual.html#addon_panel"><code>panel</code></a>
|
65 |
-
addon allows you to display panels above or below an editor.
|
66 |
-
<br>
|
67 |
-
Click the links below to add panels at the given position:
|
68 |
-
</p>
|
69 |
-
|
70 |
-
<div id="demo">
|
71 |
-
<p>
|
72 |
-
<a class="add-panel" onclick="addPanel('top')">top</a>
|
73 |
-
<a class="add-panel" onclick="addPanel('after-top')">after-top</a>
|
74 |
-
<a class="add-panel" onclick="addPanel('before-bottom')">before-bottom</a>
|
75 |
-
<a class="add-panel" onclick="addPanel('bottom')">bottom</a>
|
76 |
-
</p>
|
77 |
-
<p>
|
78 |
-
You can also replace an existing panel:
|
79 |
-
</p>
|
80 |
-
<form onsubmit="return replacePanel(this);" name="replace_panel">
|
81 |
-
<input type="submit" value="Replace panel n°" />
|
82 |
-
<input type="number" name="panel_id" min="1" value="1" />
|
83 |
-
</form>
|
84 |
-
|
85 |
-
<script>
|
86 |
-
var textarea = document.getElementById("code");
|
87 |
-
var demo = document.getElementById("demo");
|
88 |
-
var numPanels = 0;
|
89 |
-
var panels = {};
|
90 |
-
var editor;
|
91 |
-
|
92 |
-
textarea.value = demo.innerHTML.trim();
|
93 |
-
editor = CodeMirror.fromTextArea(textarea, {
|
94 |
-
lineNumbers: true,
|
95 |
-
mode: "htmlmixed"
|
96 |
-
});
|
97 |
-
|
98 |
-
function makePanel(where) {
|
99 |
-
var node = document.createElement("div");
|
100 |
-
var id = ++numPanels;
|
101 |
-
var widget, close, label;
|
102 |
-
|
103 |
-
node.id = "panel-" + id;
|
104 |
-
node.className = "panel " + where;
|
105 |
-
close = node.appendChild(document.createElement("a"));
|
106 |
-
close.setAttribute("title", "Remove me!");
|
107 |
-
close.setAttribute("class", "remove-panel");
|
108 |
-
close.textContent = "✖";
|
109 |
-
CodeMirror.on(close, "mousedown", function(e) {
|
110 |
-
e.preventDefault()
|
111 |
-
panels[node.id].clear();
|
112 |
-
});
|
113 |
-
label = node.appendChild(document.createElement("span"));
|
114 |
-
label.textContent = "I'm panel n°" + id;
|
115 |
-
return node;
|
116 |
-
}
|
117 |
-
function addPanel(where) {
|
118 |
-
var node = makePanel(where);
|
119 |
-
panels[node.id] = editor.addPanel(node, {position: where, stable: true});
|
120 |
-
}
|
121 |
-
|
122 |
-
addPanel("top");
|
123 |
-
addPanel("bottom");
|
124 |
-
|
125 |
-
function replacePanel(form) {
|
126 |
-
var id = form.elements.panel_id.value;
|
127 |
-
var panel = panels["panel-" + id];
|
128 |
-
var node = makePanel("");
|
129 |
-
|
130 |
-
panels[node.id] = editor.addPanel(node, {replace: panel, position: "after-top", stable: true});
|
131 |
-
return false;
|
132 |
-
}
|
133 |
-
</script>
|
134 |
-
|
135 |
-
</div>
|
136 |
-
|
137 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/placeholder.html
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Placeholder demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/display/placeholder.js"></script>
|
10 |
-
<style>
|
11 |
-
.CodeMirror { border: 1px solid silver; }
|
12 |
-
.CodeMirror-empty { outline: 1px solid #c22; }
|
13 |
-
.CodeMirror-empty.CodeMirror-focused { outline: none; }
|
14 |
-
.CodeMirror pre.CodeMirror-placeholder { color: #999; }
|
15 |
-
</style>
|
16 |
-
<div id=nav>
|
17 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
18 |
-
|
19 |
-
<ul>
|
20 |
-
<li><a href="../index.html">Home</a>
|
21 |
-
<li><a href="../doc/manual.html">Manual</a>
|
22 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
23 |
-
</ul>
|
24 |
-
<ul>
|
25 |
-
<li><a class=active href="#">Placeholder</a>
|
26 |
-
</ul>
|
27 |
-
</div>
|
28 |
-
|
29 |
-
<article>
|
30 |
-
<h2>Placeholder demo</h2>
|
31 |
-
<form><textarea id="code" name="code" placeholder="Code goes here..."></textarea></form>
|
32 |
-
|
33 |
-
<p>The <a href="../doc/manual.html#addon_placeholder">placeholder</a>
|
34 |
-
plug-in adds an option <code>placeholder</code> that can be set to
|
35 |
-
make text appear in the editor when it is empty and not focused.
|
36 |
-
If the source textarea has a <code>placeholder</code> attribute,
|
37 |
-
it will automatically be inherited.</p>
|
38 |
-
|
39 |
-
<script>
|
40 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
41 |
-
lineNumbers: true
|
42 |
-
});
|
43 |
-
</script>
|
44 |
-
|
45 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/preview.html
DELETED
@@ -1,87 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: HTML5 preview</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel=stylesheet href=../lib/codemirror.css>
|
8 |
-
<script src=../lib/codemirror.js></script>
|
9 |
-
<script src=../mode/xml/xml.js></script>
|
10 |
-
<script src=../mode/javascript/javascript.js></script>
|
11 |
-
<script src=../mode/css/css.js></script>
|
12 |
-
<script src=../mode/htmlmixed/htmlmixed.js></script>
|
13 |
-
<style type=text/css>
|
14 |
-
.CodeMirror {
|
15 |
-
float: left;
|
16 |
-
width: 50%;
|
17 |
-
border: 1px solid black;
|
18 |
-
}
|
19 |
-
iframe {
|
20 |
-
width: 49%;
|
21 |
-
float: left;
|
22 |
-
height: 300px;
|
23 |
-
border: 1px solid black;
|
24 |
-
border-left: 0px;
|
25 |
-
}
|
26 |
-
</style>
|
27 |
-
<div id=nav>
|
28 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
29 |
-
|
30 |
-
<ul>
|
31 |
-
<li><a href="../index.html">Home</a>
|
32 |
-
<li><a href="../doc/manual.html">Manual</a>
|
33 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
34 |
-
</ul>
|
35 |
-
<ul>
|
36 |
-
<li><a class=active href="#">HTML5 preview</a>
|
37 |
-
</ul>
|
38 |
-
</div>
|
39 |
-
|
40 |
-
<article>
|
41 |
-
<h2>HTML5 preview</h2>
|
42 |
-
|
43 |
-
<textarea id=code name=code>
|
44 |
-
<!doctype html>
|
45 |
-
<html>
|
46 |
-
<head>
|
47 |
-
<meta charset=utf-8>
|
48 |
-
<title>HTML5 canvas demo</title>
|
49 |
-
<style>p {font-family: monospace;}</style>
|
50 |
-
</head>
|
51 |
-
<body>
|
52 |
-
<p>Canvas pane goes here:</p>
|
53 |
-
<canvas id=pane width=300 height=200></canvas>
|
54 |
-
<script>
|
55 |
-
var canvas = document.getElementById('pane');
|
56 |
-
var context = canvas.getContext('2d');
|
57 |
-
|
58 |
-
context.fillStyle = 'rgb(250,0,0)';
|
59 |
-
context.fillRect(10, 10, 55, 50);
|
60 |
-
|
61 |
-
context.fillStyle = 'rgba(0, 0, 250, 0.5)';
|
62 |
-
context.fillRect(30, 30, 55, 50);
|
63 |
-
</script>
|
64 |
-
</body>
|
65 |
-
</html></textarea>
|
66 |
-
<iframe id=preview></iframe>
|
67 |
-
<script>
|
68 |
-
var delay;
|
69 |
-
// Initialize CodeMirror editor with a nice html5 canvas demo.
|
70 |
-
var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
|
71 |
-
mode: 'text/html'
|
72 |
-
});
|
73 |
-
editor.on("change", function() {
|
74 |
-
clearTimeout(delay);
|
75 |
-
delay = setTimeout(updatePreview, 300);
|
76 |
-
});
|
77 |
-
|
78 |
-
function updatePreview() {
|
79 |
-
var previewFrame = document.getElementById('preview');
|
80 |
-
var preview = previewFrame.contentDocument || previewFrame.contentWindow.document;
|
81 |
-
preview.open();
|
82 |
-
preview.write(editor.getValue());
|
83 |
-
preview.close();
|
84 |
-
}
|
85 |
-
setTimeout(updatePreview, 300);
|
86 |
-
</script>
|
87 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/requirejs.html
DELETED
@@ -1,70 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<head>
|
4 |
-
<title>CodeMirror: HTML completion demo</title>
|
5 |
-
<meta charset="utf-8"/>
|
6 |
-
<link rel=stylesheet href="../doc/docs.css">
|
7 |
-
|
8 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
9 |
-
<link rel="stylesheet" href="../addon/hint/show-hint.css">
|
10 |
-
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
|
13 |
-
</style>
|
14 |
-
</head>
|
15 |
-
|
16 |
-
<body>
|
17 |
-
<div id=nav>
|
18 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
19 |
-
<ul>
|
20 |
-
<li><a href="../index.html">Home</a>
|
21 |
-
<li><a href="../doc/manual.html">Manual</a>
|
22 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
23 |
-
</ul>
|
24 |
-
<ul>
|
25 |
-
<li><a class=active href="#">HTML completion</a>
|
26 |
-
</ul>
|
27 |
-
</div>
|
28 |
-
|
29 |
-
<article>
|
30 |
-
<h2>RequireJS module loading demo</h2>
|
31 |
-
|
32 |
-
<p>This demo does the same thing as
|
33 |
-
the <a href="html5complete.html">HTML5 completion demo</a>, but
|
34 |
-
loads its dependencies
|
35 |
-
with <a href="http://requirejs.org/">Require.js</a>, rather than
|
36 |
-
explicitly. Press <strong>ctrl-space</strong> to activate
|
37 |
-
completion.</p>
|
38 |
-
|
39 |
-
<div id="code"></div>
|
40 |
-
|
41 |
-
<button id="markdown">Dynamically load Markdown mode</button>
|
42 |
-
|
43 |
-
<script>
|
44 |
-
require.config({
|
45 |
-
packages: [{
|
46 |
-
name: "codemirror",
|
47 |
-
location: "../",
|
48 |
-
main: "lib/codemirror"
|
49 |
-
}]
|
50 |
-
});
|
51 |
-
require(["codemirror", "codemirror/mode/htmlmixed/htmlmixed",
|
52 |
-
"codemirror/addon/hint/show-hint", "codemirror/addon/hint/html-hint",
|
53 |
-
"codemirror/addon/mode/loadmode"], function(CodeMirror) {
|
54 |
-
editor = CodeMirror(document.getElementById("code"), {
|
55 |
-
mode: "text/html",
|
56 |
-
extraKeys: {"Ctrl-Space": "autocomplete"},
|
57 |
-
value: document.documentElement.innerHTML
|
58 |
-
});
|
59 |
-
|
60 |
-
CodeMirror.modeURL = "codemirror/mode/%N/%N";
|
61 |
-
document.getElementById("markdown").addEventListener("click", function() {
|
62 |
-
CodeMirror.requireMode("markdown", function() {
|
63 |
-
editor.replaceRange("This is **Markdown**.\n\n", {line: 0, ch: 0});
|
64 |
-
editor.setOption("mode", "markdown");
|
65 |
-
});
|
66 |
-
});
|
67 |
-
});
|
68 |
-
</script>
|
69 |
-
</article>
|
70 |
-
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/resize.html
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Autoresize Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/css/css.js"></script>
|
10 |
-
<style>
|
11 |
-
.CodeMirror {
|
12 |
-
border: 1px solid #eee;
|
13 |
-
height: auto;
|
14 |
-
}
|
15 |
-
</style>
|
16 |
-
<div id=nav>
|
17 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
18 |
-
|
19 |
-
<ul>
|
20 |
-
<li><a href="../index.html">Home</a>
|
21 |
-
<li><a href="../doc/manual.html">Manual</a>
|
22 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
23 |
-
</ul>
|
24 |
-
<ul>
|
25 |
-
<li><a class=active href="#">Autoresize</a>
|
26 |
-
</ul>
|
27 |
-
</div>
|
28 |
-
|
29 |
-
<article>
|
30 |
-
<h2>Autoresize Demo</h2>
|
31 |
-
<form><textarea id="code" name="code">
|
32 |
-
.CodeMirror {
|
33 |
-
border: 1px solid #eee;
|
34 |
-
height: auto;
|
35 |
-
}
|
36 |
-
</textarea></form>
|
37 |
-
|
38 |
-
<p>By setting an editor's <code>height</code> style
|
39 |
-
to <code>auto</code> and giving
|
40 |
-
the <a href="../doc/manual.html#option_viewportMargin"><code>viewportMargin</code></a>
|
41 |
-
a value of <code>Infinity</code>, CodeMirror can be made to
|
42 |
-
automatically resize to fit its content.</p>
|
43 |
-
|
44 |
-
<script>
|
45 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
46 |
-
lineNumbers: true,
|
47 |
-
viewportMargin: Infinity
|
48 |
-
});
|
49 |
-
</script>
|
50 |
-
|
51 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/rulers.html
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Ruler Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/display/rulers.js"></script>
|
10 |
-
<style>
|
11 |
-
.CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
|
12 |
-
</style>
|
13 |
-
<div id=nav>
|
14 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
15 |
-
|
16 |
-
<ul>
|
17 |
-
<li><a href="../index.html">Home</a>
|
18 |
-
<li><a href="../doc/manual.html">Manual</a>
|
19 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
20 |
-
</ul>
|
21 |
-
<ul>
|
22 |
-
<li><a class=active href="#">Ruler demo</a>
|
23 |
-
</ul>
|
24 |
-
</div>
|
25 |
-
|
26 |
-
<article>
|
27 |
-
<h2>Ruler Demo</h2>
|
28 |
-
|
29 |
-
<script>
|
30 |
-
var nums = "0123456789", space = " ";
|
31 |
-
var colors = ["#fcc", "#f5f577", "#cfc", "#aff", "#ccf", "#fcf"];
|
32 |
-
var rulers = [], value = "";
|
33 |
-
for (var i = 1; i <= 6; i++) {
|
34 |
-
rulers.push({color: colors[i], column: i * 10, lineStyle: "dashed"});
|
35 |
-
for (var j = 1; j < i; j++) value += space;
|
36 |
-
value += nums + "\n";
|
37 |
-
}
|
38 |
-
var editor = CodeMirror(document.body.lastChild, {
|
39 |
-
rulers: rulers,
|
40 |
-
value: value + value + value,
|
41 |
-
lineNumbers: true
|
42 |
-
});
|
43 |
-
</script>
|
44 |
-
|
45 |
-
<p>Demonstration of
|
46 |
-
the <a href="../doc/manual.html#addon_rulers">rulers</a> addon, which
|
47 |
-
displays vertical lines at given column offsets.</p>
|
48 |
-
|
49 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/runmode.html
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Mode Runner Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/runmode/runmode.js"></script>
|
10 |
-
<script src="../mode/xml/xml.js"></script>
|
11 |
-
<div id=nav>
|
12 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
13 |
-
|
14 |
-
<ul>
|
15 |
-
<li><a href="../index.html">Home</a>
|
16 |
-
<li><a href="../doc/manual.html">Manual</a>
|
17 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
18 |
-
</ul>
|
19 |
-
<ul>
|
20 |
-
<li><a class=active href="#">Mode Runner</a>
|
21 |
-
</ul>
|
22 |
-
</div>
|
23 |
-
|
24 |
-
<article>
|
25 |
-
<h2>Mode Runner Demo</h2>
|
26 |
-
|
27 |
-
|
28 |
-
<textarea id="code" style="width: 90%; height: 7em; border: 1px solid black; padding: .2em .4em;">
|
29 |
-
<foobar>
|
30 |
-
<blah>Enter your xml here and press the button below to display
|
31 |
-
it as highlighted by the CodeMirror XML mode</blah>
|
32 |
-
<tag2 foo="2" bar="&quot;bar&quot;"/>
|
33 |
-
</foobar></textarea><br>
|
34 |
-
<button onclick="doHighlight();">Highlight!</button>
|
35 |
-
<pre id="output" class="cm-s-default"></pre>
|
36 |
-
|
37 |
-
<script>
|
38 |
-
function doHighlight() {
|
39 |
-
CodeMirror.runMode(document.getElementById("code").value, "application/xml",
|
40 |
-
document.getElementById("output"));
|
41 |
-
}
|
42 |
-
</script>
|
43 |
-
|
44 |
-
<p>Running a CodeMirror mode outside of the editor.
|
45 |
-
The <code>CodeMirror.runMode</code> function, defined
|
46 |
-
in <code><a href="../addon/runmode/runmode.js">addon/runmode/runmode.js</a></code> takes the following arguments:</p>
|
47 |
-
|
48 |
-
<dl>
|
49 |
-
<dt><code>text (string)</code></dt>
|
50 |
-
<dd>The document to run through the highlighter.</dd>
|
51 |
-
<dt><code>mode (<a href="../doc/manual.html#option_mode">mode spec</a>)</code></dt>
|
52 |
-
<dd>The mode to use (must be loaded as normal).</dd>
|
53 |
-
<dt><code>output (function or DOM node)</code></dt>
|
54 |
-
<dd>If this is a function, it will be called for each token with
|
55 |
-
two arguments, the token's text and the token's style class (may
|
56 |
-
be <code>null</code> for unstyled tokens). If it is a DOM node,
|
57 |
-
the tokens will be converted to <code>span</code> elements as in
|
58 |
-
an editor, and inserted into the node
|
59 |
-
(through <code>innerHTML</code>).</dd>
|
60 |
-
</dl>
|
61 |
-
|
62 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/search.html
DELETED
@@ -1,99 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Search/Replace Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/dialog/dialog.css">
|
9 |
-
<link rel="stylesheet" href="../addon/search/matchesonscrollbar.css">
|
10 |
-
<script src="../lib/codemirror.js"></script>
|
11 |
-
<script src="../mode/xml/xml.js"></script>
|
12 |
-
<script src="../addon/dialog/dialog.js"></script>
|
13 |
-
<script src="../addon/search/searchcursor.js"></script>
|
14 |
-
<script src="../addon/search/search.js"></script>
|
15 |
-
<script src="../addon/scroll/annotatescrollbar.js"></script>
|
16 |
-
<script src="../addon/search/matchesonscrollbar.js"></script>
|
17 |
-
<script src="../addon/search/jump-to-line.js"></script>
|
18 |
-
<style>
|
19 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
20 |
-
dt {font-family: monospace; color: #666;}
|
21 |
-
</style>
|
22 |
-
<div id=nav>
|
23 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
24 |
-
|
25 |
-
<ul>
|
26 |
-
<li><a href="../index.html">Home</a>
|
27 |
-
<li><a href="../doc/manual.html">Manual</a>
|
28 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
29 |
-
</ul>
|
30 |
-
<ul>
|
31 |
-
<li><a class=active href="#">Search/Replace</a>
|
32 |
-
</ul>
|
33 |
-
</div>
|
34 |
-
|
35 |
-
<article>
|
36 |
-
<h2>Search/Replace Demo</h2>
|
37 |
-
<form><textarea id="code" name="code">
|
38 |
-
<dl>
|
39 |
-
<dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
|
40 |
-
<dd>Whether, when indenting, the first N*<code>tabSize</code>
|
41 |
-
spaces should be replaced by N tabs. Default is false.</dd>
|
42 |
-
|
43 |
-
<dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
|
44 |
-
<dd>Configures whether the editor should re-indent the current
|
45 |
-
line when a character is typed that might change its proper
|
46 |
-
indentation (only works if the mode supports indentation).
|
47 |
-
Default is true.</dd>
|
48 |
-
|
49 |
-
<dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
|
50 |
-
<dd>A regular expression used to determine which characters
|
51 |
-
should be replaced by a
|
52 |
-
special <a href="#option_specialCharPlaceholder">placeholder</a>.
|
53 |
-
Mostly useful for non-printing special characters. The default
|
54 |
-
is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
|
55 |
-
<dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
|
56 |
-
<dd>A function that, given a special character identified by
|
57 |
-
the <a href="#option_specialChars"><code>specialChars</code></a>
|
58 |
-
option, produces a DOM node that is used to represent the
|
59 |
-
character. By default, a red dot (<span style="color: red">•</span>)
|
60 |
-
is shown, with a title tooltip to indicate the character code.</dd>
|
61 |
-
|
62 |
-
<dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
|
63 |
-
<dd>Determines whether horizontal cursor movement through
|
64 |
-
right-to-left (Arabic, Hebrew) text is visual (pressing the left
|
65 |
-
arrow moves the cursor left) or logical (pressing the left arrow
|
66 |
-
moves to the next lower index in the string, which is visually
|
67 |
-
right in right-to-left text). The default is <code>false</code>
|
68 |
-
on Windows, and <code>true</code> on other platforms.</dd>
|
69 |
-
</dl>
|
70 |
-
</textarea></form>
|
71 |
-
|
72 |
-
<script>
|
73 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
74 |
-
mode: "text/html",
|
75 |
-
lineNumbers: true,
|
76 |
-
extraKeys: {"Alt-F": "findPersistent"}
|
77 |
-
});
|
78 |
-
</script>
|
79 |
-
|
80 |
-
<p>Demonstration of primitive search/replace functionality. The
|
81 |
-
keybindings (which can be configured with custom keymaps) are:</p>
|
82 |
-
<dl>
|
83 |
-
<dt>Ctrl-F / Cmd-F</dt><dd>Start searching</dd>
|
84 |
-
<dt>Ctrl-G / Cmd-G</dt><dd>Find next</dd>
|
85 |
-
<dt>Shift-Ctrl-G / Shift-Cmd-G</dt><dd>Find previous</dd>
|
86 |
-
<dt>Shift-Ctrl-F / Cmd-Option-F</dt><dd>Replace</dd>
|
87 |
-
<dt>Shift-Ctrl-R / Shift-Cmd-Option-F</dt><dd>Replace all</dd>
|
88 |
-
<dt>Alt-F</dt><dd>Persistent search (dialog doesn't autoclose,
|
89 |
-
enter to find next, Shift-Enter to find previous)</dd>
|
90 |
-
<dt>Alt-G</dt><dd>Jump to line</dd>
|
91 |
-
</dl>
|
92 |
-
<p>Searching is enabled by
|
93 |
-
including <a href="../addon/search/search.js">addon/search/search.js</a>
|
94 |
-
and <a href="../addon/search/searchcursor.js">addon/search/searchcursor.js</a>.
|
95 |
-
Jump to line - including <a href="../addon/search/jump-to-line.js">addon/search/jump-to-line.js</a>.</p>
|
96 |
-
<p>For good-looking input dialogs, you also want to include
|
97 |
-
<a href="../addon/dialog/dialog.js">addon/dialog/dialog.js</a>
|
98 |
-
and <a href="../addon/dialog/dialog.css">addon/dialog/dialog.css</a>.</p>
|
99 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/simplemode.html
DELETED
@@ -1,185 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Simple Mode Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/mode/simple.js"></script>
|
10 |
-
<script src="../mode/xml/xml.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border: 1px solid silver; margin-bottom: 1em; }
|
13 |
-
dt { text-indent: -2em; padding-left: 2em; margin-top: 1em; }
|
14 |
-
dd { margin-left: 1.5em; margin-bottom: 1em; }
|
15 |
-
dt {margin-top: 1em;}
|
16 |
-
</style>
|
17 |
-
|
18 |
-
<div id=nav>
|
19 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
20 |
-
|
21 |
-
<ul>
|
22 |
-
<li><a href="../index.html">Home</a>
|
23 |
-
<li><a href="../doc/manual.html">Manual</a>
|
24 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
25 |
-
</ul>
|
26 |
-
<ul>
|
27 |
-
<li><a class=active href="#">Simple Mode</a>
|
28 |
-
</ul>
|
29 |
-
</div>
|
30 |
-
|
31 |
-
<article>
|
32 |
-
<h2>Simple Mode Demo</h2>
|
33 |
-
|
34 |
-
<p>The <a href="../addon/mode/simple.js"><code>mode/simple</code></a>
|
35 |
-
addon allows CodeMirror modes to be specified using a relatively simple
|
36 |
-
declarative format. This format is not as powerful as writing code
|
37 |
-
directly against the <a href="../doc/manual.html#modeapi">mode
|
38 |
-
interface</a>, but is a lot easier to get started with, and
|
39 |
-
sufficiently expressive for many simple language modes.</p>
|
40 |
-
|
41 |
-
<p>This interface is still in flux. It is unlikely to be scrapped or
|
42 |
-
overhauled completely, so do start writing code against it, but
|
43 |
-
details might change as it stabilizes, and you might have to tweak
|
44 |
-
your code when upgrading.</p>
|
45 |
-
|
46 |
-
<p>Simple modes (loosely based on
|
47 |
-
the <a href="https://github.com/mozilla/skywriter/wiki/Common-JavaScript-Syntax-Highlighting-Specification">Common
|
48 |
-
JavaScript Syntax Highlighting Specification</a>, which never took
|
49 |
-
off), are state machines, where each state has a number of rules that
|
50 |
-
match tokens. A rule describes a type of token that may occur in the
|
51 |
-
current state, and possibly a transition to another state caused by
|
52 |
-
that token.</p>
|
53 |
-
|
54 |
-
<p>The <code>CodeMirror.defineSimpleMode(name, states)</code> method
|
55 |
-
takes a mode name and an object that describes the mode's states. The
|
56 |
-
editor below shows an example of such a mode (and is itself
|
57 |
-
highlighted by the mode shown in it).</p>
|
58 |
-
|
59 |
-
<div id="code"></div>
|
60 |
-
|
61 |
-
<p>Each state is an array of rules. A rule may have the following properties:</p>
|
62 |
-
|
63 |
-
<dl>
|
64 |
-
<dt><code><strong>regex</strong>: string | RegExp</code></dt>
|
65 |
-
<dd>The regular expression that matches the token. May be a string
|
66 |
-
or a regex object. When a regex, the <code>ignoreCase</code> flag
|
67 |
-
will be taken into account when matching the token. This regex
|
68 |
-
has to capture groups when the <code>token</code> property is
|
69 |
-
an array. If it captures groups, it must capture <em>all</em> of the string
|
70 |
-
(since JS provides no way to find out where a group matched).</dd>
|
71 |
-
<dt><code><strong>token</strong></code>: string | array<string> | null</dt>
|
72 |
-
<dd>An optional token style. Multiple styles can be specified by
|
73 |
-
separating them with dots or spaces. When this property holds an array of token styles,
|
74 |
-
the <code>regex</code> for this rule must capture a group for each array item.
|
75 |
-
</dd>
|
76 |
-
<dt><code><strong>sol</strong></code>: boolean</dt>
|
77 |
-
<dd>When true, this token will only match at the start of the line.
|
78 |
-
(The <code>^</code> regexp marker doesn't work as you'd expect in
|
79 |
-
this context because of limitations in JavaScript's RegExp
|
80 |
-
API.)</dd>
|
81 |
-
<dt><code><strong>next</strong>: string</code></dt>
|
82 |
-
<dd>When a <code>next</code> property is present, the mode will
|
83 |
-
transfer to the state named by the property when the token is
|
84 |
-
encountered.</dd>
|
85 |
-
<dt><code><strong>push</strong>: string</code></dt>
|
86 |
-
<dd>Like <code>next</code>, but instead replacing the current state
|
87 |
-
by the new state, the current state is kept on a stack, and can be
|
88 |
-
returned to with the <code>pop</code> directive.</dd>
|
89 |
-
<dt><code><strong>pop</strong>: bool</code></dt>
|
90 |
-
<dd>When true, and there is another state on the state stack, will
|
91 |
-
cause the mode to pop that state off the stack and transition to
|
92 |
-
it.</dd>
|
93 |
-
<dt><code><strong>mode</strong>: {spec, end, persistent}</code></dt>
|
94 |
-
<dd>Can be used to embed another mode inside a mode. When present,
|
95 |
-
must hold an object with a <code>spec</code> property that describes
|
96 |
-
the embedded mode, and an optional <code>end</code> end property
|
97 |
-
that specifies the regexp that will end the extent of the mode. When
|
98 |
-
a <code>persistent</code> property is set (and true), the nested
|
99 |
-
mode's state will be preserved between occurrences of the mode.</dd>
|
100 |
-
<dt><code><strong>indent</strong>: bool</code></dt>
|
101 |
-
<dd>When true, this token changes the indentation to be one unit
|
102 |
-
more than the current line's indentation.</dd>
|
103 |
-
<dt><code><strong>dedent</strong>: bool</code></dt>
|
104 |
-
<dd>When true, this token will pop one scope off the indentation
|
105 |
-
stack.</dd>
|
106 |
-
<dt><code><strong>dedentIfLineStart</strong>: bool</code></dt>
|
107 |
-
<dd>If a token has its <code>dedent</code> property set, it will, by
|
108 |
-
default, cause lines where it appears at the start to be dedented.
|
109 |
-
Set this property to false to prevent that behavior.</dd>
|
110 |
-
</dl>
|
111 |
-
|
112 |
-
<p>The <code>meta</code> property of the states object is special, and
|
113 |
-
will not be interpreted as a state. Instead, properties set on it will
|
114 |
-
be set on the mode, which is useful for properties
|
115 |
-
like <a href="../doc/manual.html#addon_comment"><code>lineComment</code></a>,
|
116 |
-
which sets the comment style for a mode. The simple mode addon also
|
117 |
-
recognizes a few such properties:</p>
|
118 |
-
|
119 |
-
<dl>
|
120 |
-
<dt><code><strong>dontIndentStates</strong>: array<string></code></dt>
|
121 |
-
<dd>An array of states in which the mode's auto-indentation should
|
122 |
-
not take effect. Usually used for multi-line comment and string
|
123 |
-
states.</dd>
|
124 |
-
</dl>
|
125 |
-
|
126 |
-
<script id="modecode">/* Example definition of a simple mode that understands a subset of
|
127 |
-
* JavaScript:
|
128 |
-
*/
|
129 |
-
|
130 |
-
CodeMirror.defineSimpleMode("simplemode", {
|
131 |
-
// The start state contains the rules that are intially used
|
132 |
-
start: [
|
133 |
-
// The regex matches the token, the token property contains the type
|
134 |
-
{regex: /"(?:[^\\]|\\.)*?(?:"|$)/, token: "string"},
|
135 |
-
// You can match multiple tokens at once. Note that the captured
|
136 |
-
// groups must span the whole string in this case
|
137 |
-
{regex: /(function)(\s+)([a-z$][\w$]*)/,
|
138 |
-
token: ["keyword", null, "variable-2"]},
|
139 |
-
// Rules are matched in the order in which they appear, so there is
|
140 |
-
// no ambiguity between this one and the one above
|
141 |
-
{regex: /(?:function|var|return|if|for|while|else|do|this)\b/,
|
142 |
-
token: "keyword"},
|
143 |
-
{regex: /true|false|null|undefined/, token: "atom"},
|
144 |
-
{regex: /0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,
|
145 |
-
token: "number"},
|
146 |
-
{regex: /\/\/.*/, token: "comment"},
|
147 |
-
{regex: /\/(?:[^\\]|\\.)*?\//, token: "variable-3"},
|
148 |
-
// A next property will cause the mode to move to a different state
|
149 |
-
{regex: /\/\*/, token: "comment", next: "comment"},
|
150 |
-
{regex: /[-+\/*=<>!]+/, token: "operator"},
|
151 |
-
// indent and dedent properties guide autoindentation
|
152 |
-
{regex: /[\{\[\(]/, indent: true},
|
153 |
-
{regex: /[\}\]\)]/, dedent: true},
|
154 |
-
{regex: /[a-z$][\w$]*/, token: "variable"},
|
155 |
-
// You can embed other modes with the mode property. This rule
|
156 |
-
// causes all code between << and >> to be highlighted with the XML
|
157 |
-
// mode.
|
158 |
-
{regex: /<</, token: "meta", mode: {spec: "xml", end: />>/}}
|
159 |
-
],
|
160 |
-
// The multi-line comment state.
|
161 |
-
comment: [
|
162 |
-
{regex: /.*?\*\//, token: "comment", next: "start"},
|
163 |
-
{regex: /.*/, token: "comment"}
|
164 |
-
],
|
165 |
-
// The meta property contains global information about the mode. It
|
166 |
-
// can contain properties like lineComment, which are supported by
|
167 |
-
// all modes, and also directives like dontIndentStates, which are
|
168 |
-
// specific to simple modes.
|
169 |
-
meta: {
|
170 |
-
dontIndentStates: ["comment"],
|
171 |
-
lineComment: "//"
|
172 |
-
}
|
173 |
-
});
|
174 |
-
</script>
|
175 |
-
|
176 |
-
<script>
|
177 |
-
var sc = document.getElementById("modecode");
|
178 |
-
var code = document.getElementById("code");
|
179 |
-
var editor = CodeMirror(code, {
|
180 |
-
value: (sc.textContent || sc.innerText || sc.innerHTML),
|
181 |
-
mode: "simplemode"
|
182 |
-
});
|
183 |
-
</script>
|
184 |
-
|
185 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/simplescrollbars.html
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Simple Scrollbar Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/scroll/simplescrollbars.css">
|
9 |
-
<script src="../lib/codemirror.js"></script>
|
10 |
-
<script src="../mode/markdown/markdown.js"></script>
|
11 |
-
<script src="../mode/xml/xml.js"></script>
|
12 |
-
<script src="../addon/scroll/simplescrollbars.js"></script>
|
13 |
-
|
14 |
-
<div id=nav>
|
15 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
16 |
-
|
17 |
-
<ul>
|
18 |
-
<li><a href="../index.html">Home</a>
|
19 |
-
<li><a href="../doc/manual.html">Manual</a>
|
20 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
21 |
-
</ul>
|
22 |
-
<ul>
|
23 |
-
<li><a class=active href="#">Simple Scrollbar</a>
|
24 |
-
</ul>
|
25 |
-
</div>
|
26 |
-
|
27 |
-
<article>
|
28 |
-
<h2>Simple Scrollbar Demo</h2>
|
29 |
-
<form><textarea id="code" name="code"># Custom Scrollbars
|
30 |
-
|
31 |
-
This is a piece of text that creates scrollbars
|
32 |
-
|
33 |
-
Lorem ipsum dolor sit amet, turpis nec facilisis neque vestibulum adipiscing, magna nunc est luctus orci a,
|
34 |
-
aliquam duis ad volutpat nostra. Vestibulum ultricies suspendisse commodo volutpat pede sed. Bibendum odio
|
35 |
-
dignissim, ad vitae mollis ac sed nibh quis, suspendisse diam, risus quas blandit phasellus luctus nec,
|
36 |
-
integer nunc vitae posuere scelerisque. Lobortis quam porta conubia nulla. Et nisl ac, imperdiet vitae ac.
|
37 |
-
Parturient sit. Et vestibulum euismod, rutrum nunc libero mauris purus convallis. Cum id adipiscing et eget
|
38 |
-
pretium rutrum, ultrices sapien magnis fringilla sit lorem, eu vitae scelerisque ipsum aliquet, magna sed
|
39 |
-
fusce vel.
|
40 |
-
|
41 |
-
Lectus ultricies libero dolor convallis, sed etiam vel hendrerit egestas viverra, at urna mauris, eget
|
42 |
-
vulputate dolor voluptatem, nulla eget sollicitudin. Sed tincidunt, elit sociis. Mattis mi tortor dui id
|
43 |
-
sodales mi, maecenas nam fringilla risus turpis mauris praesent, imperdiet maecenas ultrices nonummy tellus
|
44 |
-
quis est. Scelerisque nec pharetra quis varius fringilla. Varius vestibulum non dictum pharetra, tincidunt in
|
45 |
-
vestibulum iaculis molestie, id condimentum blandit elit urna magna pulvinar, quam suspendisse pellentesque
|
46 |
-
donec. Vel amet ad ac. Nec aut viverra, morbi mi neque massa, turpis enim proin. Tellus eu, fermentum velit
|
47 |
-
est convallis aliquam velit, rutrum in diam lacus, praesent tempor pellentesque dictum semper augue. Felis
|
48 |
-
explicabo massa amet lectus phasellus dolor. Ut lorem quis arcu neque felis ultricies, senectus vitae
|
49 |
-
curabitur sed pellentesque et, id sed risus in sed ac accumsan, blandit arcu quam duis nunc.
|
50 |
-
|
51 |
-
Sed leo sollicitudin odio vitae, purus sit egestas, justo eros inceptos auctor fermentum lectus. Ligula luctus
|
52 |
-
turpis, quod massa vitae elementum orci, nullam fringilla elit tortor. Justo ante tempor amet quam posuere
|
53 |
-
volutpat. Facilisis pede erat ut hac ultrices ipsum, wisi duis sit metus. Dolor vitae est sed sed vitae. Sed
|
54 |
-
eu ligula, morbi vestibulum nunc nibh velit ut taciti, ligula elit semper sagittis in, auctor arcu vel eget.
|
55 |
-
Mauris at vitae nec suspendisse et, aenean proin blandit suscipit. Morbi quam, dolor ultricies. Viverra
|
56 |
-
tempus. Suspendisse sit dapibus, ac fuga aenean, magna nisl nonummy augue posuere, dictum ut fuga velit
|
57 |
-
parturient augue interdum, mattis sit tellus.
|
58 |
-
|
59 |
-
Vehicula commodo tempus curabitur eros, lacinia erat vulputate lorem vel fermentum donec, lectus sed conubia
|
60 |
-
id pellentesque. Vel senectus donec pede aliquet dolor sit, nec vivamus justo placerat interdum maecenas,
|
61 |
-
sodales euismod. Quis netus sapien amet, vestibulum quam nec amet lacinia, quis aliquet, tempor vivamus tellus
|
62 |
-
enim, suscipit quis eleifend. Amet class phasellus orci pretium, risus in nulla. Neque sit ullamcorper,
|
63 |
-
ultricies platea id nec suspendisse ac. Et elementum. Dictum nam, ut dui fermentum egestas facilisis elit
|
64 |
-
augue, adipiscing donec ipsum erat nam pellentesque convallis, vestibulum vestibulum risus id nulla ut mauris,
|
65 |
-
curabitur aute aptent. Ultrices orci wisi dui ipsum praesent, pharetra felis eu quis. Est fringilla etiam,
|
66 |
-
maxime sem dapibus et eget, mi enim dignissim nec pretium, augue vehicula, volutpat proin. Et occaecati
|
67 |
-
lobortis viverra, cum in sed, vivamus tellus. Libero at malesuada est vivamus leo tortor.
|
68 |
-
</textarea></form>
|
69 |
-
|
70 |
-
<p>The <a href="../doc/manual.html#addon_simplescrollbars"><code>simplescrollbars</code></a> addon defines two
|
71 |
-
styles of non-native scrollbars: <a href="javascript:editor.setOption('scrollbarStyle', 'simple')"><code>"simple"</code></a> and <a href="javascript:editor.setOption('scrollbarStyle', 'overlay')"><code>"overlay"</code></a> (click to try), which can be passed to
|
72 |
-
the <a href="../doc/manual.html#option_scrollbarStyle"><code>scrollbarStyle</code></a> option. These implement
|
73 |
-
the scrollbar using DOM elements, allowing more control over
|
74 |
-
its <a href="../addon/scroll/simplescrollbars.css">appearance</a>.</p>
|
75 |
-
|
76 |
-
<script>
|
77 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
78 |
-
lineNumbers: true,
|
79 |
-
scrollbarStyle: "simple"
|
80 |
-
});
|
81 |
-
</script>
|
82 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/spanaffectswrapping_shim.html
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Automatically derive odd wrapping behavior for your browser</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<div id=nav>
|
8 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
9 |
-
|
10 |
-
<ul>
|
11 |
-
<li><a href="../index.html">Home</a>
|
12 |
-
<li><a href="../doc/manual.html">Manual</a>
|
13 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
14 |
-
</ul>
|
15 |
-
<ul>
|
16 |
-
<li><a class=active href="#">Automatically derive odd wrapping behavior for your browser</a>
|
17 |
-
</ul>
|
18 |
-
</div>
|
19 |
-
|
20 |
-
<article>
|
21 |
-
<h2>Automatically derive odd wrapping behavior for your browser</h2>
|
22 |
-
|
23 |
-
|
24 |
-
<p>This is a hack to automatically derive
|
25 |
-
a <code>spanAffectsWrapping</code> regexp for a browser. See the
|
26 |
-
comments above that variable
|
27 |
-
in <a href="../lib/codemirror.js"><code>lib/codemirror.js</code></a>
|
28 |
-
for some more details.</p>
|
29 |
-
|
30 |
-
<div style="white-space: pre-wrap; width: 50px;" id="area"></div>
|
31 |
-
<pre id="output"></pre>
|
32 |
-
|
33 |
-
<script id="script">
|
34 |
-
var a = document.getElementById("area"), bad = Object.create(null);
|
35 |
-
var chars = "a~`!@#$%^&*()-_=+}{[]\\|'\"/?.>,<:;", l = chars.length;
|
36 |
-
for (var x = 0; x < l; ++x) for (var y = 0; y < l; ++y) {
|
37 |
-
var s1 = "foooo" + chars.charAt(x), s2 = chars.charAt(y) + "br";
|
38 |
-
a.appendChild(document.createTextNode(s1 + s2));
|
39 |
-
var h1 = a.offsetHeight;
|
40 |
-
a.innerHTML = "";
|
41 |
-
a.appendChild(document.createElement("span")).appendChild(document.createTextNode(s1));
|
42 |
-
a.appendChild(document.createElement("span")).appendChild(document.createTextNode(s2));
|
43 |
-
if (a.offsetHeight != h1)
|
44 |
-
bad[chars.charAt(x)] = (bad[chars.charAt(x)] || "") + chars.charAt(y);
|
45 |
-
a.innerHTML = "";
|
46 |
-
}
|
47 |
-
|
48 |
-
var re = "";
|
49 |
-
function toREElt(str) {
|
50 |
-
if (str.length > 1) {
|
51 |
-
var invert = false;
|
52 |
-
if (str.length > chars.length * .6) {
|
53 |
-
invert = true;
|
54 |
-
var newStr = "";
|
55 |
-
for (var i = 0; i < l; ++i) if (str.indexOf(chars.charAt(i)) == -1) newStr += chars.charAt(i);
|
56 |
-
str = newStr;
|
57 |
-
}
|
58 |
-
str = str.replace(/[\-\.\]\"\'\\\/\^a]/g, function(orig) { return orig == "a" ? "\\w" : "\\" + orig; });
|
59 |
-
return "[" + (invert ? "^" : "") + str + "]";
|
60 |
-
} else if (str == "a") {
|
61 |
-
return "\\w";
|
62 |
-
} else if (/[?$*()+{}[\]\.|/\'\"]/.test(str)) {
|
63 |
-
return "\\" + str;
|
64 |
-
} else {
|
65 |
-
return str;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
|
69 |
-
var newRE = "";
|
70 |
-
for (;;) {
|
71 |
-
var left = null;
|
72 |
-
for (var left in bad) break;
|
73 |
-
if (left == null) break;
|
74 |
-
var right = bad[left];
|
75 |
-
delete bad[left];
|
76 |
-
for (var other in bad) if (bad[other] == right) {
|
77 |
-
left += other;
|
78 |
-
delete bad[other];
|
79 |
-
}
|
80 |
-
newRE += (newRE ? "|" : "") + toREElt(left) + toREElt(right);
|
81 |
-
}
|
82 |
-
|
83 |
-
document.getElementById("output").appendChild(document.createTextNode("Your regexp is: " + (newRE || "^$")));
|
84 |
-
</script>
|
85 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/sublime.html
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Sublime Text bindings demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/fold/foldgutter.css">
|
9 |
-
<link rel="stylesheet" href="../addon/dialog/dialog.css">
|
10 |
-
<link rel="stylesheet" href="../theme/monokai.css">
|
11 |
-
<script src="../lib/codemirror.js"></script>
|
12 |
-
<script src="../addon/search/searchcursor.js"></script>
|
13 |
-
<script src="../addon/search/search.js"></script>
|
14 |
-
<script src="../addon/dialog/dialog.js"></script>
|
15 |
-
<script src="../addon/edit/matchbrackets.js"></script>
|
16 |
-
<script src="../addon/edit/closebrackets.js"></script>
|
17 |
-
<script src="../addon/comment/comment.js"></script>
|
18 |
-
<script src="../addon/wrap/hardwrap.js"></script>
|
19 |
-
<script src="../addon/fold/foldcode.js"></script>
|
20 |
-
<script src="../addon/fold/brace-fold.js"></script>
|
21 |
-
<script src="../mode/javascript/javascript.js"></script>
|
22 |
-
<script src="../keymap/sublime.js"></script>
|
23 |
-
<style>
|
24 |
-
.CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee; line-height: 1.3; height: 500px}
|
25 |
-
.CodeMirror-linenumbers { padding: 0 8px; }
|
26 |
-
</style>
|
27 |
-
<div id=nav>
|
28 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
29 |
-
|
30 |
-
<ul>
|
31 |
-
<li><a href="../index.html">Home</a>
|
32 |
-
<li><a href="../doc/manual.html">Manual</a>
|
33 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
34 |
-
</ul>
|
35 |
-
<ul>
|
36 |
-
<li><a class=active href="#">Sublime bindings</a>
|
37 |
-
</ul>
|
38 |
-
</div>
|
39 |
-
|
40 |
-
<article>
|
41 |
-
<h2>Sublime Text bindings demo</h2>
|
42 |
-
|
43 |
-
<p>The <code>sublime</code> keymap defines many Sublime Text-specific
|
44 |
-
bindings for CodeMirror. See the code below for an overview.</p>
|
45 |
-
|
46 |
-
<p>Enable the keymap by
|
47 |
-
loading <a href="../keymap/sublime.js"><code>keymap/sublime.js</code></a>
|
48 |
-
and setting
|
49 |
-
the <a href="../doc/manual.html#option_keyMap"><code>keyMap</code></a>
|
50 |
-
option to <code>"sublime"</code>.</p>
|
51 |
-
|
52 |
-
<p>(A lot of the search functionality is still missing.)
|
53 |
-
|
54 |
-
<script>
|
55 |
-
var value = "// The bindings defined specifically in the Sublime Text mode\nvar bindings = {\n";
|
56 |
-
var map = CodeMirror.keyMap.sublime;
|
57 |
-
for (var key in map) {
|
58 |
-
var val = map[key];
|
59 |
-
if (key != "fallthrough" && val != "..." && (!/find/.test(val) || /findUnder/.test(val)))
|
60 |
-
value += " \"" + key + "\": \"" + val + "\",\n";
|
61 |
-
}
|
62 |
-
value += "}\n\n// The implementation of joinLines\n";
|
63 |
-
value += CodeMirror.commands.joinLines.toString().replace(/^function\s*\(/, "function joinLines(").replace(/\n /g, "\n") + "\n";
|
64 |
-
var editor = CodeMirror(document.body.getElementsByTagName("article")[0], {
|
65 |
-
value: value,
|
66 |
-
lineNumbers: true,
|
67 |
-
mode: "javascript",
|
68 |
-
keyMap: "sublime",
|
69 |
-
autoCloseBrackets: true,
|
70 |
-
matchBrackets: true,
|
71 |
-
showCursorWhenSelecting: true,
|
72 |
-
theme: "monokai",
|
73 |
-
tabSize: 2
|
74 |
-
});
|
75 |
-
</script>
|
76 |
-
|
77 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/tern.html
DELETED
@@ -1,133 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Tern Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/dialog/dialog.css">
|
9 |
-
<link rel="stylesheet" href="../addon/hint/show-hint.css">
|
10 |
-
<link rel="stylesheet" href="../addon/tern/tern.css">
|
11 |
-
<script src="../lib/codemirror.js"></script>
|
12 |
-
<script src="../mode/javascript/javascript.js"></script>
|
13 |
-
<script src="../addon/dialog/dialog.js"></script>
|
14 |
-
<script src="../addon/hint/show-hint.js"></script>
|
15 |
-
<script src="../addon/tern/tern.js"></script>
|
16 |
-
<script src="//ternjs.net/node_modules/acorn/dist/acorn.js"></script>
|
17 |
-
<script src="//ternjs.net/node_modules/acorn-loose/dist/acorn-loose.js"></script>
|
18 |
-
<script src="//ternjs.net/node_modules/acorn-walk/dist/walk.js"></script>
|
19 |
-
<script src="//ternjs.net/doc/demo/polyfill.js"></script>
|
20 |
-
<script src="//ternjs.net/lib/signal.js"></script>
|
21 |
-
<script src="//ternjs.net/lib/tern.js"></script>
|
22 |
-
<script src="//ternjs.net/lib/def.js"></script>
|
23 |
-
<script src="//ternjs.net/lib/comment.js"></script>
|
24 |
-
<script src="//ternjs.net/lib/infer.js"></script>
|
25 |
-
<script src="//ternjs.net/plugin/doc_comment.js"></script>
|
26 |
-
<style>
|
27 |
-
.CodeMirror {border: 1px solid #ddd;}
|
28 |
-
</style>
|
29 |
-
<div id=nav>
|
30 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
31 |
-
|
32 |
-
<ul>
|
33 |
-
<li><a href="../index.html">Home</a>
|
34 |
-
<li><a href="../doc/manual.html">Manual</a>
|
35 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
36 |
-
</ul>
|
37 |
-
<ul>
|
38 |
-
<li><a class=active href="#">Tern</a>
|
39 |
-
</ul>
|
40 |
-
</div>
|
41 |
-
|
42 |
-
<article>
|
43 |
-
<h2>Tern Demo</h2>
|
44 |
-
<form><textarea id="code" name="code">// Use ctrl-space to complete something
|
45 |
-
// Put the cursor in or after an expression, press ctrl-o to
|
46 |
-
// find its type
|
47 |
-
|
48 |
-
var foo = ["array", "of", "strings"];
|
49 |
-
var bar = foo.slice(0, 2).join("").split("a")[0];
|
50 |
-
|
51 |
-
// Works for locally defined types too.
|
52 |
-
|
53 |
-
function CTor() { this.size = 10; }
|
54 |
-
CTor.prototype.hallo = "hallo";
|
55 |
-
|
56 |
-
var baz = new CTor;
|
57 |
-
baz.
|
58 |
-
|
59 |
-
// You can press ctrl-q when the cursor is on a variable name to
|
60 |
-
// rename it. Try it with CTor...
|
61 |
-
|
62 |
-
// When the cursor is in an argument list, the arguments are
|
63 |
-
// shown below the editor.
|
64 |
-
|
65 |
-
[1].reduce( );
|
66 |
-
|
67 |
-
// And a little more advanced code...
|
68 |
-
|
69 |
-
(function(exports) {
|
70 |
-
exports.randomElt = function(arr) {
|
71 |
-
return arr[Math.floor(arr.length * Math.random())];
|
72 |
-
};
|
73 |
-
exports.strList = "foo".split("");
|
74 |
-
exports.intList = exports.strList.map(function(s) { return s.charCodeAt(0); });
|
75 |
-
})(window.myMod = {});
|
76 |
-
|
77 |
-
var randomStr = myMod.randomElt(myMod.strList);
|
78 |
-
var randomInt = myMod.randomElt(myMod.intList);
|
79 |
-
</textarea></form>
|
80 |
-
|
81 |
-
<p>Demonstrates integration of <a href="http://ternjs.net/">Tern</a>
|
82 |
-
and CodeMirror. The following keys are bound:</p>
|
83 |
-
|
84 |
-
<dl>
|
85 |
-
<dt>Ctrl-Space</dt><dd>Autocomplete</dd>
|
86 |
-
<dt>Ctrl-O</dt><dd>Find docs for the expression at the cursor</dd>
|
87 |
-
<dt>Ctrl-I</dt><dd>Find type at cursor</dd>
|
88 |
-
<dt>Alt-.</dt><dd>Jump to definition (Alt-, to jump back)</dd>
|
89 |
-
<dt>Ctrl-Q</dt><dd>Rename variable</dd>
|
90 |
-
<dt>Ctrl-.</dt><dd>Select all occurrences of a variable</dd>
|
91 |
-
</dl>
|
92 |
-
|
93 |
-
<p>Documentation is sparse for now. See the top of
|
94 |
-
the <a href="../addon/tern/tern.js">script</a> for a rough API
|
95 |
-
overview.</p>
|
96 |
-
|
97 |
-
<script>
|
98 |
-
function getURL(url, c) {
|
99 |
-
var xhr = new XMLHttpRequest();
|
100 |
-
xhr.open("get", url, true);
|
101 |
-
xhr.send();
|
102 |
-
xhr.onreadystatechange = function() {
|
103 |
-
if (xhr.readyState != 4) return;
|
104 |
-
if (xhr.status < 400) return c(null, xhr.responseText);
|
105 |
-
var e = new Error(xhr.responseText || "No response");
|
106 |
-
e.status = xhr.status;
|
107 |
-
c(e);
|
108 |
-
};
|
109 |
-
}
|
110 |
-
|
111 |
-
var server;
|
112 |
-
getURL("//ternjs.net/defs/ecmascript.json", function(err, code) {
|
113 |
-
if (err) throw new Error("Request for ecmascript.json: " + err);
|
114 |
-
server = new CodeMirror.TernServer({defs: [JSON.parse(code)]});
|
115 |
-
editor.setOption("extraKeys", {
|
116 |
-
"Ctrl-Space": function(cm) { server.complete(cm); },
|
117 |
-
"Ctrl-I": function(cm) { server.showType(cm); },
|
118 |
-
"Ctrl-O": function(cm) { server.showDocs(cm); },
|
119 |
-
"Alt-.": function(cm) { server.jumpToDef(cm); },
|
120 |
-
"Alt-,": function(cm) { server.jumpBack(cm); },
|
121 |
-
"Ctrl-Q": function(cm) { server.rename(cm); },
|
122 |
-
"Ctrl-.": function(cm) { server.selectName(cm); }
|
123 |
-
})
|
124 |
-
editor.on("cursorActivity", function(cm) { server.updateArgHints(cm); });
|
125 |
-
});
|
126 |
-
|
127 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
128 |
-
lineNumbers: true,
|
129 |
-
mode: "javascript"
|
130 |
-
});
|
131 |
-
</script>
|
132 |
-
|
133 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/theme.html
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Theme Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../theme/3024-day.css">
|
9 |
-
<link rel="stylesheet" href="../theme/3024-night.css">
|
10 |
-
<link rel="stylesheet" href="../theme/abcdef.css">
|
11 |
-
<link rel="stylesheet" href="../theme/ambiance.css">
|
12 |
-
<link rel="stylesheet" href="../theme/base16-dark.css">
|
13 |
-
<link rel="stylesheet" href="../theme/bespin.css">
|
14 |
-
<link rel="stylesheet" href="../theme/base16-light.css">
|
15 |
-
<link rel="stylesheet" href="../theme/blackboard.css">
|
16 |
-
<link rel="stylesheet" href="../theme/cobalt.css">
|
17 |
-
<link rel="stylesheet" href="../theme/colorforth.css">
|
18 |
-
<link rel="stylesheet" href="../theme/dracula.css">
|
19 |
-
<link rel="stylesheet" href="../theme/duotone-dark.css">
|
20 |
-
<link rel="stylesheet" href="../theme/duotone-light.css">
|
21 |
-
<link rel="stylesheet" href="../theme/eclipse.css">
|
22 |
-
<link rel="stylesheet" href="../theme/elegant.css">
|
23 |
-
<link rel="stylesheet" href="../theme/erlang-dark.css">
|
24 |
-
<link rel="stylesheet" href="../theme/gruvbox-dark.css">
|
25 |
-
<link rel="stylesheet" href="../theme/hopscotch.css">
|
26 |
-
<link rel="stylesheet" href="../theme/icecoder.css">
|
27 |
-
<link rel="stylesheet" href="../theme/isotope.css">
|
28 |
-
<link rel="stylesheet" href="../theme/lesser-dark.css">
|
29 |
-
<link rel="stylesheet" href="../theme/liquibyte.css">
|
30 |
-
<link rel="stylesheet" href="../theme/lucario.css">
|
31 |
-
<link rel="stylesheet" href="../theme/material.css">
|
32 |
-
<link rel="stylesheet" href="../theme/mbo.css">
|
33 |
-
<link rel="stylesheet" href="../theme/mdn-like.css">
|
34 |
-
<link rel="stylesheet" href="../theme/midnight.css">
|
35 |
-
<link rel="stylesheet" href="../theme/monokai.css">
|
36 |
-
<link rel="stylesheet" href="../theme/neat.css">
|
37 |
-
<link rel="stylesheet" href="../theme/neo.css">
|
38 |
-
<link rel="stylesheet" href="../theme/night.css">
|
39 |
-
<link rel="stylesheet" href="../theme/nord.css">
|
40 |
-
<link rel="stylesheet" href="../theme/oceanic-next.css">
|
41 |
-
<link rel="stylesheet" href="../theme/panda-syntax.css">
|
42 |
-
<link rel="stylesheet" href="../theme/paraiso-dark.css">
|
43 |
-
<link rel="stylesheet" href="../theme/paraiso-light.css">
|
44 |
-
<link rel="stylesheet" href="../theme/pastel-on-dark.css">
|
45 |
-
<link rel="stylesheet" href="../theme/railscasts.css">
|
46 |
-
<link rel="stylesheet" href="../theme/rubyblue.css">
|
47 |
-
<link rel="stylesheet" href="../theme/seti.css">
|
48 |
-
<link rel="stylesheet" href="../theme/shadowfox.css">
|
49 |
-
<link rel="stylesheet" href="../theme/solarized.css">
|
50 |
-
<link rel="stylesheet" href="../theme/the-matrix.css">
|
51 |
-
<link rel="stylesheet" href="../theme/tomorrow-night-bright.css">
|
52 |
-
<link rel="stylesheet" href="../theme/tomorrow-night-eighties.css">
|
53 |
-
<link rel="stylesheet" href="../theme/ttcn.css">
|
54 |
-
<link rel="stylesheet" href="../theme/twilight.css">
|
55 |
-
<link rel="stylesheet" href="../theme/vibrant-ink.css">
|
56 |
-
<link rel="stylesheet" href="../theme/xq-dark.css">
|
57 |
-
<link rel="stylesheet" href="../theme/xq-light.css">
|
58 |
-
<link rel="stylesheet" href="../theme/yeti.css">
|
59 |
-
<link rel="stylesheet" href="../theme/idea.css">
|
60 |
-
<link rel="stylesheet" href="../theme/darcula.css">
|
61 |
-
<link rel="stylesheet" href="../theme/zenburn.css">
|
62 |
-
<script src="../lib/codemirror.js"></script>
|
63 |
-
<script src="../mode/javascript/javascript.js"></script>
|
64 |
-
<script src="../addon/selection/active-line.js"></script>
|
65 |
-
<script src="../addon/edit/matchbrackets.js"></script>
|
66 |
-
<style>
|
67 |
-
.CodeMirror {border: 1px solid black; font-size:13px}
|
68 |
-
</style>
|
69 |
-
<div id=nav>
|
70 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
71 |
-
|
72 |
-
<ul>
|
73 |
-
<li><a href="../index.html">Home</a>
|
74 |
-
<li><a href="../doc/manual.html">Manual</a>
|
75 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
76 |
-
</ul>
|
77 |
-
<ul>
|
78 |
-
<li><a class=active href="#">Theme</a>
|
79 |
-
</ul>
|
80 |
-
</div>
|
81 |
-
|
82 |
-
<article>
|
83 |
-
<h2>Theme Demo</h2>
|
84 |
-
<form><textarea id="code" name="code">
|
85 |
-
function findSequence(goal) {
|
86 |
-
function find(start, history) {
|
87 |
-
if (start == goal)
|
88 |
-
return history;
|
89 |
-
else if (start > goal)
|
90 |
-
return null;
|
91 |
-
else
|
92 |
-
return find(start + 5, "(" + history + " + 5)") ||
|
93 |
-
find(start * 3, "(" + history + " * 3)");
|
94 |
-
}
|
95 |
-
return find(1, "1");
|
96 |
-
}</textarea></form>
|
97 |
-
|
98 |
-
<p>Select a theme: <select onchange="selectTheme()" id=select>
|
99 |
-
<option selected>default</option>
|
100 |
-
<option>3024-day</option>
|
101 |
-
<option>3024-night</option>
|
102 |
-
<option>abcdef</option>
|
103 |
-
<option>ambiance</option>
|
104 |
-
<option>base16-dark</option>
|
105 |
-
<option>base16-light</option>
|
106 |
-
<option>bespin</option>
|
107 |
-
<option>blackboard</option>
|
108 |
-
<option>cobalt</option>
|
109 |
-
<option>colorforth</option>
|
110 |
-
<option>darcula</option>
|
111 |
-
<option>dracula</option>
|
112 |
-
<option>duotone-dark</option>
|
113 |
-
<option>duotone-light</option>
|
114 |
-
<option>eclipse</option>
|
115 |
-
<option>elegant</option>
|
116 |
-
<option>erlang-dark</option>
|
117 |
-
<option>gruvbox-dark</option>
|
118 |
-
<option>hopscotch</option>
|
119 |
-
<option>icecoder</option>
|
120 |
-
<option>idea</option>
|
121 |
-
<option>isotope</option>
|
122 |
-
<option>lesser-dark</option>
|
123 |
-
<option>liquibyte</option>
|
124 |
-
<option>lucario</option>
|
125 |
-
<option>material</option>
|
126 |
-
<option>mbo</option>
|
127 |
-
<option>mdn-like</option>
|
128 |
-
<option>midnight</option>
|
129 |
-
<option>monokai</option>
|
130 |
-
<option>neat</option>
|
131 |
-
<option>neo</option>
|
132 |
-
<option>night</option>
|
133 |
-
<option>nord</option>
|
134 |
-
<option>oceanic-next</option>
|
135 |
-
<option>panda-syntax</option>
|
136 |
-
<option>paraiso-dark</option>
|
137 |
-
<option>paraiso-light</option>
|
138 |
-
<option>pastel-on-dark</option>
|
139 |
-
<option>railscasts</option>
|
140 |
-
<option>rubyblue</option>
|
141 |
-
<option>seti</option>
|
142 |
-
<option>shadowfox</option>
|
143 |
-
<option>solarized dark</option>
|
144 |
-
<option>solarized light</option>
|
145 |
-
<option>the-matrix</option>
|
146 |
-
<option>tomorrow-night-bright</option>
|
147 |
-
<option>tomorrow-night-eighties</option>
|
148 |
-
<option>ttcn</option>
|
149 |
-
<option>twilight</option>
|
150 |
-
<option>vibrant-ink</option>
|
151 |
-
<option>xq-dark</option>
|
152 |
-
<option>xq-light</option>
|
153 |
-
<option>yeti</option>
|
154 |
-
<option>zenburn</option>
|
155 |
-
</select>
|
156 |
-
</p>
|
157 |
-
|
158 |
-
<script>
|
159 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
160 |
-
lineNumbers: true,
|
161 |
-
styleActiveLine: true,
|
162 |
-
matchBrackets: true
|
163 |
-
});
|
164 |
-
var input = document.getElementById("select");
|
165 |
-
function selectTheme() {
|
166 |
-
var theme = input.options[input.selectedIndex].textContent;
|
167 |
-
editor.setOption("theme", theme);
|
168 |
-
location.hash = "#" + theme;
|
169 |
-
}
|
170 |
-
var choice = (location.hash && location.hash.slice(1)) ||
|
171 |
-
(document.location.search &&
|
172 |
-
decodeURIComponent(document.location.search.slice(1)));
|
173 |
-
if (choice) {
|
174 |
-
input.value = choice;
|
175 |
-
editor.setOption("theme", choice);
|
176 |
-
}
|
177 |
-
CodeMirror.on(window, "hashchange", function() {
|
178 |
-
var theme = location.hash.slice(1);
|
179 |
-
if (theme) { input.value = theme; selectTheme(); }
|
180 |
-
});
|
181 |
-
</script>
|
182 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/trailingspace.html
DELETED
@@ -1,48 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Trailing Whitespace Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../addon/edit/trailingspace.js"></script>
|
10 |
-
<style>
|
11 |
-
.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
|
12 |
-
.cm-trailingspace {
|
13 |
-
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==);
|
14 |
-
background-position: bottom left;
|
15 |
-
background-repeat: repeat-x;
|
16 |
-
}
|
17 |
-
</style>
|
18 |
-
<div id=nav>
|
19 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
20 |
-
|
21 |
-
<ul>
|
22 |
-
<li><a href="../index.html">Home</a>
|
23 |
-
<li><a href="../doc/manual.html">Manual</a>
|
24 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
25 |
-
</ul>
|
26 |
-
<ul>
|
27 |
-
<li><a class=active href="#">Trailing Whitespace</a>
|
28 |
-
</ul>
|
29 |
-
</div>
|
30 |
-
|
31 |
-
<article>
|
32 |
-
<h2>Trailing Whitespace Demo</h2>
|
33 |
-
<form><textarea id="code" name="code">This text
|
34 |
-
has some
|
35 |
-
trailing whitespace!</textarea></form>
|
36 |
-
|
37 |
-
<script>
|
38 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
39 |
-
lineNumbers: true,
|
40 |
-
showTrailingSpace: true
|
41 |
-
});
|
42 |
-
</script>
|
43 |
-
|
44 |
-
<p>Uses
|
45 |
-
the <a href="../doc/manual.html#addon_trailingspace">trailingspace</a>
|
46 |
-
addon to highlight trailing whitespace.</p>
|
47 |
-
|
48 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/variableheight.html
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Variable Height Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/markdown/markdown.js"></script>
|
10 |
-
<script src="../mode/xml/xml.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border: 1px solid silver; border-width: 1px 2px; }
|
13 |
-
.cm-header { font-family: arial; }
|
14 |
-
.cm-header-1 { font-size: 150%; }
|
15 |
-
.cm-header-2 { font-size: 130%; }
|
16 |
-
.cm-header-3 { font-size: 120%; }
|
17 |
-
.cm-header-4 { font-size: 110%; }
|
18 |
-
.cm-header-5 { font-size: 100%; }
|
19 |
-
.cm-header-6 { font-size: 90%; }
|
20 |
-
.cm-strong { font-size: 140%; }
|
21 |
-
</style>
|
22 |
-
<div id=nav>
|
23 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
24 |
-
|
25 |
-
<ul>
|
26 |
-
<li><a href="../index.html">Home</a>
|
27 |
-
<li><a href="../doc/manual.html">Manual</a>
|
28 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
29 |
-
</ul>
|
30 |
-
<ul>
|
31 |
-
<li><a class=active href="#">Variable Height</a>
|
32 |
-
</ul>
|
33 |
-
</div>
|
34 |
-
|
35 |
-
<article>
|
36 |
-
<h2>Variable Height Demo</h2>
|
37 |
-
<form><textarea id="code" name="code"># A First Level Header
|
38 |
-
|
39 |
-
**Bold** text in a normal-size paragraph.
|
40 |
-
|
41 |
-
And a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long, wrapped line with a piece of **big** text inside of it.
|
42 |
-
|
43 |
-
## A Second Level Header
|
44 |
-
|
45 |
-
Now is the time for all good men to come to
|
46 |
-
the aid of their country. This is just a
|
47 |
-
regular paragraph.
|
48 |
-
|
49 |
-
The quick brown fox jumped over the lazy
|
50 |
-
dog's back.
|
51 |
-
|
52 |
-
### Header 3
|
53 |
-
|
54 |
-
> This is a blockquote.
|
55 |
-
>
|
56 |
-
> This is the second paragraph in the blockquote.
|
57 |
-
>
|
58 |
-
> ## This is an H2 in a blockquote
|
59 |
-
</textarea></form>
|
60 |
-
<script id="script">
|
61 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
62 |
-
lineNumbers: true,
|
63 |
-
lineWrapping: true,
|
64 |
-
mode: "markdown"
|
65 |
-
});
|
66 |
-
</script>
|
67 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/vim.html
DELETED
@@ -1,113 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Vim bindings demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/dialog/dialog.css">
|
9 |
-
<link rel="stylesheet" href="../theme/midnight.css">
|
10 |
-
<link rel="stylesheet" href="../theme/solarized.css">
|
11 |
-
<script src="../lib/codemirror.js"></script>
|
12 |
-
<script src="../addon/dialog/dialog.js"></script>
|
13 |
-
<script src="../addon/search/searchcursor.js"></script>
|
14 |
-
<script src="../mode/clike/clike.js"></script>
|
15 |
-
<script src="../addon/edit/matchbrackets.js"></script>
|
16 |
-
<script src="../keymap/vim.js"></script>
|
17 |
-
<style>
|
18 |
-
.CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
|
19 |
-
</style>
|
20 |
-
<div id=nav>
|
21 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
22 |
-
|
23 |
-
<ul>
|
24 |
-
<li><a href="../index.html">Home</a>
|
25 |
-
<li><a href="../doc/manual.html">Manual</a>
|
26 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
27 |
-
</ul>
|
28 |
-
<ul>
|
29 |
-
<li><a class=active href="#">Vim bindings</a>
|
30 |
-
</ul>
|
31 |
-
</div>
|
32 |
-
|
33 |
-
<article>
|
34 |
-
<h2>Vim bindings demo</h2>
|
35 |
-
|
36 |
-
<p><strong style="color: #c33; text-decoration: none">Note:</strong> The CodeMirror vim bindings do not have an
|
37 |
-
active maintainer. That means that if you report bugs in it, they are
|
38 |
-
likely to go unanswered. It also means that if you want to help, you
|
39 |
-
are very welcome to look
|
40 |
-
at <a href="https://github.com/codemirror/codemirror/issues?q=is%3Aissue+is%3Aopen+label%3Avim">the
|
41 |
-
open issues</a> and see which ones you can solve.</p>
|
42 |
-
|
43 |
-
<form><textarea id="code" name="code">
|
44 |
-
#include "syscalls.h"
|
45 |
-
/* getchar: simple buffered version */
|
46 |
-
int getchar(void)
|
47 |
-
{
|
48 |
-
static char buf[BUFSIZ];
|
49 |
-
static char *bufp = buf;
|
50 |
-
static int n = 0;
|
51 |
-
if (n == 0) { /* buffer is empty */
|
52 |
-
n = read(0, buf, sizeof buf);
|
53 |
-
bufp = buf;
|
54 |
-
}
|
55 |
-
return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
|
56 |
-
}
|
57 |
-
</textarea></form>
|
58 |
-
<div style="font-size: 13px; width: 300px; height: 30px;">Key buffer: <span id="command-display"></span></div>
|
59 |
-
|
60 |
-
<p>The vim keybindings are enabled by including <code><a
|
61 |
-
href="../keymap/vim.js">keymap/vim.js</a></code> and setting the
|
62 |
-
<code>keyMap</code> option to <code>vim</code>.</p>
|
63 |
-
|
64 |
-
<p><strong>Features</strong></p>
|
65 |
-
|
66 |
-
<ul>
|
67 |
-
<li>All common motions and operators, including text objects</li>
|
68 |
-
<li>Operator motion orthogonality</li>
|
69 |
-
<li>Visual mode - characterwise, linewise, blockwise</li>
|
70 |
-
<li>Full macro support (q, @)</li>
|
71 |
-
<li>Incremental highlighted search (/, ?, #, *, g#, g*)</li>
|
72 |
-
<li>Search/replace with confirm (:substitute, :%s)</li>
|
73 |
-
<li>Search history</li>
|
74 |
-
<li>Jump lists (Ctrl-o, Ctrl-i)</li>
|
75 |
-
<li>Key/command mapping with API (:map, :nmap, :vmap)</li>
|
76 |
-
<li>Sort (:sort)</li>
|
77 |
-
<li>Marks (`, ')</li>
|
78 |
-
<li>:global</li>
|
79 |
-
<li>Insert mode behaves identical to base CodeMirror</li>
|
80 |
-
<li>Cross-buffer yank/paste</li>
|
81 |
-
</ul>
|
82 |
-
|
83 |
-
<p>For the full list of key mappings and Ex commands, refer to the
|
84 |
-
<code>defaultKeymap</code> and <code>defaultExCommandMap</code> at the
|
85 |
-
top of <code><a href="../keymap/vim.js">keymap/vim.js</a></code>.
|
86 |
-
|
87 |
-
<p>Note that while the vim mode tries to emulate the most useful
|
88 |
-
features of vim as faithfully as possible, it does not strive to
|
89 |
-
become a complete vim implementation</p>
|
90 |
-
|
91 |
-
<script>
|
92 |
-
CodeMirror.commands.save = function(){ alert("Saving"); };
|
93 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
94 |
-
lineNumbers: true,
|
95 |
-
mode: "text/x-csrc",
|
96 |
-
keyMap: "vim",
|
97 |
-
matchBrackets: true,
|
98 |
-
showCursorWhenSelecting: true,
|
99 |
-
inputStyle: "contenteditable"
|
100 |
-
});
|
101 |
-
var commandDisplay = document.getElementById('command-display');
|
102 |
-
var keys = '';
|
103 |
-
CodeMirror.on(editor, 'vim-keypress', function(key) {
|
104 |
-
keys = keys + key;
|
105 |
-
commandDisplay.innerHTML = keys;
|
106 |
-
});
|
107 |
-
CodeMirror.on(editor, 'vim-command-done', function(e) {
|
108 |
-
keys = '';
|
109 |
-
commandDisplay.innerHTML = keys;
|
110 |
-
});
|
111 |
-
</script>
|
112 |
-
|
113 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/visibletabs.html
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Visible tabs demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/clike/clike.js"></script>
|
10 |
-
<style>
|
11 |
-
.CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
|
12 |
-
.cm-tab {
|
13 |
-
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=);
|
14 |
-
background-position: right;
|
15 |
-
background-repeat: no-repeat;
|
16 |
-
}
|
17 |
-
</style>
|
18 |
-
<div id=nav>
|
19 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
20 |
-
|
21 |
-
<ul>
|
22 |
-
<li><a href="../index.html">Home</a>
|
23 |
-
<li><a href="../doc/manual.html">Manual</a>
|
24 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
25 |
-
</ul>
|
26 |
-
<ul>
|
27 |
-
<li><a class=active href="#">Visible tabs</a>
|
28 |
-
</ul>
|
29 |
-
</div>
|
30 |
-
|
31 |
-
<article>
|
32 |
-
<h2>Visible tabs demo</h2>
|
33 |
-
<form><textarea id="code" name="code">
|
34 |
-
#include "syscalls.h"
|
35 |
-
/* getchar: simple buffered version */
|
36 |
-
int getchar(void)
|
37 |
-
{
|
38 |
-
static char buf[BUFSIZ];
|
39 |
-
static char *bufp = buf;
|
40 |
-
static int n = 0;
|
41 |
-
if (n == 0) { /* buffer is empty */
|
42 |
-
n = read(0, buf, sizeof buf);
|
43 |
-
bufp = buf;
|
44 |
-
}
|
45 |
-
return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
|
46 |
-
}
|
47 |
-
</textarea></form>
|
48 |
-
|
49 |
-
<p>Tabs inside the editor are spans with the
|
50 |
-
class <code>cm-tab</code>, and can be styled.</p>
|
51 |
-
|
52 |
-
<script>
|
53 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
54 |
-
lineNumbers: true,
|
55 |
-
tabSize: 4,
|
56 |
-
indentUnit: 4,
|
57 |
-
indentWithTabs: true,
|
58 |
-
mode: "text/x-csrc"
|
59 |
-
});
|
60 |
-
</script>
|
61 |
-
|
62 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/widget.html
DELETED
@@ -1,85 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Inline Widget Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<script src="../mode/javascript/javascript.js"></script>
|
10 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jshint/2.9.5/jshint.min.js"></script>
|
11 |
-
<style>
|
12 |
-
.CodeMirror {border: 1px solid black;}
|
13 |
-
.lint-error {font-family: arial; font-size: 70%; background: #ffa; color: #a00; padding: 2px 5px 3px; }
|
14 |
-
.lint-error-icon {color: white; background-color: red; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 7px;}
|
15 |
-
</style>
|
16 |
-
<div id=nav>
|
17 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
18 |
-
|
19 |
-
<ul>
|
20 |
-
<li><a href="../index.html">Home</a>
|
21 |
-
<li><a href="../doc/manual.html">Manual</a>
|
22 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
23 |
-
</ul>
|
24 |
-
<ul>
|
25 |
-
<li><a class=active href="#">Inline Widget</a>
|
26 |
-
</ul>
|
27 |
-
</div>
|
28 |
-
|
29 |
-
<article>
|
30 |
-
<h2>Inline Widget Demo</h2>
|
31 |
-
|
32 |
-
|
33 |
-
<div id=code></div>
|
34 |
-
<script id="script">var widgets = []
|
35 |
-
function updateHints() {
|
36 |
-
editor.operation(function(){
|
37 |
-
for (var i = 0; i < widgets.length; ++i)
|
38 |
-
editor.removeLineWidget(widgets[i]);
|
39 |
-
widgets.length = 0;
|
40 |
-
|
41 |
-
JSHINT(editor.getValue());
|
42 |
-
for (var i = 0; i < JSHINT.errors.length; ++i) {
|
43 |
-
var err = JSHINT.errors[i];
|
44 |
-
if (!err) continue;
|
45 |
-
var msg = document.createElement("div");
|
46 |
-
var icon = msg.appendChild(document.createElement("span"));
|
47 |
-
icon.innerHTML = "!!";
|
48 |
-
icon.className = "lint-error-icon";
|
49 |
-
msg.appendChild(document.createTextNode(err.reason));
|
50 |
-
msg.className = "lint-error";
|
51 |
-
widgets.push(editor.addLineWidget(err.line - 1, msg, {coverGutter: false, noHScroll: true}));
|
52 |
-
}
|
53 |
-
});
|
54 |
-
var info = editor.getScrollInfo();
|
55 |
-
var after = editor.charCoords({line: editor.getCursor().line + 1, ch: 0}, "local").top;
|
56 |
-
if (info.top + info.clientHeight < after)
|
57 |
-
editor.scrollTo(null, after - info.clientHeight + 3);
|
58 |
-
}
|
59 |
-
|
60 |
-
window.onload = function() {
|
61 |
-
var sc = document.getElementById("script");
|
62 |
-
var content = sc.textContent || sc.innerText || sc.innerHTML;
|
63 |
-
|
64 |
-
window.editor = CodeMirror(document.getElementById("code"), {
|
65 |
-
lineNumbers: true,
|
66 |
-
mode: "javascript",
|
67 |
-
value: content
|
68 |
-
});
|
69 |
-
|
70 |
-
var waiting;
|
71 |
-
editor.on("change", function() {
|
72 |
-
clearTimeout(waiting);
|
73 |
-
waiting = setTimeout(updateHints, 500);
|
74 |
-
});
|
75 |
-
|
76 |
-
setTimeout(updateHints, 100);
|
77 |
-
};
|
78 |
-
|
79 |
-
"long line to create a horizontal scrollbar, in order to test whether the (non-inline) widgets stay in place when scrolling to the right";
|
80 |
-
</script>
|
81 |
-
<p>This demo runs <a href="http://jshint.com">JSHint</a> over the code
|
82 |
-
in the editor (which is the script used on this page), and
|
83 |
-
inserts <a href="../doc/manual.html#addLineWidget">line widgets</a> to
|
84 |
-
display the warnings that JSHint comes up with.</p>
|
85 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/demo/xmlcomplete.html
DELETED
@@ -1,119 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: XML Autocomplete Demo</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="../doc/docs.css">
|
6 |
-
|
7 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
8 |
-
<link rel="stylesheet" href="../addon/hint/show-hint.css">
|
9 |
-
<script src="../lib/codemirror.js"></script>
|
10 |
-
<script src="../addon/hint/show-hint.js"></script>
|
11 |
-
<script src="../addon/hint/xml-hint.js"></script>
|
12 |
-
<script src="../mode/xml/xml.js"></script>
|
13 |
-
<style>
|
14 |
-
.CodeMirror { border: 1px solid #eee; }
|
15 |
-
</style>
|
16 |
-
<div id=nav>
|
17 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
|
18 |
-
|
19 |
-
<ul>
|
20 |
-
<li><a href="../index.html">Home</a>
|
21 |
-
<li><a href="../doc/manual.html">Manual</a>
|
22 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
23 |
-
</ul>
|
24 |
-
<ul>
|
25 |
-
<li><a class=active href="#">XML Autocomplete</a>
|
26 |
-
</ul>
|
27 |
-
</div>
|
28 |
-
|
29 |
-
<article>
|
30 |
-
<h2>XML Autocomplete Demo</h2>
|
31 |
-
<form><textarea id="code" name="code"><!-- write some xml below -->
|
32 |
-
</textarea></form>
|
33 |
-
|
34 |
-
<p>Press <strong>ctrl-space</strong>, or type a '<' character to
|
35 |
-
activate autocompletion. This demo defines a simple schema that
|
36 |
-
guides completion. The schema can be customized—see
|
37 |
-
the <a href="../doc/manual.html#addon_xml-hint">manual</a>.</p>
|
38 |
-
|
39 |
-
<p>Development of the <code>xml-hint</code> addon was kindly
|
40 |
-
sponsored
|
41 |
-
by <a href="http://www.xperiment.mobi">www.xperiment.mobi</a>.</p>
|
42 |
-
|
43 |
-
<script>
|
44 |
-
var dummy = {
|
45 |
-
attrs: {
|
46 |
-
color: ["red", "green", "blue", "purple", "white", "black", "yellow"],
|
47 |
-
size: ["large", "medium", "small"],
|
48 |
-
description: null
|
49 |
-
},
|
50 |
-
children: []
|
51 |
-
};
|
52 |
-
|
53 |
-
var tags = {
|
54 |
-
"!top": ["top"],
|
55 |
-
"!attrs": {
|
56 |
-
id: null,
|
57 |
-
class: ["A", "B", "C"]
|
58 |
-
},
|
59 |
-
top: {
|
60 |
-
attrs: {
|
61 |
-
lang: ["en", "de", "fr", "nl"],
|
62 |
-
freeform: null
|
63 |
-
},
|
64 |
-
children: ["animal", "plant"]
|
65 |
-
},
|
66 |
-
animal: {
|
67 |
-
attrs: {
|
68 |
-
name: null,
|
69 |
-
isduck: ["yes", "no"]
|
70 |
-
},
|
71 |
-
children: ["wings", "feet", "body", "head", "tail"]
|
72 |
-
},
|
73 |
-
plant: {
|
74 |
-
attrs: {name: null},
|
75 |
-
children: ["leaves", "stem", "flowers"]
|
76 |
-
},
|
77 |
-
wings: dummy, feet: dummy, body: dummy, head: dummy, tail: dummy,
|
78 |
-
leaves: dummy, stem: dummy, flowers: dummy
|
79 |
-
};
|
80 |
-
|
81 |
-
function completeAfter(cm, pred) {
|
82 |
-
var cur = cm.getCursor();
|
83 |
-
if (!pred || pred()) setTimeout(function() {
|
84 |
-
if (!cm.state.completionActive)
|
85 |
-
cm.showHint({completeSingle: false});
|
86 |
-
}, 100);
|
87 |
-
return CodeMirror.Pass;
|
88 |
-
}
|
89 |
-
|
90 |
-
function completeIfAfterLt(cm) {
|
91 |
-
return completeAfter(cm, function() {
|
92 |
-
var cur = cm.getCursor();
|
93 |
-
return cm.getRange(CodeMirror.Pos(cur.line, cur.ch - 1), cur) == "<";
|
94 |
-
});
|
95 |
-
}
|
96 |
-
|
97 |
-
function completeIfInTag(cm) {
|
98 |
-
return completeAfter(cm, function() {
|
99 |
-
var tok = cm.getTokenAt(cm.getCursor());
|
100 |
-
if (tok.type == "string" && (!/['"]/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1)) return false;
|
101 |
-
var inner = CodeMirror.innerMode(cm.getMode(), tok.state).state;
|
102 |
-
return inner.tagName;
|
103 |
-
});
|
104 |
-
}
|
105 |
-
|
106 |
-
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
107 |
-
mode: "xml",
|
108 |
-
lineNumbers: true,
|
109 |
-
extraKeys: {
|
110 |
-
"'<'": completeAfter,
|
111 |
-
"'/'": completeIfAfterLt,
|
112 |
-
"' '": completeIfInTag,
|
113 |
-
"'='": completeIfInTag,
|
114 |
-
"Ctrl-Space": "autocomplete"
|
115 |
-
},
|
116 |
-
hintOptions: {schemaInfo: tags}
|
117 |
-
});
|
118 |
-
</script>
|
119 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/doc/activebookmark.js
DELETED
@@ -1,57 +0,0 @@
|
|
1 |
-
// Kludge in HTML5 tag recognition in IE8
|
2 |
-
document.createElement("section");
|
3 |
-
document.createElement("article");
|
4 |
-
|
5 |
-
(function() {
|
6 |
-
if (!window.addEventListener) return;
|
7 |
-
var pending = false, prevVal = null;
|
8 |
-
|
9 |
-
function updateSoon() {
|
10 |
-
if (!pending) {
|
11 |
-
pending = true;
|
12 |
-
setTimeout(update, 250);
|
13 |
-
}
|
14 |
-
}
|
15 |
-
|
16 |
-
function update() {
|
17 |
-
pending = false;
|
18 |
-
var marks = document.getElementById("nav").getElementsByTagName("a"), found;
|
19 |
-
for (var i = 0; i < marks.length; ++i) {
|
20 |
-
var mark = marks[i], m;
|
21 |
-
if (mark.getAttribute("data-default")) {
|
22 |
-
if (found == null) found = i;
|
23 |
-
} else if (m = mark.href.match(/#(.*)/)) {
|
24 |
-
var ref = document.getElementById(m[1]);
|
25 |
-
if (ref && ref.getBoundingClientRect().top < 50)
|
26 |
-
found = i;
|
27 |
-
}
|
28 |
-
}
|
29 |
-
if (found != null && found != prevVal) {
|
30 |
-
prevVal = found;
|
31 |
-
var lis = document.getElementById("nav").getElementsByTagName("li");
|
32 |
-
for (var i = 0; i < lis.length; ++i) lis[i].className = "";
|
33 |
-
for (var i = 0; i < marks.length; ++i) {
|
34 |
-
if (found == i) {
|
35 |
-
marks[i].className = "active";
|
36 |
-
for (var n = marks[i]; n; n = n.parentNode)
|
37 |
-
if (n.nodeName == "LI") n.className = "active";
|
38 |
-
} else {
|
39 |
-
marks[i].className = "";
|
40 |
-
}
|
41 |
-
}
|
42 |
-
}
|
43 |
-
}
|
44 |
-
|
45 |
-
window.addEventListener("scroll", updateSoon);
|
46 |
-
window.addEventListener("load", updateSoon);
|
47 |
-
window.addEventListener("hashchange", function() {
|
48 |
-
setTimeout(function() {
|
49 |
-
var hash = document.location.hash, found = null, m;
|
50 |
-
var marks = document.getElementById("nav").getElementsByTagName("a");
|
51 |
-
for (var i = 0; i < marks.length; i++)
|
52 |
-
if ((m = marks[i].href.match(/(#.*)/)) && m[1] == hash) { found = i; break; }
|
53 |
-
if (found != null) for (var i = 0; i < marks.length; i++)
|
54 |
-
marks[i].className = i == found ? "active" : "";
|
55 |
-
}, 300);
|
56 |
-
});
|
57 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/doc/docs.css
DELETED
@@ -1,274 +0,0 @@
|
|
1 |
-
@font-face {
|
2 |
-
font-family: 'Source Sans Pro';
|
3 |
-
font-style: normal;
|
4 |
-
font-weight: 400;
|
5 |
-
src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(//themes.googleusercontent.com/static/fonts/sourcesanspro/v5/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff) format('woff');
|
6 |
-
}
|
7 |
-
|
8 |
-
body, html { margin: 0; padding: 0; height: 100%; }
|
9 |
-
section, article { display: block; padding: 0; }
|
10 |
-
|
11 |
-
body {
|
12 |
-
background: #f8f8f8;
|
13 |
-
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
14 |
-
line-height: 1.5;
|
15 |
-
}
|
16 |
-
|
17 |
-
p { margin-top: 0; }
|
18 |
-
|
19 |
-
h2, h3, h1 {
|
20 |
-
font-weight: normal;
|
21 |
-
margin-bottom: .7em;
|
22 |
-
}
|
23 |
-
h1 { font-size: 140%; }
|
24 |
-
h2 { font-size: 120%; }
|
25 |
-
h3 { font-size: 110%; }
|
26 |
-
article > h2:first-child, section:first-child > h2 { margin-top: 0; }
|
27 |
-
|
28 |
-
#nav h1 {
|
29 |
-
margin-right: 12px;
|
30 |
-
margin-top: 0;
|
31 |
-
margin-bottom: 2px;
|
32 |
-
color: #d30707;
|
33 |
-
letter-spacing: .5px;
|
34 |
-
}
|
35 |
-
|
36 |
-
a, a:visited, a:link, .quasilink {
|
37 |
-
color: #A21313;
|
38 |
-
}
|
39 |
-
|
40 |
-
em {
|
41 |
-
padding-right: 2px;
|
42 |
-
}
|
43 |
-
|
44 |
-
.quasilink {
|
45 |
-
cursor: pointer;
|
46 |
-
}
|
47 |
-
|
48 |
-
article {
|
49 |
-
max-width: 700px;
|
50 |
-
margin: 0 0 0 160px;
|
51 |
-
border-left: 2px solid #E30808;
|
52 |
-
border-right: 1px solid #ddd;
|
53 |
-
padding: 30px 50px 100px 50px;
|
54 |
-
background: white;
|
55 |
-
z-index: 2;
|
56 |
-
position: relative;
|
57 |
-
min-height: 100%;
|
58 |
-
box-sizing: border-box;
|
59 |
-
-moz-box-sizing: border-box;
|
60 |
-
}
|
61 |
-
|
62 |
-
#nav {
|
63 |
-
position: fixed;
|
64 |
-
padding-top: 30px;
|
65 |
-
max-height: 100%;
|
66 |
-
box-sizing: -moz-border-box;
|
67 |
-
box-sizing: border-box;
|
68 |
-
overflow-y: auto;
|
69 |
-
left: 0; right: none;
|
70 |
-
width: 160px;
|
71 |
-
text-align: right;
|
72 |
-
z-index: 1;
|
73 |
-
}
|
74 |
-
|
75 |
-
@media screen and (min-width: 1000px) {
|
76 |
-
article {
|
77 |
-
margin: 0 auto;
|
78 |
-
}
|
79 |
-
#nav {
|
80 |
-
right: 50%;
|
81 |
-
width: auto;
|
82 |
-
border-right: 349px solid transparent;
|
83 |
-
}
|
84 |
-
}
|
85 |
-
|
86 |
-
#nav ul {
|
87 |
-
display: block;
|
88 |
-
margin: 0; padding: 0;
|
89 |
-
margin-bottom: 32px;
|
90 |
-
}
|
91 |
-
|
92 |
-
#nav a {
|
93 |
-
text-decoration: none;
|
94 |
-
}
|
95 |
-
|
96 |
-
#nav li {
|
97 |
-
display: block;
|
98 |
-
margin-bottom: 4px;
|
99 |
-
}
|
100 |
-
|
101 |
-
#nav li ul {
|
102 |
-
font-size: 80%;
|
103 |
-
margin-bottom: 0;
|
104 |
-
display: none;
|
105 |
-
}
|
106 |
-
|
107 |
-
#nav li.active ul {
|
108 |
-
display: block;
|
109 |
-
}
|
110 |
-
|
111 |
-
#nav li li a {
|
112 |
-
padding-right: 20px;
|
113 |
-
display: inline-block;
|
114 |
-
}
|
115 |
-
|
116 |
-
#nav ul a {
|
117 |
-
color: black;
|
118 |
-
padding: 0 7px 1px 11px;
|
119 |
-
}
|
120 |
-
|
121 |
-
#nav ul a.active, #nav ul a:hover {
|
122 |
-
border-bottom: 1px solid #E30808;
|
123 |
-
margin-bottom: -1px;
|
124 |
-
color: #E30808;
|
125 |
-
}
|
126 |
-
|
127 |
-
#logo {
|
128 |
-
border: 0;
|
129 |
-
margin-right: 12px;
|
130 |
-
margin-bottom: 25px;
|
131 |
-
}
|
132 |
-
|
133 |
-
section {
|
134 |
-
border-top: 1px solid #E30808;
|
135 |
-
margin: 1.5em 0;
|
136 |
-
}
|
137 |
-
|
138 |
-
section.first {
|
139 |
-
border: none;
|
140 |
-
margin-top: 0;
|
141 |
-
}
|
142 |
-
|
143 |
-
#demo {
|
144 |
-
position: relative;
|
145 |
-
}
|
146 |
-
|
147 |
-
#demolist {
|
148 |
-
position: absolute;
|
149 |
-
right: 5px;
|
150 |
-
top: 5px;
|
151 |
-
z-index: 25;
|
152 |
-
}
|
153 |
-
|
154 |
-
.yinyang {
|
155 |
-
position: absolute;
|
156 |
-
top: -10px;
|
157 |
-
left: 0; right: 0;
|
158 |
-
margin: auto;
|
159 |
-
display: block;
|
160 |
-
height: 120px;
|
161 |
-
}
|
162 |
-
|
163 |
-
.actions {
|
164 |
-
margin: 1em 0 0;
|
165 |
-
min-height: 100px;
|
166 |
-
position: relative;
|
167 |
-
}
|
168 |
-
|
169 |
-
.actionspicture {
|
170 |
-
pointer-events: none;
|
171 |
-
position: absolute;
|
172 |
-
height: 100px;
|
173 |
-
top: 0; left: 0; right: 0;
|
174 |
-
}
|
175 |
-
|
176 |
-
.actionlink {
|
177 |
-
pointer-events: auto;
|
178 |
-
font-family: arial;
|
179 |
-
font-size: 80%;
|
180 |
-
font-weight: bold;
|
181 |
-
position: absolute;
|
182 |
-
top: 0; bottom: 0;
|
183 |
-
line-height: 1;
|
184 |
-
height: 1em;
|
185 |
-
margin: auto;
|
186 |
-
}
|
187 |
-
|
188 |
-
.actionlink.download {
|
189 |
-
color: white;
|
190 |
-
right: 50%;
|
191 |
-
margin-right: 13px;
|
192 |
-
text-shadow: -1px 1px 3px #b00, -1px -1px 3px #b00, 1px 0px 3px #b00;
|
193 |
-
}
|
194 |
-
|
195 |
-
.actionlink.fund {
|
196 |
-
color: #b00;
|
197 |
-
left: 50%;
|
198 |
-
margin-left: 15px;
|
199 |
-
}
|
200 |
-
|
201 |
-
.actionlink:hover {
|
202 |
-
text-decoration: underline;
|
203 |
-
}
|
204 |
-
|
205 |
-
.actionlink a {
|
206 |
-
color: inherit;
|
207 |
-
}
|
208 |
-
|
209 |
-
.actionsleft {
|
210 |
-
float: left;
|
211 |
-
}
|
212 |
-
|
213 |
-
.actionsright {
|
214 |
-
float: right;
|
215 |
-
text-align: right;
|
216 |
-
}
|
217 |
-
|
218 |
-
@media screen and (max-width: 800px) {
|
219 |
-
.actions {
|
220 |
-
padding-top: 120px;
|
221 |
-
}
|
222 |
-
.actionsleft, .actionsright {
|
223 |
-
float: none;
|
224 |
-
text-align: left;
|
225 |
-
margin-bottom: 1em;
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
th {
|
230 |
-
text-decoration: underline;
|
231 |
-
font-weight: normal;
|
232 |
-
text-align: left;
|
233 |
-
}
|
234 |
-
|
235 |
-
#features ul {
|
236 |
-
list-style: none;
|
237 |
-
margin: 0 0 1em;
|
238 |
-
padding: 0 0 0 1.2em;
|
239 |
-
}
|
240 |
-
|
241 |
-
#features li:before {
|
242 |
-
content: "-";
|
243 |
-
width: 1em;
|
244 |
-
display: inline-block;
|
245 |
-
padding: 0;
|
246 |
-
margin: 0;
|
247 |
-
margin-left: -1em;
|
248 |
-
}
|
249 |
-
|
250 |
-
.rel {
|
251 |
-
margin-bottom: 0;
|
252 |
-
}
|
253 |
-
.rel-note {
|
254 |
-
margin-top: 0;
|
255 |
-
color: #555;
|
256 |
-
}
|
257 |
-
|
258 |
-
pre {
|
259 |
-
padding-left: 15px;
|
260 |
-
border-left: 2px solid #ddd;
|
261 |
-
}
|
262 |
-
|
263 |
-
code {
|
264 |
-
padding: 0 2px;
|
265 |
-
}
|
266 |
-
|
267 |
-
strong {
|
268 |
-
text-decoration: underline;
|
269 |
-
font-weight: normal;
|
270 |
-
}
|
271 |
-
|
272 |
-
.field {
|
273 |
-
border: 1px solid #A21313;
|
274 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/doc/internals.html
DELETED
@@ -1,504 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Internals</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="docs.css">
|
6 |
-
<style>dl dl {margin: 0;} .update {color: #d40 !important}</style>
|
7 |
-
<script src="activebookmark.js"></script>
|
8 |
-
|
9 |
-
<div id=nav>
|
10 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
|
11 |
-
|
12 |
-
<ul>
|
13 |
-
<li><a href="../index.html">Home</a>
|
14 |
-
<li><a href="manual.html">Manual</a>
|
15 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
16 |
-
</ul>
|
17 |
-
<ul>
|
18 |
-
<li><a href="#top">Introduction</a></li>
|
19 |
-
<li><a href="#approach">General Approach</a></li>
|
20 |
-
<li><a href="#input">Input</a></li>
|
21 |
-
<li><a href="#selection">Selection</a></li>
|
22 |
-
<li><a href="#update">Intelligent Updating</a></li>
|
23 |
-
<li><a href="#parse">Parsing</a></li>
|
24 |
-
<li><a href="#summary">What Gives?</a></li>
|
25 |
-
<li><a href="#btree">Content Representation</a></li>
|
26 |
-
<li><a href="#keymap">Key Maps</a></li>
|
27 |
-
</ul>
|
28 |
-
</div>
|
29 |
-
|
30 |
-
<article>
|
31 |
-
|
32 |
-
<h2 id=top>(Re-) Implementing A Syntax-Highlighting Editor in JavaScript</h2>
|
33 |
-
|
34 |
-
<p style="font-size: 85%" id="intro">
|
35 |
-
<strong>Topic:</strong> JavaScript, code editor implementation<br>
|
36 |
-
<strong>Author:</strong> Marijn Haverbeke<br>
|
37 |
-
<strong>Date:</strong> March 2nd 2011 (updated November 13th 2011)
|
38 |
-
</p>
|
39 |
-
|
40 |
-
<p style="padding: 0 3em 0 2em"><strong>Caution</strong>: this text was written briefly after
|
41 |
-
version 2 was initially written. It no longer (even including the
|
42 |
-
update at the bottom) fully represents the current implementation. I'm
|
43 |
-
leaving it here as a historic document. For more up-to-date
|
44 |
-
information, look at the entries
|
45 |
-
tagged <a href="http://marijnhaverbeke.nl/blog/#cm-internals">cm-internals</a>
|
46 |
-
on my blog.</p>
|
47 |
-
|
48 |
-
<p>This is a followup to
|
49 |
-
my <a href="https://codemirror.net/story.html">Brutal Odyssey to the
|
50 |
-
Dark Side of the DOM Tree</a> story. That one describes the
|
51 |
-
mind-bending process of implementing (what would become) CodeMirror 1.
|
52 |
-
This one describes the internals of CodeMirror 2, a complete rewrite
|
53 |
-
and rethink of the old code base. I wanted to give this piece another
|
54 |
-
Hunter Thompson copycat subtitle, but somehow that would be out of
|
55 |
-
place—the process this time around was one of straightforward
|
56 |
-
engineering, requiring no serious mind-bending whatsoever.</p>
|
57 |
-
|
58 |
-
<p>So, what is wrong with CodeMirror 1? I'd estimate, by mailing list
|
59 |
-
activity and general search-engine presence, that it has been
|
60 |
-
integrated into about a thousand systems by now. The most prominent
|
61 |
-
one, since a few weeks,
|
62 |
-
being <a href="http://googlecode.blogspot.com/2011/01/make-quick-fixes-quicker-on-google.html">Google
|
63 |
-
code's project hosting</a>. It works, and it's being used widely.</p>
|
64 |
-
|
65 |
-
<p>Still, I did not start replacing it because I was bored. CodeMirror
|
66 |
-
1 was heavily reliant on <code>designMode</code>
|
67 |
-
or <code>contentEditable</code> (depending on the browser). Neither of
|
68 |
-
these are well specified (HTML5 tries
|
69 |
-
to <a href="http://www.w3.org/TR/html5/editing.html#contenteditable">specify</a>
|
70 |
-
their basics), and, more importantly, they tend to be one of the more
|
71 |
-
obscure and buggy areas of browser functionality—CodeMirror, by using
|
72 |
-
this functionality in a non-typical way, was constantly running up
|
73 |
-
against browser bugs. WebKit wouldn't show an empty line at the end of
|
74 |
-
the document, and in some releases would suddenly get unbearably slow.
|
75 |
-
Firefox would show the cursor in the wrong place. Internet Explorer
|
76 |
-
would insist on linkifying everything that looked like a URL or email
|
77 |
-
address, a behaviour that can't be turned off. Some bugs I managed to
|
78 |
-
work around (which was often a frustrating, painful process), others,
|
79 |
-
such as the Firefox cursor placement, I gave up on, and had to tell
|
80 |
-
user after user that they were known problems, but not something I
|
81 |
-
could help.</p>
|
82 |
-
|
83 |
-
<p>Also, there is the fact that <code>designMode</code> (which seemed
|
84 |
-
to be less buggy than <code>contentEditable</code> in Webkit and
|
85 |
-
Firefox, and was thus used by CodeMirror 1 in those browsers) requires
|
86 |
-
a frame. Frames are another tricky area. It takes some effort to
|
87 |
-
prevent getting tripped up by domain restrictions, they don't
|
88 |
-
initialize synchronously, behave strangely in response to the back
|
89 |
-
button, and, on several browsers, can't be moved around the DOM
|
90 |
-
without having them re-initialize. They did provide a very nice way to
|
91 |
-
namespace the library, though—CodeMirror 1 could freely pollute the
|
92 |
-
namespace inside the frame.</p>
|
93 |
-
|
94 |
-
<p>Finally, working with an editable document means working with
|
95 |
-
selection in arbitrary DOM structures. Internet Explorer (8 and
|
96 |
-
before) has an utterly different (and awkward) selection API than all
|
97 |
-
of the other browsers, and even among the different implementations of
|
98 |
-
<code>document.selection</code>, details about how exactly a selection
|
99 |
-
is represented vary quite a bit. Add to that the fact that Opera's
|
100 |
-
selection support tended to be very buggy until recently, and you can
|
101 |
-
imagine why CodeMirror 1 contains 700 lines of selection-handling
|
102 |
-
code.</p>
|
103 |
-
|
104 |
-
<p>And that brings us to the main issue with the CodeMirror 1
|
105 |
-
code base: The proportion of browser-bug-workarounds to real
|
106 |
-
application code was getting dangerously high. By building on top of a
|
107 |
-
few dodgy features, I put the system in a vulnerable position—any
|
108 |
-
incompatibility and bugginess in these features, I had to paper over
|
109 |
-
with my own code. Not only did I have to do some serious stunt-work to
|
110 |
-
get it to work on older browsers (as detailed in the
|
111 |
-
previous <a href="https://codemirror.net/story.html">story</a>), things
|
112 |
-
also kept breaking in newly released versions, requiring me to come up
|
113 |
-
with <em>new</em> scary hacks in order to keep up. This was starting
|
114 |
-
to lose its appeal.</p>
|
115 |
-
|
116 |
-
<section id=approach>
|
117 |
-
<h2>General Approach</h2>
|
118 |
-
|
119 |
-
<p>What CodeMirror 2 does is try to sidestep most of the hairy hacks
|
120 |
-
that came up in version 1. I owe a lot to the
|
121 |
-
<a href="http://ace.ajax.org">ACE</a> editor for inspiration on how to
|
122 |
-
approach this.</p>
|
123 |
-
|
124 |
-
<p>I absolutely did not want to be completely reliant on key events to
|
125 |
-
generate my input. Every JavaScript programmer knows that key event
|
126 |
-
information is horrible and incomplete. Some people (most awesomely
|
127 |
-
Mihai Bazon with <a href="http://ymacs.org">Ymacs</a>) have been able
|
128 |
-
to build more or less functioning editors by directly reading key
|
129 |
-
events, but it takes a lot of work (the kind of never-ending, fragile
|
130 |
-
work I described earlier), and will never be able to properly support
|
131 |
-
things like multi-keystoke international character
|
132 |
-
input. <a href="#keymap" class="update">[see below for caveat]</a></p>
|
133 |
-
|
134 |
-
<p>So what I do is focus a hidden textarea, and let the browser
|
135 |
-
believe that the user is typing into that. What we show to the user is
|
136 |
-
a DOM structure we built to represent his document. If this is updated
|
137 |
-
quickly enough, and shows some kind of believable cursor, it feels
|
138 |
-
like a real text-input control.</p>
|
139 |
-
|
140 |
-
<p>Another big win is that this DOM representation does not have to
|
141 |
-
span the whole document. Some CodeMirror 1 users insisted that they
|
142 |
-
needed to put a 30 thousand line XML document into CodeMirror. Putting
|
143 |
-
all that into the DOM takes a while, especially since, for some
|
144 |
-
reason, an editable DOM tree is slower than a normal one on most
|
145 |
-
browsers. If we have full control over what we show, we must only
|
146 |
-
ensure that the visible part of the document has been added, and can
|
147 |
-
do the rest only when needed. (Fortunately, the <code>onscroll</code>
|
148 |
-
event works almost the same on all browsers, and lends itself well to
|
149 |
-
displaying things only as they are scrolled into view.)</p>
|
150 |
-
</section>
|
151 |
-
<section id="input">
|
152 |
-
<h2>Input</h2>
|
153 |
-
|
154 |
-
<p>ACE uses its hidden textarea only as a text input shim, and does
|
155 |
-
all cursor movement and things like text deletion itself by directly
|
156 |
-
handling key events. CodeMirror's way is to let the browser do its
|
157 |
-
thing as much as possible, and not, for example, define its own set of
|
158 |
-
key bindings. One way to do this would have been to have the whole
|
159 |
-
document inside the hidden textarea, and after each key event update
|
160 |
-
the display DOM to reflect what's in that textarea.</p>
|
161 |
-
|
162 |
-
<p>That'd be simple, but it is not realistic. For even medium-sized
|
163 |
-
document the editor would be constantly munging huge strings, and get
|
164 |
-
terribly slow. What CodeMirror 2 does is put the current selection,
|
165 |
-
along with an extra line on the top and on the bottom, into the
|
166 |
-
textarea.</p>
|
167 |
-
|
168 |
-
<p>This means that the arrow keys (and their ctrl-variations), home,
|
169 |
-
end, etcetera, do not have to be handled specially. We just read the
|
170 |
-
cursor position in the textarea, and update our cursor to match it.
|
171 |
-
Also, copy and paste work pretty much for free, and people get their
|
172 |
-
native key bindings, without any special work on my part. For example,
|
173 |
-
I have emacs key bindings configured for Chrome and Firefox. There is
|
174 |
-
no way for a script to detect this. <a class="update"
|
175 |
-
href="#keymap">[no longer the case]</a></p>
|
176 |
-
|
177 |
-
<p>Of course, since only a small part of the document sits in the
|
178 |
-
textarea, keys like page up and ctrl-end won't do the right thing.
|
179 |
-
CodeMirror is catching those events and handling them itself.</p>
|
180 |
-
</section>
|
181 |
-
<section id="selection">
|
182 |
-
<h2>Selection</h2>
|
183 |
-
|
184 |
-
<p>Getting and setting the selection range of a textarea in modern
|
185 |
-
browsers is trivial—you just use the <code>selectionStart</code>
|
186 |
-
and <code>selectionEnd</code> properties. On IE you have to do some
|
187 |
-
insane stuff with temporary ranges and compensating for the fact that
|
188 |
-
moving the selection by a 'character' will treat \r\n as a single
|
189 |
-
character, but even there it is possible to build functions that
|
190 |
-
reliably set and get the selection range.</p>
|
191 |
-
|
192 |
-
<p>But consider this typical case: When I'm somewhere in my document,
|
193 |
-
press shift, and press the up arrow, something gets selected. Then, if
|
194 |
-
I, still holding shift, press the up arrow again, the top of my
|
195 |
-
selection is adjusted. The selection remembers where its <em>head</em>
|
196 |
-
and its <em>anchor</em> are, and moves the head when we shift-move.
|
197 |
-
This is a generally accepted property of selections, and done right by
|
198 |
-
every editing component built in the past twenty years.</p>
|
199 |
-
|
200 |
-
<p>But not something that the browser selection APIs expose.</p>
|
201 |
-
|
202 |
-
<p>Great. So when someone creates an 'upside-down' selection, the next
|
203 |
-
time CodeMirror has to update the textarea, it'll re-create the
|
204 |
-
selection as an 'upside-up' selection, with the anchor at the top, and
|
205 |
-
the next cursor motion will behave in an unexpected way—our second
|
206 |
-
up-arrow press in the example above will not do anything, since it is
|
207 |
-
interpreted in exactly the same way as the first.</p>
|
208 |
-
|
209 |
-
<p>No problem. We'll just, ehm, detect that the selection is
|
210 |
-
upside-down (you can tell by the way it was created), and then, when
|
211 |
-
an upside-down selection is present, and a cursor-moving key is
|
212 |
-
pressed in combination with shift, we quickly collapse the selection
|
213 |
-
in the textarea to its start, allow the key to take effect, and then
|
214 |
-
combine its new head with its old anchor to get the <em>real</em>
|
215 |
-
selection.</p>
|
216 |
-
|
217 |
-
<p>In short, scary hacks could not be avoided entirely in CodeMirror
|
218 |
-
2.</p>
|
219 |
-
|
220 |
-
<p>And, the observant reader might ask, how do you even know that a
|
221 |
-
key combo is a cursor-moving combo, if you claim you support any
|
222 |
-
native key bindings? Well, we don't, but we can learn. The editor
|
223 |
-
keeps a set known cursor-movement combos (initialized to the
|
224 |
-
predictable defaults), and updates this set when it observes that
|
225 |
-
pressing a certain key had (only) the effect of moving the cursor.
|
226 |
-
This, of course, doesn't work if the first time the key is used was
|
227 |
-
for extending an inverted selection, but it works most of the
|
228 |
-
time.</p>
|
229 |
-
</section>
|
230 |
-
<section id="update">
|
231 |
-
<h2>Intelligent Updating</h2>
|
232 |
-
|
233 |
-
<p>One thing that always comes up when you have a complicated internal
|
234 |
-
state that's reflected in some user-visible external representation
|
235 |
-
(in this case, the displayed code and the textarea's content) is
|
236 |
-
keeping the two in sync. The naive way is to just update the display
|
237 |
-
every time you change your state, but this is not only error prone
|
238 |
-
(you'll forget), it also easily leads to duplicate work on big,
|
239 |
-
composite operations. Then you start passing around flags indicating
|
240 |
-
whether the display should be updated in an attempt to be efficient
|
241 |
-
again and, well, at that point you might as well give up completely.</p>
|
242 |
-
|
243 |
-
<p>I did go down that road, but then switched to a much simpler model:
|
244 |
-
simply keep track of all the things that have been changed during an
|
245 |
-
action, and then, only at the end, use this information to update the
|
246 |
-
user-visible display.</p>
|
247 |
-
|
248 |
-
<p>CodeMirror uses a concept of <em>operations</em>, which start by
|
249 |
-
calling a specific set-up function that clears the state and end by
|
250 |
-
calling another function that reads this state and does the required
|
251 |
-
updating. Most event handlers, and all the user-visible methods that
|
252 |
-
change state are wrapped like this. There's a method
|
253 |
-
called <code>operation</code> that accepts a function, and returns
|
254 |
-
another function that wraps the given function as an operation.</p>
|
255 |
-
|
256 |
-
<p>It's trivial to extend this (as CodeMirror does) to detect nesting,
|
257 |
-
and, when an operation is started inside an operation, simply
|
258 |
-
increment the nesting count, and only do the updating when this count
|
259 |
-
reaches zero again.</p>
|
260 |
-
|
261 |
-
<p>If we have a set of changed ranges and know the currently shown
|
262 |
-
range, we can (with some awkward code to deal with the fact that
|
263 |
-
changes can add and remove lines, so we're dealing with a changing
|
264 |
-
coordinate system) construct a map of the ranges that were left
|
265 |
-
intact. We can then compare this map with the part of the document
|
266 |
-
that's currently visible (based on scroll offset and editor height) to
|
267 |
-
determine whether something needs to be updated.</p>
|
268 |
-
|
269 |
-
<p>CodeMirror uses two update algorithms—a full refresh, where it just
|
270 |
-
discards the whole part of the DOM that contains the edited text and
|
271 |
-
rebuilds it, and a patch algorithm, where it uses the information
|
272 |
-
about changed and intact ranges to update only the out-of-date parts
|
273 |
-
of the DOM. When more than 30 percent (which is the current heuristic,
|
274 |
-
might change) of the lines need to be updated, the full refresh is
|
275 |
-
chosen (since it's faster to do than painstakingly finding and
|
276 |
-
updating all the changed lines), in the other case it does the
|
277 |
-
patching (so that, if you scroll a line or select another character,
|
278 |
-
the whole screen doesn't have to be
|
279 |
-
re-rendered). <span class="update">[the full-refresh
|
280 |
-
algorithm was dropped, it wasn't really faster than the patching
|
281 |
-
one]</span></p>
|
282 |
-
|
283 |
-
<p>All updating uses <code>innerHTML</code> rather than direct DOM
|
284 |
-
manipulation, since that still seems to be by far the fastest way to
|
285 |
-
build documents. There's a per-line function that combines the
|
286 |
-
highlighting, <a href="manual.html#markText">marking</a>, and
|
287 |
-
selection info for that line into a snippet of HTML. The patch updater
|
288 |
-
uses this to reset individual lines, the refresh updater builds an
|
289 |
-
HTML chunk for the whole visible document at once, and then uses a
|
290 |
-
single <code>innerHTML</code> update to do the refresh.</p>
|
291 |
-
</section>
|
292 |
-
<section id="parse">
|
293 |
-
<h2>Parsers can be Simple</h2>
|
294 |
-
|
295 |
-
<p>When I wrote CodeMirror 1, I
|
296 |
-
thought <a href="https://codemirror.net/story.html#parser">interruptable
|
297 |
-
parsers</a> were a hugely scary and complicated thing, and I used a
|
298 |
-
bunch of heavyweight abstractions to keep this supposed complexity
|
299 |
-
under control: parsers
|
300 |
-
were <a href="http://bob.pythonmac.org/archives/2005/07/06/iteration-in-javascript/">iterators</a>
|
301 |
-
that consumed input from another iterator, and used funny
|
302 |
-
closure-resetting tricks to copy and resume themselves.</p>
|
303 |
-
|
304 |
-
<p>This made for a rather nice system, in that parsers formed strictly
|
305 |
-
separate modules, and could be composed in predictable ways.
|
306 |
-
Unfortunately, it was quite slow (stacking three or four iterators on
|
307 |
-
top of each other), and extremely intimidating to people not used to a
|
308 |
-
functional programming style.</p>
|
309 |
-
|
310 |
-
<p>With a few small changes, however, we can keep all those
|
311 |
-
advantages, but simplify the API and make the whole thing less
|
312 |
-
indirect and inefficient. CodeMirror
|
313 |
-
2's <a href="manual.html#modeapi">mode API</a> uses explicit state
|
314 |
-
objects, and makes the parser/tokenizer a function that simply takes a
|
315 |
-
state and a character stream abstraction, advances the stream one
|
316 |
-
token, and returns the way the token should be styled. This state may
|
317 |
-
be copied, optionally in a mode-defined way, in order to be able to
|
318 |
-
continue a parse at a given point. Even someone who's never touched a
|
319 |
-
lambda in his life can understand this approach. Additionally, far
|
320 |
-
fewer objects are allocated in the course of parsing now.</p>
|
321 |
-
|
322 |
-
<p>The biggest speedup comes from the fact that the parsing no longer
|
323 |
-
has to touch the DOM though. In CodeMirror 1, on an older browser, you
|
324 |
-
could <em>see</em> the parser work its way through the document,
|
325 |
-
managing some twenty lines in each 50-millisecond time slice it got. It
|
326 |
-
was reading its input from the DOM, and updating the DOM as it went
|
327 |
-
along, which any experienced JavaScript programmer will immediately
|
328 |
-
spot as a recipe for slowness. In CodeMirror 2, the parser usually
|
329 |
-
finishes the whole document in a single 100-millisecond time slice—it
|
330 |
-
manages some 1500 lines during that time on Chrome. All it has to do
|
331 |
-
is munge strings, so there is no real reason for it to be slow
|
332 |
-
anymore.</p>
|
333 |
-
</section>
|
334 |
-
<section id="summary">
|
335 |
-
<h2>What Gives?</h2>
|
336 |
-
|
337 |
-
<p>Given all this, what can you expect from CodeMirror 2?</p>
|
338 |
-
|
339 |
-
<ul>
|
340 |
-
|
341 |
-
<li><strong>Small.</strong> the base library is
|
342 |
-
some <span class="update">45k</span> when minified
|
343 |
-
now, <span class="update">17k</span> when gzipped. It's smaller than
|
344 |
-
its own logo.</li>
|
345 |
-
|
346 |
-
<li><strong>Lightweight.</strong> CodeMirror 2 initializes very
|
347 |
-
quickly, and does almost no work when it is not focused. This means
|
348 |
-
you can treat it almost like a textarea, have multiple instances on a
|
349 |
-
page without trouble.</li>
|
350 |
-
|
351 |
-
<li><strong>Huge document support.</strong> Since highlighting is
|
352 |
-
really fast, and no DOM structure is being built for non-visible
|
353 |
-
content, you don't have to worry about locking up your browser when a
|
354 |
-
user enters a megabyte-sized document.</li>
|
355 |
-
|
356 |
-
<li><strong>Extended API.</strong> Some things kept coming up in the
|
357 |
-
mailing list, such as marking pieces of text or lines, which were
|
358 |
-
extremely hard to do with CodeMirror 1. The new version has proper
|
359 |
-
support for these built in.</li>
|
360 |
-
|
361 |
-
<li><strong>Tab support.</strong> Tabs inside editable documents were,
|
362 |
-
for some reason, a no-go. At least six different people announced they
|
363 |
-
were going to add tab support to CodeMirror 1, none survived (I mean,
|
364 |
-
none delivered a working version). CodeMirror 2 no longer removes tabs
|
365 |
-
from your document.</li>
|
366 |
-
|
367 |
-
<li><strong>Sane styling.</strong> <code>iframe</code> nodes aren't
|
368 |
-
really known for respecting document flow. Now that an editor instance
|
369 |
-
is a plain <code>div</code> element, it is much easier to size it to
|
370 |
-
fit the surrounding elements. You don't even have to make it scroll if
|
371 |
-
you do not <a href="../demo/resize.html">want to</a>.</li>
|
372 |
-
|
373 |
-
</ul>
|
374 |
-
|
375 |
-
<p>On the downside, a CodeMirror 2 instance is <em>not</em> a native
|
376 |
-
editable component. Though it does its best to emulate such a
|
377 |
-
component as much as possible, there is functionality that browsers
|
378 |
-
just do not allow us to hook into. Doing select-all from the context
|
379 |
-
menu, for example, is not currently detected by CodeMirror.</p>
|
380 |
-
|
381 |
-
<p id="changes" style="margin-top: 2em;"><span style="font-weight:
|
382 |
-
bold">[Updates from November 13th 2011]</span> Recently, I've made
|
383 |
-
some changes to the codebase that cause some of the text above to no
|
384 |
-
longer be current. I've left the text intact, but added markers at the
|
385 |
-
passages that are now inaccurate. The new situation is described
|
386 |
-
below.</p>
|
387 |
-
</section>
|
388 |
-
<section id="btree">
|
389 |
-
<h2>Content Representation</h2>
|
390 |
-
|
391 |
-
<p>The original implementation of CodeMirror 2 represented the
|
392 |
-
document as a flat array of line objects. This worked well—splicing
|
393 |
-
arrays will require the part of the array after the splice to be
|
394 |
-
moved, but this is basically just a simple <code>memmove</code> of a
|
395 |
-
bunch of pointers, so it is cheap even for huge documents.</p>
|
396 |
-
|
397 |
-
<p>However, I recently added line wrapping and code folding (line
|
398 |
-
collapsing, basically). Once lines start taking up a non-constant
|
399 |
-
amount of vertical space, looking up a line by vertical position
|
400 |
-
(which is needed when someone clicks the document, and to determine
|
401 |
-
the visible part of the document during scrolling) can only be done
|
402 |
-
with a linear scan through the whole array, summing up line heights as
|
403 |
-
you go. Seeing how I've been going out of my way to make big documents
|
404 |
-
fast, this is not acceptable.</p>
|
405 |
-
|
406 |
-
<p>The new representation is based on a B-tree. The leaves of the tree
|
407 |
-
contain arrays of line objects, with a fixed minimum and maximum size,
|
408 |
-
and the non-leaf nodes simply hold arrays of child nodes. Each node
|
409 |
-
stores both the amount of lines that live below them and the vertical
|
410 |
-
space taken up by these lines. This allows the tree to be indexed both
|
411 |
-
by line number and by vertical position, and all access has
|
412 |
-
logarithmic complexity in relation to the document size.</p>
|
413 |
-
|
414 |
-
<p>I gave line objects and tree nodes parent pointers, to the node
|
415 |
-
above them. When a line has to update its height, it can simply walk
|
416 |
-
these pointers to the top of the tree, adding or subtracting the
|
417 |
-
difference in height from each node it encounters. The parent pointers
|
418 |
-
also make it cheaper (in complexity terms, the difference is probably
|
419 |
-
tiny in normal-sized documents) to find the current line number when
|
420 |
-
given a line object. In the old approach, the whole document array had
|
421 |
-
to be searched. Now, we can just walk up the tree and count the sizes
|
422 |
-
of the nodes coming before us at each level.</p>
|
423 |
-
|
424 |
-
<p>I chose B-trees, not regular binary trees, mostly because they
|
425 |
-
allow for very fast bulk insertions and deletions. When there is a big
|
426 |
-
change to a document, it typically involves adding, deleting, or
|
427 |
-
replacing a chunk of subsequent lines. In a regular balanced tree, all
|
428 |
-
these inserts or deletes would have to be done separately, which could
|
429 |
-
be really expensive. In a B-tree, to insert a chunk, you just walk
|
430 |
-
down the tree once to find where it should go, insert them all in one
|
431 |
-
shot, and then break up the node if needed. This breaking up might
|
432 |
-
involve breaking up nodes further up, but only requires a single pass
|
433 |
-
back up the tree. For deletion, I'm somewhat lax in keeping things
|
434 |
-
balanced—I just collapse nodes into a leaf when their child count goes
|
435 |
-
below a given number. This means that there are some weird editing
|
436 |
-
patterns that may result in a seriously unbalanced tree, but even such
|
437 |
-
an unbalanced tree will perform well, unless you spend a day making
|
438 |
-
strangely repeating edits to a really big document.</p>
|
439 |
-
</section>
|
440 |
-
<section id="keymap">
|
441 |
-
<h2>Keymaps</h2>
|
442 |
-
|
443 |
-
<p><a href="#approach">Above</a>, I claimed that directly catching key
|
444 |
-
events for things like cursor movement is impractical because it
|
445 |
-
requires some browser-specific kludges. I then proceeded to explain
|
446 |
-
some awful <a href="#selection">hacks</a> that were needed to make it
|
447 |
-
possible for the selection changes to be detected through the
|
448 |
-
textarea. In fact, the second hack is about as bad as the first.</p>
|
449 |
-
|
450 |
-
<p>On top of that, in the presence of user-configurable tab sizes and
|
451 |
-
collapsed and wrapped lines, lining up cursor movement in the textarea
|
452 |
-
with what's visible on the screen becomes a nightmare. Thus, I've
|
453 |
-
decided to move to a model where the textarea's selection is no longer
|
454 |
-
depended on.</p>
|
455 |
-
|
456 |
-
<p>So I moved to a model where all cursor movement is handled by my
|
457 |
-
own code. This adds support for a goal column, proper interaction of
|
458 |
-
cursor movement with collapsed lines, and makes it possible for
|
459 |
-
vertical movement to move through wrapped lines properly, instead of
|
460 |
-
just treating them like non-wrapped lines.</p>
|
461 |
-
|
462 |
-
<p>The key event handlers now translate the key event into a string,
|
463 |
-
something like <code>Ctrl-Home</code> or <code>Shift-Cmd-R</code>, and
|
464 |
-
use that string to look up an action to perform. To make keybinding
|
465 |
-
customizable, this lookup goes through
|
466 |
-
a <a href="manual.html#option_keyMap">table</a>, using a scheme that
|
467 |
-
allows such tables to be chained together (for example, the default
|
468 |
-
Mac bindings fall through to a table named 'emacsy', which defines
|
469 |
-
basic Emacs-style bindings like <code>Ctrl-F</code>, and which is also
|
470 |
-
used by the custom Emacs bindings).</p>
|
471 |
-
|
472 |
-
<p>A new
|
473 |
-
option <a href="manual.html#option_extraKeys"><code>extraKeys</code></a>
|
474 |
-
allows ad-hoc keybindings to be defined in a much nicer way than what
|
475 |
-
was possible with the
|
476 |
-
old <a href="manual.html#option_onKeyEvent"><code>onKeyEvent</code></a>
|
477 |
-
callback. You simply provide an object mapping key identifiers to
|
478 |
-
functions, instead of painstakingly looking at raw key events.</p>
|
479 |
-
|
480 |
-
<p>Built-in commands map to strings, rather than functions, for
|
481 |
-
example <code>"goLineUp"</code> is the default action bound to the up
|
482 |
-
arrow key. This allows new keymaps to refer to them without
|
483 |
-
duplicating any code. New commands can be defined by assigning to
|
484 |
-
the <code>CodeMirror.commands</code> object, which maps such commands
|
485 |
-
to functions.</p>
|
486 |
-
|
487 |
-
<p>The hidden textarea now only holds the current selection, with no
|
488 |
-
extra characters around it. This has a nice advantage: polling for
|
489 |
-
input becomes much, much faster. If there's a big selection, this text
|
490 |
-
does not have to be read from the textarea every time—when we poll,
|
491 |
-
just noticing that something is still selected is enough to tell us
|
492 |
-
that no new text was typed.</p>
|
493 |
-
|
494 |
-
<p>The reason that cheap polling is important is that many browsers do
|
495 |
-
not fire useful events on IME (input method engine) input, which is
|
496 |
-
the thing where people inputting a language like Japanese or Chinese
|
497 |
-
use multiple keystrokes to create a character or sequence of
|
498 |
-
characters. Most modern browsers fire <code>input</code> when the
|
499 |
-
composing is finished, but many don't fire anything when the character
|
500 |
-
is updated <em>during</em> composition. So we poll, whenever the
|
501 |
-
editor is focused, to provide immediate updates of the display.</p>
|
502 |
-
|
503 |
-
</section>
|
504 |
-
</article>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/doc/logo.png
DELETED
Binary file
|
inc/static/libs/codemirror-5.44.0/doc/logo.svg
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="640">
|
2 |
-
<path d="M292.4 53.2s8.7 18.6-3.6 39.2c-6.2 10.2-163.1 43.6-224.3 128.6-37.5 58.7-95 228.7 88.7 341.2 82.5 42.5 117.5 41.2 117.5 41.2s-55-38.7-20-65 86.2-38.7 100-75c16.2 12.5 42.5 38.7 67.5 36.2-2.5-16.2-8.7-22.5 11.2-25s30-2.5 30-2.5-18.7-15-40-16.2-61.2-42.5-60-60c26.2-15 60-40 80-32.5s40 20 43.7 31.2c0 7.5-3.7 20 12.5 10s12.5-16.2 18.7-30 7.5-16.2-6.2-27.5-46.2-37.5-72.5-30-81.2 28.7-108.7 2.5c11.2-25 28.7-65 20-92.5 16.2-12.5 35-26.2 37.5-48.7 18.7-2.5 58.7-13.7 51.2-33.7S374.9 36.0 293.6 53.5" fill="#fff"/>
|
3 |
-
<path d="M551.9 257.4c13.7-36.2 36.2-97.5 15-100s-45 55-51.2 70-31.2 90-17.5 100 53.7-70 53.7-70" fill="#fff"/>
|
4 |
-
<path d="M435.6 159.9c3.9-6.1 7.2-.8-9.6.4-16.8 1.2-37.0 6.4-40.4 13.8-6.4 13.7-8.6 47.6-33.0 55.1-1.2 8.7 0 28.7 34.3 32.5s35.6-18.7 55.6-18.1 18.1-6.8 11.2-12.5-30.6-43.7-30.6-56.2 8.1-8.1 12.5-15M128.7 536.8s-10.6-28.1 20.6-43.1 59.3-3.1 65 7.5-9.3 53.1-63.1 53.7c-13.1-10.6-22.5-18.1-22.5-18.1" fill="#da687d"/>
|
5 |
-
<g opacity=".7" transform="matrix(1.25 0 0 -1.25 -26.846 640)">
|
6 |
-
<path d="M466.2 369.8c.4-1.5.2-3.1.2-4.8-.0-1.6-.1-3.3-.6-4.9.1-.3-.0-.8-.0-1.2-.4-.5-.1-.9-.2-1.3.6-.6 1.5-1.3 1.1-2.1-.2-.5-.8-.7-1.4-.9-.3-1.4-.7-3.0-1.0-4.6-.0-.4-.0-1.0-.1-1.4-.3-1.0-.6-1.9-.9-3.0-.2-.9.0-2.6-1.0-2.8-.4-1.0-.6-1.8-1.1-2.8-.2-.1-.4.1-.6.0-.3-.3-.2-.8-.5-1.1-.2-.2-.5-.1-.6-.3-.3-.5-.2-1.2-.5-1.9a4.7 4.7 0 0 1-1.1-1.4c-.5-1.1-.6-2.6-1.5-3.5-.2-.2-.7-.3-1.0-.6-.2-.2-.4-.6-.6-.9-.3-.4-.6-1.0-.9-1.5-1.0-1.7-2.3-3.7-3.3-5.6-.1-.3-.2-.8-.3-1.1-.3-.8-.9-1.5-1.2-2.3-.5-1.2-1.3-3.3-2.5-4.4-.1-.1-.4-.2-.6-.4-.1-.2-.1-.5-.3-.8-.0-.1-.4-.1-.5-.3-.2-.2-.3-.4-.4-.6-.4-.3-1.0-.5-1.3-.9-.2-.3-.3-.7-.6-1.1-.3-.4-.7-.7-1.0-1.2-.9-1.2-1.3-2.8-2.7-3.3-.3-.1-.8-.1-1.2-.2-.3.3-.0.8-.1 1.1-.0.2-.2.3-.3.5-.1.4-.3 1.3-.3 1.8.0.5.3.9.3 1.6.0.5-.1 1.2-.1 1.8-.0.3.0.6.0.9-.0.5-.0.8.0 1.4.0.7-.0 1.4-.1 2.1.3 1.7.5 3.0 1.0 4.9.2.8.7 2.3 1.1 3.3.8 1.8 1.6 3.9 2.6 5.9.3.6.8 1.1 1.1 1.8.1.3.2.8.3 1.2 1.6 3.3 3.8 6.2 5.5 9.7 1.4 2.8 2.8 5.4 4.7 8.5.8 1.4 1.5 2.9 2.4 4.0.6.8 1.6 2.4 2.3 3.9.2.5.2 1.0 1.0 1.1.7.9 1.3 2.0 2.1 2.8.2.2.5.3.7.4.2.2.3.5.6.7.5.4 1.4.8 2.0 1.6.1.2.2.4.4.6.4.5 1.1 1.8 1.8 2.0.0.0.2.0.3-.0" fill="#da687d"/>
|
7 |
-
</g>
|
8 |
-
<g opacity=".7" transform="matrix(1.25 0 0 -1.25 -26.846 640)">
|
9 |
-
<path d="M459.8 349.4c.6-1.9.7-4.1.9-6.2-.0-2.1-.1-4.5-.7-6.9.0-.4-.1-1.1-.1-1.6-.5-.7-.2-1.2-.4-1.8.7-.8 1.6-1.6 1.1-2.8-.3-.8-1.1-1.0-1.8-1.4-.6-1.9-1.2-4.2-1.8-6.3-.1-.6-.2-1.3-.4-1.9-.5-1.3-1.1-2.6-1.5-4.1-.4-1.2-.3-3.4-1.6-3.6-.6-1.3-.9-2.3-1.6-3.6-.3-.2-.5.1-.8-.0-.3-.4-.4-1.0-.7-1.4-.2-.2-.5-.2-.7-.5-.4-.6-.3-1.5-.7-2.4a6.5 6.5 0 0 1-1.1-1.3l-.1-.2-.0-.1-.0-.0-.0-.0v-.0l.0.1-.0-.0-.0-.0-.0-.0-.0-.0-.0-.0c-.6-1.6-.8-3.6-1.8-4.9-.3-.4-.8-.5-1.1-.9-.2-.3-.4-.9-.7-1.3-.3-.6-.7-1.4-1.0-2.1-1.0-2.4-2.5-5.2-3.5-8.0-.1-.5-.2-1.1-.3-1.6-.4-1.1-1.0-2.2-1.3-3.3-.6-1.7-1.4-4.7-3.0-6.3-.1-.2-.5-.4-.7-.6-.2-.3-.1-.7-.4-1.1-.1-.1-.4-.2-.6-.4-.2-.3-.3-.6-.5-.9-.5-.5-1.2-.8-1.7-1.4-.3-.4-.5-1.0-.9-1.5-.4-.5-.9-1.1-1.4-1.6l-1.8-2.6c-.5-.8-1.2-1.5-2.0-1.8-.4-.2-1.0-.1-1.5-.2-.3.4.0 1.0.0 1.5-.0.2-.2.5-.2.7-.0.6-.1 1.7-.0 2.3.0.6.5 1.1.7 2.0.1.7-.0 1.5-.0 2.3.0.3.1.7.1 1.2.0.6-.0.9.1 1.7.1.9-.0 1.8-.1 2.7.4 2.1.6 3.8 1.2 6.3.2 1.1.7 3.1 1.2 4.4.4 1.3.9 2.6 1.3 4.0.4 1.4.9 2.8 1.4 4.2.3.9.8 1.7 1.2 2.7.2.5.2 1.1.4 1.7.4 1.2.9 2.5 1.5 3.6a147.5 147.5 0 0 0 1.7 3.3l.9 1.8c.3.5.6 1.1.9 1.7a75.5 75.5 0 0 1 1.8 3.6 129.6 129.6 0 0 0 3.1 5.7 340.1 340.1 0 0 0 3.6 5.8c1.1 1.8 2.2 3.8 3.3 5.3.8 1.1 2.1 3.1 3.0 5.1.3.7.3 1.3 1.1 1.4.9 1.2 1.6 2.6 2.4 3.7.2.2.5.4.8.7.2.3.4.7.6 1.0.5.6 1.6 1.2 2.2 2.5.1.3.1.6.3 1.0.3.8 1.0 2.7 1.7 3.1.0.0.2.0.3.0" fill="#da687d"/>
|
10 |
-
</g>
|
11 |
-
<path d="M520.8 231.2s-10 38.3-5.8 70l5.8-70m11.8-25.9c-.7-2.6-5.7 74.3-4.2 77.0 1.4 2.6 8.9-60.7 4.2-77.0" fill="#fff"/>
|
12 |
-
<path d="M294.0 57.9s5.8 33.2-48.3 50.7-128.8 32.4-183.8 98.3c-55 65.8-65 174.9-27.5 246.6 37.5 71.6 129.1 160.8 294.1 160.8S624.6 487.7 624.6 400.2c0-45.8-25.1-35.6-33.8 7.3-7.8 38.8-80.5 183.6-263.0 183.6-182.5 0-275.8-110.8-287.5-205.8-11.6-95 14.8-176.8 110.7-226.0 95.8-49.1 156.6-29.5 143.3-101.2" fill="#2d2b2c"/>
|
13 |
-
<path d="M248.5 314.5s-10.8 50.0-63.3 74.1c-52.5 24.1-75 37.5-82.5 79.1 20-33.3 78.3-40 110.8-72.5s35-80.8 35-80.8m14.1-115.8s45 58.3 98.3 30c53.3-28.3 25.8-94.1 25-98.3-.8-4.1 5.8 73.3-34.1 86.6-40 13.3-89.1-18.3-89.1-18.3M145.2 547.0s28.3 1.6 49.1-21.6c20.8-23.3 9.1-60 43.3-73.3 34.1-13.3 57.5-5 57.5-5s-60.8 8.3-65.8 43.3-13.3 50.8-26.6 61.6c-13.3 10.8-30.8 12.5-30.8 12.5l-26.6-17.5z" fill="#2d2b2c"/>
|
14 |
-
<path d="M273.7 365.6s50.6-8.4 73.7-60c18.9-42.2 6.2-78.7 6.2-78.7l-25.6 3.7s10.6 30.6 2.5 58.1-26.8 59.3-56.8 76.8m272.6-117.0c-18.0 45.1-44.7 77.5-47.8 75.8-5.6-3.1-.4-42.5 17.6-87.7 18.0-45.1 40.5-79.5 48.8-76.2 8.3 3.2-.6 42.9-18.6 88.1m26.2-90.6c-20.5-11.1-45.8 30.5-66.5 79.1-20.7 48.6-23.1 87.7-7.1 94.7 21.3 9.3 41.4-27.8 62.1-76.4s30-87.5 11.5-97.5" fill="#2d2b2c"/>
|
15 |
-
<path d="M199.4 402.9s12.9 38.7 77.5 30.8c60.8-7.5 86.9-30.9 124.1-54.1 26.6-16.6 25-9.1 28.3-8.3 3.3.8 18.3 10 34.1 8.3.8 8.3-7.4 1.6-10.8 9.1-1.6 5 12.6 28.5 33.3 25 34.1-5.8 24.5-20 31.2-35.8 6.6-15.8 11.2-24.1-22.0-46.6-25.8-23.3-40-17.4-52.5-17.4s-45 17.4-67.5 13.3-36.6-12.5-36.6-12.5l-14.9 16.6s27.4 20.8 59.1 13.3c31.6-7.5 55.0-31.6 82.5-19.1 27.5 12.5 32.8 20.8 41.2 27.0 9.5 7.0 10.4 14.5 3.7 21.2-6.6 6.6.0 11.6-4.1 19.1-4.1 7.5-25 10.8-25 10.8s22.8-29.3-5-31.6c-20-1.6-32.5-28.3-60.8-14.1-40.6 20.3-98.3 55-138.3 59.1-38.9 4.0-53.3-8.3-63.3-31.6-11.6 10-14.1 17.5-14.1 17.5" fill="#2d2b2c"/>
|
16 |
-
<path d="M342.7 411.2s28.3 15 20 47.5-45.8 55-70 65.8c-24.1 10.8-42.1 25.1-24.1 34.1 15 7.5 23.3-11.6 45-15 21.6-3.3 40.8 5 42.5 17.5-9.1-5-15.8-5-15.8-5s7.5 5 8.3 13.3c.8 8.3-.8 4.1-5.8 4.1-12.5 0-14.1-10.8-25-9.1-27.5 2.5-29.1 14.1-44.1 15.8-15 1.6-40-6.6-36.6-25.8 3.3-19.1 29.1-32.5 53.3-42.5 24.1-10 60.8-41.6 55.8-70-5-28.3-26.6-22.5-26.6-22.5l23.3-8.3zm71.0-235.9s11.8 5.9 19.3 35.9c5 10.8 11.6 19.5 17.5 22.0 5.8 2.5-2.5 5-6.6 4.1-4.1-.8-12.9-4.5-18.7.4s-20 18.3-40 15c-20-3.3-37.0-16.0-37.0-16.0s7.5 33.1 52.0 31.0c30.9-1.4 24.1-17.5 45-20.8 20.8-3.3 18.6-13.8 14.1-22.5-7.0-13.7-29.1-17.0-31.6-57.2-2.5-4.1-18.1.5-13.9 8.0m71.2 209.1c1.8 1.8-14.7 39.3-14.7 39.3s-3.3 9.1-12.2 5.9c-9.1-3.3-6.7-9.9-6.7-9.9l21.2-38.5s11.6 2.3 12.5 3.2m23.4-53.3l-4.1 12.5-13.6-10.4 3.6-7.9 14.1 5.8z" fill="#2d2b2c"/>
|
17 |
-
<path d="M356.0 403.7c-2.5 9.1 29.1 62.5 50.8 59.1 21.6-3.3 24.9 3.3 18.3 7.5-6.6 4.1-18.3 5.8-16.6 11.6 1.6 5.8 6.2 11.6-4.5 10-10.8-1.6-32.9-13.3-46.2-35.8-4.1 13.3-5.8 17.5-5.8 17.5s42.5 44.1 85.8 25.8c-7.5-5.8-28.3-4.1-10.8-14.1s30.8-13.3 39.1 2.5c4.1-.8 4.1-37.5-50.8-35-19.1-2.5-45-40-45-59.1-5 5-11.6.8-14.1 10m169.4-184.3s-10.9 32.8-6.3 60l6.3-60m11.2-19.4c-.5-2.0-5.0 57.2-4.0 59.2 1.0 2.0 7.3-46.6 4.0-59.2m-145.6-32.8s47.0-4.1 38.7-22.9c-25.1-56.5-72.9-89.5-161.2-86.2 50-20 92.5-17.5 133.3 17.5 20.4 17.5 29.8 38.8 37.1 55.1 11.6 26 8.2 28.4-4.6 35.7-15.7 8.8-42.7 3.2-43.3.8" fill="#2d2b2c"/>
|
18 |
-
<path d="M395.8 174.2s12.9 8.9 23.1 1.6c4.6-4.8 7.7-7.4-5.4-6.8l-16.1-.6c-11.1-2.2-10.9 1.1-1.5 5.8z" fill="#2d2b2c"/>
|
19 |
-
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/doc/manual.html
DELETED
@@ -1,3579 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: User Manual</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="docs.css">
|
6 |
-
<script src="activebookmark.js"></script>
|
7 |
-
|
8 |
-
<script src="../lib/codemirror.js"></script>
|
9 |
-
<link rel="stylesheet" href="../lib/codemirror.css">
|
10 |
-
<script src="../addon/runmode/runmode.js"></script>
|
11 |
-
<script src="../addon/runmode/colorize.js"></script>
|
12 |
-
<script src="../mode/javascript/javascript.js"></script>
|
13 |
-
<script src="../mode/xml/xml.js"></script>
|
14 |
-
<script src="../mode/css/css.js"></script>
|
15 |
-
<script src="../mode/htmlmixed/htmlmixed.js"></script>
|
16 |
-
<style>
|
17 |
-
dt { text-indent: -2em; padding-left: 2em; margin-top: 1em; }
|
18 |
-
dd { margin-left: 1.5em; margin-bottom: 1em; }
|
19 |
-
dt {margin-top: 1em;}
|
20 |
-
dd dl, dd dt, dd dd, dd ul { margin-top: 0; margin-bottom: 0; }
|
21 |
-
dt + dt { margin-top: 0; }
|
22 |
-
dt.command { position: relative; }
|
23 |
-
span.keybinding { position: absolute; right: 0; font-size: 80%; color: #555; text-indent: 0; }
|
24 |
-
</style>
|
25 |
-
|
26 |
-
<div id=nav>
|
27 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
|
28 |
-
<ul>
|
29 |
-
<li><a href="../index.html">Home</a></li>
|
30 |
-
<li><a href="#overview" class=active data-default="true">Manual</a></li>
|
31 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a></li>
|
32 |
-
</ul>
|
33 |
-
<ul>
|
34 |
-
<li><a href="#usage">Basic Usage</a></li>
|
35 |
-
<li><a href="#config">Configuration</a></li>
|
36 |
-
<li><a href="#events">Events</a></li>
|
37 |
-
<li><a href="#keymaps">Key maps</a></li>
|
38 |
-
<li><a href="#commands">Commands</a></li>
|
39 |
-
<li><a href="#styling">Customized Styling</a></li>
|
40 |
-
<li><a href="#api">Programming API</a>
|
41 |
-
<ul>
|
42 |
-
<li><a href="#api_constructor">Constructor</a></li>
|
43 |
-
<li><a href="#api_content">Content manipulation</a></li>
|
44 |
-
<li><a href="#api_selection">Selection</a></li>
|
45 |
-
<li><a href="#api_configuration">Configuration</a></li>
|
46 |
-
<li><a href="#api_doc">Document management</a></li>
|
47 |
-
<li><a href="#api_history">History</a></li>
|
48 |
-
<li><a href="#api_marker">Text-marking</a></li>
|
49 |
-
<li><a href="#api_decoration">Widget, gutter, and decoration</a></li>
|
50 |
-
<li><a href="#api_sizing">Sizing, scrolling, and positioning</a></li>
|
51 |
-
<li><a href="#api_mode">Mode, state, and tokens</a></li>
|
52 |
-
<li><a href="#api_misc">Miscellaneous methods</a></li>
|
53 |
-
<li><a href="#api_static">Static properties</a></li>
|
54 |
-
</ul>
|
55 |
-
</li>
|
56 |
-
<li><a href="#addons">Addons</a></li>
|
57 |
-
<li><a href="#modeapi">Writing CodeMirror Modes</a></li>
|
58 |
-
<li><a href="#vimapi">Vim Mode API</a>
|
59 |
-
<ul>
|
60 |
-
<li><a href="#vimapi_configuration">Configuration</a></li>
|
61 |
-
<li><a href="#vimapi_extending">Extending VIM</a></li>
|
62 |
-
</ul>
|
63 |
-
</li>
|
64 |
-
</ul>
|
65 |
-
</div>
|
66 |
-
|
67 |
-
<article>
|
68 |
-
|
69 |
-
<section class=first id=overview>
|
70 |
-
<h2 style="position: relative">
|
71 |
-
User manual and reference guide
|
72 |
-
<span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.44.0</span>
|
73 |
-
</h2>
|
74 |
-
|
75 |
-
<p>CodeMirror is a code-editor component that can be embedded in
|
76 |
-
Web pages. The core library provides <em>only</em> the editor
|
77 |
-
component, no accompanying buttons, auto-completion, or other IDE
|
78 |
-
functionality. It does provide a rich API on top of which such
|
79 |
-
functionality can be straightforwardly implemented. See
|
80 |
-
the <a href="#addons">addons</a> included in the distribution,
|
81 |
-
and the <a href="https://github.com/codemirror/CodeMirror/wiki/CodeMirror-addons">list
|
82 |
-
of externally hosted addons</a>, for reusable
|
83 |
-
implementations of extra features.</p>
|
84 |
-
|
85 |
-
<p>CodeMirror works with language-specific modes. Modes are
|
86 |
-
JavaScript programs that help color (and optionally indent) text
|
87 |
-
written in a given language. The distribution comes with a number
|
88 |
-
of modes (see the <a href="../mode/"><code>mode/</code></a>
|
89 |
-
directory), and it isn't hard to <a href="#modeapi">write new
|
90 |
-
ones</a> for other languages.</p>
|
91 |
-
</section>
|
92 |
-
|
93 |
-
<section id=usage>
|
94 |
-
<h2>Basic Usage</h2>
|
95 |
-
|
96 |
-
<p>The easiest way to use CodeMirror is to simply load the script
|
97 |
-
and style sheet found under <code>lib/</code> in the distribution,
|
98 |
-
plus a mode script from one of the <code>mode/</code> directories.
|
99 |
-
For example:</p>
|
100 |
-
|
101 |
-
<pre data-lang="text/html"><script src="lib/codemirror.js"></script>
|
102 |
-
<link rel="stylesheet" href="lib/codemirror.css">
|
103 |
-
<script src="mode/javascript/javascript.js"></script></pre>
|
104 |
-
|
105 |
-
<p>(Alternatively, use a module loader. <a href="#modloader">More
|
106 |
-
about that later.</a>)</p>
|
107 |
-
|
108 |
-
<p>Having done this, an editor instance can be created like
|
109 |
-
this:</p>
|
110 |
-
|
111 |
-
<pre data-lang="javascript">var myCodeMirror = CodeMirror(document.body);</pre>
|
112 |
-
|
113 |
-
<p>The editor will be appended to the document body, will start
|
114 |
-
empty, and will use the mode that we loaded. To have more control
|
115 |
-
over the new editor, a configuration object can be passed
|
116 |
-
to <a href="#CodeMirror"><code>CodeMirror</code></a> as a second
|
117 |
-
argument:</p>
|
118 |
-
|
119 |
-
<pre data-lang="javascript">var myCodeMirror = CodeMirror(document.body, {
|
120 |
-
value: "function myScript(){return 100;}\n",
|
121 |
-
mode: "javascript"
|
122 |
-
});</pre>
|
123 |
-
|
124 |
-
<p>This will initialize the editor with a piece of code already in
|
125 |
-
it, and explicitly tell it to use the JavaScript mode (which is
|
126 |
-
useful when multiple modes are loaded).
|
127 |
-
See <a href="#config">below</a> for a full discussion of the
|
128 |
-
configuration options that CodeMirror accepts.</p>
|
129 |
-
|
130 |
-
<p>In cases where you don't want to append the editor to an
|
131 |
-
element, and need more control over the way it is inserted, the
|
132 |
-
first argument to the <code>CodeMirror</code> function can also
|
133 |
-
be a function that, when given a DOM element, inserts it into the
|
134 |
-
document somewhere. This could be used to, for example, replace a
|
135 |
-
textarea with a real editor:</p>
|
136 |
-
|
137 |
-
<pre data-lang="javascript">var myCodeMirror = CodeMirror(function(elt) {
|
138 |
-
myTextArea.parentNode.replaceChild(elt, myTextArea);
|
139 |
-
}, {value: myTextArea.value});</pre>
|
140 |
-
|
141 |
-
<p>However, for this use case, which is a common way to use
|
142 |
-
CodeMirror, the library provides a much more powerful
|
143 |
-
shortcut:</p>
|
144 |
-
|
145 |
-
<pre data-lang="javascript">var myCodeMirror = CodeMirror.fromTextArea(myTextArea);</pre>
|
146 |
-
|
147 |
-
<p>This will, among other things, ensure that the textarea's value
|
148 |
-
is updated with the editor's contents when the form (if it is part
|
149 |
-
of a form) is submitted. See the <a href="#fromTextArea">API
|
150 |
-
reference</a> for a full description of this method.</p>
|
151 |
-
|
152 |
-
<h3 id=modloader>Module loaders</h3>
|
153 |
-
|
154 |
-
<p>The files in the CodeMirror distribution contain shims for
|
155 |
-
loading them (and their dependencies) in AMD or CommonJS
|
156 |
-
environments. If the variables <code>exports</code>
|
157 |
-
and <code>module</code> exist and have type object, CommonJS-style
|
158 |
-
require will be used. If not, but there is a
|
159 |
-
function <code>define</code> with an <code>amd</code> property
|
160 |
-
present, AMD-style (RequireJS) will be used.</p>
|
161 |
-
|
162 |
-
<p>It is possible to
|
163 |
-
use <a href="http://browserify.org/">Browserify</a> or similar
|
164 |
-
tools to statically build modules using CodeMirror. Alternatively,
|
165 |
-
use <a href="http://requirejs.org/">RequireJS</a> to dynamically
|
166 |
-
load dependencies at runtime. Both of these approaches have the
|
167 |
-
advantage that they don't use the global namespace and can, thus,
|
168 |
-
do things like load multiple versions of CodeMirror alongside each
|
169 |
-
other.</p>
|
170 |
-
|
171 |
-
<p>Here's a simple example of using RequireJS to load CodeMirror:</p>
|
172 |
-
|
173 |
-
<pre data-lang="javascript">require([
|
174 |
-
"cm/lib/codemirror", "cm/mode/htmlmixed/htmlmixed"
|
175 |
-
], function(CodeMirror) {
|
176 |
-
CodeMirror.fromTextArea(document.getElementById("code"), {
|
177 |
-
lineNumbers: true,
|
178 |
-
mode: "htmlmixed"
|
179 |
-
});
|
180 |
-
});</pre>
|
181 |
-
|
182 |
-
<p>It will automatically load the modes that the mixed HTML mode
|
183 |
-
depends on (XML, JavaScript, and CSS). Do <em>not</em> use
|
184 |
-
RequireJS' <code>paths</code> option to configure the path to
|
185 |
-
CodeMirror, since it will break loading submodules through
|
186 |
-
relative paths. Use
|
187 |
-
the <a href="http://requirejs.org/docs/api.html#packages"><code>packages</code></a>
|
188 |
-
configuration option instead, as in:</p>
|
189 |
-
|
190 |
-
<pre data-lang=javascript>require.config({
|
191 |
-
packages: [{
|
192 |
-
name: "codemirror",
|
193 |
-
location: "../path/to/codemirror",
|
194 |
-
main: "lib/codemirror"
|
195 |
-
}]
|
196 |
-
});</pre>
|
197 |
-
|
198 |
-
</section>
|
199 |
-
|
200 |
-
<section id=config>
|
201 |
-
<h2>Configuration</h2>
|
202 |
-
|
203 |
-
<p>Both the <a href="#CodeMirror"><code>CodeMirror</code></a>
|
204 |
-
function and its <code>fromTextArea</code> method take as second
|
205 |
-
(optional) argument an object containing configuration options.
|
206 |
-
Any option not supplied like this will be taken
|
207 |
-
from <a href="#defaults"><code>CodeMirror.defaults</code></a>, an
|
208 |
-
object containing the default options. You can update this object
|
209 |
-
to change the defaults on your page.</p>
|
210 |
-
|
211 |
-
<p>Options are not checked in any way, so setting bogus option
|
212 |
-
values is bound to lead to odd errors.</p>
|
213 |
-
|
214 |
-
<p>These are the supported options:</p>
|
215 |
-
|
216 |
-
<dl>
|
217 |
-
<dt id="option_value"><code><strong>value</strong>: string|CodeMirror.Doc</code></dt>
|
218 |
-
<dd>The starting value of the editor. Can be a string, or
|
219 |
-
a <a href="#api_doc">document object</a>.</dd>
|
220 |
-
|
221 |
-
<dt id="option_mode"><code><strong>mode</strong>: string|object</code></dt>
|
222 |
-
<dd>The mode to use. When not given, this will default to the
|
223 |
-
first mode that was loaded. It may be a string, which either
|
224 |
-
simply names the mode or is
|
225 |
-
a <a href="http://en.wikipedia.org/wiki/MIME">MIME</a> type
|
226 |
-
associated with the mode. Alternatively, it may be an object
|
227 |
-
containing configuration options for the mode, with
|
228 |
-
a <code>name</code> property that names the mode (for
|
229 |
-
example <code>{name: "javascript", json: true}</code>). The demo
|
230 |
-
pages for each mode contain information about what configuration
|
231 |
-
parameters the mode supports. You can ask CodeMirror which modes
|
232 |
-
and MIME types have been defined by inspecting
|
233 |
-
the <code>CodeMirror.modes</code>
|
234 |
-
and <code>CodeMirror.mimeModes</code> objects. The first maps
|
235 |
-
mode names to their constructors, and the second maps MIME types
|
236 |
-
to mode specs.</dd>
|
237 |
-
|
238 |
-
<dt id="option_lineSeparator"><code><strong>lineSeparator</strong>: string|null</code></dt>
|
239 |
-
<dd>Explicitly set the line separator for the editor. By default
|
240 |
-
(value <code>null</code>), the document will be split on CRLFs
|
241 |
-
as well as lone CRs and LFs, and a single LF will be used as
|
242 |
-
line separator in all output (such
|
243 |
-
as <a href="#getValue"><code>getValue</code></a>). When a
|
244 |
-
specific string is given, lines will only be split on that
|
245 |
-
string, and output will, by default, use that same
|
246 |
-
separator.</dd>
|
247 |
-
|
248 |
-
<dt id="option_theme"><code><strong>theme</strong>: string</code></dt>
|
249 |
-
<dd>The theme to style the editor with. You must make sure the
|
250 |
-
CSS file defining the corresponding <code>.cm-s-[name]</code>
|
251 |
-
styles is loaded (see
|
252 |
-
the <a href="../theme/"><code>theme</code></a> directory in the
|
253 |
-
distribution). The default is <code>"default"</code>, for which
|
254 |
-
colors are included in <code>codemirror.css</code>. It is
|
255 |
-
possible to use multiple theming classes at once—for
|
256 |
-
example <code>"foo bar"</code> will assign both
|
257 |
-
the <code>cm-s-foo</code> and the <code>cm-s-bar</code> classes
|
258 |
-
to the editor.</dd>
|
259 |
-
|
260 |
-
<dt id="option_indentUnit"><code><strong>indentUnit</strong>: integer</code></dt>
|
261 |
-
<dd>How many spaces a block (whatever that means in the edited
|
262 |
-
language) should be indented. The default is 2.</dd>
|
263 |
-
|
264 |
-
<dt id="option_smartIndent"><code><strong>smartIndent</strong>: boolean</code></dt>
|
265 |
-
<dd>Whether to use the context-sensitive indentation that the
|
266 |
-
mode provides (or just indent the same as the line before).
|
267 |
-
Defaults to true.</dd>
|
268 |
-
|
269 |
-
<dt id="option_tabSize"><code><strong>tabSize</strong>: integer</code></dt>
|
270 |
-
<dd>The width of a tab character. Defaults to 4.</dd>
|
271 |
-
|
272 |
-
<dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
|
273 |
-
<dd>Whether, when indenting, the first N*<code>tabSize</code>
|
274 |
-
spaces should be replaced by N tabs. Default is false.</dd>
|
275 |
-
|
276 |
-
<dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
|
277 |
-
<dd>Configures whether the editor should re-indent the current
|
278 |
-
line when a character is typed that might change its proper
|
279 |
-
indentation (only works if the mode supports indentation).
|
280 |
-
Default is true.</dd>
|
281 |
-
|
282 |
-
<dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
|
283 |
-
<dd>A regular expression used to determine which characters
|
284 |
-
should be replaced by a
|
285 |
-
special <a href="#option_specialCharPlaceholder">placeholder</a>.
|
286 |
-
Mostly useful for non-printing special characters. The default
|
287 |
-
is <code>/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/</code>.</dd>
|
288 |
-
<dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
|
289 |
-
<dd>A function that, given a special character identified by
|
290 |
-
the <a href="#option_specialChars"><code>specialChars</code></a>
|
291 |
-
option, produces a DOM node that is used to represent the
|
292 |
-
character. By default, a red dot (<span style="color: red">•</span>)
|
293 |
-
is shown, with a title tooltip to indicate the character code.</dd>
|
294 |
-
|
295 |
-
<dt id="option_direction"><code><strong>direction</strong>: "ltr" | "rtl"</code></dt>
|
296 |
-
<dd>Flips overall layout and selects base paragraph direction to
|
297 |
-
be left-to-right or right-to-left. Default is "ltr".
|
298 |
-
CodeMirror applies the Unicode Bidirectional Algorithm to each
|
299 |
-
line, but does not autodetect base direction — it's set to the
|
300 |
-
editor direction for all lines. The resulting order is
|
301 |
-
sometimes wrong when base direction doesn't match user intent
|
302 |
-
(for example, leading and trailing punctuation jumps to the
|
303 |
-
wrong side of the line). Therefore, it's helpful for
|
304 |
-
multilingual input to let users toggle this option.
|
305 |
-
|
306 |
-
<dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
|
307 |
-
<dd>Determines whether horizontal cursor movement through
|
308 |
-
right-to-left (Arabic, Hebrew) text is visual (pressing the left
|
309 |
-
arrow moves the cursor left) or logical (pressing the left arrow
|
310 |
-
moves to the next lower index in the string, which is visually
|
311 |
-
right in right-to-left text). The default is <code>false</code>
|
312 |
-
on Windows, and <code>true</code> on other platforms.</dd>
|
313 |
-
|
314 |
-
<dt id="option_keyMap"><code><strong>keyMap</strong>: string</code></dt>
|
315 |
-
<dd>Configures the key map to use. The default
|
316 |
-
is <code>"default"</code>, which is the only key map defined
|
317 |
-
in <code>codemirror.js</code> itself. Extra key maps are found in
|
318 |
-
the <a href="../keymap/"><code>key map</code></a> directory. See
|
319 |
-
the <a href="#keymaps">section on key maps</a> for more
|
320 |
-
information.</dd>
|
321 |
-
|
322 |
-
<dt id="option_extraKeys"><code><strong>extraKeys</strong>: object</code></dt>
|
323 |
-
<dd>Can be used to specify extra key bindings for the editor,
|
324 |
-
alongside the ones defined
|
325 |
-
by <a href="#option_keyMap"><code>keyMap</code></a>. Should be
|
326 |
-
either null, or a valid <a href="#keymaps">key map</a> value.</dd>
|
327 |
-
|
328 |
-
<dt id="option_configureMouse"><code><strong>configureMouse</strong>: fn(cm: CodeMirror, repeat: "single" | "double" | "triple", event: Event) → Object</code></dt>
|
329 |
-
<dd>Allows you to configure the behavior of mouse selection and
|
330 |
-
dragging. The function is called when the left mouse button is
|
331 |
-
pressed. The returned object may have the following properties:
|
332 |
-
<dl>
|
333 |
-
<dt><code><strong>unit</strong>: "char" | "word" | "line" | "rectangle" | fn(CodeMirror, Pos) → {from: Pos, to: Pos}</code></dt>
|
334 |
-
<dd>The unit by which to select. May be one of the built-in
|
335 |
-
units or a function that takes a position and returns a
|
336 |
-
range around that, for a custom unit. The default is to
|
337 |
-
return <code>"word"</code> for double
|
338 |
-
clicks, <code>"line"</code> for triple
|
339 |
-
clicks, <code>"rectangle"</code> for alt-clicks (or, on
|
340 |
-
Chrome OS, meta-shift-clicks), and <code>"single"</code>
|
341 |
-
otherwise.</dd>
|
342 |
-
<dt><code><strong>extend</strong>: bool</code></dt>
|
343 |
-
<dd>Whether to extend the existing selection range or start
|
344 |
-
a new one. By default, this is enabled when shift
|
345 |
-
clicking.</dd>
|
346 |
-
<dt><code><strong>addNew</strong>: bool</code></dt>
|
347 |
-
<dd>When enabled, this adds a new range to the existing
|
348 |
-
selection, rather than replacing it. The default behavior is
|
349 |
-
to enable this for command-click on Mac OS, and
|
350 |
-
control-click on other platforms.</dd>
|
351 |
-
<dt><code><strong>moveOnDrag</strong>: bool</code></dt>
|
352 |
-
<dd>When the mouse even drags content around inside the
|
353 |
-
editor, this controls whether it is copied (false) or moved
|
354 |
-
(true). By default, this is enabled by alt-clicking on Mac
|
355 |
-
OS, and ctrl-clicking elsewhere.</dd>
|
356 |
-
</dl>
|
357 |
-
</dd>
|
358 |
-
|
359 |
-
<dt id="option_lineWrapping"><code><strong>lineWrapping</strong>: boolean</code></dt>
|
360 |
-
<dd>Whether CodeMirror should scroll or wrap for long lines.
|
361 |
-
Defaults to <code>false</code> (scroll).</dd>
|
362 |
-
|
363 |
-
<dt id="option_lineNumbers"><code><strong>lineNumbers</strong>: boolean</code></dt>
|
364 |
-
<dd>Whether to show line numbers to the left of the editor.</dd>
|
365 |
-
|
366 |
-
<dt id="option_firstLineNumber"><code><strong>firstLineNumber</strong>: integer</code></dt>
|
367 |
-
<dd>At which number to start counting lines. Default is 1.</dd>
|
368 |
-
|
369 |
-
<dt id="option_lineNumberFormatter"><code><strong>lineNumberFormatter</strong>: function(line: integer) → string</code></dt>
|
370 |
-
<dd>A function used to format line numbers. The function is
|
371 |
-
passed the line number, and should return a string that will be
|
372 |
-
shown in the gutter.</dd>
|
373 |
-
|
374 |
-
<dt id="option_gutters"><code><strong>gutters</strong>: array<string></code></dt>
|
375 |
-
<dd>Can be used to add extra gutters (beyond or instead of the
|
376 |
-
line number gutter). Should be an array of CSS class names, each
|
377 |
-
of which defines a <code>width</code> (and optionally a
|
378 |
-
background), and which will be used to draw the background of
|
379 |
-
the gutters. <em>May</em> include
|
380 |
-
the <code>CodeMirror-linenumbers</code> class, in order to
|
381 |
-
explicitly set the position of the line number gutter (it will
|
382 |
-
default to be to the right of all other gutters). These class
|
383 |
-
names are the keys passed
|
384 |
-
to <a href="#setGutterMarker"><code>setGutterMarker</code></a>.</dd>
|
385 |
-
|
386 |
-
<dt id="option_fixedGutter"><code><strong>fixedGutter</strong>: boolean</code></dt>
|
387 |
-
<dd>Determines whether the gutter scrolls along with the content
|
388 |
-
horizontally (false) or whether it stays fixed during horizontal
|
389 |
-
scrolling (true, the default).</dd>
|
390 |
-
|
391 |
-
<dt id="option_scrollbarStyle"><code><strong>scrollbarStyle</strong>: string</code></dt>
|
392 |
-
<dd>Chooses a scrollbar implementation. The default
|
393 |
-
is <code>"native"</code>, showing native scrollbars. The core
|
394 |
-
library also provides the <code>"null"</code> style, which
|
395 |
-
completely hides the
|
396 |
-
scrollbars. <a href="#addon_simplescrollbars">Addons</a> can
|
397 |
-
implement additional scrollbar models.</dd>
|
398 |
-
|
399 |
-
<dt id="option_coverGutterNextToScrollbar"><code><strong>coverGutterNextToScrollbar</strong>: boolean</code></dt>
|
400 |
-
<dd>When <a href="#option_fixedGutter"><code>fixedGutter</code></a>
|
401 |
-
is on, and there is a horizontal scrollbar, by default the
|
402 |
-
gutter will be visible to the left of this scrollbar. If this
|
403 |
-
option is set to true, it will be covered by an element with
|
404 |
-
class <code>CodeMirror-gutter-filler</code>.</dd>
|
405 |
-
|
406 |
-
<dt id="option_inputStyle"><code><strong>inputStyle</strong>: string</code></dt>
|
407 |
-
<dd>Selects the way CodeMirror handles input and focus. The core
|
408 |
-
library defines the <code>"textarea"</code>
|
409 |
-
and <code>"contenteditable"</code> input models. On mobile
|
410 |
-
browsers, the default is <code>"contenteditable"</code>. On
|
411 |
-
desktop browsers, the default is <code>"textarea"</code>.
|
412 |
-
Support for IME and screen readers is better in
|
413 |
-
the <code>"contenteditable"</code> model. The intention is to
|
414 |
-
make it the default on modern desktop browsers in the
|
415 |
-
future.</dd>
|
416 |
-
|
417 |
-
<dt id="option_readOnly"><code><strong>readOnly</strong>: boolean|string</code></dt>
|
418 |
-
<dd>This disables editing of the editor content by the user. If
|
419 |
-
the special value <code>"nocursor"</code> is given (instead of
|
420 |
-
simply <code>true</code>), focusing of the editor is also
|
421 |
-
disallowed.</dd>
|
422 |
-
|
423 |
-
<dt id="option_showCursorWhenSelecting"><code><strong>showCursorWhenSelecting</strong>: boolean</code></dt>
|
424 |
-
<dd>Whether the cursor should be drawn when a selection is
|
425 |
-
active. Defaults to false.</dd>
|
426 |
-
|
427 |
-
<dt id="option_lineWiseCopyCut"><code><strong>lineWiseCopyCut</strong>: boolean</code></dt>
|
428 |
-
<dd>When enabled, which is the default, doing copy or cut when
|
429 |
-
there is no selection will copy or cut the whole lines that have
|
430 |
-
cursors on them.</dd>
|
431 |
-
|
432 |
-
<dt id="option_pasteLinesPerSelection"><code><strong>pasteLinesPerSelection</strong>: boolean</code></dt>
|
433 |
-
<dd>When pasting something from an external source (not from the
|
434 |
-
editor itself), if the number of lines matches the number of
|
435 |
-
selection, CodeMirror will by default insert one line per
|
436 |
-
selection. You can set this to <code>false</code> to disable
|
437 |
-
that behavior.</dd>
|
438 |
-
|
439 |
-
<dt id="option_selectionsMayTouch"><code><strong>selectionsMayTouch</strong>: boolean</code></dt>
|
440 |
-
<dd>Determines whether multiple selections are joined as soon as
|
441 |
-
they touch (the default) or only when they overlap (true).</dd>
|
442 |
-
|
443 |
-
<dt id="option_undoDepth"><code><strong>undoDepth</strong>: integer</code></dt>
|
444 |
-
<dd>The maximum number of undo levels that the editor stores.
|
445 |
-
Note that this includes selection change events. Defaults to
|
446 |
-
200.</dd>
|
447 |
-
|
448 |
-
<dt id="option_historyEventDelay"><code><strong>historyEventDelay</strong>: integer</code></dt>
|
449 |
-
<dd>The period of inactivity (in milliseconds) that will cause a
|
450 |
-
new history event to be started when typing or deleting.
|
451 |
-
Defaults to 1250.</dd>
|
452 |
-
|
453 |
-
<dt id="option_tabindex"><code><strong>tabindex</strong>: integer</code></dt>
|
454 |
-
<dd>The <a href="http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex">tab
|
455 |
-
index</a> to assign to the editor. If not given, no tab index
|
456 |
-
will be assigned.</dd>
|
457 |
-
|
458 |
-
<dt id="option_autofocus"><code><strong>autofocus</strong>: boolean</code></dt>
|
459 |
-
<dd>Can be used to make CodeMirror focus itself on
|
460 |
-
initialization. Defaults to off.
|
461 |
-
When <a href="#fromTextArea"><code>fromTextArea</code></a> is
|
462 |
-
used, and no explicit value is given for this option, it will be
|
463 |
-
set to true when either the source textarea is focused, or it
|
464 |
-
has an <code>autofocus</code> attribute and no other element is
|
465 |
-
focused.</dd>
|
466 |
-
|
467 |
-
<dt id="option_phrases"><code><strong>phrases</strong>: ?object</code></dt>
|
468 |
-
<dd>Some addons run user-visible strings (such as labels in the
|
469 |
-
interface) through the <a href="#phrase"><code>phrase</code></a>
|
470 |
-
method to allow for translation. This option determines the
|
471 |
-
return value of that method. When it is null or an object that
|
472 |
-
doesn't have a property named by the input string, that string
|
473 |
-
is returned. Otherwise, the value of the property corresponding
|
474 |
-
to that string is returned.</dd>
|
475 |
-
</dl>
|
476 |
-
|
477 |
-
<p>Below this a few more specialized, low-level options are
|
478 |
-
listed. These are only useful in very specific situations, you
|
479 |
-
might want to skip them the first time you read this manual.</p>
|
480 |
-
|
481 |
-
<dl>
|
482 |
-
<dt id="option_dragDrop"><code><strong>dragDrop</strong>: boolean</code></dt>
|
483 |
-
<dd>Controls whether drag-and-drop is enabled. On by default.</dd>
|
484 |
-
|
485 |
-
<dt id="option_allowDropFileTypes"><code><strong>allowDropFileTypes</strong>: array<string></code></dt>
|
486 |
-
<dd>When set (default is <code>null</code>) only files whose
|
487 |
-
type is in the array can be dropped into the editor. The strings
|
488 |
-
should be MIME types, and will be checked against
|
489 |
-
the <a href="https://w3c.github.io/FileAPI/#dfn-type"><code>type</code></a>
|
490 |
-
of the <code>File</code> object as reported by the browser.</dd>
|
491 |
-
|
492 |
-
<dt id="option_cursorBlinkRate"><code><strong>cursorBlinkRate</strong>: number</code></dt>
|
493 |
-
<dd>Half-period in milliseconds used for cursor blinking. The default blink
|
494 |
-
rate is 530ms. By setting this to zero, blinking can be disabled. A
|
495 |
-
negative value hides the cursor entirely.</dd>
|
496 |
-
|
497 |
-
<dt id="option_cursorScrollMargin"><code><strong>cursorScrollMargin</strong>: number</code></dt>
|
498 |
-
<dd>How much extra space to always keep above and below the
|
499 |
-
cursor when approaching the top or bottom of the visible view in
|
500 |
-
a scrollable document. Default is 0.</dd>
|
501 |
-
|
502 |
-
<dt id="option_cursorHeight"><code><strong>cursorHeight</strong>: number</code></dt>
|
503 |
-
<dd>Determines the height of the cursor. Default is 1, meaning
|
504 |
-
it spans the whole height of the line. For some fonts (and by
|
505 |
-
some tastes) a smaller height (for example <code>0.85</code>),
|
506 |
-
which causes the cursor to not reach all the way to the bottom
|
507 |
-
of the line, looks better</dd>
|
508 |
-
|
509 |
-
<dt id="option_resetSelectionOnContextMenu"><code><strong>resetSelectionOnContextMenu</strong>: boolean</code></dt>
|
510 |
-
<dd>Controls whether, when the context menu is opened with a
|
511 |
-
click outside of the current selection, the cursor is moved to
|
512 |
-
the point of the click. Defaults to <code>true</code>.</dd>
|
513 |
-
|
514 |
-
<dt id="option_workTime"><code id="option_wordkDelay"><strong>workTime</strong>, <strong>workDelay</strong>: number</code></dt>
|
515 |
-
<dd>Highlighting is done by a pseudo background-thread that will
|
516 |
-
work for <code>workTime</code> milliseconds, and then use
|
517 |
-
timeout to sleep for <code>workDelay</code> milliseconds. The
|
518 |
-
defaults are 200 and 300, you can change these options to make
|
519 |
-
the highlighting more or less aggressive.</dd>
|
520 |
-
|
521 |
-
<dt id="option_pollInterval"><code><strong>pollInterval</strong>: number</code></dt>
|
522 |
-
<dd>Indicates how quickly CodeMirror should poll its input
|
523 |
-
textarea for changes (when focused). Most input is captured by
|
524 |
-
events, but some things, like IME input on some browsers, don't
|
525 |
-
generate events that allow CodeMirror to properly detect it.
|
526 |
-
Thus, it polls. Default is 100 milliseconds.</dd>
|
527 |
-
|
528 |
-
<dt id="option_flattenSpans"><code><strong>flattenSpans</strong>: boolean</code></dt>
|
529 |
-
<dd>By default, CodeMirror will combine adjacent tokens into a
|
530 |
-
single span if they have the same class. This will result in a
|
531 |
-
simpler DOM tree, and thus perform better. With some kinds of
|
532 |
-
styling (such as rounded corners), this will change the way the
|
533 |
-
document looks. You can set this option to false to disable this
|
534 |
-
behavior.</dd>
|
535 |
-
|
536 |
-
<dt id="option_addModeClass"><code><strong>addModeClass</strong>: boolean</code></dt>
|
537 |
-
<dd>When enabled (off by default), an extra CSS class will be
|
538 |
-
added to each token, indicating the
|
539 |
-
(<a href="#innerMode">inner</a>) mode that produced it, prefixed
|
540 |
-
with <code>"cm-m-"</code>. For example, tokens from the XML mode
|
541 |
-
will get the <code>cm-m-xml</code> class.</dd>
|
542 |
-
|
543 |
-
<dt id="option_maxHighlightLength"><code><strong>maxHighlightLength</strong>: number</code></dt>
|
544 |
-
<dd>When highlighting long lines, in order to stay responsive,
|
545 |
-
the editor will give up and simply style the rest of the line as
|
546 |
-
plain text when it reaches a certain position. The default is
|
547 |
-
10 000. You can set this to <code>Infinity</code> to turn off
|
548 |
-
this behavior.</dd>
|
549 |
-
|
550 |
-
<dt id="option_viewportMargin"><code><strong>viewportMargin</strong>: integer</code></dt>
|
551 |
-
<dd>Specifies the amount of lines that are rendered above and
|
552 |
-
below the part of the document that's currently scrolled into
|
553 |
-
view. This affects the amount of updates needed when scrolling,
|
554 |
-
and the amount of work that such an update does. You should
|
555 |
-
usually leave it at its default, 10. Can be set
|
556 |
-
to <code>Infinity</code> to make sure the whole document is
|
557 |
-
always rendered, and thus the browser's text search works on it.
|
558 |
-
This <em>will</em> have bad effects on performance of big
|
559 |
-
documents.</dd>
|
560 |
-
|
561 |
-
<dt id="option_spellcheck"><code><strong>spellcheck</strong>: boolean</code></dt>
|
562 |
-
<dd>Specifies whether or not spellcheck will be enabled on the input.</dd>
|
563 |
-
|
564 |
-
<dt id="option_autocorrect"><code><strong>autocorrect</strong>: boolean</code></dt>
|
565 |
-
<dd>Specifies whether or not autocorrect will be enabled on the input.</dd>
|
566 |
-
|
567 |
-
<dt id="option_autocapitalize"><code><strong>autocapitalize</strong>: boolean</code></dt>
|
568 |
-
<dd>Specifies whether or not autocapitalization will be enabled on the input.</dd>
|
569 |
-
</dl>
|
570 |
-
</section>
|
571 |
-
|
572 |
-
<section id=events>
|
573 |
-
<h2>Events</h2>
|
574 |
-
|
575 |
-
<p>Various CodeMirror-related objects emit events, which allow
|
576 |
-
client code to react to various situations. Handlers for such
|
577 |
-
events can be registered with the <a href="#on"><code>on</code></a>
|
578 |
-
and <a href="#off"><code>off</code></a> methods on the objects
|
579 |
-
that the event fires on. To fire your own events,
|
580 |
-
use <code>CodeMirror.signal(target, name, args...)</code>,
|
581 |
-
where <code>target</code> is a non-DOM-node object.</p>
|
582 |
-
|
583 |
-
<p>An editor instance fires the following events.
|
584 |
-
The <code>instance</code> argument always refers to the editor
|
585 |
-
itself.</p>
|
586 |
-
|
587 |
-
<dl>
|
588 |
-
<dt id="event_change"><code><strong>"change"</strong> (instance: CodeMirror, changeObj: object)</code></dt>
|
589 |
-
<dd>Fires every time the content of the editor is changed.
|
590 |
-
The <code>changeObj</code> is a <code>{from, to, text, removed,
|
591 |
-
origin}</code> object containing information about the changes
|
592 |
-
that occurred as second argument. <code>from</code>
|
593 |
-
and <code>to</code> are the positions (in the pre-change
|
594 |
-
coordinate system) where the change started and ended (for
|
595 |
-
example, it might be <code>{ch:0, line:18}</code> if the
|
596 |
-
position is at the beginning of line #19). <code>text</code> is
|
597 |
-
an array of strings representing the text that replaced the
|
598 |
-
changed range (split by line). <code>removed</code> is the text
|
599 |
-
that used to be between <code>from</code> and <code>to</code>,
|
600 |
-
which is overwritten by this change. This event is
|
601 |
-
fired <em>before</em> the end of
|
602 |
-
an <a href="#operation">operation</a>, before the DOM updates
|
603 |
-
happen.</dd>
|
604 |
-
|
605 |
-
<dt id="event_changes"><code><strong>"changes"</strong> (instance: CodeMirror, changes: array<object>)</code></dt>
|
606 |
-
<dd>Like the <a href="#event_change"><code>"change"</code></a>
|
607 |
-
event, but batched per <a href="#operation">operation</a>,
|
608 |
-
passing an array containing all the changes that happened in the
|
609 |
-
operation. This event is fired after the operation finished, and
|
610 |
-
display changes it makes will trigger a new operation.</dd>
|
611 |
-
|
612 |
-
<dt id="event_beforeChange"><code><strong>"beforeChange"</strong> (instance: CodeMirror, changeObj: object)</code></dt>
|
613 |
-
<dd>This event is fired before a change is applied, and its
|
614 |
-
handler may choose to modify or cancel the change.
|
615 |
-
The <code>changeObj</code> object
|
616 |
-
has <code>from</code>, <code>to</code>, and <code>text</code>
|
617 |
-
properties, as with
|
618 |
-
the <a href="#event_change"><code>"change"</code></a> event. It
|
619 |
-
also has a <code>cancel()</code> method, which can be called to
|
620 |
-
cancel the change, and, <strong>if</strong> the change isn't
|
621 |
-
coming from an undo or redo event, an <code>update(from, to,
|
622 |
-
text)</code> method, which may be used to modify the change.
|
623 |
-
Undo or redo changes can't be modified, because they hold some
|
624 |
-
metainformation for restoring old marked ranges that is only
|
625 |
-
valid for that specific change. All three arguments
|
626 |
-
to <code>update</code> are optional, and can be left off to
|
627 |
-
leave the existing value for that field
|
628 |
-
intact. <strong>Note:</strong> you may not do anything from
|
629 |
-
a <code>"beforeChange"</code> handler that would cause changes
|
630 |
-
to the document or its visualization. Doing so will, since this
|
631 |
-
handler is called directly from the bowels of the CodeMirror
|
632 |
-
implementation, probably cause the editor to become
|
633 |
-
corrupted.</dd>
|
634 |
-
|
635 |
-
<dt id="event_cursorActivity"><code><strong>"cursorActivity"</strong> (instance: CodeMirror)</code></dt>
|
636 |
-
<dd>Will be fired when the cursor or selection moves, or any
|
637 |
-
change is made to the editor content.</dd>
|
638 |
-
|
639 |
-
<dt id="event_keyHandled"><code><strong>"keyHandled"</strong> (instance: CodeMirror, name: string, event: Event)</code></dt>
|
640 |
-
<dd>Fired after a key is handled through a
|
641 |
-
key map. <code>name</code> is the name of the handled key (for
|
642 |
-
example <code>"Ctrl-X"</code> or <code>"'q'"</code>),
|
643 |
-
and <code>event</code> is the DOM <code>keydown</code>
|
644 |
-
or <code>keypress</code> event.</dd>
|
645 |
-
|
646 |
-
<dt id="event_inputRead"><code><strong>"inputRead"</strong> (instance: CodeMirror, changeObj: object)</code></dt>
|
647 |
-
<dd>Fired whenever new input is read from the hidden textarea
|
648 |
-
(typed or pasted by the user).</dd>
|
649 |
-
|
650 |
-
<dt id="event_electricInput"><code><strong>"electricInput"</strong> (instance: CodeMirror, line: integer)</code></dt>
|
651 |
-
<dd>Fired if text input matched the
|
652 |
-
mode's <a href="#option_electricChars">electric</a> patterns,
|
653 |
-
and this caused the line's indentation to change.</dd>
|
654 |
-
|
655 |
-
<dt id="event_beforeSelectionChange"><code><strong>"beforeSelectionChange"</strong> (instance: CodeMirror, obj: {ranges, origin, update})</code></dt>
|
656 |
-
<dd>This event is fired before the selection is moved. Its
|
657 |
-
handler may inspect the set of selection ranges, present as an
|
658 |
-
array of <code>{anchor, head}</code> objects in
|
659 |
-
the <code>ranges</code> property of the <code>obj</code>
|
660 |
-
argument, and optionally change them by calling
|
661 |
-
the <code>update</code> method on this object, passing an array
|
662 |
-
of ranges in the same format. The object also contains
|
663 |
-
an <code>origin</code> property holding the origin string passed
|
664 |
-
to the selection-changing method, if any. Handlers for this
|
665 |
-
event have the same restriction
|
666 |
-
as <a href="#event_beforeChange"><code>"beforeChange"</code></a>
|
667 |
-
handlers — they should not do anything to directly update the
|
668 |
-
state of the editor.</dd>
|
669 |
-
|
670 |
-
<dt id="event_viewportChange"><code><strong>"viewportChange"</strong> (instance: CodeMirror, from: number, to: number)</code></dt>
|
671 |
-
<dd>Fires whenever the <a href="#getViewport">view port</a> of
|
672 |
-
the editor changes (due to scrolling, editing, or any other
|
673 |
-
factor). The <code>from</code> and <code>to</code> arguments
|
674 |
-
give the new start and end of the viewport.</dd>
|
675 |
-
|
676 |
-
<dt id="event_swapDoc"><code><strong>"swapDoc"</strong> (instance: CodeMirror, oldDoc: Doc)</code></dt>
|
677 |
-
<dd>This is signalled when the editor's document is replaced
|
678 |
-
using the <a href="#swapDoc"><code>swapDoc</code></a>
|
679 |
-
method.</dd>
|
680 |
-
|
681 |
-
<dt id="event_gutterClick"><code><strong>"gutterClick"</strong> (instance: CodeMirror, line: integer, gutter: string, clickEvent: Event)</code></dt>
|
682 |
-
<dd>Fires when the editor gutter (the line-number area) is
|
683 |
-
clicked. Will pass the editor instance as first argument, the
|
684 |
-
(zero-based) number of the line that was clicked as second
|
685 |
-
argument, the CSS class of the gutter that was clicked as third
|
686 |
-
argument, and the raw <code>mousedown</code> event object as
|
687 |
-
fourth argument.</dd>
|
688 |
-
|
689 |
-
<dt id="event_gutterContextMenu"><code><strong>"gutterContextMenu"</strong> (instance: CodeMirror, line: integer, gutter: string, contextMenu: Event: Event)</code></dt>
|
690 |
-
<dd>Fires when the editor gutter (the line-number area)
|
691 |
-
receives a <code>contextmenu</code> event. Will pass the editor
|
692 |
-
instance as first argument, the (zero-based) number of the line
|
693 |
-
that was clicked as second argument, the CSS class of the
|
694 |
-
gutter that was clicked as third argument, and the raw
|
695 |
-
<code>contextmenu</code> mouse event object as fourth argument.
|
696 |
-
You can <code>preventDefault</code> the event, to signal that
|
697 |
-
CodeMirror should do no further handling.</dd>
|
698 |
-
|
699 |
-
<dt id="event_focus"><code><strong>"focus"</strong> (instance: CodeMirror, event: Event)</code></dt>
|
700 |
-
<dd>Fires whenever the editor is focused.</dd>
|
701 |
-
|
702 |
-
<dt id="event_blur"><code><strong>"blur"</strong> (instance: CodeMirror, event: Event)</code></dt>
|
703 |
-
<dd>Fires whenever the editor is unfocused.</dd>
|
704 |
-
|
705 |
-
<dt id="event_scroll"><code><strong>"scroll"</strong> (instance: CodeMirror)</code></dt>
|
706 |
-
<dd>Fires when the editor is scrolled.</dd>
|
707 |
-
|
708 |
-
<dt id="event_refresh"><code><strong>"refresh"</strong> (instance: CodeMirror)</code></dt>
|
709 |
-
<dd>Fires when the editor is <a href="#refresh">refreshed</a>
|
710 |
-
or <a href="#setSize">resized</a>. Mostly useful to invalidate
|
711 |
-
cached values that depend on the editor or character size.</dd>
|
712 |
-
|
713 |
-
<dt id="event_optionChange"><code><strong>"optionChange"</strong> (instance: CodeMirror, option: string)</code></dt>
|
714 |
-
<dd>Dispatched every time an option is changed with <a href="#setOption"><code>setOption</code></a>.</dd>
|
715 |
-
|
716 |
-
<dt id="event_scrollCursorIntoView"><code><strong>"scrollCursorIntoView"</strong> (instance: CodeMirror, event: Event)</code></dt>
|
717 |
-
<dd>Fires when the editor tries to scroll its cursor into view.
|
718 |
-
Can be hooked into to take care of additional scrollable
|
719 |
-
containers around the editor. When the event object has
|
720 |
-
its <code>preventDefault</code> method called, CodeMirror will
|
721 |
-
not itself try to scroll the window.</dd>
|
722 |
-
|
723 |
-
<dt id="event_update"><code><strong>"update"</strong> (instance: CodeMirror)</code></dt>
|
724 |
-
<dd>Will be fired whenever CodeMirror updates its DOM display.</dd>
|
725 |
-
|
726 |
-
<dt id="event_renderLine"><code><strong>"renderLine"</strong> (instance: CodeMirror, line: LineHandle, element: Element)</code></dt>
|
727 |
-
<dd>Fired whenever a line is (re-)rendered to the DOM. Fired
|
728 |
-
right after the DOM element is built, <em>before</em> it is
|
729 |
-
added to the document. The handler may mess with the style of
|
730 |
-
the resulting element, or add event handlers, but
|
731 |
-
should <em>not</em> try to change the state of the editor.</dd>
|
732 |
-
|
733 |
-
<dt id="event_dom"><code><strong>"mousedown"</strong>,
|
734 |
-
<strong>"dblclick"</strong>, <strong>"touchstart"</strong>, <strong>"contextmenu"</strong>,
|
735 |
-
<strong>"keydown"</strong>, <strong>"keypress"</strong>,
|
736 |
-
<strong>"keyup"</strong>, <strong>"cut"</strong>, <strong>"copy"</strong>, <strong>"paste"</strong>,
|
737 |
-
<strong>"dragstart"</strong>, <strong>"dragenter"</strong>,
|
738 |
-
<strong>"dragover"</strong>, <strong>"dragleave"</strong>,
|
739 |
-
<strong>"drop"</strong>
|
740 |
-
(instance: CodeMirror, event: Event)</code></dt>
|
741 |
-
<dd>Fired when CodeMirror is handling a DOM event of this type.
|
742 |
-
You can <code>preventDefault</code> the event, or give it a
|
743 |
-
truthy <code>codemirrorIgnore</code> property, to signal that
|
744 |
-
CodeMirror should do no further handling.</dd>
|
745 |
-
</dl>
|
746 |
-
|
747 |
-
<p>Document objects (instances
|
748 |
-
of <a href="#Doc"><code>CodeMirror.Doc</code></a>) emit the
|
749 |
-
following events:</p>
|
750 |
-
|
751 |
-
<dl>
|
752 |
-
<dt id="event_doc_change"><code><strong>"change"</strong> (doc: CodeMirror.Doc, changeObj: object)</code></dt>
|
753 |
-
<dd>Fired whenever a change occurs to the
|
754 |
-
document. <code>changeObj</code> has a similar type as the
|
755 |
-
object passed to the
|
756 |
-
editor's <a href="#event_change"><code>"change"</code></a>
|
757 |
-
event.</dd>
|
758 |
-
|
759 |
-
<dt id="event_doc_beforeChange"><code><strong>"beforeChange"</strong> (doc: CodeMirror.Doc, change: object)</code></dt>
|
760 |
-
<dd>See the <a href="#event_beforeChange">description of the
|
761 |
-
same event</a> on editor instances.</dd>
|
762 |
-
|
763 |
-
<dt id="event_doc_cursorActivity"><code><strong>"cursorActivity"</strong> (doc: CodeMirror.Doc)</code></dt>
|
764 |
-
<dd>Fired whenever the cursor or selection in this document
|
765 |
-
changes.</dd>
|
766 |
-
|
767 |
-
<dt id="event_doc_beforeSelectionChange"><code><strong>"beforeSelectionChange"</strong> (doc: CodeMirror.Doc, selection: {head, anchor})</code></dt>
|
768 |
-
<dd>Equivalent to
|
769 |
-
the <a href="#event_beforeSelectionChange">event by the same
|
770 |
-
name</a> as fired on editor instances.</dd>
|
771 |
-
</dl>
|
772 |
-
|
773 |
-
<p>Line handles (as returned by, for
|
774 |
-
example, <a href="#getLineHandle"><code>getLineHandle</code></a>)
|
775 |
-
support these events:</p>
|
776 |
-
|
777 |
-
<dl>
|
778 |
-
<dt id="event_delete"><code><strong>"delete"</strong> ()</code></dt>
|
779 |
-
<dd>Will be fired when the line object is deleted. A line object
|
780 |
-
is associated with the <em>start</em> of the line. Mostly useful
|
781 |
-
when you need to find out when your <a href="#setGutterMarker">gutter
|
782 |
-
markers</a> on a given line are removed.</dd>
|
783 |
-
<dt id="event_line_change"><code><strong>"change"</strong> (line: LineHandle, changeObj: object)</code></dt>
|
784 |
-
<dd>Fires when the line's text content is changed in any way
|
785 |
-
(but the line is not deleted outright). The <code>change</code>
|
786 |
-
object is similar to the one passed
|
787 |
-
to <a href="#event_change">change event</a> on the editor
|
788 |
-
object.</dd>
|
789 |
-
</dl>
|
790 |
-
|
791 |
-
<p>Marked range handles (<code>CodeMirror.TextMarker</code>), as returned
|
792 |
-
by <a href="#markText"><code>markText</code></a>
|
793 |
-
and <a href="#setBookmark"><code>setBookmark</code></a>, emit the
|
794 |
-
following events:</p>
|
795 |
-
|
796 |
-
<dl>
|
797 |
-
<dt id="event_beforeCursorEnter"><code><strong>"beforeCursorEnter"</strong> ()</code></dt>
|
798 |
-
<dd>Fired when the cursor enters the marked range. From this
|
799 |
-
event handler, the editor state may be inspected
|
800 |
-
but <em>not</em> modified, with the exception that the range on
|
801 |
-
which the event fires may be cleared.</dd>
|
802 |
-
<dt id="event_clear"><code><strong>"clear"</strong> (from: {line, ch}, to: {line, ch})</code></dt>
|
803 |
-
<dd>Fired when the range is cleared, either through cursor
|
804 |
-
movement in combination
|
805 |
-
with <a href="#mark_clearOnEnter"><code>clearOnEnter</code></a>
|
806 |
-
or through a call to its <code>clear()</code> method. Will only
|
807 |
-
be fired once per handle. Note that deleting the range through
|
808 |
-
text editing does not fire this event, because an undo action
|
809 |
-
might bring the range back into existence. <code>from</code>
|
810 |
-
and <code>to</code> give the part of the document that the range
|
811 |
-
spanned when it was cleared.</dd>
|
812 |
-
<dt id="event_hide"><code><strong>"hide"</strong> ()</code></dt>
|
813 |
-
<dd>Fired when the last part of the marker is removed from the
|
814 |
-
document by editing operations.</dd>
|
815 |
-
<dt id="event_unhide"><code><strong>"unhide"</strong> ()</code></dt>
|
816 |
-
<dd>Fired when, after the marker was removed by editing, a undo
|
817 |
-
operation brought the marker back.</dd>
|
818 |
-
</dl>
|
819 |
-
|
820 |
-
<p>Line widgets (<code>CodeMirror.LineWidget</code>), returned
|
821 |
-
by <a href="#addLineWidget"><code>addLineWidget</code></a>, fire
|
822 |
-
these events:</p>
|
823 |
-
|
824 |
-
<dl>
|
825 |
-
<dt id="event_redraw"><code><strong>"redraw"</strong> ()</code></dt>
|
826 |
-
<dd>Fired whenever the editor re-adds the widget to the DOM.
|
827 |
-
This will happen once right after the widget is added (if it is
|
828 |
-
scrolled into view), and then again whenever it is scrolled out
|
829 |
-
of view and back in again, or when changes to the editor options
|
830 |
-
or the line the widget is on require the widget to be
|
831 |
-
redrawn.</dd>
|
832 |
-
</dl>
|
833 |
-
</section>
|
834 |
-
|
835 |
-
<section id=keymaps>
|
836 |
-
<h2>Key Maps</h2>
|
837 |
-
|
838 |
-
<p>Key maps are ways to associate keys and mouse buttons with
|
839 |
-
functionality. A key map is an object mapping strings that
|
840 |
-
identify the buttons to functions that implement their
|
841 |
-
functionality.</p>
|
842 |
-
|
843 |
-
<p>The CodeMirror distributions comes
|
844 |
-
with <a href="../demo/emacs.html">Emacs</a>, <a href="../demo/vim.html">Vim</a>,
|
845 |
-
and <a href="../demo/sublime.html">Sublime Text</a>-style keymaps.</p>
|
846 |
-
|
847 |
-
<p>Keys are identified either by name or by character.
|
848 |
-
The <code>CodeMirror.keyNames</code> object defines names for
|
849 |
-
common keys and associates them with their key codes. Examples of
|
850 |
-
names defined here are <code>Enter</code>, <code>F5</code>,
|
851 |
-
and <code>Q</code>. These can be prefixed
|
852 |
-
with <code>Shift-</code>, <code>Cmd-</code>, <code>Ctrl-</code>,
|
853 |
-
and <code>Alt-</code> to specify a modifier. So for
|
854 |
-
example, <code>Shift-Ctrl-Space</code> would be a valid key
|
855 |
-
identifier.</p>
|
856 |
-
|
857 |
-
<p>Common example: map the Tab key to insert spaces instead of a tab
|
858 |
-
character.</p>
|
859 |
-
|
860 |
-
<pre data-lang="javascript">
|
861 |
-
editor.setOption("extraKeys", {
|
862 |
-
Tab: function(cm) {
|
863 |
-
var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
|
864 |
-
cm.replaceSelection(spaces);
|
865 |
-
}
|
866 |
-
});</pre>
|
867 |
-
|
868 |
-
<p>Alternatively, a character can be specified directly by
|
869 |
-
surrounding it in single quotes, for example <code>'$'</code>
|
870 |
-
or <code>'q'</code>. Due to limitations in the way browsers fire
|
871 |
-
key events, these may not be prefixed with modifiers.</p>
|
872 |
-
|
873 |
-
<p>To bind mouse buttons, use the names `LeftClick`,
|
874 |
-
`MiddleClick`, and `RightClick`. These can also be prefixed with
|
875 |
-
modifiers, and in addition, the word `Double` or `Triple` can be
|
876 |
-
put before `Click` (as in `LeftDoubleClick`) to bind a double- or
|
877 |
-
triple-click. The function for such a binding is passed the
|
878 |
-
position that was clicked as second argument.</p>
|
879 |
-
|
880 |
-
<p id="normalizeKeyMap">Multi-stroke key bindings can be specified
|
881 |
-
by separating the key names by spaces in the property name, for
|
882 |
-
example <code>Ctrl-X Ctrl-V</code>. When a map contains
|
883 |
-
multi-stoke bindings or keys with modifiers that are not specified
|
884 |
-
in the default order (<code>Shift-Cmd-Ctrl-Alt</code>), you must
|
885 |
-
call <code>CodeMirror.normalizeKeyMap</code> on it before it can
|
886 |
-
be used. This function takes a keymap and modifies it to normalize
|
887 |
-
modifier order and properly recognize multi-stroke bindings. It
|
888 |
-
will return the keymap itself.</p>
|
889 |
-
|
890 |
-
<p>The <code>CodeMirror.keyMap</code> object associates key maps
|
891 |
-
with names. User code and key map definitions can assign extra
|
892 |
-
properties to this object. Anywhere where a key map is expected, a
|
893 |
-
string can be given, which will be looked up in this object. It
|
894 |
-
also contains the <code>"default"</code> key map holding the
|
895 |
-
default bindings.</p>
|
896 |
-
|
897 |
-
<p>The values of properties in key maps can be either functions of
|
898 |
-
a single argument (the CodeMirror instance), strings, or
|
899 |
-
<code>false</code>. Strings refer
|
900 |
-
to <a href="#commands">commands</a>, which are described below. If
|
901 |
-
the property is set to <code>false</code>, CodeMirror leaves
|
902 |
-
handling of the key up to the browser. A key handler function may
|
903 |
-
return <code>CodeMirror.Pass</code> to indicate that it has
|
904 |
-
decided not to handle the key, and other handlers (or the default
|
905 |
-
behavior) should be given a turn.</p>
|
906 |
-
|
907 |
-
<p>Keys mapped to command names that start with the
|
908 |
-
characters <code>"go"</code> or to functions that have a
|
909 |
-
truthy <code>motion</code> property (which should be used for
|
910 |
-
cursor-movement actions) will be fired even when an
|
911 |
-
extra <code>Shift</code> modifier is present (i.e. <code>"Up":
|
912 |
-
"goLineUp"</code> matches both up and shift-up). This is used to
|
913 |
-
easily implement shift-selection.</p>
|
914 |
-
|
915 |
-
<p>Key maps can defer to each other by defining
|
916 |
-
a <code>fallthrough</code> property. This indicates that when a
|
917 |
-
key is not found in the map itself, one or more other maps should
|
918 |
-
be searched. It can hold either a single key map or an array of
|
919 |
-
key maps.</p>
|
920 |
-
|
921 |
-
<p>When a key map needs to set something up when it becomes
|
922 |
-
active, or tear something down when deactivated, it can
|
923 |
-
contain <code>attach</code> and/or <code>detach</code> properties,
|
924 |
-
which should hold functions that take the editor instance and the
|
925 |
-
next or previous keymap. Note that this only works for the
|
926 |
-
<a href="#option_keyMap">top-level keymap</a>, not for fallthrough
|
927 |
-
maps or maps added
|
928 |
-
with <a href="#option_extraKeys"><code>extraKeys</code></a>
|
929 |
-
or <a href="#addKeyMap"><code>addKeyMap</code></a>.</p>
|
930 |
-
</section>
|
931 |
-
|
932 |
-
<section id=commands>
|
933 |
-
<h2>Commands</h2>
|
934 |
-
|
935 |
-
<p>Commands are parameter-less actions that can be performed on an
|
936 |
-
editor. Their main use is for key bindings. Commands are defined by
|
937 |
-
adding properties to the <code>CodeMirror.commands</code> object.
|
938 |
-
A number of common commands are defined by the library itself,
|
939 |
-
most of them used by the default key bindings. The value of a
|
940 |
-
command property must be a function of one argument (an editor
|
941 |
-
instance).</p>
|
942 |
-
|
943 |
-
<p>Some of the commands below are referenced in the default
|
944 |
-
key map, but not defined by the core library. These are intended to
|
945 |
-
be defined by user code or addons.</p>
|
946 |
-
|
947 |
-
<p>Commands can also be run with
|
948 |
-
the <a href="#execCommand"><code>execCommand</code></a>
|
949 |
-
method.</p>
|
950 |
-
|
951 |
-
<dl>
|
952 |
-
<dt class=command id=command_selectAll><code><strong>selectAll</strong></code><span class=keybinding>Ctrl-A (PC), Cmd-A (Mac)</span></dt>
|
953 |
-
<dd>Select the whole content of the editor.</dd>
|
954 |
-
|
955 |
-
<dt class=command id=command_singleSelection><code><strong>singleSelection</strong></code><span class=keybinding>Esc</span></dt>
|
956 |
-
<dd>When multiple selections are present, this deselects all but
|
957 |
-
the primary selection.</dd>
|
958 |
-
|
959 |
-
<dt class=command id=command_killLine><code><strong>killLine</strong></code><span class=keybinding>Ctrl-K (Mac)</span></dt>
|
960 |
-
<dd>Emacs-style line killing. Deletes the part of the line after
|
961 |
-
the cursor. If that consists only of whitespace, the newline at
|
962 |
-
the end of the line is also deleted.</dd>
|
963 |
-
|
964 |
-
<dt class=command id=command_deleteLine><code><strong>deleteLine</strong></code><span class=keybinding>Ctrl-D (PC), Cmd-D (Mac)</span></dt>
|
965 |
-
<dd>Deletes the whole line under the cursor, including newline at the end.</dd>
|
966 |
-
|
967 |
-
<dt class=command id=command_delLineLeft><code><strong>delLineLeft</strong></code></dt>
|
968 |
-
<dd>Delete the part of the line before the cursor.</dd>
|
969 |
-
|
970 |
-
<dt class=command id=command_delWrappedLineLeft><code><strong>delWrappedLineLeft</strong></code><span class=keybinding>Cmd-Backspace (Mac)</span></dt>
|
971 |
-
<dd>Delete the part of the line from the left side of the visual line the cursor is on to the cursor.</dd>
|
972 |
-
|
973 |
-
<dt class=command id=command_delWrappedLineRight><code><strong>delWrappedLineRight</strong></code><span class=keybinding>Cmd-Delete (Mac)</span></dt>
|
974 |
-
<dd>Delete the part of the line from the cursor to the right side of the visual line the cursor is on.</dd>
|
975 |
-
|
976 |
-
<dt class=command id=command_undo><code><strong>undo</strong></code><span class=keybinding>Ctrl-Z (PC), Cmd-Z (Mac)</span></dt>
|
977 |
-
<dd>Undo the last change. Note that, because browsers still
|
978 |
-
don't make it possible for scripts to react to or customize the
|
979 |
-
context menu, selecting undo (or redo) from the context menu in
|
980 |
-
a CodeMirror instance does not work.</dd>
|
981 |
-
|
982 |
-
<dt class=command id=command_redo><code><strong>redo</strong></code><span class=keybinding>Ctrl-Y (PC), Shift-Cmd-Z (Mac), Cmd-Y (Mac)</span></dt>
|
983 |
-
<dd>Redo the last undone change.</dd>
|
984 |
-
|
985 |
-
<dt class=command id=command_undoSelection><code><strong>undoSelection</strong></code><span class=keybinding>Ctrl-U (PC), Cmd-U (Mac)</span></dt>
|
986 |
-
<dd>Undo the last change to the selection, or if there are no
|
987 |
-
selection-only changes at the top of the history, undo the last
|
988 |
-
change.</dd>
|
989 |
-
|
990 |
-
<dt class=command id=command_redoSelection><code><strong>redoSelection</strong></code><span class=keybinding>Alt-U (PC), Shift-Cmd-U (Mac)</span></dt>
|
991 |
-
<dd>Redo the last change to the selection, or the last text change if
|
992 |
-
no selection changes remain.</dd>
|
993 |
-
|
994 |
-
<dt class=command id=command_goDocStart><code><strong>goDocStart</strong></code><span class=keybinding>Ctrl-Home (PC), Cmd-Up (Mac), Cmd-Home (Mac)</span></dt>
|
995 |
-
<dd>Move the cursor to the start of the document.</dd>
|
996 |
-
|
997 |
-
<dt class=command id=command_goDocEnd><code><strong>goDocEnd</strong></code><span class=keybinding>Ctrl-End (PC), Cmd-End (Mac), Cmd-Down (Mac)</span></dt>
|
998 |
-
<dd>Move the cursor to the end of the document.</dd>
|
999 |
-
|
1000 |
-
<dt class=command id=command_goLineStart><code><strong>goLineStart</strong></code><span class=keybinding>Alt-Left (PC), Ctrl-A (Mac)</span></dt>
|
1001 |
-
<dd>Move the cursor to the start of the line.</dd>
|
1002 |
-
|
1003 |
-
<dt class=command id=command_goLineStartSmart><code><strong>goLineStartSmart</strong></code><span class=keybinding>Home</span></dt>
|
1004 |
-
<dd>Move to the start of the text on the line, or if we are
|
1005 |
-
already there, to the actual start of the line (including
|
1006 |
-
whitespace).</dd>
|
1007 |
-
|
1008 |
-
<dt class=command id=command_goLineEnd><code><strong>goLineEnd</strong></code><span class=keybinding>Alt-Right (PC), Ctrl-E (Mac)</span></dt>
|
1009 |
-
<dd>Move the cursor to the end of the line.</dd>
|
1010 |
-
|
1011 |
-
<dt class=command id=command_goLineRight><code><strong>goLineRight</strong></code><span class=keybinding>Cmd-Right (Mac)</span></dt>
|
1012 |
-
<dd>Move the cursor to the right side of the visual line it is on.</dd>
|
1013 |
-
|
1014 |
-
<dt class=command id=command_goLineLeft><code><strong>goLineLeft</strong></code><span class=keybinding>Cmd-Left (Mac)</span></dt>
|
1015 |
-
<dd>Move the cursor to the left side of the visual line it is on. If
|
1016 |
-
this line is wrapped, that may not be the start of the line.</dd>
|
1017 |
-
|
1018 |
-
<dt class=command id=command_goLineLeftSmart><code><strong>goLineLeftSmart</strong></code></dt>
|
1019 |
-
<dd>Move the cursor to the left side of the visual line it is
|
1020 |
-
on. If that takes it to the start of the line, behave
|
1021 |
-
like <a href="#command_goLineStartSmart"><code>goLineStartSmart</code></a>.</dd>
|
1022 |
-
|
1023 |
-
<dt class=command id=command_goLineUp><code><strong>goLineUp</strong></code><span class=keybinding>Up, Ctrl-P (Mac)</span></dt>
|
1024 |
-
<dd>Move the cursor up one line.</dd>
|
1025 |
-
|
1026 |
-
<dt class=command id=command_goLineDown><code><strong>goLineDown</strong></code><span class=keybinding>Down, Ctrl-N (Mac)</span></dt>
|
1027 |
-
<dd>Move down one line.</dd>
|
1028 |
-
|
1029 |
-
<dt class=command id=command_goPageUp><code><strong>goPageUp</strong></code><span class=keybinding>PageUp, Shift-Ctrl-V (Mac)</span></dt>
|
1030 |
-
<dd>Move the cursor up one screen, and scroll up by the same distance.</dd>
|
1031 |
-
|
1032 |
-
<dt class=command id=command_goPageDown><code><strong>goPageDown</strong></code><span class=keybinding>PageDown, Ctrl-V (Mac)</span></dt>
|
1033 |
-
<dd>Move the cursor down one screen, and scroll down by the same distance.</dd>
|
1034 |
-
|
1035 |
-
<dt class=command id=command_goCharLeft><code><strong>goCharLeft</strong></code><span class=keybinding>Left, Ctrl-B (Mac)</span></dt>
|
1036 |
-
<dd>Move the cursor one character left, going to the previous line
|
1037 |
-
when hitting the start of line.</dd>
|
1038 |
-
|
1039 |
-
<dt class=command id=command_goCharRight><code><strong>goCharRight</strong></code><span class=keybinding>Right, Ctrl-F (Mac)</span></dt>
|
1040 |
-
<dd>Move the cursor one character right, going to the next line
|
1041 |
-
when hitting the end of line.</dd>
|
1042 |
-
|
1043 |
-
<dt class=command id=command_goColumnLeft><code><strong>goColumnLeft</strong></code></dt>
|
1044 |
-
<dd>Move the cursor one character left, but don't cross line boundaries.</dd>
|
1045 |
-
|
1046 |
-
<dt class=command id=command_goColumnRight><code><strong>goColumnRight</strong></code></dt>
|
1047 |
-
<dd>Move the cursor one character right, don't cross line boundaries.</dd>
|
1048 |
-
|
1049 |
-
<dt class=command id=command_goWordLeft><code><strong>goWordLeft</strong></code><span class=keybinding>Alt-B (Mac)</span></dt>
|
1050 |
-
<dd>Move the cursor to the start of the previous word.</dd>
|
1051 |
-
|
1052 |
-
<dt class=command id=command_goWordRight><code><strong>goWordRight</strong></code><span class=keybinding>Alt-F (Mac)</span></dt>
|
1053 |
-
<dd>Move the cursor to the end of the next word.</dd>
|
1054 |
-
|
1055 |
-
<dt class=command id=command_goGroupLeft><code><strong>goGroupLeft</strong></code><span class=keybinding>Ctrl-Left (PC), Alt-Left (Mac)</span></dt>
|
1056 |
-
<dd>Move to the left of the group before the cursor. A group is
|
1057 |
-
a stretch of word characters, a stretch of punctuation
|
1058 |
-
characters, a newline, or a stretch of <em>more than one</em>
|
1059 |
-
whitespace character.</dd>
|
1060 |
-
|
1061 |
-
<dt class=command id=command_goGroupRight><code><strong>goGroupRight</strong></code><span class=keybinding>Ctrl-Right (PC), Alt-Right (Mac)</span></dt>
|
1062 |
-
<dd>Move to the right of the group after the cursor
|
1063 |
-
(see <a href="#command_goGroupLeft">above</a>).</dd>
|
1064 |
-
|
1065 |
-
<dt class=command id=command_delCharBefore><code><strong>delCharBefore</strong></code><span class=keybinding>Shift-Backspace, Ctrl-H (Mac)</span></dt>
|
1066 |
-
<dd>Delete the character before the cursor.</dd>
|
1067 |
-
|
1068 |
-
<dt class=command id=command_delCharAfter><code><strong>delCharAfter</strong></code><span class=keybinding>Delete, Ctrl-D (Mac)</span></dt>
|
1069 |
-
<dd>Delete the character after the cursor.</dd>
|
1070 |
-
|
1071 |
-
<dt class=command id=command_delWordBefore><code><strong>delWordBefore</strong></code><span class=keybinding>Alt-Backspace (Mac)</span></dt>
|
1072 |
-
<dd>Delete up to the start of the word before the cursor.</dd>
|
1073 |
-
|
1074 |
-
<dt class=command id=command_delWordAfter><code><strong>delWordAfter</strong></code><span class=keybinding>Alt-D (Mac)</span></dt>
|
1075 |
-
<dd>Delete up to the end of the word after the cursor.</dd>
|
1076 |
-
|
1077 |
-
<dt class=command id=command_delGroupBefore><code><strong>delGroupBefore</strong></code><span class=keybinding>Ctrl-Backspace (PC), Alt-Backspace (Mac)</span></dt>
|
1078 |
-
<dd>Delete to the left of the <a href="#command_goGroupLeft">group</a> before the cursor.</dd>
|
1079 |
-
|
1080 |
-
<dt class=command id=command_delGroupAfter><code><strong>delGroupAfter</strong></code><span class=keybinding>Ctrl-Delete (PC), Ctrl-Alt-Backspace (Mac), Alt-Delete (Mac)</span></dt>
|
1081 |
-
<dd>Delete to the start of the <a href="#command_goGroupLeft">group</a> after the cursor.</dd>
|
1082 |
-
|
1083 |
-
<dt class=command id=command_indentAuto><code><strong>indentAuto</strong></code><span class=keybinding>Shift-Tab</span></dt>
|
1084 |
-
<dd>Auto-indent the current line or selection.</dd>
|
1085 |
-
|
1086 |
-
<dt class=command id=command_indentMore><code><strong>indentMore</strong></code><span class=keybinding>Ctrl-] (PC), Cmd-] (Mac)</span></dt>
|
1087 |
-
<dd>Indent the current line or selection by one <a href="#option_indentUnit">indent unit</a>.</dd>
|
1088 |
-
|
1089 |
-
<dt class=command id=command_indentLess><code><strong>indentLess</strong></code><span class=keybinding>Ctrl-[ (PC), Cmd-[ (Mac)</span></dt>
|
1090 |
-
<dd>Dedent the current line or selection by one <a href="#option_indentUnit">indent unit</a>.</dd>
|
1091 |
-
|
1092 |
-
<dt class=command id=command_insertTab><code><strong>insertTab</strong></code></dt>
|
1093 |
-
<dd>Insert a tab character at the cursor.</dd>
|
1094 |
-
|
1095 |
-
<dt class=command id=command_insertSoftTab><code><strong>insertSoftTab</strong></code></dt>
|
1096 |
-
<dd>Insert the amount of spaces that match the width a tab at
|
1097 |
-
the cursor position would have.</dd>
|
1098 |
-
|
1099 |
-
<dt class=command id=command_defaultTab><code><strong>defaultTab</strong></code><span class=keybinding>Tab</span></dt>
|
1100 |
-
<dd>If something is selected, indent it by
|
1101 |
-
one <a href="#option_indentUnit">indent unit</a>. If nothing is
|
1102 |
-
selected, insert a tab character.</dd>
|
1103 |
-
|
1104 |
-
<dt class=command id=command_transposeChars><code><strong>transposeChars</strong></code><span class=keybinding>Ctrl-T (Mac)</span></dt>
|
1105 |
-
<dd>Swap the characters before and after the cursor.</dd>
|
1106 |
-
|
1107 |
-
<dt class=command id=command_newlineAndIndent><code><strong>newlineAndIndent</strong></code><span class=keybinding>Enter</span></dt>
|
1108 |
-
<dd>Insert a newline and auto-indent the new line.</dd>
|
1109 |
-
|
1110 |
-
<dt class=command id=command_toggleOverwrite><code><strong>toggleOverwrite</strong></code><span class=keybinding>Insert</span></dt>
|
1111 |
-
<dd>Flip the <a href="#toggleOverwrite">overwrite</a> flag.</dd>
|
1112 |
-
|
1113 |
-
<dt class=command id=command_save><code><strong>save</strong></code><span class=keybinding>Ctrl-S (PC), Cmd-S (Mac)</span></dt>
|
1114 |
-
<dd>Not defined by the core library, only referred to in
|
1115 |
-
key maps. Intended to provide an easy way for user code to define
|
1116 |
-
a save command.</dd>
|
1117 |
-
|
1118 |
-
<dt class=command id=command_find><code><strong>find</strong></code><span class=keybinding>Ctrl-F (PC), Cmd-F (Mac)</span></dt>
|
1119 |
-
<dt class=command id=command_findNext><code><strong>findNext</strong></code><span class=keybinding>Ctrl-G (PC), Cmd-G (Mac)</span></dt>
|
1120 |
-
<dt class=command id=command_findPrev><code><strong>findPrev</strong></code><span class=keybinding>Shift-Ctrl-G (PC), Shift-Cmd-G (Mac)</span></dt>
|
1121 |
-
<dt class=command id=command_replace><code><strong>replace</strong></code><span class=keybinding>Shift-Ctrl-F (PC), Cmd-Alt-F (Mac)</span></dt>
|
1122 |
-
<dt class=command id=command_replaceAll><code><strong>replaceAll</strong></code><span class=keybinding>Shift-Ctrl-R (PC), Shift-Cmd-Alt-F (Mac)</span></dt>
|
1123 |
-
<dd>Not defined by the core library, but defined in
|
1124 |
-
the <a href="#addon_search">search addon</a> (or custom client
|
1125 |
-
addons).</dd>
|
1126 |
-
|
1127 |
-
</dl>
|
1128 |
-
|
1129 |
-
</section>
|
1130 |
-
|
1131 |
-
<section id=styling>
|
1132 |
-
<h2>Customized Styling</h2>
|
1133 |
-
|
1134 |
-
<p>Up to a certain extent, CodeMirror's look can be changed by
|
1135 |
-
modifying style sheet files. The style sheets supplied by modes
|
1136 |
-
simply provide the colors for that mode, and can be adapted in a
|
1137 |
-
very straightforward way. To style the editor itself, it is
|
1138 |
-
possible to alter or override the styles defined
|
1139 |
-
in <a href="../lib/codemirror.css"><code>codemirror.css</code></a>.</p>
|
1140 |
-
|
1141 |
-
<p>Some care must be taken there, since a lot of the rules in this
|
1142 |
-
file are necessary to have CodeMirror function properly. Adjusting
|
1143 |
-
colors should be safe, of course, and with some care a lot of
|
1144 |
-
other things can be changed as well. The CSS classes defined in
|
1145 |
-
this file serve the following roles:</p>
|
1146 |
-
|
1147 |
-
<dl>
|
1148 |
-
<dt id="class_CodeMirror"><code><strong>CodeMirror</strong></code></dt>
|
1149 |
-
<dd>The outer element of the editor. This should be used for the
|
1150 |
-
editor width, height, borders and positioning. Can also be used
|
1151 |
-
to set styles that should hold for everything inside the editor
|
1152 |
-
(such as font and font size), or to set a background. Setting
|
1153 |
-
this class' <code>height</code> style to <code>auto</code> will
|
1154 |
-
make the editor <a href="../demo/resize.html">resize to fit its
|
1155 |
-
content</a> (it is recommended to also set
|
1156 |
-
the <a href="#option_viewportMargin"><code>viewportMargin</code>
|
1157 |
-
option</a> to <code>Infinity</code> when doing this.</dd>
|
1158 |
-
|
1159 |
-
<dt id="class_CodeMirror_focused"><code><strong>CodeMirror-focused</strong></code></dt>
|
1160 |
-
<dd>Whenever the editor is focused, the top element gets this
|
1161 |
-
class. This is used to hide the cursor and give the selection a
|
1162 |
-
different color when the editor is not focused.</dd>
|
1163 |
-
|
1164 |
-
<dt id="class_CodeMirror_gutters"><code><strong>CodeMirror-gutters</strong></code></dt>
|
1165 |
-
<dd>This is the backdrop for all gutters. Use it to set the
|
1166 |
-
default gutter background color, and optionally add a border on
|
1167 |
-
the right of the gutters.</dd>
|
1168 |
-
|
1169 |
-
<dt id="class_CodeMirror_linenumbers"><code><strong>CodeMirror-linenumbers</strong></code></dt>
|
1170 |
-
<dd>Use this for giving a background or width to the line number
|
1171 |
-
gutter.</dd>
|
1172 |
-
|
1173 |
-
<dt id="class_CodeMirror_linenumber"><code><strong>CodeMirror-linenumber</strong></code></dt>
|
1174 |
-
<dd>Used to style the actual individual line numbers. These
|
1175 |
-
won't be children of the <code>CodeMirror-linenumbers</code>
|
1176 |
-
(plural) element, but rather will be absolutely positioned to
|
1177 |
-
overlay it. Use this to set alignment and text properties for
|
1178 |
-
the line numbers.</dd>
|
1179 |
-
|
1180 |
-
<dt id="class_CodeMirror_lines"><code><strong>CodeMirror-lines</strong></code></dt>
|
1181 |
-
<dd>The visible lines. This is where you specify vertical
|
1182 |
-
padding for the editor content.</dd>
|
1183 |
-
|
1184 |
-
<dt id="class_CodeMirror_cursor"><code><strong>CodeMirror-cursor</strong></code></dt>
|
1185 |
-
<dd>The cursor is a block element that is absolutely positioned.
|
1186 |
-
You can make it look whichever way you want.</dd>
|
1187 |
-
|
1188 |
-
<dt id="class_CodeMirror_selected"><code><strong>CodeMirror-selected</strong></code></dt>
|
1189 |
-
<dd>The selection is represented by <code>span</code> elements
|
1190 |
-
with this class.</dd>
|
1191 |
-
|
1192 |
-
<dt id="class_CodeMirror_matchingbracket"><code><strong>CodeMirror-matchingbracket</strong></code>,
|
1193 |
-
<code><strong>CodeMirror-nonmatchingbracket</strong></code></dt>
|
1194 |
-
<dd>These are used to style matched (or unmatched) brackets.</dd>
|
1195 |
-
</dl>
|
1196 |
-
|
1197 |
-
<p>If your page's style sheets do funky things to
|
1198 |
-
all <code>div</code> or <code>pre</code> elements (you probably
|
1199 |
-
shouldn't do that), you'll have to define rules to cancel these
|
1200 |
-
effects out again for elements under the <code>CodeMirror</code>
|
1201 |
-
class.</p>
|
1202 |
-
|
1203 |
-
<p>Themes are also simply CSS files, which define colors for
|
1204 |
-
various syntactic elements. See the files in
|
1205 |
-
the <a href="../theme/"><code>theme</code></a> directory.</p>
|
1206 |
-
</section>
|
1207 |
-
|
1208 |
-
<section id=api>
|
1209 |
-
<h2>Programming API</h2>
|
1210 |
-
|
1211 |
-
<p>A lot of CodeMirror features are only available through its
|
1212 |
-
API. Thus, you need to write code (or
|
1213 |
-
use <a href="#addons">addons</a>) if you want to expose them to
|
1214 |
-
your users.</p>
|
1215 |
-
|
1216 |
-
<p>Whenever points in the document are represented, the API uses
|
1217 |
-
objects with <code>line</code> and <code>ch</code> properties.
|
1218 |
-
Both are zero-based. CodeMirror makes sure to 'clip' any positions
|
1219 |
-
passed by client code so that they fit inside the document, so you
|
1220 |
-
shouldn't worry too much about sanitizing your coordinates. If you
|
1221 |
-
give <code>ch</code> a value of <code>null</code>, or don't
|
1222 |
-
specify it, it will be replaced with the length of the specified
|
1223 |
-
line. Such positions may also have a <code>sticky</code> property
|
1224 |
-
holding <code>"before"</code> or <code>"after"</code>, whether the
|
1225 |
-
position is associated with the character before or after it. This
|
1226 |
-
influences, for example, where the cursor is drawn on a
|
1227 |
-
line-break or bidi-direction boundary.</p>
|
1228 |
-
|
1229 |
-
<p>Methods prefixed with <code>doc.</code> can, unless otherwise
|
1230 |
-
specified, be called both on <code>CodeMirror</code> (editor)
|
1231 |
-
instances and <code>CodeMirror.Doc</code> instances. Methods
|
1232 |
-
prefixed with <code>cm.</code> are <em>only</em> available
|
1233 |
-
on <code>CodeMirror</code> instances.</p>
|
1234 |
-
|
1235 |
-
<h3 id="api_constructor">Constructor</h3>
|
1236 |
-
|
1237 |
-
<p id="CodeMirror">Constructing an editor instance is done with
|
1238 |
-
the <code><strong>CodeMirror</strong>(place: Element|fn(Element),
|
1239 |
-
?option: object)</code> constructor. If the <code>place</code>
|
1240 |
-
argument is a DOM element, the editor will be appended to it. If
|
1241 |
-
it is a function, it will be called, and is expected to place the
|
1242 |
-
editor into the document. <code>options</code> may be an element
|
1243 |
-
mapping <a href="#config">option names</a> to values. The options
|
1244 |
-
that it doesn't explicitly specify (or all options, if it is not
|
1245 |
-
passed) will be taken
|
1246 |
-
from <a href="#defaults"><code>CodeMirror.defaults</code></a>.</p>
|
1247 |
-
|
1248 |
-
<p>Note that the options object passed to the constructor will be
|
1249 |
-
mutated when the instance's options
|
1250 |
-
are <a href="#setOption">changed</a>, so you shouldn't share such
|
1251 |
-
objects between instances.</p>
|
1252 |
-
|
1253 |
-
<p>See <a href="#fromTextArea"><code>CodeMirror.fromTextArea</code></a>
|
1254 |
-
for another way to construct an editor instance.</p>
|
1255 |
-
|
1256 |
-
<h3 id="api_content">Content manipulation methods</h3>
|
1257 |
-
|
1258 |
-
<dl>
|
1259 |
-
<dt id="getValue"><code><strong>doc.getValue</strong>(?separator: string) → string</code></dt>
|
1260 |
-
<dd>Get the current editor content. You can pass it an optional
|
1261 |
-
argument to specify the string to be used to separate lines
|
1262 |
-
(defaults to <code>"\n"</code>).</dd>
|
1263 |
-
<dt id="setValue"><code><strong>doc.setValue</strong>(content: string)</code></dt>
|
1264 |
-
<dd>Set the editor content.</dd>
|
1265 |
-
|
1266 |
-
<dt id="getRange"><code><strong>doc.getRange</strong>(from: {line, ch}, to: {line, ch}, ?separator: string) → string</code></dt>
|
1267 |
-
<dd>Get the text between the given points in the editor, which
|
1268 |
-
should be <code>{line, ch}</code> objects. An optional third
|
1269 |
-
argument can be given to indicate the line separator string to
|
1270 |
-
use (defaults to <code>"\n"</code>).</dd>
|
1271 |
-
<dt id="replaceRange"><code><strong>doc.replaceRange</strong>(replacement: string, from: {line, ch}, to: {line, ch}, ?origin: string)</code></dt>
|
1272 |
-
<dd>Replace the part of the document between <code>from</code>
|
1273 |
-
and <code>to</code> with the given string. <code>from</code>
|
1274 |
-
and <code>to</code> must be <code>{line, ch}</code>
|
1275 |
-
objects. <code>to</code> can be left off to simply insert the
|
1276 |
-
string at position <code>from</code>. When <code>origin</code>
|
1277 |
-
is given, it will be passed on
|
1278 |
-
to <a href="#event_change"><code>"change"</code> events</a>, and
|
1279 |
-
its first letter will be used to determine whether this change
|
1280 |
-
can be merged with previous history events, in the way described
|
1281 |
-
for <a href="#selection_origin">selection origins</a>.</dd>
|
1282 |
-
|
1283 |
-
<dt id="getLine"><code><strong>doc.getLine</strong>(n: integer) → string</code></dt>
|
1284 |
-
<dd>Get the content of line <code>n</code>.</dd>
|
1285 |
-
|
1286 |
-
<dt id="lineCount"><code><strong>doc.lineCount</strong>() → integer</code></dt>
|
1287 |
-
<dd>Get the number of lines in the editor.</dd>
|
1288 |
-
<dt id="firstLine"><code><strong>doc.firstLine</strong>() → integer</code></dt>
|
1289 |
-
<dd>Get the number of first line in the editor. This will
|
1290 |
-
usually be zero but for <a href="#linkedDoc_from">linked sub-views</a>,
|
1291 |
-
or <a href="#api_doc">documents</a> instantiated with a non-zero
|
1292 |
-
first line, it might return other values.</dd>
|
1293 |
-
<dt id="lastLine"><code><strong>doc.lastLine</strong>() → integer</code></dt>
|
1294 |
-
<dd>Get the number of last line in the editor. This will
|
1295 |
-
usually be <code>doc.lineCount() - 1</code>,
|
1296 |
-
but for <a href="#linkedDoc_from">linked sub-views</a>,
|
1297 |
-
it might return other values.</dd>
|
1298 |
-
|
1299 |
-
<dt id="getLineHandle"><code><strong>doc.getLineHandle</strong>(num: integer) → LineHandle</code></dt>
|
1300 |
-
<dd>Fetches the line handle for the given line number.</dd>
|
1301 |
-
<dt id="getLineNumber"><code><strong>doc.getLineNumber</strong>(handle: LineHandle) → integer</code></dt>
|
1302 |
-
<dd>Given a line handle, returns the current position of that
|
1303 |
-
line (or <code>null</code> when it is no longer in the
|
1304 |
-
document).</dd>
|
1305 |
-
<dt id="eachLine"><code><strong>doc.eachLine</strong>(f: (line: LineHandle))</code></dt>
|
1306 |
-
<dt><code><strong>doc.eachLine</strong>(start: integer, end: integer, f: (line: LineHandle))</code></dt>
|
1307 |
-
<dd>Iterate over the whole document, or if <code>start</code>
|
1308 |
-
and <code>end</code> line numbers are given, the range
|
1309 |
-
from <code>start</code> up to (not including) <code>end</code>,
|
1310 |
-
and call <code>f</code> for each line, passing the line handle.
|
1311 |
-
This is a faster way to visit a range of line handlers than
|
1312 |
-
calling <a href="#getLineHandle"><code>getLineHandle</code></a>
|
1313 |
-
for each of them. Note that line handles have
|
1314 |
-
a <code>text</code> property containing the line's content (as a
|
1315 |
-
string).</dd>
|
1316 |
-
|
1317 |
-
<dt id="markClean"><code><strong>doc.markClean</strong>()</code></dt>
|
1318 |
-
<dd>Set the editor content as 'clean', a flag that it will
|
1319 |
-
retain until it is edited, and which will be set again when such
|
1320 |
-
an edit is undone again. Useful to track whether the content
|
1321 |
-
needs to be saved. This function is deprecated in favor
|
1322 |
-
of <a href="#changeGeneration"><code>changeGeneration</code></a>,
|
1323 |
-
which allows multiple subsystems to track different notions of
|
1324 |
-
cleanness without interfering.</dd>
|
1325 |
-
<dt id="changeGeneration"><code><strong>doc.changeGeneration</strong>(?closeEvent: boolean) → integer</code></dt>
|
1326 |
-
<dd>Returns a number that can later be passed
|
1327 |
-
to <a href="#isClean"><code>isClean</code></a> to test whether
|
1328 |
-
any edits were made (and not undone) in the meantime.
|
1329 |
-
If <code>closeEvent</code> is true, the current history event
|
1330 |
-
will be ‘closed’, meaning it can't be combined with further
|
1331 |
-
changes (rapid typing or deleting events are typically
|
1332 |
-
combined).</dd>
|
1333 |
-
<dt id="isClean"><code><strong>doc.isClean</strong>(?generation: integer) → boolean</code></dt>
|
1334 |
-
<dd>Returns whether the document is currently clean — not
|
1335 |
-
modified since initialization or the last call
|
1336 |
-
to <a href="#markClean"><code>markClean</code></a> if no
|
1337 |
-
argument is passed, or since the matching call
|
1338 |
-
to <a href="#changeGeneration"><code>changeGeneration</code></a>
|
1339 |
-
if a generation value is given.</dd>
|
1340 |
-
</dl>
|
1341 |
-
|
1342 |
-
<h3 id="api_selection">Cursor and selection methods</h3>
|
1343 |
-
|
1344 |
-
<dl>
|
1345 |
-
<dt id="getSelection"><code><strong>doc.getSelection</strong>(?lineSep: string) → string</code></dt>
|
1346 |
-
<dd>Get the currently selected code. Optionally pass a line
|
1347 |
-
separator to put between the lines in the output. When multiple
|
1348 |
-
selections are present, they are concatenated with instances
|
1349 |
-
of <code>lineSep</code> in between.</dd>
|
1350 |
-
<dt id="getSelections"><code><strong>doc.getSelections</strong>(?lineSep: string) → array<string></code></dt>
|
1351 |
-
<dd>Returns an array containing a string for each selection,
|
1352 |
-
representing the content of the selections.</dd>
|
1353 |
-
|
1354 |
-
<dt id="replaceSelection"><code><strong>doc.replaceSelection</strong>(replacement: string, ?select: string)</code></dt>
|
1355 |
-
<dd>Replace the selection(s) with the given string. By default,
|
1356 |
-
the new selection ends up after the inserted text. The
|
1357 |
-
optional <code>select</code> argument can be used to change
|
1358 |
-
this—passing <code>"around"</code> will cause the new text to be
|
1359 |
-
selected, passing <code>"start"</code> will collapse the
|
1360 |
-
selection to the start of the inserted text.</dd>
|
1361 |
-
<dt id="replaceSelections"><code><strong>doc.replaceSelections</strong>(replacements: array<string>, ?select: string)</code></dt>
|
1362 |
-
<dd>The length of the given array should be the same as the
|
1363 |
-
number of active selections. Replaces the content of the
|
1364 |
-
selections with the strings in the array.
|
1365 |
-
The <code>select</code> argument works the same as
|
1366 |
-
in <a href="#replaceSelection"><code>replaceSelection</code></a>.</dd>
|
1367 |
-
|
1368 |
-
<dt id="getCursor"><code><strong>doc.getCursor</strong>(?start: string) → {line, ch}</code></dt>
|
1369 |
-
<dd>Retrieve one end of the <em>primary</em>
|
1370 |
-
selection. <code>start</code> is an optional string indicating
|
1371 |
-
which end of the selection to return. It may
|
1372 |
-
be <code>"from"</code>, <code>"to"</code>, <code>"head"</code>
|
1373 |
-
(the side of the selection that moves when you press
|
1374 |
-
shift+arrow), or <code>"anchor"</code> (the fixed side of the
|
1375 |
-
selection). Omitting the argument is the same as
|
1376 |
-
passing <code>"head"</code>. A <code>{line, ch}</code> object
|
1377 |
-
will be returned.</dd>
|
1378 |
-
<dt id="listSelections"><code><strong>doc.listSelections</strong>() → array<{anchor, head}></code></dt>
|
1379 |
-
<dd>Retrieves a list of all current selections. These will
|
1380 |
-
always be sorted, and never overlap (overlapping selections are
|
1381 |
-
merged). Each object in the array contains <code>anchor</code>
|
1382 |
-
and <code>head</code> properties referring to <code>{line,
|
1383 |
-
ch}</code> objects.</dd>
|
1384 |
-
|
1385 |
-
<dt id="somethingSelected"><code><strong>doc.somethingSelected</strong>() → boolean</code></dt>
|
1386 |
-
<dd>Return true if any text is selected.</dd>
|
1387 |
-
<dt id="setCursor"><code><strong>doc.setCursor</strong>(pos: {line, ch}|number, ?ch: number, ?options: object)</code></dt>
|
1388 |
-
<dd>Set the cursor position. You can either pass a
|
1389 |
-
single <code>{line, ch}</code> object, or the line and the
|
1390 |
-
character as two separate parameters. Will replace all
|
1391 |
-
selections with a single, empty selection at the given position.
|
1392 |
-
The supported options are the same as for <a href="#setSelection"><code>setSelection</code></a>.</dd>
|
1393 |
-
|
1394 |
-
<dt id="setSelection"><code><strong>doc.setSelection</strong>(anchor: {line, ch}, ?head: {line, ch}, ?options: object)</code></dt>
|
1395 |
-
<dd>Set a single selection range. <code>anchor</code>
|
1396 |
-
and <code>head</code> should be <code>{line, ch}</code>
|
1397 |
-
objects. <code>head</code> defaults to <code>anchor</code> when
|
1398 |
-
not given. These options are supported:
|
1399 |
-
<dl>
|
1400 |
-
<dt id="selection_scroll"><code><strong>scroll</strong>: boolean</code></dt>
|
1401 |
-
<dd>Determines whether the selection head should be scrolled
|
1402 |
-
into view. Defaults to true.</dd>
|
1403 |
-
<dt id="selection_origin"><code><strong>origin</strong>: string</code></dt>
|
1404 |
-
<dd>Determines whether the selection history event may be
|
1405 |
-
merged with the previous one. When an origin starts with the
|
1406 |
-
character <code>+</code>, and the last recorded selection had
|
1407 |
-
the same origin and was similar (close
|
1408 |
-
in <a href="#option_historyEventDelay">time</a>, both
|
1409 |
-
collapsed or both non-collapsed), the new one will replace the
|
1410 |
-
old one. When it starts with <code>*</code>, it will always
|
1411 |
-
replace the previous event (if that had the same origin).
|
1412 |
-
Built-in motion uses the <code>"+move"</code> origin. User input uses the <code>"+input"</code> origin.</dd>
|
1413 |
-
<dt id="selection_bias"><code><strong>bias</strong>: number</code></dt>
|
1414 |
-
<dd>Determine the direction into which the selection endpoints
|
1415 |
-
should be adjusted when they fall inside
|
1416 |
-
an <a href="#mark_atomic">atomic</a> range. Can be either -1
|
1417 |
-
(backward) or 1 (forward). When not given, the bias will be
|
1418 |
-
based on the relative position of the old selection—the editor
|
1419 |
-
will try to move further away from that, to prevent getting
|
1420 |
-
stuck.</dd>
|
1421 |
-
</dl></dd>
|
1422 |
-
|
1423 |
-
<dt id="setSelections"><code><strong>doc.setSelections</strong>(ranges: array<{anchor, head}>, ?primary: integer, ?options: object)</code></dt>
|
1424 |
-
<dd>Sets a new set of selections. There must be at least one
|
1425 |
-
selection in the given array. When <code>primary</code> is a
|
1426 |
-
number, it determines which selection is the primary one. When
|
1427 |
-
it is not given, the primary index is taken from the previous
|
1428 |
-
selection, or set to the last range if the previous selection
|
1429 |
-
had less ranges than the new one. Supports the same options
|
1430 |
-
as <a href="#setSelection"><code>setSelection</code></a>.</dd>
|
1431 |
-
<dt id="addSelection"><code><strong>doc.addSelection</strong>(anchor: {line, ch}, ?head: {line, ch})</code></dt>
|
1432 |
-
<dd>Adds a new selection to the existing set of selections, and
|
1433 |
-
makes it the primary selection.</dd>
|
1434 |
-
|
1435 |
-
<dt id="extendSelection"><code><strong>doc.extendSelection</strong>(from: {line, ch}, ?to: {line, ch}, ?options: object)</code></dt>
|
1436 |
-
<dd>Similar
|
1437 |
-
to <a href="#setSelection"><code>setSelection</code></a>, but
|
1438 |
-
will, if shift is held or
|
1439 |
-
the <a href="#setExtending">extending</a> flag is set, move the
|
1440 |
-
head of the selection while leaving the anchor at its current
|
1441 |
-
place. <code>to</code> is optional, and can be passed to ensure
|
1442 |
-
a region (for example a word or paragraph) will end up selected
|
1443 |
-
(in addition to whatever lies between that region and the
|
1444 |
-
current anchor). When multiple selections are present, all but
|
1445 |
-
the primary selection will be dropped by this method.
|
1446 |
-
Supports the same options as <a href="#setSelection"><code>setSelection</code></a>.</dd>
|
1447 |
-
<dt id="extendSelections"><code><strong>doc.extendSelections</strong>(heads: array<{line, ch}>, ?options: object)</code></dt>
|
1448 |
-
<dd>An equivalent
|
1449 |
-
of <a href="#extendSelection"><code>extendSelection</code></a>
|
1450 |
-
that acts on all selections at once.</dd>
|
1451 |
-
<dt id="extendSelectionsBy"><code><strong>doc.extendSelectionsBy</strong>(f: function(range: {anchor, head}) → {line, ch}), ?options: object)</code></dt>
|
1452 |
-
<dd>Applies the given function to all existing selections, and
|
1453 |
-
calls <a href="#extendSelections"><code>extendSelections</code></a>
|
1454 |
-
on the result.</dd>
|
1455 |
-
<dt id="setExtending"><code><strong>doc.setExtending</strong>(value: boolean)</code></dt>
|
1456 |
-
<dd>Sets or clears the 'extending' flag, which acts similar to
|
1457 |
-
the shift key, in that it will cause cursor movement and calls
|
1458 |
-
to <a href="#extendSelection"><code>extendSelection</code></a>
|
1459 |
-
to leave the selection anchor in place.</dd>
|
1460 |
-
<dt id="getExtending"><code><strong>doc.getExtending</strong>() → boolean</code></dt>
|
1461 |
-
<dd>Get the value of the 'extending' flag.</dd>
|
1462 |
-
|
1463 |
-
<dt id="hasFocus"><code><strong>cm.hasFocus</strong>() → boolean</code></dt>
|
1464 |
-
<dd>Tells you whether the editor currently has focus.</dd>
|
1465 |
-
|
1466 |
-
<dt id="findPosH"><code><strong>cm.findPosH</strong>(start: {line, ch}, amount: integer, unit: string, visually: boolean) → {line, ch, ?hitSide: boolean}</code></dt>
|
1467 |
-
<dd>Used to find the target position for horizontal cursor
|
1468 |
-
motion. <code>start</code> is a <code>{line, ch}</code>
|
1469 |
-
object, <code>amount</code> an integer (may be negative),
|
1470 |
-
and <code>unit</code> one of the
|
1471 |
-
string <code>"char"</code>, <code>"column"</code>,
|
1472 |
-
or <code>"word"</code>. Will return a position that is produced
|
1473 |
-
by moving <code>amount</code> times the distance specified
|
1474 |
-
by <code>unit</code>. When <code>visually</code> is true, motion
|
1475 |
-
in right-to-left text will be visual rather than logical. When
|
1476 |
-
the motion was clipped by hitting the end or start of the
|
1477 |
-
document, the returned value will have a <code>hitSide</code>
|
1478 |
-
property set to true.</dd>
|
1479 |
-
<dt id="findPosV"><code><strong>cm.findPosV</strong>(start: {line, ch}, amount: integer, unit: string) → {line, ch, ?hitSide: boolean}</code></dt>
|
1480 |
-
<dd>Similar to <a href="#findPosH"><code>findPosH</code></a>,
|
1481 |
-
but used for vertical motion. <code>unit</code> may
|
1482 |
-
be <code>"line"</code> or <code>"page"</code>. The other
|
1483 |
-
arguments and the returned value have the same interpretation as
|
1484 |
-
they have in <code>findPosH</code>.</dd>
|
1485 |
-
|
1486 |
-
<dt id="findWordAt"><code><strong>cm.findWordAt</strong>(pos: {line, ch}) → {anchor: {line, ch}, head: {line, ch}}</code></dt>
|
1487 |
-
<dd>Returns the start and end of the 'word' (the stretch of
|
1488 |
-
letters, whitespace, or punctuation) at the given position.</dd>
|
1489 |
-
</dl>
|
1490 |
-
|
1491 |
-
<h3 id="api_configuration">Configuration methods</h3>
|
1492 |
-
|
1493 |
-
<dl>
|
1494 |
-
<dt id="setOption"><code><strong>cm.setOption</strong>(option: string, value: any)</code></dt>
|
1495 |
-
<dd>Change the configuration of the editor. <code>option</code>
|
1496 |
-
should the name of an <a href="#config">option</a>,
|
1497 |
-
and <code>value</code> should be a valid value for that
|
1498 |
-
option.</dd>
|
1499 |
-
<dt id="getOption"><code><strong>cm.getOption</strong>(option: string) → any</code></dt>
|
1500 |
-
<dd>Retrieves the current value of the given option for this
|
1501 |
-
editor instance.</dd>
|
1502 |
-
|
1503 |
-
<dt id="addKeyMap"><code><strong>cm.addKeyMap</strong>(map: object, bottom: boolean)</code></dt>
|
1504 |
-
<dd>Attach an additional <a href="#keymaps">key map</a> to the
|
1505 |
-
editor. This is mostly useful for addons that need to register
|
1506 |
-
some key handlers without trampling on
|
1507 |
-
the <a href="#option_extraKeys"><code>extraKeys</code></a>
|
1508 |
-
option. Maps added in this way have a higher precedence than
|
1509 |
-
the <code>extraKeys</code>
|
1510 |
-
and <a href="#option_keyMap"><code>keyMap</code></a> options,
|
1511 |
-
and between them, the maps added earlier have a lower precedence
|
1512 |
-
than those added later, unless the <code>bottom</code> argument
|
1513 |
-
was passed, in which case they end up below other key maps added
|
1514 |
-
with this method.</dd>
|
1515 |
-
<dt id="removeKeyMap"><code><strong>cm.removeKeyMap</strong>(map: object)</code></dt>
|
1516 |
-
<dd>Disable a keymap added
|
1517 |
-
with <a href="#addKeyMap"><code>addKeyMap</code></a>. Either
|
1518 |
-
pass in the key map object itself, or a string, which will be
|
1519 |
-
compared against the <code>name</code> property of the active
|
1520 |
-
key maps.</dd>
|
1521 |
-
|
1522 |
-
<dt id="addOverlay"><code><strong>cm.addOverlay</strong>(mode: string|object, ?options: object)</code></dt>
|
1523 |
-
<dd>Enable a highlighting overlay. This is a stateless mini-mode
|
1524 |
-
that can be used to add extra highlighting. For example,
|
1525 |
-
the <a href="../demo/search.html">search addon</a> uses it to
|
1526 |
-
highlight the term that's currently being
|
1527 |
-
searched. <code>mode</code> can be a <a href="#option_mode">mode
|
1528 |
-
spec</a> or a mode object (an object with
|
1529 |
-
a <a href="#token"><code>token</code></a> method).
|
1530 |
-
The <code>options</code> parameter is optional. If given, it
|
1531 |
-
should be an object, optionally containing the following options:
|
1532 |
-
<dl>
|
1533 |
-
<dt><code><strong>opaque</strong>: bool</code></dt>
|
1534 |
-
<dd>Defaults to off, but can be given to allow the overlay
|
1535 |
-
styling, when not <code>null</code>, to override the styling of
|
1536 |
-
the base mode entirely, instead of the two being applied
|
1537 |
-
together.</dd>
|
1538 |
-
<dt><code><strong>priority</strong>: number</code></dt>
|
1539 |
-
<dd>Determines the ordering in which the overlays are
|
1540 |
-
applied. Those with high priority are applied after those
|
1541 |
-
with lower priority, and able to override the opaqueness of
|
1542 |
-
the ones that come before. Defaults to 0.</dd>
|
1543 |
-
</dl>
|
1544 |
-
</dd>
|
1545 |
-
|
1546 |
-
<dt id="removeOverlay"><code><strong>cm.removeOverlay</strong>(mode: string|object)</code></dt>
|
1547 |
-
<dd>Pass this the exact value passed for the <code>mode</code>
|
1548 |
-
parameter to <a href="#addOverlay"><code>addOverlay</code></a>,
|
1549 |
-
or a string that corresponds to the <code>name</code> property of
|
1550 |
-
that value, to remove an overlay again.</dd>
|
1551 |
-
|
1552 |
-
<dt id="on"><code><strong>cm.on</strong>(type: string, func: (...args))</code></dt>
|
1553 |
-
<dd>Register an event handler for the given event type (a
|
1554 |
-
string) on the editor instance. There is also
|
1555 |
-
a <code>CodeMirror.on(object, type, func)</code> version
|
1556 |
-
that allows registering of events on any object.</dd>
|
1557 |
-
<dt id="off"><code><strong>cm.off</strong>(type: string, func: (...args))</code></dt>
|
1558 |
-
<dd>Remove an event handler on the editor instance. An
|
1559 |
-
equivalent <code>CodeMirror.off(object, type,
|
1560 |
-
func)</code> also exists.</dd>
|
1561 |
-
</dl>
|
1562 |
-
|
1563 |
-
<h3 id="api_doc">Document management methods</h3>
|
1564 |
-
|
1565 |
-
<p id="Doc">Each editor is associated with an instance
|
1566 |
-
of <code>CodeMirror.Doc</code>, its document. A document
|
1567 |
-
represents the editor content, plus a selection, an undo history,
|
1568 |
-
and a <a href="#option_mode">mode</a>. A document can only be
|
1569 |
-
associated with a single editor at a time. You can create new
|
1570 |
-
documents by calling the <code>CodeMirror.Doc(text: string, mode:
|
1571 |
-
Object, firstLineNumber: ?number, lineSeparator: ?string)</code>
|
1572 |
-
constructor. The last three arguments are optional and can be used
|
1573 |
-
to set a mode for the document, make it start at a line number
|
1574 |
-
other than 0, and set a specific line separator respectively.</p>
|
1575 |
-
|
1576 |
-
<dl>
|
1577 |
-
<dt id="getDoc"><code><strong>cm.getDoc</strong>() → Doc</code></dt>
|
1578 |
-
<dd>Retrieve the currently active document from an editor.</dd>
|
1579 |
-
<dt id="getEditor"><code><strong>doc.getEditor</strong>() → CodeMirror</code></dt>
|
1580 |
-
<dd>Retrieve the editor associated with a document. May
|
1581 |
-
return <code>null</code>.</dd>
|
1582 |
-
|
1583 |
-
<dt id="swapDoc"><code><strong>cm.swapDoc</strong>(doc: CodeMirror.Doc) → Doc</code></dt>
|
1584 |
-
<dd>Attach a new document to the editor. Returns the old
|
1585 |
-
document, which is now no longer associated with an editor.</dd>
|
1586 |
-
|
1587 |
-
<dt id="copy"><code><strong>doc.copy</strong>(copyHistory: boolean) → Doc</code></dt>
|
1588 |
-
<dd>Create an identical copy of the given doc.
|
1589 |
-
When <code>copyHistory</code> is true, the history will also be
|
1590 |
-
copied. Can not be called directly on an editor.</dd>
|
1591 |
-
|
1592 |
-
<dt id="linkedDoc"><code><strong>doc.linkedDoc</strong>(options: object) → Doc</code></dt>
|
1593 |
-
<dd>Create a new document that's linked to the target document.
|
1594 |
-
Linked documents will stay in sync (changes to one are also
|
1595 |
-
applied to the other) until <a href="#unlinkDoc">unlinked</a>.
|
1596 |
-
These are the options that are supported:
|
1597 |
-
<dl>
|
1598 |
-
<dt id="linkedDoc_sharedHist"><code><strong>sharedHist</strong>: boolean</code></dt>
|
1599 |
-
<dd>When turned on, the linked copy will share an undo
|
1600 |
-
history with the original. Thus, something done in one of
|
1601 |
-
the two can be undone in the other, and vice versa.</dd>
|
1602 |
-
<dt id="linkedDoc_from"><code><strong>from</strong>: integer</code></dt>
|
1603 |
-
<dt id="linkedDoc_to"><code><strong>to</strong>: integer</code></dt>
|
1604 |
-
<dd>Can be given to make the new document a subview of the
|
1605 |
-
original. Subviews only show a given range of lines. Note
|
1606 |
-
that line coordinates inside the subview will be consistent
|
1607 |
-
with those of the parent, so that for example a subview
|
1608 |
-
starting at line 10 will refer to its first line as line 10,
|
1609 |
-
not 0.</dd>
|
1610 |
-
<dt id="linkedDoc_mode"><code><strong>mode</strong>: string|object</code></dt>
|
1611 |
-
<dd>By default, the new document inherits the mode of the
|
1612 |
-
parent. This option can be set to
|
1613 |
-
a <a href="#option_mode">mode spec</a> to give it a
|
1614 |
-
different mode.</dd>
|
1615 |
-
</dl></dd>
|
1616 |
-
<dt id="unlinkDoc"><code><strong>doc.unlinkDoc</strong>(doc: CodeMirror.Doc)</code></dt>
|
1617 |
-
<dd>Break the link between two documents. After calling this,
|
1618 |
-
changes will no longer propagate between the documents, and, if
|
1619 |
-
they had a shared history, the history will become
|
1620 |
-
separate.</dd>
|
1621 |
-
<dt id="iterLinkedDocs"><code><strong>doc.iterLinkedDocs</strong>(function: (doc: CodeMirror.Doc, sharedHist: boolean))</code></dt>
|
1622 |
-
<dd>Will call the given function for all documents linked to the
|
1623 |
-
target document. It will be passed two arguments, the linked document
|
1624 |
-
and a boolean indicating whether that document shares history
|
1625 |
-
with the target.</dd>
|
1626 |
-
</dl>
|
1627 |
-
|
1628 |
-
<h3 id="api_history">History-related methods</h3>
|
1629 |
-
|
1630 |
-
<dl>
|
1631 |
-
<dt id="undo"><code><strong>doc.undo</strong>()</code></dt>
|
1632 |
-
<dd>Undo one edit (if any undo events are stored).</dd>
|
1633 |
-
<dt id="redo"><code><strong>doc.redo</strong>()</code></dt>
|
1634 |
-
<dd>Redo one undone edit.</dd>
|
1635 |
-
|
1636 |
-
<dt id="undoSelection"><code><strong>doc.undoSelection</strong>()</code></dt>
|
1637 |
-
<dd>Undo one edit or selection change.</dd>
|
1638 |
-
<dt id="redoSelection"><code><strong>doc.redoSelection</strong>()</code></dt>
|
1639 |
-
<dd>Redo one undone edit or selection change.</dd>
|
1640 |
-
|
1641 |
-
<dt id="historySize"><code><strong>doc.historySize</strong>() → {undo: integer, redo: integer}</code></dt>
|
1642 |
-
<dd>Returns an object with <code>{undo, redo}</code> properties,
|
1643 |
-
both of which hold integers, indicating the amount of stored
|
1644 |
-
undo and redo operations.</dd>
|
1645 |
-
<dt id="clearHistory"><code><strong>doc.clearHistory</strong>()</code></dt>
|
1646 |
-
<dd>Clears the editor's undo history.</dd>
|
1647 |
-
<dt id="getHistory"><code><strong>doc.getHistory</strong>() → object</code></dt>
|
1648 |
-
<dd>Get a (JSON-serializable) representation of the undo history.</dd>
|
1649 |
-
<dt id="setHistory"><code><strong>doc.setHistory</strong>(history: object)</code></dt>
|
1650 |
-
<dd>Replace the editor's undo history with the one provided,
|
1651 |
-
which must be a value as returned
|
1652 |
-
by <a href="#getHistory"><code>getHistory</code></a>. Note that
|
1653 |
-
this will have entirely undefined results if the editor content
|
1654 |
-
isn't also the same as it was when <code>getHistory</code> was
|
1655 |
-
called.</dd>
|
1656 |
-
</dl>
|
1657 |
-
|
1658 |
-
<h3 id="api_marker">Text-marking methods</h3>
|
1659 |
-
|
1660 |
-
<dl>
|
1661 |
-
<dt id="markText"><code><strong>doc.markText</strong>(from: {line, ch}, to: {line, ch}, ?options: object) → TextMarker</code></dt>
|
1662 |
-
<dd>Can be used to mark a range of text with a specific CSS
|
1663 |
-
class name. <code>from</code> and <code>to</code> should
|
1664 |
-
be <code>{line, ch}</code> objects. The <code>options</code>
|
1665 |
-
parameter is optional. When given, it should be an object that
|
1666 |
-
may contain the following configuration options:
|
1667 |
-
<dl>
|
1668 |
-
<dt id="mark_className"><code><strong>className</strong>: string</code></dt>
|
1669 |
-
<dd>Assigns a CSS class to the marked stretch of text.</dd>
|
1670 |
-
<dt id="mark_inclusiveLeft"><code><strong>inclusiveLeft</strong>: boolean</code></dt>
|
1671 |
-
<dd>Determines whether
|
1672 |
-
text inserted on the left of the marker will end up inside
|
1673 |
-
or outside of it.</dd>
|
1674 |
-
<dt id="mark_inclusiveRight"><code><strong>inclusiveRight</strong>: boolean</code></dt>
|
1675 |
-
<dd>Like <code>inclusiveLeft</code>,
|
1676 |
-
but for the right side.</dd>
|
1677 |
-
<dt id="mark_atomic"><code><strong>atomic</strong>: boolean</code></dt>
|
1678 |
-
<dd>Atomic ranges act as a single unit when cursor movement is
|
1679 |
-
concerned—i.e. it is impossible to place the cursor inside of
|
1680 |
-
them. In atomic ranges, <code>inclusiveLeft</code>
|
1681 |
-
and <code>inclusiveRight</code> have a different meaning—they
|
1682 |
-
will prevent the cursor from being placed respectively
|
1683 |
-
directly before and directly after the range.</dd>
|
1684 |
-
<dt id="mark_collapsed"><code><strong>collapsed</strong>: boolean</code></dt>
|
1685 |
-
<dd>Collapsed ranges do not show up in the display. Setting a
|
1686 |
-
range to be collapsed will automatically make it atomic.</dd>
|
1687 |
-
<dt id="mark_clearOnEnter"><code><strong>clearOnEnter</strong>: boolean</code></dt>
|
1688 |
-
<dd>When enabled, will cause the mark to clear itself whenever
|
1689 |
-
the cursor enters its range. This is mostly useful for
|
1690 |
-
text-replacement widgets that need to 'snap open' when the
|
1691 |
-
user tries to edit them. The
|
1692 |
-
<a href="#event_clear"><code>"clear"</code></a> event
|
1693 |
-
fired on the range handle can be used to be notified when this
|
1694 |
-
happens.</dd>
|
1695 |
-
<dt id="mark_clearWhenEmpty"><code><strong>clearWhenEmpty</strong>: boolean</code></dt>
|
1696 |
-
<dd>Determines whether the mark is automatically cleared when
|
1697 |
-
it becomes empty. Default is true.</dd>
|
1698 |
-
<dt id="mark_replacedWith"><code><strong>replacedWith</strong>: Element</code></dt>
|
1699 |
-
<dd>Use a given node to display this range. Implies both
|
1700 |
-
collapsed and atomic. The given DOM node <em>must</em> be an
|
1701 |
-
inline element (as opposed to a block element).</dd>
|
1702 |
-
<dt><code><strong>handleMouseEvents</strong>: boolean</code></dt>
|
1703 |
-
<dd>When <code>replacedWith</code> is given, this determines
|
1704 |
-
whether the editor will capture mouse and drag events
|
1705 |
-
occurring in this widget. Default is false—the events will be
|
1706 |
-
left alone for the default browser handler, or specific
|
1707 |
-
handlers on the widget, to capture.</dd>
|
1708 |
-
<dt id="mark_readOnly"><code><strong>readOnly</strong>: boolean</code></dt>
|
1709 |
-
<dd>A read-only span can, as long as it is not cleared, not be
|
1710 |
-
modified except by
|
1711 |
-
calling <a href="#setValue"><code>setValue</code></a> to reset
|
1712 |
-
the whole document. <em>Note:</em> adding a read-only span
|
1713 |
-
currently clears the undo history of the editor, because
|
1714 |
-
existing undo events being partially nullified by read-only
|
1715 |
-
spans would corrupt the history (in the current
|
1716 |
-
implementation).</dd>
|
1717 |
-
<dt id="mark_addToHistory"><code><strong>addToHistory</strong>: boolean</code></dt>
|
1718 |
-
<dd>When set to true (default is false), adding this marker
|
1719 |
-
will create an event in the undo history that can be
|
1720 |
-
individually undone (clearing the marker).</dd>
|
1721 |
-
<dt id="mark_startStyle"><code><strong>startStyle</strong>: string</code></dt><dd>Can be used to specify
|
1722 |
-
an extra CSS class to be applied to the leftmost span that
|
1723 |
-
is part of the marker.</dd>
|
1724 |
-
<dt id="mark_endStyle"><code><strong>endStyle</strong>: string</code></dt><dd>Equivalent
|
1725 |
-
to <code>startStyle</code>, but for the rightmost span.</dd>
|
1726 |
-
<dt id="mark_css"><code><strong>css</strong>: string</code></dt>
|
1727 |
-
<dd>A string of CSS to be applied to the covered text. For example <code>"color: #fe3"</code>.</dd>
|
1728 |
-
<dt id="mark_attributes"><code><strong>attributes</strong>: object</code></dt>
|
1729 |
-
<dd>When given, add the attributes in the given object to the
|
1730 |
-
elements created for the marked text. Adding <code>class</code> or
|
1731 |
-
<code>style</code> attributes this way is not supported.</dd>
|
1732 |
-
<dt id="mark_shared"><code><strong>shared</strong>: boolean</code></dt><dd>When the
|
1733 |
-
target document is <a href="#linkedDoc">linked</a> to other
|
1734 |
-
documents, you can set <code>shared</code> to true to make the
|
1735 |
-
marker appear in all documents. By default, a marker appears
|
1736 |
-
only in its target document.</dd>
|
1737 |
-
</dl>
|
1738 |
-
The method will return an object that represents the marker
|
1739 |
-
(with constructor <code>CodeMirror.TextMarker</code>), which
|
1740 |
-
exposes three methods:
|
1741 |
-
<code><strong>clear</strong>()</code>, to remove the mark,
|
1742 |
-
<code><strong>find</strong>()</code>, which returns
|
1743 |
-
a <code>{from, to}</code> object (both holding document
|
1744 |
-
positions), indicating the current position of the marked range,
|
1745 |
-
or <code>undefined</code> if the marker is no longer in the
|
1746 |
-
document, and finally <code><strong>changed</strong>()</code>,
|
1747 |
-
which you can call if you've done something that might change
|
1748 |
-
the size of the marker (for example changing the content of
|
1749 |
-
a <a href="#mark_replacedWith"><code>replacedWith</code></a>
|
1750 |
-
node), and want to cheaply update the display.</dd>
|
1751 |
-
|
1752 |
-
<dt id="setBookmark"><code><strong>doc.setBookmark</strong>(pos: {line, ch}, ?options: object) → TextMarker</code></dt>
|
1753 |
-
<dd>Inserts a bookmark, a handle that follows the text around it
|
1754 |
-
as it is being edited, at the given position. A bookmark has two
|
1755 |
-
methods <code>find()</code> and <code>clear()</code>. The first
|
1756 |
-
returns the current position of the bookmark, if it is still in
|
1757 |
-
the document, and the second explicitly removes the bookmark.
|
1758 |
-
The options argument is optional. If given, the following
|
1759 |
-
properties are recognized:
|
1760 |
-
<dl>
|
1761 |
-
<dt><code><strong>widget</strong>: Element</code></dt><dd>Can be used to display a DOM
|
1762 |
-
node at the current location of the bookmark (analogous to
|
1763 |
-
the <a href="#mark_replacedWith"><code>replacedWith</code></a>
|
1764 |
-
option to <a href="#markText"><code>markText</code></a>).</dd>
|
1765 |
-
<dt><code><strong>insertLeft</strong>: boolean</code></dt><dd>By default, text typed
|
1766 |
-
when the cursor is on top of the bookmark will end up to the
|
1767 |
-
right of the bookmark. Set this option to true to make it go
|
1768 |
-
to the left instead.</dd>
|
1769 |
-
<dt><code><strong>shared</strong>: boolean</code></dt><dd>See
|
1770 |
-
the corresponding <a href="#mark_shared">option</a>
|
1771 |
-
to <code>markText</code>.</dd>
|
1772 |
-
<dt><code><strong>handleMouseEvents</strong>: boolean</code></dt>
|
1773 |
-
<dd>As with <a href="#markText"><code>markText</code></a>,
|
1774 |
-
this determines whether mouse events on the widget inserted
|
1775 |
-
for this bookmark are handled by CodeMirror. The default is
|
1776 |
-
false.</dd>
|
1777 |
-
</dl></dd>
|
1778 |
-
|
1779 |
-
<dt id="findMarks"><code><strong>doc.findMarks</strong>(from: {line, ch}, to: {line, ch}) → array<TextMarker></code></dt>
|
1780 |
-
<dd>Returns an array of all the bookmarks and marked ranges
|
1781 |
-
found between the given positions (non-inclusive).</dd>
|
1782 |
-
<dt id="findMarksAt"><code><strong>doc.findMarksAt</strong>(pos: {line, ch}) → array<TextMarker></code></dt>
|
1783 |
-
<dd>Returns an array of all the bookmarks and marked ranges
|
1784 |
-
present at the given position.</dd>
|
1785 |
-
<dt id="getAllMarks"><code><strong>doc.getAllMarks</strong>() → array<TextMarker></code></dt>
|
1786 |
-
<dd>Returns an array containing all marked ranges in the document.</dd>
|
1787 |
-
</dl>
|
1788 |
-
|
1789 |
-
<h3 id="api_decoration">Widget, gutter, and decoration methods</h3>
|
1790 |
-
|
1791 |
-
<dl>
|
1792 |
-
<dt id="setGutterMarker"><code><strong>doc.setGutterMarker</strong>(line: integer|LineHandle, gutterID: string, value: Element) → LineHandle</code></dt>
|
1793 |
-
<dd>Sets the gutter marker for the given gutter (identified by
|
1794 |
-
its CSS class, see
|
1795 |
-
the <a href="#option_gutters"><code>gutters</code></a> option)
|
1796 |
-
to the given value. Value can be either <code>null</code>, to
|
1797 |
-
clear the marker, or a DOM element, to set it. The DOM element
|
1798 |
-
will be shown in the specified gutter next to the specified
|
1799 |
-
line.</dd>
|
1800 |
-
|
1801 |
-
<dt id="clearGutter"><code><strong>doc.clearGutter</strong>(gutterID: string)</code></dt>
|
1802 |
-
<dd>Remove all gutter markers in
|
1803 |
-
the <a href="#option_gutters">gutter</a> with the given ID.</dd>
|
1804 |
-
|
1805 |
-
<dt id="addLineClass"><code><strong>doc.addLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
|
1806 |
-
<dd>Set a CSS class name for the given line. <code>line</code>
|
1807 |
-
can be a number or a line handle. <code>where</code> determines
|
1808 |
-
to which element this class should be applied, can can be one
|
1809 |
-
of <code>"text"</code> (the text element, which lies in front of
|
1810 |
-
the selection), <code>"background"</code> (a background element
|
1811 |
-
that will be behind the selection), <code>"gutter"</code> (the
|
1812 |
-
line's gutter space), or <code>"wrap"</code> (the wrapper node
|
1813 |
-
that wraps all of the line's elements, including gutter
|
1814 |
-
elements). <code>class</code> should be the name of the class to
|
1815 |
-
apply.</dd>
|
1816 |
-
|
1817 |
-
<dt id="removeLineClass"><code><strong>doc.removeLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
|
1818 |
-
<dd>Remove a CSS class from a line. <code>line</code> can be a
|
1819 |
-
line handle or number. <code>where</code> should be one
|
1820 |
-
of <code>"text"</code>, <code>"background"</code>,
|
1821 |
-
or <code>"wrap"</code>
|
1822 |
-
(see <a href="#addLineClass"><code>addLineClass</code></a>). <code>class</code>
|
1823 |
-
can be left off to remove all classes for the specified node, or
|
1824 |
-
be a string to remove only a specific class.</dd>
|
1825 |
-
|
1826 |
-
<dt id="lineInfo"><code><strong>doc.lineInfo</strong>(line: integer|LineHandle) → object</code></dt>
|
1827 |
-
<dd>Returns the line number, text content, and marker status of
|
1828 |
-
the given line, which can be either a number or a line handle.
|
1829 |
-
The returned object has the structure <code>{line, handle, text,
|
1830 |
-
gutterMarkers, textClass, bgClass, wrapClass, widgets}</code>,
|
1831 |
-
where <code>gutterMarkers</code> is an object mapping gutter IDs
|
1832 |
-
to marker elements, and <code>widgets</code> is an array
|
1833 |
-
of <a href="#addLineWidget">line widgets</a> attached to this
|
1834 |
-
line, and the various class properties refer to classes added
|
1835 |
-
with <a href="#addLineClass"><code>addLineClass</code></a>.</dd>
|
1836 |
-
|
1837 |
-
<dt id="addWidget"><code><strong>cm.addWidget</strong>(pos: {line, ch}, node: Element, scrollIntoView: boolean)</code></dt>
|
1838 |
-
<dd>Puts <code>node</code>, which should be an absolutely
|
1839 |
-
positioned DOM node, into the editor, positioned right below the
|
1840 |
-
given <code>{line, ch}</code> position.
|
1841 |
-
When <code>scrollIntoView</code> is true, the editor will ensure
|
1842 |
-
that the entire node is visible (if possible). To remove the
|
1843 |
-
widget again, simply use DOM methods (move it somewhere else, or
|
1844 |
-
call <code>removeChild</code> on its parent).</dd>
|
1845 |
-
|
1846 |
-
<dt id="addLineWidget"><code><strong>doc.addLineWidget</strong>(line: integer|LineHandle, node: Element, ?options: object) → LineWidget</code></dt>
|
1847 |
-
<dd>Adds a line widget, an element shown below a line, spanning
|
1848 |
-
the whole of the editor's width, and moving the lines below it
|
1849 |
-
downwards. <code>line</code> should be either an integer or a
|
1850 |
-
line handle, and <code>node</code> should be a DOM node, which
|
1851 |
-
will be displayed below the given line. <code>options</code>,
|
1852 |
-
when given, should be an object that configures the behavior of
|
1853 |
-
the widget. The following options are supported (all default to
|
1854 |
-
false):
|
1855 |
-
<dl>
|
1856 |
-
<dt><code><strong>coverGutter</strong>: boolean</code></dt>
|
1857 |
-
<dd>Whether the widget should cover the gutter.</dd>
|
1858 |
-
<dt><code><strong>noHScroll</strong>: boolean</code></dt>
|
1859 |
-
<dd>Whether the widget should stay fixed in the face of
|
1860 |
-
horizontal scrolling.</dd>
|
1861 |
-
<dt><code><strong>above</strong>: boolean</code></dt>
|
1862 |
-
<dd>Causes the widget to be placed above instead of below
|
1863 |
-
the text of the line.</dd>
|
1864 |
-
<dt><code><strong>handleMouseEvents</strong>: boolean</code></dt>
|
1865 |
-
<dd>Determines whether the editor will capture mouse and
|
1866 |
-
drag events occurring in this widget. Default is false—the
|
1867 |
-
events will be left alone for the default browser handler,
|
1868 |
-
or specific handlers on the widget, to capture.</dd>
|
1869 |
-
<dt><code><strong>insertAt</strong>: integer</code></dt>
|
1870 |
-
<dd>By default, the widget is added below other widgets for
|
1871 |
-
the line. This option can be used to place it at a different
|
1872 |
-
position (zero for the top, N to put it after the Nth other
|
1873 |
-
widget). Note that this only has effect once, when the
|
1874 |
-
widget is created.
|
1875 |
-
</dl>
|
1876 |
-
Note that the widget node will become a descendant of nodes with
|
1877 |
-
CodeMirror-specific CSS classes, and those classes might in some
|
1878 |
-
cases affect it. This method returns an object that represents
|
1879 |
-
the widget placement. It'll have a <code>line</code> property
|
1880 |
-
pointing at the line handle that it is associated with, and the following methods:
|
1881 |
-
<dl>
|
1882 |
-
<dt id="widget_clear"><code><strong>clear</strong>()</code></dt><dd>Removes the widget.</dd>
|
1883 |
-
<dt id="widget_changed"><code><strong>changed</strong>()</code></dt><dd>Call
|
1884 |
-
this if you made some change to the widget's DOM node that
|
1885 |
-
might affect its height. It'll force CodeMirror to update
|
1886 |
-
the height of the line that contains the widget.</dd>
|
1887 |
-
</dl>
|
1888 |
-
</dd>
|
1889 |
-
</dl>
|
1890 |
-
|
1891 |
-
<h3 id="api_sizing">Sizing, scrolling and positioning methods</h3>
|
1892 |
-
|
1893 |
-
<dl>
|
1894 |
-
<dt id="setSize"><code><strong>cm.setSize</strong>(width: number|string, height: number|string)</code></dt>
|
1895 |
-
<dd>Programmatically set the size of the editor (overriding the
|
1896 |
-
applicable <a href="#css-resize">CSS
|
1897 |
-
rules</a>). <code>width</code> and <code>height</code>
|
1898 |
-
can be either numbers (interpreted as pixels) or CSS units
|
1899 |
-
(<code>"100%"</code>, for example). You can
|
1900 |
-
pass <code>null</code> for either of them to indicate that that
|
1901 |
-
dimension should not be changed.</dd>
|
1902 |
-
|
1903 |
-
<dt id="scrollTo"><code><strong>cm.scrollTo</strong>(x: number, y: number)</code></dt>
|
1904 |
-
<dd>Scroll the editor to a given (pixel) position. Both
|
1905 |
-
arguments may be left as <code>null</code>
|
1906 |
-
or <code>undefined</code> to have no effect.</dd>
|
1907 |
-
<dt id="getScrollInfo"><code><strong>cm.getScrollInfo</strong>() → {left, top, width, height, clientWidth, clientHeight}</code></dt>
|
1908 |
-
<dd>Get an <code>{left, top, width, height, clientWidth,
|
1909 |
-
clientHeight}</code> object that represents the current scroll
|
1910 |
-
position, the size of the scrollable area, and the size of the
|
1911 |
-
visible area (minus scrollbars).</dd>
|
1912 |
-
<dt id="scrollIntoView"><code><strong>cm.scrollIntoView</strong>(what: {line, ch}|{left, top, right, bottom}|{from, to}|null, ?margin: number)</code></dt>
|
1913 |
-
<dd>Scrolls the given position into view. <code>what</code> may
|
1914 |
-
be <code>null</code> to scroll the cursor into view,
|
1915 |
-
a <code>{line, ch}</code> position to scroll a character into
|
1916 |
-
view, a <code>{left, top, right, bottom}</code> pixel range (in
|
1917 |
-
editor-local coordinates), or a range <code>{from, to}</code>
|
1918 |
-
containing either two character positions or two pixel squares.
|
1919 |
-
The <code>margin</code> parameter is optional. When given, it
|
1920 |
-
indicates the amount of vertical pixels around the given area
|
1921 |
-
that should be made visible as well.</dd>
|
1922 |
-
|
1923 |
-
<dt id="cursorCoords"><code><strong>cm.cursorCoords</strong>(where: boolean|{line, ch}, mode: string) → {left, top, bottom}</code></dt>
|
1924 |
-
<dd>Returns an <code>{left, top, bottom}</code> object
|
1925 |
-
containing the coordinates of the cursor position.
|
1926 |
-
If <code>mode</code> is <code>"local"</code>, they will be
|
1927 |
-
relative to the top-left corner of the editable document. If it
|
1928 |
-
is <code>"page"</code> or not given, they are relative to the
|
1929 |
-
top-left corner of the page. If <code>mode</code>
|
1930 |
-
is <code>"window"</code>, the coordinates are relative to the
|
1931 |
-
top-left corner of the currently visible (scrolled)
|
1932 |
-
window. <code>where</code> can be a boolean indicating whether
|
1933 |
-
you want the start (<code>true</code>) or the end
|
1934 |
-
(<code>false</code>) of the selection, or, if a <code>{line,
|
1935 |
-
ch}</code> object is given, it specifies the precise position at
|
1936 |
-
which you want to measure.</dd>
|
1937 |
-
<dt id="charCoords"><code><strong>cm.charCoords</strong>(pos: {line, ch}, ?mode: string) → {left, right, top, bottom}</code></dt>
|
1938 |
-
<dd>Returns the position and dimensions of an arbitrary
|
1939 |
-
character. <code>pos</code> should be a <code>{line, ch}</code>
|
1940 |
-
object. This differs from <code>cursorCoords</code> in that
|
1941 |
-
it'll give the size of the whole character, rather than just the
|
1942 |
-
position that the cursor would have when it would sit at that
|
1943 |
-
position.</dd>
|
1944 |
-
<dt id="coordsChar"><code><strong>cm.coordsChar</strong>(object: {left, top}, ?mode: string) → {line, ch}</code></dt>
|
1945 |
-
<dd>Given an <code>{left, top}</code> object (e.g. coordinates of a mouse event) returns
|
1946 |
-
the <code>{line, ch}</code> position that corresponds to it. The
|
1947 |
-
optional <code>mode</code> parameter determines relative to what
|
1948 |
-
the coordinates are interpreted. It may
|
1949 |
-
be <code>"window"</code>, <code>"page"</code> (the default),
|
1950 |
-
or <code>"local"</code>.</dd>
|
1951 |
-
<dt id="lineAtHeight"><code><strong>cm.lineAtHeight</strong>(height: number, ?mode: string) → number</code></dt>
|
1952 |
-
<dd>Computes the line at the given pixel
|
1953 |
-
height. <code>mode</code> can be one of the same strings
|
1954 |
-
that <a href="#coordsChar"><code>coordsChar</code></a>
|
1955 |
-
accepts.</dd>
|
1956 |
-
<dt id="heightAtLine"><code><strong>cm.heightAtLine</strong>(line: integer|LineHandle, ?mode: string, ?includeWidgets: bool) → number</code></dt>
|
1957 |
-
<dd>Computes the height of the top of a line, in the coordinate
|
1958 |
-
system specified by <code>mode</code>
|
1959 |
-
(see <a href="#coordsChar"><code>coordsChar</code></a>), which
|
1960 |
-
defaults to <code>"page"</code>. When a line below the bottom of
|
1961 |
-
the document is specified, the returned value is the bottom of
|
1962 |
-
the last line in the document. By default, the position of the
|
1963 |
-
actual text is returned. If `includeWidgets` is true and the
|
1964 |
-
line has line widgets, the position above the first line widget
|
1965 |
-
is returned.</dd>
|
1966 |
-
<dt id="defaultTextHeight"><code><strong>cm.defaultTextHeight</strong>() → number</code></dt>
|
1967 |
-
<dd>Returns the line height of the default font for the editor.</dd>
|
1968 |
-
<dt id="defaultCharWidth"><code><strong>cm.defaultCharWidth</strong>() → number</code></dt>
|
1969 |
-
<dd>Returns the pixel width of an 'x' in the default font for
|
1970 |
-
the editor. (Note that for non-monospace fonts, this is mostly
|
1971 |
-
useless, and even for monospace fonts, non-ascii characters
|
1972 |
-
might have a different width).</dd>
|
1973 |
-
|
1974 |
-
<dt id="getViewport"><code><strong>cm.getViewport</strong>() → {from: number, to: number}</code></dt>
|
1975 |
-
<dd>Returns a <code>{from, to}</code> object indicating the
|
1976 |
-
start (inclusive) and end (exclusive) of the currently rendered
|
1977 |
-
part of the document. In big documents, when most content is
|
1978 |
-
scrolled out of view, CodeMirror will only render the visible
|
1979 |
-
part, and a margin around it. See also
|
1980 |
-
the <a href="#event_viewportChange"><code>viewportChange</code></a>
|
1981 |
-
event.</dd>
|
1982 |
-
|
1983 |
-
<dt id="refresh"><code><strong>cm.refresh</strong>()</code></dt>
|
1984 |
-
<dd>If your code does something to change the size of the editor
|
1985 |
-
element (window resizes are already listened for), or unhides
|
1986 |
-
it, you should probably follow up by calling this method to
|
1987 |
-
ensure CodeMirror is still looking as intended. See also
|
1988 |
-
the <a href="#addon_autorefresh">autorefresh addon</a>.</dd>
|
1989 |
-
</dl>
|
1990 |
-
|
1991 |
-
<h3 id="api_mode">Mode, state, and token-related methods</h3>
|
1992 |
-
|
1993 |
-
<p>When writing language-aware functionality, it can often be
|
1994 |
-
useful to hook into the knowledge that the CodeMirror language
|
1995 |
-
mode has. See <a href="#modeapi">the section on modes</a> for a
|
1996 |
-
more detailed description of how these work.</p>
|
1997 |
-
|
1998 |
-
<dl>
|
1999 |
-
<dt id="getMode"><code><strong>doc.getMode</strong>() → object</code></dt>
|
2000 |
-
<dd>Gets the (outer) mode object for the editor. Note that this
|
2001 |
-
is distinct from <code>getOption("mode")</code>, which gives you
|
2002 |
-
the mode specification, rather than the resolved, instantiated
|
2003 |
-
<a href="#defineMode">mode object</a>.</dd>
|
2004 |
-
|
2005 |
-
<dt id="getModeAt"><code><strong>cm.getModeAt</strong>(pos: {line, ch}) → object</code></dt>
|
2006 |
-
<dd>Gets the inner mode at a given position. This will return
|
2007 |
-
the same as <a href="#getMode"><code>getMode</code></a> for
|
2008 |
-
simple modes, but will return an inner mode for nesting modes
|
2009 |
-
(such as <code>htmlmixed</code>).</dd>
|
2010 |
-
|
2011 |
-
<dt id="getTokenAt"><code><strong>cm.getTokenAt</strong>(pos: {line, ch}, ?precise: boolean) → object</code></dt>
|
2012 |
-
<dd>Retrieves information about the token the current mode found
|
2013 |
-
before the given position (a <code>{line, ch}</code> object). The
|
2014 |
-
returned object has the following properties:
|
2015 |
-
<dl>
|
2016 |
-
<dt><code><strong>start</strong></code></dt><dd>The character (on the given line) at which the token starts.</dd>
|
2017 |
-
<dt><code><strong>end</strong></code></dt><dd>The character at which the token ends.</dd>
|
2018 |
-
<dt><code><strong>string</strong></code></dt><dd>The token's string.</dd>
|
2019 |
-
<dt><code><strong>type</strong></code></dt><dd>The token type the mode assigned
|
2020 |
-
to the token, such as <code>"keyword"</code>
|
2021 |
-
or <code>"comment"</code> (may also be null).</dd>
|
2022 |
-
<dt><code><strong>state</strong></code></dt><dd>The mode's state at the end of this token.</dd>
|
2023 |
-
</dl>
|
2024 |
-
If <code>precise</code> is true, the token will be guaranteed to be accurate based on recent edits. If false or
|
2025 |
-
not specified, the token will use cached state information, which will be faster but might not be accurate if
|
2026 |
-
edits were recently made and highlighting has not yet completed.
|
2027 |
-
</dd>
|
2028 |
-
|
2029 |
-
<dt id="getLineTokens"><code><strong>cm.getLineTokens</strong>(line: integer, ?precise: boolean) → array<{start, end, string, type, state}></code></dt>
|
2030 |
-
<dd>This is similar
|
2031 |
-
to <a href="#getTokenAt"><code>getTokenAt</code></a>, but
|
2032 |
-
collects all tokens for a given line into an array. It is much
|
2033 |
-
cheaper than repeatedly calling <code>getTokenAt</code>, which
|
2034 |
-
re-parses the part of the line before the token for every call.</dd>
|
2035 |
-
|
2036 |
-
<dt id="getTokenTypeAt"><code><strong>cm.getTokenTypeAt</strong>(pos: {line, ch}) → string</code></dt>
|
2037 |
-
<dd>This is a (much) cheaper version
|
2038 |
-
of <a href="#getTokenAt"><code>getTokenAt</code></a> useful for
|
2039 |
-
when you just need the type of the token at a given position,
|
2040 |
-
and no other information. Will return <code>null</code> for
|
2041 |
-
unstyled tokens, and a string, potentially containing multiple
|
2042 |
-
space-separated style names, otherwise.</dd>
|
2043 |
-
|
2044 |
-
<dt id="getHelpers"><code><strong>cm.getHelpers</strong>(pos: {line, ch}, type: string) → array<helper></code></dt>
|
2045 |
-
<dd>Fetch the set of applicable helper values for the given
|
2046 |
-
position. Helpers provide a way to look up functionality
|
2047 |
-
appropriate for a mode. The <code>type</code> argument provides
|
2048 |
-
the helper namespace (see
|
2049 |
-
<a href="#registerHelper"><code>registerHelper</code></a>), in
|
2050 |
-
which the values will be looked up. When the mode itself has a
|
2051 |
-
property that corresponds to the <code>type</code>, that
|
2052 |
-
directly determines the keys that are used to look up the helper
|
2053 |
-
values (it may be either a single string, or an array of
|
2054 |
-
strings). Failing that, the mode's <code>helperType</code>
|
2055 |
-
property and finally the mode's name are used.</dd>
|
2056 |
-
<dd>For example, the JavaScript mode has a
|
2057 |
-
property <code>fold</code> containing <code>"brace"</code>. When
|
2058 |
-
the <code>brace-fold</code> addon is loaded, that defines a
|
2059 |
-
helper named <code>brace</code> in the <code>fold</code>
|
2060 |
-
namespace. This is then used by
|
2061 |
-
the <a href="#addon_foldcode"><code>foldcode</code></a> addon to
|
2062 |
-
figure out that it can use that folding function to fold
|
2063 |
-
JavaScript code.</dd>
|
2064 |
-
<dd>When any <a href="#registerGlobalHelper">'global'</a>
|
2065 |
-
helpers are defined for the given namespace, their predicates
|
2066 |
-
are called on the current mode and editor, and all those that
|
2067 |
-
declare they are applicable will also be added to the array that
|
2068 |
-
is returned.</dd>
|
2069 |
-
|
2070 |
-
<dt id="getHelper"><code><strong>cm.getHelper</strong>(pos: {line, ch}, type: string) → helper</code></dt>
|
2071 |
-
<dd>Returns the first applicable helper value.
|
2072 |
-
See <a href="#getHelpers"><code>getHelpers</code></a>.</dd>
|
2073 |
-
|
2074 |
-
<dt id="getStateAfter"><code><strong>cm.getStateAfter</strong>(?line: integer, ?precise: boolean) → object</code></dt>
|
2075 |
-
<dd>Returns the mode's parser state, if any, at the end of the
|
2076 |
-
given line number. If no line number is given, the state at the
|
2077 |
-
end of the document is returned. This can be useful for storing
|
2078 |
-
parsing errors in the state, or getting other kinds of
|
2079 |
-
contextual information for a line. <code>precise</code> is defined
|
2080 |
-
as in <code>getTokenAt()</code>.</dd>
|
2081 |
-
</dl>
|
2082 |
-
|
2083 |
-
<h3 id="api_misc">Miscellaneous methods</h3>
|
2084 |
-
|
2085 |
-
<dl>
|
2086 |
-
<dt id="operation"><code><strong>cm.operation</strong>(func: () → any) → any</code></dt>
|
2087 |
-
<dd>CodeMirror internally buffers changes and only updates its
|
2088 |
-
DOM structure after it has finished performing some operation.
|
2089 |
-
If you need to perform a lot of operations on a CodeMirror
|
2090 |
-
instance, you can call this method with a function argument. It
|
2091 |
-
will call the function, buffering up all changes, and only doing
|
2092 |
-
the expensive update after the function returns. This can be a
|
2093 |
-
lot faster. The return value from this method will be the return
|
2094 |
-
value of your function.</dd>
|
2095 |
-
|
2096 |
-
<dt id="startOperation"><code><strong>cm.startOperation</strong>()</code></dt>
|
2097 |
-
<dt id="endOperation"><code><strong>cm.endOperation</strong>()</code></dt>
|
2098 |
-
<dd>In normal circumstances, use the above <code>operation</code>
|
2099 |
-
method. But if you want to buffer operations happening asynchronously,
|
2100 |
-
or that can't all be wrapped in a callback function, you can
|
2101 |
-
call <code>startOperation</code> to tell CodeMirror to start
|
2102 |
-
buffering changes, and <code>endOperation</code> to actually
|
2103 |
-
render all the updates. <em>Be careful:</em> if you use this
|
2104 |
-
API and forget to call <code>endOperation</code>, the editor will
|
2105 |
-
just never update.</dd>
|
2106 |
-
|
2107 |
-
<dt id="indentLine"><code><strong>cm.indentLine</strong>(line: integer, ?dir: string|integer)</code></dt>
|
2108 |
-
<dd>Adjust the indentation of the given line. The second
|
2109 |
-
argument (which defaults to <code>"smart"</code>) may be one of:
|
2110 |
-
<dl>
|
2111 |
-
<dt><code><strong>"prev"</strong></code></dt>
|
2112 |
-
<dd>Base indentation on the indentation of the previous line.</dd>
|
2113 |
-
<dt><code><strong>"smart"</strong></code></dt>
|
2114 |
-
<dd>Use the mode's smart indentation if available, behave
|
2115 |
-
like <code>"prev"</code> otherwise.</dd>
|
2116 |
-
<dt><code><strong>"add"</strong></code></dt>
|
2117 |
-
<dd>Increase the indentation of the line by
|
2118 |
-
one <a href="#option_indentUnit">indent unit</a>.</dd>
|
2119 |
-
<dt><code><strong>"subtract"</strong></code></dt>
|
2120 |
-
<dd>Reduce the indentation of the line.</dd>
|
2121 |
-
<dt><code><strong><integer></strong></code></dt>
|
2122 |
-
<dd>Add (positive number) or reduce (negative number) the
|
2123 |
-
indentation by the given amount of spaces.</dd>
|
2124 |
-
</dl></dd>
|
2125 |
-
|
2126 |
-
<dt id="toggleOverwrite"><code><strong>cm.toggleOverwrite</strong>(?value: boolean)</code></dt>
|
2127 |
-
<dd>Switches between overwrite and normal insert mode (when not
|
2128 |
-
given an argument), or sets the overwrite mode to a specific
|
2129 |
-
state (when given an argument).</dd>
|
2130 |
-
|
2131 |
-
<dt id="isReadOnly"><code><strong>cm.isReadOnly</strong>() → boolean</code></dt>
|
2132 |
-
<dd>Tells you whether the editor's content can be edited by the
|
2133 |
-
user.</dd>
|
2134 |
-
|
2135 |
-
<dt id="lineSeparator"><code><strong>doc.lineSeparator</strong>()</code></dt>
|
2136 |
-
<dd>Returns the preferred line separator string for this
|
2137 |
-
document, as per the <a href="#option_lineSeparator">option</a>
|
2138 |
-
by the same name. When that option is <code>null</code>, the
|
2139 |
-
string <code>"\n"</code> is returned.</dd>
|
2140 |
-
|
2141 |
-
<dt id="execCommand"><code><strong>cm.execCommand</strong>(name: string)</code></dt>
|
2142 |
-
<dd>Runs the <a href="#commands">command</a> with the given name on the editor.</dd>
|
2143 |
-
|
2144 |
-
<dt id="posFromIndex"><code><strong>doc.posFromIndex</strong>(index: integer) → {line, ch}</code></dt>
|
2145 |
-
<dd>Calculates and returns a <code>{line, ch}</code> object for a
|
2146 |
-
zero-based <code>index</code> who's value is relative to the start of the
|
2147 |
-
editor's text. If the <code>index</code> is out of range of the text then
|
2148 |
-
the returned object is clipped to start or end of the text
|
2149 |
-
respectively.</dd>
|
2150 |
-
<dt id="indexFromPos"><code><strong>doc.indexFromPos</strong>(object: {line, ch}) → integer</code></dt>
|
2151 |
-
<dd>The reverse of <a href="#posFromIndex"><code>posFromIndex</code></a>.</dd>
|
2152 |
-
|
2153 |
-
<dt id="focus"><code><strong>cm.focus</strong>()</code></dt>
|
2154 |
-
<dd>Give the editor focus.</dd>
|
2155 |
-
|
2156 |
-
<dt id="phrase"><code><strong>cm.phrase</strong>(text: string) → string</code></dt>
|
2157 |
-
<dd>Allow the given string to be translated with
|
2158 |
-
the <a href="#option_phrases"><code>phrases</code>
|
2159 |
-
option</a>.</dd>
|
2160 |
-
|
2161 |
-
<dt id="getInputField"><code><strong>cm.getInputField</strong>() → Element</code></dt>
|
2162 |
-
<dd>Returns the input field for the editor. Will be a textarea
|
2163 |
-
or an editable div, depending on the value of
|
2164 |
-
the <a href="#option_inputStyle"><code>inputStyle</code></a>
|
2165 |
-
option.</dd>
|
2166 |
-
<dt id="getWrapperElement"><code><strong>cm.getWrapperElement</strong>() → Element</code></dt>
|
2167 |
-
<dd>Returns the DOM node that represents the editor, and
|
2168 |
-
controls its size. Remove this from your tree to delete an
|
2169 |
-
editor instance.</dd>
|
2170 |
-
<dt id="getScrollerElement"><code><strong>cm.getScrollerElement</strong>() → Element</code></dt>
|
2171 |
-
<dd>Returns the DOM node that is responsible for the scrolling
|
2172 |
-
of the editor.</dd>
|
2173 |
-
<dt id="getGutterElement"><code><strong>cm.getGutterElement</strong>() → Element</code></dt>
|
2174 |
-
<dd>Fetches the DOM node that contains the editor gutters.</dd>
|
2175 |
-
</dl>
|
2176 |
-
|
2177 |
-
<h3 id="api_static">Static properties</h3>
|
2178 |
-
<p>The <code>CodeMirror</code> object itself provides
|
2179 |
-
several useful properties.</p>
|
2180 |
-
|
2181 |
-
<dl>
|
2182 |
-
<dt id="version"><code><strong>CodeMirror.version</strong>: string</code></dt>
|
2183 |
-
<dd>It contains a string that indicates the version of the
|
2184 |
-
library. This is a triple of
|
2185 |
-
integers <code>"major.minor.patch"</code>,
|
2186 |
-
where <code>patch</code> is zero for releases, and something
|
2187 |
-
else (usually one) for dev snapshots.</dd>
|
2188 |
-
|
2189 |
-
<dt id="fromTextArea"><code><strong>CodeMirror.fromTextArea</strong>(textArea: TextAreaElement, ?config: object)</code></dt>
|
2190 |
-
<dd>This method provides another way to initialize an editor. It
|
2191 |
-
takes a textarea DOM node as first argument and an optional
|
2192 |
-
configuration object as second. It will replace the textarea
|
2193 |
-
with a CodeMirror instance, and wire up the form of that
|
2194 |
-
textarea (if any) to make sure the editor contents are put into
|
2195 |
-
the textarea when the form is submitted. The text in the
|
2196 |
-
textarea will provide the content for the editor. A CodeMirror
|
2197 |
-
instance created this way has three additional methods:
|
2198 |
-
<dl>
|
2199 |
-
<dt id="save"><code><strong>cm.save</strong>()</code></dt>
|
2200 |
-
<dd>Copy the content of the editor into the textarea.</dd>
|
2201 |
-
|
2202 |
-
<dt id="toTextArea"><code><strong>cm.toTextArea</strong>()</code></dt>
|
2203 |
-
<dd>Remove the editor, and restore the original textarea (with
|
2204 |
-
the editor's current content). If you dynamically create and
|
2205 |
-
destroy editors made with `fromTextArea`, without destroying
|
2206 |
-
the form they are part of, you should make sure to call
|
2207 |
-
`toTextArea` to remove the editor, or its `"submit"` handler
|
2208 |
-
on the form will cause a memory leak.</dd>
|
2209 |
-
|
2210 |
-
<dt id="getTextArea"><code><strong>cm.getTextArea</strong>() → TextAreaElement</code></dt>
|
2211 |
-
<dd>Returns the textarea that the instance was based on.</dd>
|
2212 |
-
</dl>
|
2213 |
-
</dd>
|
2214 |
-
|
2215 |
-
<dt id="defaults"><code><strong>CodeMirror.defaults</strong>: object</code></dt>
|
2216 |
-
<dd>An object containing default values for
|
2217 |
-
all <a href="#config">options</a>. You can assign to its
|
2218 |
-
properties to modify defaults (though this won't affect editors
|
2219 |
-
that have already been created).</dd>
|
2220 |
-
|
2221 |
-
<dt id="defineExtension"><code><strong>CodeMirror.defineExtension</strong>(name: string, value: any)</code></dt>
|
2222 |
-
<dd>If you want to define extra methods in terms of the
|
2223 |
-
CodeMirror API, it is possible to
|
2224 |
-
use <code>defineExtension</code>. This will cause the given
|
2225 |
-
value (usually a method) to be added to all CodeMirror instances
|
2226 |
-
created from then on.</dd>
|
2227 |
-
|
2228 |
-
<dt id="defineDocExtension"><code><strong>CodeMirror.defineDocExtension</strong>(name: string, value: any)</code></dt>
|
2229 |
-
<dd>Like <a href="#defineExtension"><code>defineExtension</code></a>,
|
2230 |
-
but the method will be added to the interface
|
2231 |
-
for <a href="#Doc"><code>Doc</code></a> objects instead.</dd>
|
2232 |
-
|
2233 |
-
<dt id="defineOption"><code><strong>CodeMirror.defineOption</strong>(name: string,
|
2234 |
-
default: any, updateFunc: function)</code></dt>
|
2235 |
-
<dd>Similarly, <code>defineOption</code> can be used to define new options for
|
2236 |
-
CodeMirror. The <code>updateFunc</code> will be called with the
|
2237 |
-
editor instance and the new value when an editor is initialized,
|
2238 |
-
and whenever the option is modified
|
2239 |
-
through <a href="#setOption"><code>setOption</code></a>.</dd>
|
2240 |
-
|
2241 |
-
<dt id="defineInitHook"><code><strong>CodeMirror.defineInitHook</strong>(func: function)</code></dt>
|
2242 |
-
<dd>If your extension just needs to run some
|
2243 |
-
code whenever a CodeMirror instance is initialized,
|
2244 |
-
use <code>CodeMirror.defineInitHook</code>. Give it a function as
|
2245 |
-
its only argument, and from then on, that function will be called
|
2246 |
-
(with the instance as argument) whenever a new CodeMirror instance
|
2247 |
-
is initialized.</dd>
|
2248 |
-
|
2249 |
-
<dt id="registerHelper"><code><strong>CodeMirror.registerHelper</strong>(type: string, name: string, value: helper)</code></dt>
|
2250 |
-
<dd>Registers a helper value with the given <code>name</code> in
|
2251 |
-
the given namespace (<code>type</code>). This is used to define
|
2252 |
-
functionality that may be looked up by mode. Will create (if it
|
2253 |
-
doesn't already exist) a property on the <code>CodeMirror</code>
|
2254 |
-
object for the given <code>type</code>, pointing to an object
|
2255 |
-
that maps names to values. I.e. after
|
2256 |
-
doing <code>CodeMirror.registerHelper("hint", "foo",
|
2257 |
-
myFoo)</code>, the value <code>CodeMirror.hint.foo</code> will
|
2258 |
-
point to <code>myFoo</code>.</dd>
|
2259 |
-
|
2260 |
-
<dt id="registerGlobalHelper"><code><strong>CodeMirror.registerGlobalHelper</strong>(type: string, name: string, predicate: fn(mode, CodeMirror), value: helper)</code></dt>
|
2261 |
-
<dd>Acts
|
2262 |
-
like <a href="#registerHelper"><code>registerHelper</code></a>,
|
2263 |
-
but also registers this helper as 'global', meaning that it will
|
2264 |
-
be included by <a href="#getHelpers"><code>getHelpers</code></a>
|
2265 |
-
whenever the given <code>predicate</code> returns true when
|
2266 |
-
called with the local mode and editor.</dd>
|
2267 |
-
|
2268 |
-
<dt id="Pos"><code><strong>CodeMirror.Pos</strong>(line: integer, ?ch: integer, ?sticky: string)</code></dt>
|
2269 |
-
<dd>A constructor for the objects that are used to represent
|
2270 |
-
positions in editor documents. <code>sticky</code> defaults to
|
2271 |
-
null, but can be set to <code>"before"</code>
|
2272 |
-
or <code>"after"</code> to make the position explicitly
|
2273 |
-
associate with the character before or after it.</dd>
|
2274 |
-
|
2275 |
-
<dt id="changeEnd"><code><strong>CodeMirror.changeEnd</strong>(change: object) → {line, ch}</code></dt>
|
2276 |
-
<dd>Utility function that computes an end position from a change
|
2277 |
-
(an object with <code>from</code>, <code>to</code>,
|
2278 |
-
and <code>text</code> properties, as passed to
|
2279 |
-
various <a href="#event_change">event handlers</a>). The
|
2280 |
-
returned position will be the end of the changed
|
2281 |
-
range, <em>after</em> the change is applied.</dd>
|
2282 |
-
|
2283 |
-
<dt id="countColumn"><code><strong>CodeMirror.countColumn</strong>(line: string, index: number, tabSize: number) → number</code></dt>
|
2284 |
-
<dd>Find the column position at a given string index using a given tabsize.</dd>
|
2285 |
-
</dl>
|
2286 |
-
</section>
|
2287 |
-
|
2288 |
-
<section id=addons>
|
2289 |
-
<h2 id="addons">Addons</h2>
|
2290 |
-
|
2291 |
-
<p>The <code>addon</code> directory in the distribution contains a
|
2292 |
-
number of reusable components that implement extra editor
|
2293 |
-
functionality (on top of extension functions
|
2294 |
-
like <a href="#defineOption"><code>defineOption</code></a>, <a href="#defineExtension"><code>defineExtension</code></a>,
|
2295 |
-
and <a href="#registerHelper"><code>registerHelper</code></a>). In
|
2296 |
-
brief, they are:</p>
|
2297 |
-
|
2298 |
-
<dl>
|
2299 |
-
<dt id="addon_dialog"><a href="../addon/dialog/dialog.js"><code>dialog/dialog.js</code></a></dt>
|
2300 |
-
<dd>Provides a very simple way to query users for text input.
|
2301 |
-
Adds the <strong><code>openDialog(template, callback, options) →
|
2302 |
-
closeFunction</code></strong> method to CodeMirror instances,
|
2303 |
-
which can be called with an HTML fragment or a detached DOM
|
2304 |
-
node that provides the prompt (should include an <code>input</code>
|
2305 |
-
or <code>button</code> tag), and a callback function that is called
|
2306 |
-
when the user presses enter. It returns a function <code>closeFunction</code>
|
2307 |
-
which, if called, will close the dialog immediately.
|
2308 |
-
<strong><code>openDialog</code></strong> takes the following options:
|
2309 |
-
<dl>
|
2310 |
-
<dt><code><strong>closeOnEnter</strong>: bool</code></dt>
|
2311 |
-
<dd>If true, the dialog will be closed when the user presses
|
2312 |
-
enter in the input. Defaults to <code>true</code>.</dd>
|
2313 |
-
<dt><code><strong>closeOnBlur</strong>: bool</code></dt>
|
2314 |
-
<dd>Determines whether the dialog is closed when it loses focus. Defaults to <code>true</code>.</dd>
|
2315 |
-
<dt><code><strong>onKeyDown</strong>: fn(event: KeyboardEvent, value: string, close: fn()) → bool</code></dt>
|
2316 |
-
<dd>An event handler that will be called whenever <code>keydown</code> fires in the
|
2317 |
-
dialog's input. If your callback returns <code>true</code>,
|
2318 |
-
the dialog will not do any further processing of the event.</dd>
|
2319 |
-
<dt><code><strong>onKeyUp</strong>: fn(event: KeyboardEvent, value: string, close: fn()) → bool</code></dt>
|
2320 |
-
<dd>Same as <code>onKeyDown</code> but for the
|
2321 |
-
<code>keyup</code> event.</dd>
|
2322 |
-
<dt><code><strong>onInput</strong>: fn(event: InputEvent, value: string, close: fn()) → bool</code></dt>
|
2323 |
-
<dd>Same as <code>onKeyDown</code> but for the
|
2324 |
-
<code>input</code> event.</dd>
|
2325 |
-
<dt><code><strong>onClose</strong>: fn(instance)</code>:</dt>
|
2326 |
-
<dd>A callback that will be called after the dialog has been closed and
|
2327 |
-
removed from the DOM. No return value.</dd>
|
2328 |
-
</dl>
|
2329 |
-
|
2330 |
-
<p>Also adds an <strong><code>openNotification(template, options) →
|
2331 |
-
closeFunction</code></strong> function that simply shows an HTML
|
2332 |
-
fragment as a notification at the top of the editor. It takes a
|
2333 |
-
single option: <code>duration</code>, the amount of time after
|
2334 |
-
which the notification will be automatically closed. If <code>
|
2335 |
-
duration</code> is zero, the dialog will not be closed automatically.</p>
|
2336 |
-
|
2337 |
-
<p>Depends on <code>addon/dialog/dialog.css</code>.</p></dd>
|
2338 |
-
|
2339 |
-
<dt id="addon_searchcursor"><a href="../addon/search/searchcursor.js"><code>search/searchcursor.js</code></a></dt>
|
2340 |
-
<dd>Adds the <code>getSearchCursor(query, start, options) →
|
2341 |
-
cursor</code> method to CodeMirror instances, which can be used
|
2342 |
-
to implement search/replace functionality. <code>query</code>
|
2343 |
-
can be a regular expression or a string. <code>start</code>
|
2344 |
-
provides the starting position of the search. It can be
|
2345 |
-
a <code>{line, ch}</code> object, or can be left off to default
|
2346 |
-
to the start of the document. <code>options</code> is an
|
2347 |
-
optional object, which can contain the property `caseFold:
|
2348 |
-
false` to disable case folding when matching a string, or the
|
2349 |
-
property `multiline: disable` to disable multi-line matching for
|
2350 |
-
regular expressions (which may help performance). A search
|
2351 |
-
cursor has the following methods:
|
2352 |
-
<dl>
|
2353 |
-
<dt><code><strong>findNext</strong>() → boolean</code></dt>
|
2354 |
-
<dt><code><strong>findPrevious</strong>() → boolean</code></dt>
|
2355 |
-
<dd>Search forward or backward from the current position.
|
2356 |
-
The return value indicates whether a match was found. If
|
2357 |
-
matching a regular expression, the return value will be the
|
2358 |
-
array returned by the <code>match</code> method, in case you
|
2359 |
-
want to extract matched groups.</dd>
|
2360 |
-
<dt><code><strong>from</strong>() → {line, ch}</code></dt>
|
2361 |
-
<dt><code><strong>to</strong>() → {line, ch}</code></dt>
|
2362 |
-
<dd>These are only valid when the last call
|
2363 |
-
to <code>findNext</code> or <code>findPrevious</code> did
|
2364 |
-
not return false. They will return <code>{line, ch}</code>
|
2365 |
-
objects pointing at the start and end of the match.</dd>
|
2366 |
-
<dt><code><strong>replace</strong>(text: string, ?origin: string)</code></dt>
|
2367 |
-
<dd>Replaces the currently found match with the given text
|
2368 |
-
and adjusts the cursor position to reflect the
|
2369 |
-
replacement.</dd>
|
2370 |
-
</dl></dd>
|
2371 |
-
|
2372 |
-
<dt id="addon_search"><a href="../addon/search/search.js"><code>search/search.js</code></a></dt>
|
2373 |
-
<dd>Implements the search commands. CodeMirror has keys bound to
|
2374 |
-
these by default, but will not do anything with them unless an
|
2375 |
-
implementation is provided. Depends
|
2376 |
-
on <code>searchcursor.js</code>, and will make use
|
2377 |
-
of <a href="#addon_dialog"><code>openDialog</code></a> when
|
2378 |
-
available to make prompting for search queries less ugly.</dd>
|
2379 |
-
|
2380 |
-
<dt id="addon_jump-to-line"><a href="../addon/search/jump-to-line.js"><code>search/jump-to-line.js</code></a></dt>
|
2381 |
-
<dd>Implements a <code>jumpToLine</code> command and binding <code>Alt-G</code> to it.
|
2382 |
-
Accepts <code>linenumber</code>, <code>+/-linenumber</code>, <code>line:char</code>,
|
2383 |
-
<code>scroll%</code> and <code>:linenumber</code> formats.
|
2384 |
-
This will make use of <a href="#addon_dialog"><code>openDialog</code></a>
|
2385 |
-
when available to make prompting for line number neater.</dd>
|
2386 |
-
|
2387 |
-
<dt id="addon_matchesonscrollbar"><a href="../addon/search/matchesonscrollbar.js"><code>search/matchesonscrollbar.js</code></a></dt>
|
2388 |
-
<dd>Adds a <code>showMatchesOnScrollbar</code> method to editor
|
2389 |
-
instances, which should be given a query (string or regular
|
2390 |
-
expression), optionally a case-fold flag (only applicable for
|
2391 |
-
strings), and optionally a class name (defaults
|
2392 |
-
to <code>CodeMirror-search-match</code>) as arguments. When
|
2393 |
-
called, matches of the given query will be displayed on the
|
2394 |
-
editor's vertical scrollbar. The method returns an object with
|
2395 |
-
a <code>clear</code> method that can be called to remove the
|
2396 |
-
matches. Depends on
|
2397 |
-
the <a href="#addon_annotatescrollbar"><code>annotatescrollbar</code></a>
|
2398 |
-
addon, and
|
2399 |
-
the <a href="../addon/search/matchesonscrollbar.css"><code>matchesonscrollbar.css</code></a>
|
2400 |
-
file provides a default (transparent yellowish) definition of
|
2401 |
-
the CSS class applied to the matches. Note that the matches are
|
2402 |
-
only perfectly aligned if your scrollbar does not have buttons
|
2403 |
-
at the top and bottom. You can use
|
2404 |
-
the <a href="#addon_simplescrollbars"><code>simplescrollbar</code></a>
|
2405 |
-
addon to make sure of this. If this addon is loaded,
|
2406 |
-
the <a href="#addon_search"><code>search</code></a> addon will
|
2407 |
-
automatically use it.</dd>
|
2408 |
-
|
2409 |
-
<dt id="addon_matchbrackets"><a href="../addon/edit/matchbrackets.js"><code>edit/matchbrackets.js</code></a></dt>
|
2410 |
-
<dd>Defines an option <code>matchBrackets</code> which, when set
|
2411 |
-
to true or an options object, causes matching brackets to be
|
2412 |
-
highlighted whenever the cursor is next to them. It also adds a
|
2413 |
-
method <code>matchBrackets</code> that forces this to happen
|
2414 |
-
once, and a method <code>findMatchingBracket</code> that can be
|
2415 |
-
used to run the bracket-finding algorithm that this uses
|
2416 |
-
internally. It takes a start position and an optional config
|
2417 |
-
object. By default, it will find the match to a matchable
|
2418 |
-
character either before or after the cursor (preferring the one
|
2419 |
-
before), but you can control its behavior with these options:
|
2420 |
-
<dl>
|
2421 |
-
<dt><strong><code>afterCursor</code></strong></dt>
|
2422 |
-
<dd>Only use the character after the start position, never the one before it.</dd>
|
2423 |
-
<dt><strong><code>strict</code></strong></dt>
|
2424 |
-
<dd>Causes only matches where both brackets are at the same side of the start position to be considered.</dd>
|
2425 |
-
<dt><strong><code>maxScanLines</code></strong></dt>
|
2426 |
-
<dd>Stop after scanning this amount of lines without a successful match. Defaults to 1000.</dd>
|
2427 |
-
<dt><strong><code>maxScanLineLength</code></strong></dt>
|
2428 |
-
<dd>Ignore lines longer than this. Defaults to 10000.</dd>
|
2429 |
-
<dt><strong><code>maxHighlightLineLength</code></strong></dt>
|
2430 |
-
<dd>Don't highlight a bracket in a line longer than this. Defaults to 1000.</dd>
|
2431 |
-
</dl></dd>
|
2432 |
-
|
2433 |
-
<dt id="addon_closebrackets"><a href="../addon/edit/closebrackets.js"><code>edit/closebrackets.js</code></a></dt>
|
2434 |
-
<dd>Defines an option <code>autoCloseBrackets</code> that will
|
2435 |
-
auto-close brackets and quotes when typed. By default, it'll
|
2436 |
-
auto-close <code>()[]{}''""</code>, but you can pass it a string
|
2437 |
-
similar to that (containing pairs of matching characters), or an
|
2438 |
-
object with <code>pairs</code> and
|
2439 |
-
optionally <code>explode</code> properties to customize
|
2440 |
-
it. <code>explode</code> should be a similar string that gives
|
2441 |
-
the pairs of characters that, when enter is pressed between
|
2442 |
-
them, should have the second character also moved to its own
|
2443 |
-
line. By default, if the active mode has
|
2444 |
-
a <code>closeBrackets</code> property, that overrides the
|
2445 |
-
configuration given in the option. But you can add
|
2446 |
-
an <code>override</code> property with a truthy value to
|
2447 |
-
override mode-specific
|
2448 |
-
configuration. <a href="../demo/closebrackets.html">Demo
|
2449 |
-
here</a>.</dd>
|
2450 |
-
|
2451 |
-
<dt id="addon_matchtags"><a href="../addon/edit/matchtags.js"><code>edit/matchtags.js</code></a></dt>
|
2452 |
-
<dd>Defines an option <code>matchTags</code> that, when enabled,
|
2453 |
-
will cause the tags around the cursor to be highlighted (using
|
2454 |
-
the <code>CodeMirror-matchingtag</code> class). Also
|
2455 |
-
defines
|
2456 |
-
a <a href="#commands">command</a> <code>toMatchingTag</code>,
|
2457 |
-
which you can bind a key to in order to jump to the tag matching
|
2458 |
-
the one under the cursor. Depends on
|
2459 |
-
the <code>addon/fold/xml-fold.js</code>
|
2460 |
-
addon. <a href="../demo/matchtags.html">Demo here.</a></dd>
|
2461 |
-
|
2462 |
-
<dt id="addon_trailingspace"><a href="../addon/edit/trailingspace.js"><code>edit/trailingspace.js</code></a></dt>
|
2463 |
-
<dd>Adds an option <code>showTrailingSpace</code> which, when
|
2464 |
-
enabled, adds the CSS class <code>cm-trailingspace</code> to
|
2465 |
-
stretches of whitespace at the end of lines.
|
2466 |
-
The <a href="../demo/trailingspace.html">demo</a> has a nice
|
2467 |
-
squiggly underline style for this class.</dd>
|
2468 |
-
|
2469 |
-
<dt id="addon_closetag"><a href="../addon/edit/closetag.js"><code>edit/closetag.js</code></a></dt>
|
2470 |
-
<dd>Defines an <code>autoCloseTags</code> option that will
|
2471 |
-
auto-close XML tags when '<code>></code>' or '<code>/</code>'
|
2472 |
-
is typed, and
|
2473 |
-
a <code>closeTag</code> <a href="#commands">command</a> that
|
2474 |
-
closes the nearest open tag. Depends on
|
2475 |
-
the <code>fold/xml-fold.js</code> addon. See
|
2476 |
-
the <a href="../demo/closetag.html">demo</a>.</dd>
|
2477 |
-
|
2478 |
-
<dt id="addon_continuelist"><a href="../addon/edit/continuelist.js"><code>edit/continuelist.js</code></a></dt>
|
2479 |
-
<dd>Markdown specific. Defines
|
2480 |
-
a <code>"newlineAndIndentContinueMarkdownList"</code> <a href="#commands">command</a>
|
2481 |
-
that can be bound to <code>enter</code> to automatically
|
2482 |
-
insert the leading characters for continuing a list. See
|
2483 |
-
the <a href="../mode/markdown/index.html">Markdown mode
|
2484 |
-
demo</a>.</dd>
|
2485 |
-
|
2486 |
-
<dt id="addon_comment"><a href="../addon/comment/comment.js"><code>comment/comment.js</code></a></dt>
|
2487 |
-
<dd>Addon for commenting and uncommenting code. Adds four
|
2488 |
-
methods to CodeMirror instances:
|
2489 |
-
<dl>
|
2490 |
-
<dt id="toggleComment"><code><strong>toggleComment</strong>(?options: object)</code></dt>
|
2491 |
-
<dd>Tries to uncomment the current selection, and if that
|
2492 |
-
fails, line-comments it.</dd>
|
2493 |
-
<dt id="lineComment"><code><strong>lineComment</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
|
2494 |
-
<dd>Set the lines in the given range to be line comments. Will
|
2495 |
-
fall back to <code>blockComment</code> when no line comment
|
2496 |
-
style is defined for the mode.</dd>
|
2497 |
-
<dt id="blockComment"><code><strong>blockComment</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
|
2498 |
-
<dd>Wrap the code in the given range in a block comment. Will
|
2499 |
-
fall back to <code>lineComment</code> when no block comment
|
2500 |
-
style is defined for the mode.</dd>
|
2501 |
-
<dt id="uncomment"><code><strong>uncomment</strong>(from: {line, ch}, to: {line, ch}, ?options: object) → boolean</code></dt>
|
2502 |
-
<dd>Try to uncomment the given range.
|
2503 |
-
Returns <code>true</code> if a comment range was found and
|
2504 |
-
removed, <code>false</code> otherwise.</dd>
|
2505 |
-
</dl>
|
2506 |
-
The <code>options</code> object accepted by these methods may
|
2507 |
-
have the following properties:
|
2508 |
-
<dl>
|
2509 |
-
<dt><code>blockCommentStart, blockCommentEnd, blockCommentLead, lineComment: string</code></dt>
|
2510 |
-
<dd>Override the <a href="#mode_comment">comment string
|
2511 |
-
properties</a> of the mode with custom comment strings.</dd>
|
2512 |
-
<dt><code><strong>padding</strong>: string</code></dt>
|
2513 |
-
<dd>A string that will be inserted after opening and leading
|
2514 |
-
markers, and before closing comment markers. Defaults to a
|
2515 |
-
single space.</dd>
|
2516 |
-
<dt><code><strong>commentBlankLines</strong>: boolean</code></dt>
|
2517 |
-
<dd>Whether, when adding line comments, to also comment lines
|
2518 |
-
that contain only whitespace.</dd>
|
2519 |
-
<dt><code><strong>indent</strong>: boolean</code></dt>
|
2520 |
-
<dd>When adding line comments and this is turned on, it will
|
2521 |
-
align the comment block to the current indentation of the
|
2522 |
-
first line of the block.</dd>
|
2523 |
-
<dt><code><strong>fullLines</strong>: boolean</code></dt>
|
2524 |
-
<dd>When block commenting, this controls whether the whole
|
2525 |
-
lines are indented, or only the precise range that is given.
|
2526 |
-
Defaults to <code>true</code>.</dd>
|
2527 |
-
</dl>
|
2528 |
-
The addon also defines
|
2529 |
-
a <code>toggleComment</code> <a href="#commands">command</a>,
|
2530 |
-
which is a shorthand command for calling
|
2531 |
-
<code>toggleComment</code> with no options.</dd>
|
2532 |
-
|
2533 |
-
<dt id="addon_foldcode"><a href="../addon/fold/foldcode.js"><code>fold/foldcode.js</code></a></dt>
|
2534 |
-
<dd>Helps with code folding. Adds a <code>foldCode</code> method
|
2535 |
-
to editor instances, which will try to do a code fold starting
|
2536 |
-
at the given line, or unfold the fold that is already present.
|
2537 |
-
The method takes as first argument the position that should be
|
2538 |
-
folded (may be a line number or
|
2539 |
-
a <a href="#Pos"><code>Pos</code></a>), and as second optional
|
2540 |
-
argument either a range-finder function, or an options object,
|
2541 |
-
supporting the following properties:
|
2542 |
-
<dl>
|
2543 |
-
<dt><code><strong>rangeFinder</strong>: fn(CodeMirror, Pos)</code></dt>
|
2544 |
-
<dd id="helper_fold_auto">The function that is used to find
|
2545 |
-
foldable ranges. If this is not directly passed, it will
|
2546 |
-
default to <code>CodeMirror.fold.auto</code>, which
|
2547 |
-
uses <a href="#getHelpers"><code>getHelpers</code></a> with
|
2548 |
-
a <code>"fold"</code> type to find folding functions
|
2549 |
-
appropriate for the local mode. There are files in
|
2550 |
-
the <a href="../addon/fold/"><code>addon/fold/</code></a>
|
2551 |
-
directory providing <code>CodeMirror.fold.brace</code>, which
|
2552 |
-
finds blocks in brace languages (JavaScript, C, Java,
|
2553 |
-
etc), <code>CodeMirror.fold.indent</code>, for languages where
|
2554 |
-
indentation determines block structure (Python, Haskell),
|
2555 |
-
and <code>CodeMirror.fold.xml</code>, for XML-style languages,
|
2556 |
-
and <code>CodeMirror.fold.comment</code>, for folding comment
|
2557 |
-
blocks.</dd>
|
2558 |
-
<dt><code><strong>widget</strong>: string|Element</code></dt>
|
2559 |
-
<dd>The widget to show for folded ranges. Can be either a
|
2560 |
-
string, in which case it'll become a span with
|
2561 |
-
class <code>CodeMirror-foldmarker</code>, or a DOM node.</dd>
|
2562 |
-
<dt><code><strong>scanUp</strong>: boolean</code></dt>
|
2563 |
-
<dd>When true (default is false), the addon will try to find
|
2564 |
-
foldable ranges on the lines above the current one if there
|
2565 |
-
isn't an eligible one on the given line.</dd>
|
2566 |
-
<dt><code><strong>minFoldSize</strong>: integer</code></dt>
|
2567 |
-
<dd>The minimum amount of lines that a fold should span to be
|
2568 |
-
accepted. Defaults to 0, which also allows single-line
|
2569 |
-
folds.</dd>
|
2570 |
-
</dl>
|
2571 |
-
See <a href="../demo/folding.html">the demo</a> for an
|
2572 |
-
example.</dd>
|
2573 |
-
|
2574 |
-
<dt id="addon_foldgutter"><a href="../addon/fold/foldgutter.js"><code>fold/foldgutter.js</code></a></dt>
|
2575 |
-
<dd>Provides an option <code>foldGutter</code>, which can be
|
2576 |
-
used to create a gutter with markers indicating the blocks that
|
2577 |
-
can be folded. Create a gutter using
|
2578 |
-
the <a href="#option_gutters"><code>gutters</code></a> option,
|
2579 |
-
giving it the class <code>CodeMirror-foldgutter</code> or
|
2580 |
-
something else if you configure the addon to use a different
|
2581 |
-
class, and this addon will show markers next to folded and
|
2582 |
-
foldable blocks, and handle clicks in this gutter. Note that
|
2583 |
-
CSS styles should be applied to make the gutter, and the fold
|
2584 |
-
markers within it, visible. A default set of CSS styles are
|
2585 |
-
available in:
|
2586 |
-
<a href="../addon/fold/foldgutter.css">
|
2587 |
-
<code>addon/fold/foldgutter.css</code>
|
2588 |
-
</a>.
|
2589 |
-
The option
|
2590 |
-
can be either set to <code>true</code>, or an object containing
|
2591 |
-
the following optional option fields:
|
2592 |
-
<dl>
|
2593 |
-
<dt><code><strong>gutter</strong>: string</code></dt>
|
2594 |
-
<dd>The CSS class of the gutter. Defaults
|
2595 |
-
to <code>"CodeMirror-foldgutter"</code>. You will have to
|
2596 |
-
style this yourself to give it a width (and possibly a
|
2597 |
-
background). See the default gutter style rules above.</dd>
|
2598 |
-
<dt><code><strong>indicatorOpen</strong>: string | Element</code></dt>
|
2599 |
-
<dd>A CSS class or DOM element to be used as the marker for
|
2600 |
-
open, foldable blocks. Defaults
|
2601 |
-
to <code>"CodeMirror-foldgutter-open"</code>.</dd>
|
2602 |
-
<dt><code><strong>indicatorFolded</strong>: string | Element</code></dt>
|
2603 |
-
<dd>A CSS class or DOM element to be used as the marker for
|
2604 |
-
folded blocks. Defaults to <code>"CodeMirror-foldgutter-folded"</code>.</dd>
|
2605 |
-
<dt><code><strong>rangeFinder</strong>: fn(CodeMirror, Pos)</code></dt>
|
2606 |
-
<dd>The range-finder function to use when determining whether
|
2607 |
-
something can be folded. When not
|
2608 |
-
given, <a href="#helper_fold_auto"><code>CodeMirror.fold.auto</code></a>
|
2609 |
-
will be used as default.</dd>
|
2610 |
-
</dl>
|
2611 |
-
The <code>foldOptions</code> editor option can be set to an
|
2612 |
-
object to provide an editor-wide default configuration.
|
2613 |
-
Demo <a href="../demo/folding.html">here</a>.</dd>
|
2614 |
-
|
2615 |
-
<dt id="addon_runmode"><a href="../addon/runmode/runmode.js"><code>runmode/runmode.js</code></a></dt>
|
2616 |
-
<dd>Can be used to run a CodeMirror mode over text without
|
2617 |
-
actually opening an editor instance.
|
2618 |
-
See <a href="../demo/runmode.html">the demo</a> for an example.
|
2619 |
-
There are alternate versions of the file available for
|
2620 |
-
running <a href="../addon/runmode/runmode-standalone.js">stand-alone</a>
|
2621 |
-
(without including all of CodeMirror) and
|
2622 |
-
for <a href="../addon/runmode/runmode.node.js">running under
|
2623 |
-
node.js</a> (see <code>bin/source-highlight</code> for an example of using the latter).</dd>
|
2624 |
-
|
2625 |
-
<dt id="addon_colorize"><a href="../addon/runmode/colorize.js"><code>runmode/colorize.js</code></a></dt>
|
2626 |
-
<dd>Provides a convenient way to syntax-highlight code snippets
|
2627 |
-
in a webpage. Depends on
|
2628 |
-
the <a href="#addon_runmode"><code>runmode</code></a> addon (or
|
2629 |
-
its standalone variant). Provides
|
2630 |
-
a <code>CodeMirror.colorize</code> function that can be called
|
2631 |
-
with an array (or other array-ish collection) of DOM nodes that
|
2632 |
-
represent the code snippets. By default, it'll get
|
2633 |
-
all <code>pre</code> tags. Will read the <code>data-lang</code>
|
2634 |
-
attribute of these nodes to figure out their language, and
|
2635 |
-
syntax-color their content using the relevant CodeMirror mode
|
2636 |
-
(you'll have to load the scripts for the relevant modes
|
2637 |
-
yourself). A second argument may be provided to give a default
|
2638 |
-
mode, used when no language attribute is found for a node. Used
|
2639 |
-
in this manual to highlight example code.</dd>
|
2640 |
-
|
2641 |
-
<dt id="addon_overlay"><a href="../addon/mode/overlay.js"><code>mode/overlay.js</code></a></dt>
|
2642 |
-
<dd>Mode combinator that can be used to extend a mode with an
|
2643 |
-
'overlay' — a secondary mode is run over the stream, along with
|
2644 |
-
the base mode, and can color specific pieces of text without
|
2645 |
-
interfering with the base mode.
|
2646 |
-
Defines <code>CodeMirror.overlayMode</code>, which is used to
|
2647 |
-
create such a mode. See <a href="../demo/mustache.html">this
|
2648 |
-
demo</a> for a detailed example.</dd>
|
2649 |
-
|
2650 |
-
<dt id="addon_multiplex"><a href="../addon/mode/multiplex.js"><code>mode/multiplex.js</code></a></dt>
|
2651 |
-
<dd>Mode combinator that can be used to easily 'multiplex'
|
2652 |
-
between several modes.
|
2653 |
-
Defines <code>CodeMirror.multiplexingMode</code> which, when
|
2654 |
-
given as first argument a mode object, and as other arguments
|
2655 |
-
any number of <code>{open, close, mode [, delimStyle, innerStyle, parseDelimiters]}</code>
|
2656 |
-
objects, will return a mode object that starts parsing using the
|
2657 |
-
mode passed as first argument, but will switch to another mode
|
2658 |
-
as soon as it encounters a string that occurs in one of
|
2659 |
-
the <code>open</code> fields of the passed objects. When in a
|
2660 |
-
sub-mode, it will go back to the top mode again when
|
2661 |
-
the <code>close</code> string is encountered.
|
2662 |
-
Pass <code>"\n"</code> for <code>open</code> or <code>close</code>
|
2663 |
-
if you want to switch on a blank line.
|
2664 |
-
<ul><li>When <code>delimStyle</code> is specified, it will be the token
|
2665 |
-
style returned for the delimiter tokens (as well as
|
2666 |
-
<code>[delimStyle]-open</code> on the opening token and
|
2667 |
-
<code>[delimStyle]-close</code> on the closing token).</li>
|
2668 |
-
<li>When <code>innerStyle</code> is specified, it will be the token
|
2669 |
-
style added for each inner mode token.</li>
|
2670 |
-
<li>When <code>parseDelimiters</code> is true, the content of
|
2671 |
-
the delimiters will also be passed to the inner mode.
|
2672 |
-
(And <code>delimStyle</code> is ignored.)</li></ul> The outer
|
2673 |
-
mode will not see the content between the delimiters.
|
2674 |
-
See <a href="../demo/multiplex.html">this demo</a> for an
|
2675 |
-
example.</dd>
|
2676 |
-
|
2677 |
-
<dt id="addon_show-hint"><a href="../addon/hint/show-hint.js"><code>hint/show-hint.js</code></a></dt>
|
2678 |
-
<dd>Provides a framework for showing autocompletion hints.
|
2679 |
-
Defines <code>editor.showHint</code>, which takes an optional
|
2680 |
-
options object, and pops up a widget that allows the user to
|
2681 |
-
select a completion. Finding hints is done with a hinting
|
2682 |
-
functions (the <code>hint</code> option), which is a function
|
2683 |
-
that take an editor instance and options object, and return
|
2684 |
-
a <code>{list, from, to}</code> object, where <code>list</code>
|
2685 |
-
is an array of strings or objects (the completions),
|
2686 |
-
and <code>from</code> and <code>to</code> give the start and end
|
2687 |
-
of the token that is being completed as <code>{line, ch}</code>
|
2688 |
-
objects. An optional <code>selectedHint</code> property (an
|
2689 |
-
integer) can be added to the completion object to control the
|
2690 |
-
initially selected hint.</dd>
|
2691 |
-
<dd>If no hinting function is given, the addon will
|
2692 |
-
use <code>CodeMirror.hint.auto</code>, which
|
2693 |
-
calls <a href="#getHelpers"><code>getHelpers</code></a> with
|
2694 |
-
the <code>"hint"</code> type to find applicable hinting
|
2695 |
-
functions, and tries them one by one. If that fails, it looks
|
2696 |
-
for a <code>"hintWords"</code> helper to fetch a list of
|
2697 |
-
completable words for the mode, and
|
2698 |
-
uses <code>CodeMirror.hint.fromList</code> to complete from
|
2699 |
-
those.</dd>
|
2700 |
-
<dd>When completions aren't simple strings, they should be
|
2701 |
-
objects with the following properties:
|
2702 |
-
<dl>
|
2703 |
-
<dt><code><strong>text</strong>: string</code></dt>
|
2704 |
-
<dd>The completion text. This is the only required
|
2705 |
-
property.</dd>
|
2706 |
-
<dt><code><strong>displayText</strong>: string</code></dt>
|
2707 |
-
<dd>The text that should be displayed in the menu.</dd>
|
2708 |
-
<dt><code><strong>className</strong>: string</code></dt>
|
2709 |
-
<dd>A CSS class name to apply to the completion's line in the
|
2710 |
-
menu.</dd>
|
2711 |
-
<dt><code><strong>render</strong>: fn(Element, self, data)</code></dt>
|
2712 |
-
<dd>A method used to create the DOM structure for showing the
|
2713 |
-
completion by appending it to its first argument.</dd>
|
2714 |
-
<dt><code><strong>hint</strong>: fn(CodeMirror, self, data)</code></dt>
|
2715 |
-
<dd>A method used to actually apply the completion, instead of
|
2716 |
-
the default behavior.</dd>
|
2717 |
-
<dt><code><strong>from</strong>: {line, ch}</code></dt>
|
2718 |
-
<dd>Optional <code>from</code> position that will be used by <code>pick()</code> instead
|
2719 |
-
of the global one passed with the full list of completions.</dd>
|
2720 |
-
<dt><code><strong>to</strong>: {line, ch}</code></dt>
|
2721 |
-
<dd>Optional <code>to</code> position that will be used by <code>pick()</code> instead
|
2722 |
-
of the global one passed with the full list of completions.</dd>
|
2723 |
-
</dl></dd>
|
2724 |
-
|
2725 |
-
<dd>The plugin understands the following options, which may be
|
2726 |
-
either passed directly in the argument to <code>showHint</code>,
|
2727 |
-
or provided by setting an <code>hintOptions</code> editor
|
2728 |
-
option to an object (the former takes precedence). The options
|
2729 |
-
object will also be passed along to the hinting function, which
|
2730 |
-
may understand additional options.
|
2731 |
-
<dl>
|
2732 |
-
<dt><code><strong>hint</strong>: function</code></dt>
|
2733 |
-
<dd>A hinting function, as specified above. It is possible to
|
2734 |
-
set the <code>async</code> property on a hinting function to
|
2735 |
-
true, in which case it will be called with
|
2736 |
-
arguments <code>(cm, callback, ?options)</code>, and the
|
2737 |
-
completion interface will only be popped up when the hinting
|
2738 |
-
function calls the callback, passing it the object holding the
|
2739 |
-
completions.
|
2740 |
-
The hinting function can also return a promise, and the completion
|
2741 |
-
interface will only be popped when the promise resolves.
|
2742 |
-
By default, hinting only works when there is no
|
2743 |
-
selection. You can give a hinting function
|
2744 |
-
a <code>supportsSelection</code> property with a truthy value
|
2745 |
-
to indicate that it supports selections.</dd>
|
2746 |
-
<dt><code><strong>completeSingle</strong>: boolean</code></dt>
|
2747 |
-
<dd>Determines whether, when only a single completion is
|
2748 |
-
available, it is completed without showing the dialog.
|
2749 |
-
Defaults to true.</dd>
|
2750 |
-
<dt><code><strong>alignWithWord</strong>: boolean</code></dt>
|
2751 |
-
<dd>Whether the pop-up should be horizontally aligned with the
|
2752 |
-
start of the word (true, default), or with the cursor (false).</dd>
|
2753 |
-
<dt><code><strong>closeOnUnfocus</strong>: boolean</code></dt>
|
2754 |
-
<dd>When enabled (which is the default), the pop-up will close
|
2755 |
-
when the editor is unfocused.</dd>
|
2756 |
-
<dt><code><strong>customKeys</strong>: keymap</code></dt>
|
2757 |
-
<dd>Allows you to provide a custom key map of keys to be active
|
2758 |
-
when the pop-up is active. The handlers will be called with an
|
2759 |
-
extra argument, a handle to the completion menu, which
|
2760 |
-
has <code>moveFocus(n)</code>, <code>setFocus(n)</code>, <code>pick()</code>,
|
2761 |
-
and <code>close()</code> methods (see the source for details),
|
2762 |
-
that can be used to change the focused element, pick the
|
2763 |
-
current element or close the menu. Additionally <code>menuSize()</code>
|
2764 |
-
can give you access to the size of the current dropdown menu,
|
2765 |
-
<code>length</code> give you the number of available completions, and
|
2766 |
-
<code>data</code> give you full access to the completion returned by the
|
2767 |
-
hinting function.</dd>
|
2768 |
-
<dt><code><strong>extraKeys</strong>: keymap</code></dt>
|
2769 |
-
<dd>Like <code>customKeys</code> above, but the bindings will
|
2770 |
-
be added to the set of default bindings, instead of replacing
|
2771 |
-
them.</dd>
|
2772 |
-
</dl>
|
2773 |
-
The following events will be fired on the completions object
|
2774 |
-
during completion:
|
2775 |
-
<dl>
|
2776 |
-
<dt><code><strong>"shown"</strong> ()</code></dt>
|
2777 |
-
<dd>Fired when the pop-up is shown.</dd>
|
2778 |
-
<dt><code><strong>"select"</strong> (completion, Element)</code></dt>
|
2779 |
-
<dd>Fired when a completion is selected. Passed the completion
|
2780 |
-
value (string or object) and the DOM node that represents it
|
2781 |
-
in the menu.</dd>
|
2782 |
-
<dt><code><strong>"pick"</strong> (completion)</code></dt>
|
2783 |
-
<dd>Fired when a completion is picked. Passed the completion value
|
2784 |
-
(string or object).</dd>
|
2785 |
-
<dt><code><strong>"close"</strong> ()</code></dt>
|
2786 |
-
<dd>Fired when the completion is finished.</dd>
|
2787 |
-
</dl>
|
2788 |
-
This addon depends on styles
|
2789 |
-
from <code>addon/hint/show-hint.css</code>. Check
|
2790 |
-
out <a href="../demo/complete.html">the demo</a> for an
|
2791 |
-
example.</dd>
|
2792 |
-
|
2793 |
-
<dt id="addon_javascript-hint"><a href="../addon/hint/javascript-hint.js"><code>hint/javascript-hint.js</code></a></dt>
|
2794 |
-
<dd>Defines a simple hinting function for JavaScript
|
2795 |
-
(<code>CodeMirror.hint.javascript</code>) and CoffeeScript
|
2796 |
-
(<code>CodeMirror.hint.coffeescript</code>) code. This will
|
2797 |
-
simply use the JavaScript environment that the editor runs in as
|
2798 |
-
a source of information about objects and their properties.</dd>
|
2799 |
-
|
2800 |
-
<dt id="addon_xml-hint"><a href="../addon/hint/xml-hint.js"><code>hint/xml-hint.js</code></a></dt>
|
2801 |
-
<dd>Defines <code>CodeMirror.hint.xml</code>, which produces
|
2802 |
-
hints for XML tagnames, attribute names, and attribute values,
|
2803 |
-
guided by a <code>schemaInfo</code> option (a property of the
|
2804 |
-
second argument passed to the hinting function, or the third
|
2805 |
-
argument passed to <code>CodeMirror.showHint</code>).<br>The
|
2806 |
-
schema info should be an object mapping tag names to information
|
2807 |
-
about these tags, with optionally a <code>"!top"</code> property
|
2808 |
-
containing a list of the names of valid top-level tags. The
|
2809 |
-
values of the properties should be objects with optional
|
2810 |
-
properties <code>children</code> (an array of valid child
|
2811 |
-
element names, omit to simply allow all tags to appear)
|
2812 |
-
and <code>attrs</code> (an object mapping attribute names
|
2813 |
-
to <code>null</code> for free-form attributes, and an array of
|
2814 |
-
valid values for restricted
|
2815 |
-
attributes). <a href="../demo/xmlcomplete.html">Demo
|
2816 |
-
here.</a></dd>
|
2817 |
-
|
2818 |
-
<dt id="addon_html-hint"><a href="../addon/hint/html-hint.js"><code>hint/html-hint.js</code></a></dt>
|
2819 |
-
<dd>Provides schema info to
|
2820 |
-
the <a href="#addon_xml-hint">xml-hint</a> addon for HTML
|
2821 |
-
documents. Defines a schema
|
2822 |
-
object <code>CodeMirror.htmlSchema</code> that you can pass to
|
2823 |
-
as a <code>schemaInfo</code> option, and
|
2824 |
-
a <code>CodeMirror.hint.html</code> hinting function that
|
2825 |
-
automatically calls <code>CodeMirror.hint.xml</code> with this
|
2826 |
-
schema data. See
|
2827 |
-
the <a href="../demo/html5complete.html">demo</a>.</dd>
|
2828 |
-
|
2829 |
-
<dt id="addon_css-hint"><a href="../addon/hint/css-hint.js"><code>hint/css-hint.js</code></a></dt>
|
2830 |
-
<dd>A hinting function for CSS, SCSS, or LESS code.
|
2831 |
-
Defines <code>CodeMirror.hint.css</code>.</dd>
|
2832 |
-
|
2833 |
-
<dt id="addon_anyword-hint"><a href="../addon/hint/anyword-hint.js"><code>hint/anyword-hint.js</code></a></dt>
|
2834 |
-
<dd>A very simple hinting function
|
2835 |
-
(<code>CodeMirror.hint.anyword</code>) that simply looks for
|
2836 |
-
words in the nearby code and completes to those. Takes two
|
2837 |
-
optional options, <code>word</code>, a regular expression that
|
2838 |
-
matches words (sequences of one or more character),
|
2839 |
-
and <code>range</code>, which defines how many lines the addon
|
2840 |
-
should scan when completing (defaults to 500).</dd>
|
2841 |
-
|
2842 |
-
<dt id="addon_sql-hint"><a href="../addon/hint/sql-hint.js"><code>hint/sql-hint.js</code></a></dt>
|
2843 |
-
<dd>A simple SQL hinter. Defines <code>CodeMirror.hint.sql</code>.
|
2844 |
-
Takes two optional options, <code>tables</code>, a object with
|
2845 |
-
table names as keys and array of respective column names as values,
|
2846 |
-
and <code>defaultTable</code>, a string corresponding to a
|
2847 |
-
table name in <code>tables</code> for autocompletion.</dd>
|
2848 |
-
|
2849 |
-
<dt id="addon_match-highlighter"><a href="../addon/search/match-highlighter.js"><code>search/match-highlighter.js</code></a></dt>
|
2850 |
-
<dd>Adds a <code>highlightSelectionMatches</code> option that
|
2851 |
-
can be enabled to highlight all instances of a currently
|
2852 |
-
selected word. Can be set either to true or to an object
|
2853 |
-
containing the following options: <code>minChars</code>, for the
|
2854 |
-
minimum amount of selected characters that triggers a highlight
|
2855 |
-
(default 2), <code>style</code>, for the style to be used to
|
2856 |
-
highlight the matches (default <code>"matchhighlight"</code>,
|
2857 |
-
which will correspond to CSS
|
2858 |
-
class <code>cm-matchhighlight</code>), <code>trim</code>, which
|
2859 |
-
controls whether whitespace is trimmed from the selection,
|
2860 |
-
and <code>showToken</code> which can be set to <code>true</code>
|
2861 |
-
or to a regexp matching the characters that make up a word. When
|
2862 |
-
enabled, it causes the current word to be highlighted when
|
2863 |
-
nothing is selected (defaults to off).
|
2864 |
-
Demo <a href="../demo/matchhighlighter.html">here</a>.</dd>
|
2865 |
-
|
2866 |
-
<dt id="addon_lint"><a href="../addon/lint/lint.js"><code>lint/lint.js</code></a></dt>
|
2867 |
-
<dd>Defines an interface component for showing linting warnings,
|
2868 |
-
with pluggable warning sources
|
2869 |
-
(see <a href="../addon/lint/html-lint.js"><code>html-lint.js</code></a>,
|
2870 |
-
<a href="../addon/lint/json-lint.js"><code>json-lint.js</code></a>,
|
2871 |
-
<a href="../addon/lint/javascript-lint.js"><code>javascript-lint.js</code></a>,
|
2872 |
-
<a href="../addon/lint/coffeescript-lint.js"><code>coffeescript-lint.js</code></a>,
|
2873 |
-
and <a href="../addon/lint/css-lint.js"><code>css-lint.js</code></a>
|
2874 |
-
in the same directory). Defines a <code>lint</code> option that
|
2875 |
-
can be set to an annotation source (for
|
2876 |
-
example <code>CodeMirror.lint.javascript</code>), to an options
|
2877 |
-
object (in which case the <code>getAnnotations</code> field is
|
2878 |
-
used as annotation source), or simply to <code>true</code>. When
|
2879 |
-
no annotation source is
|
2880 |
-
specified, <a href="#getHelper"><code>getHelper</code></a> with
|
2881 |
-
type <code>"lint"</code> is used to find an annotation function.
|
2882 |
-
An annotation source function should, when given a document
|
2883 |
-
string, an options object, and an editor instance, return an
|
2884 |
-
array of <code>{message, severity, from, to}</code> objects
|
2885 |
-
representing problems. When the function has
|
2886 |
-
an <code>async</code> property with a truthy value, it will be
|
2887 |
-
called with an additional second argument, which is a callback
|
2888 |
-
to pass the array to.
|
2889 |
-
The linting function can also return a promise, in that case the linter
|
2890 |
-
will only be executed when the promise resolves.
|
2891 |
-
By default, the linter will run (debounced) whenever the document is changed.
|
2892 |
-
You can pass a <code>lintOnChange: false</code> option to disable that.
|
2893 |
-
Depends on <code>addon/lint/lint.css</code>. A demo can be
|
2894 |
-
found <a href="../demo/lint.html">here</a>.</dd>
|
2895 |
-
|
2896 |
-
<dt id="addon_mark-selection"><a href="../addon/selection/mark-selection.js"><code>selection/mark-selection.js</code></a></dt>
|
2897 |
-
<dd>Causes the selected text to be marked with the CSS class
|
2898 |
-
<code>CodeMirror-selectedtext</code> when the <code>styleSelectedText</code> option
|
2899 |
-
is enabled. Useful to change the colour of the selection (in addition to the background),
|
2900 |
-
like in <a href="../demo/markselection.html">this demo</a>.</dd>
|
2901 |
-
|
2902 |
-
<dt id="addon_active-line"><a href="../addon/selection/active-line.js"><code>selection/active-line.js</code></a></dt>
|
2903 |
-
<dd>Defines a <code>styleActiveLine</code> option that, when
|
2904 |
-
enabled, gives the wrapper of the line that contains the cursor
|
2905 |
-
the class <code>CodeMirror-activeline</code>, adds a background
|
2906 |
-
with the class <code>CodeMirror-activeline-background</code>,
|
2907 |
-
and adds the class <code>CodeMirror-activeline-gutter</code> to
|
2908 |
-
the line's gutter space is enabled. The option's value may be a
|
2909 |
-
boolean or an object specifying the following options:
|
2910 |
-
<dl>
|
2911 |
-
<dt><code><strong>nonEmpty</strong>: bool</code></dt>
|
2912 |
-
<dd>Controls whether single-line selections, or just cursor
|
2913 |
-
selections, are styled. Defaults to false (only cursor
|
2914 |
-
selections).</dd>
|
2915 |
-
</dl>
|
2916 |
-
See the <a href="../demo/activeline.html">demo</a>.</dd>
|
2917 |
-
|
2918 |
-
<dt id="addon_selection-pointer"><a href="../addon/selection/selection-pointer.js"><code>selection/selection-pointer.js</code></a></dt>
|
2919 |
-
<dd>Defines a <code>selectionPointer</code> option which you can
|
2920 |
-
use to control the mouse cursor appearance when hovering over
|
2921 |
-
the selection. It can be set to a string,
|
2922 |
-
like <code>"pointer"</code>, or to true, in which case
|
2923 |
-
the <code>"default"</code> (arrow) cursor will be used. You can
|
2924 |
-
see a demo <a href="../mode/htmlmixed/index.html">here</a>.</dd>
|
2925 |
-
|
2926 |
-
<dt id="addon_loadmode"><a href="../addon/mode/loadmode.js"><code>mode/loadmode.js</code></a></dt>
|
2927 |
-
<dd>Defines a <code>CodeMirror.requireMode(modename,
|
2928 |
-
callback)</code> function that will try to load a given mode and
|
2929 |
-
call the callback when it succeeded. You'll have to
|
2930 |
-
set <code>CodeMirror.modeURL</code> to a string that mode paths
|
2931 |
-
can be constructed from, for
|
2932 |
-
example <code>"mode/%N/%N.js"</code>—the <code>%N</code>'s will
|
2933 |
-
be replaced with the mode name. Also
|
2934 |
-
defines <code>CodeMirror.autoLoadMode(instance, mode)</code>,
|
2935 |
-
which will ensure the given mode is loaded and cause the given
|
2936 |
-
editor instance to refresh its mode when the loading
|
2937 |
-
succeeded. See the <a href="../demo/loadmode.html">demo</a>.</dd>
|
2938 |
-
|
2939 |
-
<dt id="addon_meta"><a href="../mode/meta.js"><code>mode/meta.js</code></a></dt>
|
2940 |
-
<dd>Provides meta-information about all the modes in the
|
2941 |
-
distribution in a single file.
|
2942 |
-
Defines <code>CodeMirror.modeInfo</code>, an array of objects
|
2943 |
-
with <code>{name, mime, mode}</code> properties,
|
2944 |
-
where <code>name</code> is the human-readable
|
2945 |
-
name, <code>mime</code> the MIME type, and <code>mode</code> the
|
2946 |
-
name of the mode file that defines this MIME. There are optional
|
2947 |
-
properties <code>mimes</code>, which holds an array of MIME
|
2948 |
-
types for modes with multiple MIMEs associated,
|
2949 |
-
and <code>ext</code>, which holds an array of file extensions
|
2950 |
-
associated with this mode. Four convenience
|
2951 |
-
functions, <code>CodeMirror.findModeByMIME</code>,
|
2952 |
-
<code>CodeMirror.findModeByExtension</code>,
|
2953 |
-
<code>CodeMirror.findModeByFileName</code>
|
2954 |
-
and <code>CodeMirror.findModeByName</code> are provided, which
|
2955 |
-
return such an object given a MIME, extension, file name or mode name
|
2956 |
-
string. Note that, for historical reasons, this file resides in the
|
2957 |
-
top-level <code>mode</code> directory, not
|
2958 |
-
under <code>addon</code>. <a href="../demo/loadmode.html">Demo</a>.</dd>
|
2959 |
-
|
2960 |
-
<dt id="addon_continuecomment"><a href="../addon/comment/continuecomment.js"><code>comment/continuecomment.js</code></a></dt>
|
2961 |
-
<dd>Adds a <code>continueComments</code> option, which sets whether the
|
2962 |
-
editor will make the next line continue a comment when you press Enter
|
2963 |
-
inside a comment block. Can be set to a boolean to enable/disable this
|
2964 |
-
functionality. Set to a string, it will continue comments using a custom
|
2965 |
-
shortcut. Set to an object, it will use the <code>key</code> property for
|
2966 |
-
a custom shortcut and the boolean <code>continueLineComment</code>
|
2967 |
-
property to determine whether single-line comments should be continued
|
2968 |
-
(defaulting to <code>true</code>).</dd>
|
2969 |
-
|
2970 |
-
<dt id="addon_placeholder"><a href="../addon/display/placeholder.js"><code>display/placeholder.js</code></a></dt>
|
2971 |
-
<dd>Adds a <code>placeholder</code> option that can be used to
|
2972 |
-
make content appear in the editor when it is empty and not
|
2973 |
-
focused. It can hold either a string or a DOM node. Also gives
|
2974 |
-
the editor a <code>CodeMirror-empty</code> CSS class whenever it
|
2975 |
-
doesn't contain any text.
|
2976 |
-
See <a href="../demo/placeholder.html">the demo</a>.</dd>
|
2977 |
-
|
2978 |
-
<dt id="addon_fullscreen"><a href="../addon/display/fullscreen.js"><code>display/fullscreen.js</code></a></dt>
|
2979 |
-
<dd>Defines an option <code>fullScreen</code> that, when set
|
2980 |
-
to <code>true</code>, will make the editor full-screen (as in,
|
2981 |
-
taking up the whole browser window). Depends
|
2982 |
-
on <a href="../addon/display/fullscreen.css"><code>fullscreen.css</code></a>. <a href="../demo/fullscreen.html">Demo
|
2983 |
-
here</a>.</dd>
|
2984 |
-
|
2985 |
-
<dt id="addon_autorefresh"><a href="../addon/display/autorefresh.js"><code>display/autorefresh.js</code></a></dt>
|
2986 |
-
<dd>This addon can be useful when initializing an editor in a
|
2987 |
-
hidden DOM node, in cases where it is difficult to
|
2988 |
-
call <a href="#refresh"><code>refresh</code></a> when the editor
|
2989 |
-
becomes visible. It defines an option <code>autoRefresh</code>
|
2990 |
-
which you can set to true to ensure that, if the editor wasn't
|
2991 |
-
visible on initialization, it will be refreshed the first time
|
2992 |
-
it becomes visible. This is done by polling every 250
|
2993 |
-
milliseconds (you can pass a value like <code>{delay:
|
2994 |
-
500}</code> as the option value to configure this). Note that
|
2995 |
-
this addon will only refresh the editor <em>once</em> when it
|
2996 |
-
first becomes visible, and won't take care of further restyling
|
2997 |
-
and resizing.</dd>
|
2998 |
-
|
2999 |
-
<dt id="addon_simplescrollbars"><a href="../addon/scroll/simplescrollbars.js"><code>scroll/simplescrollbars.js</code></a></dt>
|
3000 |
-
<dd>Defines two additional scrollbar
|
3001 |
-
models, <code>"simple"</code> and <code>"overlay"</code>
|
3002 |
-
(see <a href="../demo/simplescrollbars.html">demo</a>) that can
|
3003 |
-
be selected with
|
3004 |
-
the <a href="#option_scrollbarStyle"><code>scrollbarStyle</code></a>
|
3005 |
-
option. Depends
|
3006 |
-
on <a href="../addon/scroll/simplescrollbars.css"><code>simplescrollbars.css</code></a>,
|
3007 |
-
which can be further overridden to style your own
|
3008 |
-
scrollbars.</dd>
|
3009 |
-
|
3010 |
-
<dt id="addon_annotatescrollbar"><a href="../addon/scroll/annotatescrollbar.js"><code>scroll/annotatescrollbar.js</code></a></dt>
|
3011 |
-
<dd>Provides functionality for showing markers on the scrollbar
|
3012 |
-
to call out certain parts of the document. Adds a
|
3013 |
-
method <code>annotateScrollbar</code> to editor instances that
|
3014 |
-
can be called, with a CSS class name as argument, to create a
|
3015 |
-
set of annotations. The method returns an object
|
3016 |
-
whose <code>update</code> method can be called with a sorted array
|
3017 |
-
of <code>{from: Pos, to: Pos}</code> objects marking the ranges
|
3018 |
-
to be highlighted. To detach the annotations, call the
|
3019 |
-
object's <code>clear</code> method.</dd>
|
3020 |
-
|
3021 |
-
<dt id="addon_rulers"><a href="../addon/display/rulers.js"><code>display/rulers.js</code></a></dt>
|
3022 |
-
<dd>Adds a <code>rulers</code> option, which can be used to show
|
3023 |
-
one or more vertical rulers in the editor. The option, if
|
3024 |
-
defined, should be given an array of <code>{column [, className,
|
3025 |
-
color, lineStyle, width]}</code> objects or numbers (which
|
3026 |
-
indicate a column). The ruler will be displayed at the column
|
3027 |
-
indicated by the number or the <code>column</code> property.
|
3028 |
-
The <code>className</code> property can be used to assign a
|
3029 |
-
custom style to a ruler. <a href="../demo/rulers.html">Demo
|
3030 |
-
here</a>.</dd>
|
3031 |
-
|
3032 |
-
<dt id="addon_panel"><a href="../addon/display/panel.js"><code>display/panel.js</code></a></dt>
|
3033 |
-
<dd>Defines an <code>addPanel</code> method for CodeMirror
|
3034 |
-
instances, which places a DOM node above or below an editor, and
|
3035 |
-
shrinks the editor to make room for the node. The method takes
|
3036 |
-
as first argument as DOM node, and as second an optional options
|
3037 |
-
object. The <code>Panel</code> object returned by this method
|
3038 |
-
has a <code>clear</code> method that is used to remove the
|
3039 |
-
panel, and a <code>changed</code> method that can be used to
|
3040 |
-
notify the addon when the size of the panel's DOM node has
|
3041 |
-
changed.<br/>
|
3042 |
-
The method accepts the following options:
|
3043 |
-
<dl>
|
3044 |
-
<dt><code><strong>position</strong>: string</code></dt>
|
3045 |
-
<dd>Controls the position of the newly added panel. The
|
3046 |
-
following values are recognized:
|
3047 |
-
<dl>
|
3048 |
-
<dt><code><strong>top</strong> (default)</code></dt>
|
3049 |
-
<dd>Adds the panel at the very top.</dd>
|
3050 |
-
<dt><code><strong>after-top</strong></code></dt>
|
3051 |
-
<dd>Adds the panel at the bottom of the top panels.</dd>
|
3052 |
-
<dt><code><strong>bottom</strong></code></dt>
|
3053 |
-
<dd>Adds the panel at the very bottom.</dd>
|
3054 |
-
<dt><code><strong>before-bottom</strong></code></dt>
|
3055 |
-
<dd>Adds the panel at the top of the bottom panels.</dd>
|
3056 |
-
</dl>
|
3057 |
-
</dd>
|
3058 |
-
<dt><code><strong>before</strong>: Panel</code></dt>
|
3059 |
-
<dd>The new panel will be added before the given panel.</dd>
|
3060 |
-
<dt><code><strong>after</strong>: Panel</code></dt>
|
3061 |
-
<dd>The new panel will be added after the given panel.</dd>
|
3062 |
-
<dt><code><strong>replace</strong>: Panel</code></dt>
|
3063 |
-
<dd>The new panel will replace the given panel.</dd>
|
3064 |
-
<dt><code><strong>stable</strong>: bool</code></dt>
|
3065 |
-
<dd>Whether to scroll the editor to keep the text's vertical
|
3066 |
-
position stable, when adding a panel above it. Defaults to false.</dd>
|
3067 |
-
</dl>
|
3068 |
-
When using the <code>after</code>, <code>before</code> or <code>replace</code> options,
|
3069 |
-
if the panel doesn't exists or has been removed,
|
3070 |
-
the value of the <code>position</code> option will be used as a fallback.
|
3071 |
-
<br>
|
3072 |
-
A demo of the addon is available <a href="../demo/panel.html">here</a>.
|
3073 |
-
</dd>
|
3074 |
-
|
3075 |
-
<dt id="addon_hardwrap"><a href="../addon/wrap/hardwrap.js"><code>wrap/hardwrap.js</code></a></dt>
|
3076 |
-
<dd>Addon to perform hard line wrapping/breaking for paragraphs
|
3077 |
-
of text. Adds these methods to editor instances:
|
3078 |
-
<dl>
|
3079 |
-
<dt><code><strong>wrapParagraph</strong>(?pos: {line, ch}, ?options: object)</code></dt>
|
3080 |
-
<dd>Wraps the paragraph at the given position.
|
3081 |
-
If <code>pos</code> is not given, it defaults to the cursor
|
3082 |
-
position.</dd>
|
3083 |
-
<dt><code><strong>wrapRange</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
|
3084 |
-
<dd>Wraps the given range as one big paragraph.</dd>
|
3085 |
-
<dt><code><strong>wrapParagraphsInRange</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
|
3086 |
-
<dd>Wraps the paragraphs in (and overlapping with) the
|
3087 |
-
given range individually.</dd>
|
3088 |
-
</dl>
|
3089 |
-
The following options are recognized:
|
3090 |
-
<dl>
|
3091 |
-
<dt><code><strong>paragraphStart</strong>, <strong>paragraphEnd</strong>: RegExp</code></dt>
|
3092 |
-
<dd>Blank lines are always considered paragraph boundaries.
|
3093 |
-
These options can be used to specify a pattern that causes
|
3094 |
-
lines to be considered the start or end of a paragraph.</dd>
|
3095 |
-
<dt><code><strong>column</strong>: number</code></dt>
|
3096 |
-
<dd>The column to wrap at. Defaults to 80.</dd>
|
3097 |
-
<dt><code><strong>wrapOn</strong>: RegExp</code></dt>
|
3098 |
-
<dd>A regular expression that matches only those
|
3099 |
-
two-character strings that allow wrapping. By default, the
|
3100 |
-
addon wraps on whitespace and after dash characters.</dd>
|
3101 |
-
<dt><code><strong>killTrailingSpace</strong>: boolean</code></dt>
|
3102 |
-
<dd>Whether trailing space caused by wrapping should be
|
3103 |
-
preserved, or deleted. Defaults to true.</dd>
|
3104 |
-
</dl>
|
3105 |
-
A demo of the addon is available <a href="../demo/hardwrap.html">here</a>.
|
3106 |
-
</dd>
|
3107 |
-
|
3108 |
-
<dt id="addon_merge"><a href="../addon/merge/merge.js"><code>merge/merge.js</code></a></dt>
|
3109 |
-
<dd>Implements an interface for merging changes, using either a
|
3110 |
-
2-way or a 3-way view. The <code>CodeMirror.MergeView</code>
|
3111 |
-
constructor takes arguments similar to
|
3112 |
-
the <a href="#CodeMirror"><code>CodeMirror</code></a>
|
3113 |
-
constructor, first a node to append the interface to, and then
|
3114 |
-
an options object. Options are passed through to the editors
|
3115 |
-
inside the view. These extra options are recognized:
|
3116 |
-
<dl>
|
3117 |
-
<dt><code><strong>origLeft</strong></code> and <code><strong>origRight</strong>: string</code></dt>
|
3118 |
-
<dd>If given these provide original versions of the
|
3119 |
-
document, which will be shown to the left and right of the
|
3120 |
-
editor in non-editable CodeMirror instances. The merge
|
3121 |
-
interface will highlight changes between the editable
|
3122 |
-
document and the original(s). To create a 2-way (as opposed
|
3123 |
-
to 3-way) merge view, provide only one of them.</dd>
|
3124 |
-
<dt><code><strong>revertButtons</strong>: boolean</code></dt>
|
3125 |
-
<dd>Determines whether buttons that allow the user to revert
|
3126 |
-
changes are shown. Defaults to true.</dd>
|
3127 |
-
<dt><code><strong>revertChunk</strong>: fn(mv: MergeView, from: CodeMirror, fromStart: Pos, fromEnd: Pos, to: CodeMirror, toStart: Pos, toEnd: Pos)</code></dt>
|
3128 |
-
<dd>Can be used to define custom behavior when the user
|
3129 |
-
reverts a changed chunk.</dd>
|
3130 |
-
<dt><code><strong>connect</strong>: string</code></dt>
|
3131 |
-
<dd>Sets the style used to connect changed chunks of code.
|
3132 |
-
By default, connectors are drawn. When this is set
|
3133 |
-
to <code>"align"</code>, the smaller chunk is padded to
|
3134 |
-
align with the bigger chunk instead.</dd>
|
3135 |
-
<dt><code><strong>collapseIdentical</strong>: boolean|number</code></dt>
|
3136 |
-
<dd>When true (default is false), stretches of unchanged
|
3137 |
-
text will be collapsed. When a number is given, this
|
3138 |
-
indicates the amount of lines to leave visible around such
|
3139 |
-
stretches (which defaults to 2).</dd>
|
3140 |
-
<dt><code><strong>allowEditingOriginals</strong>: boolean</code></dt>
|
3141 |
-
<dd>Determines whether the original editor allows editing.
|
3142 |
-
Defaults to false.</dd>
|
3143 |
-
<dt><code><strong>showDifferences</strong>: boolean</code></dt>
|
3144 |
-
<dd>When true (the default), changed pieces of text are
|
3145 |
-
highlighted.</dd>
|
3146 |
-
<dt><code><strong>chunkClassLocation</strong>: string|Array</code></dt>
|
3147 |
-
<dd>By default the chunk highlights are added
|
3148 |
-
using <a href="#addLineClass"><code>addLineClass</code></a>
|
3149 |
-
with "background". Override this to customize it to be any
|
3150 |
-
valid `where` parameter or an Array of valid `where`
|
3151 |
-
parameters.</dd>
|
3152 |
-
</dl>
|
3153 |
-
The addon also defines commands <code>"goNextDiff"</code>
|
3154 |
-
and <code>"goPrevDiff"</code> to quickly jump to the next
|
3155 |
-
changed chunk. <a href="../demo/merge.html">Demo
|
3156 |
-
here</a>.</dd>
|
3157 |
-
|
3158 |
-
<dt id="addon_tern"><a href="../addon/tern/tern.js"><code>tern/tern.js</code></a></dt>
|
3159 |
-
<dd>Provides integration with
|
3160 |
-
the <a href="http://ternjs.net">Tern</a> JavaScript analysis
|
3161 |
-
engine, for completion, definition finding, and minor
|
3162 |
-
refactoring help. See the <a href="../demo/tern.html">demo</a>
|
3163 |
-
for a very simple integration. For more involved scenarios, see
|
3164 |
-
the comments at the top of
|
3165 |
-
the <a href="../addon/tern/tern.js">addon</a> and the
|
3166 |
-
implementation of the
|
3167 |
-
(multi-file) <a href="http://ternjs.net/doc/demo.html">demonstration
|
3168 |
-
on the Tern website</a>.</dd>
|
3169 |
-
</dl>
|
3170 |
-
</section>
|
3171 |
-
|
3172 |
-
<section id=modeapi>
|
3173 |
-
<h2>Writing CodeMirror Modes</h2>
|
3174 |
-
|
3175 |
-
<p>Modes typically consist of a single JavaScript file. This file
|
3176 |
-
defines, in the simplest case, a lexer (tokenizer) for your
|
3177 |
-
language—a function that takes a character stream as input,
|
3178 |
-
advances it past a token, and returns a style for that token. More
|
3179 |
-
advanced modes can also handle indentation for the language.</p>
|
3180 |
-
|
3181 |
-
<p>This section describes the low-level mode interface. Many modes
|
3182 |
-
are written directly against this, since it offers a lot of
|
3183 |
-
control, but for a quick mode definition, you might want to use
|
3184 |
-
the <a href="../demo/simplemode.html">simple mode addon</a>.</p>
|
3185 |
-
|
3186 |
-
<p id="defineMode">The mode script should
|
3187 |
-
call <code><strong>CodeMirror.defineMode</strong></code> to
|
3188 |
-
register itself with CodeMirror. This function takes two
|
3189 |
-
arguments. The first should be the name of the mode, for which you
|
3190 |
-
should use a lowercase string, preferably one that is also the
|
3191 |
-
name of the files that define the mode (i.e. <code>"xml"</code> is
|
3192 |
-
defined in <code>xml.js</code>). The second argument should be a
|
3193 |
-
function that, given a CodeMirror configuration object (the thing
|
3194 |
-
passed to the <code>CodeMirror</code> function) and an optional
|
3195 |
-
mode configuration object (as in
|
3196 |
-
the <a href="#option_mode"><code>mode</code></a> option), returns
|
3197 |
-
a mode object.</p>
|
3198 |
-
|
3199 |
-
<p>Typically, you should use this second argument
|
3200 |
-
to <code>defineMode</code> as your module scope function (modes
|
3201 |
-
should not leak anything into the global scope!), i.e. write your
|
3202 |
-
whole mode inside this function.</p>
|
3203 |
-
|
3204 |
-
<p>The main responsibility of a mode script is <em>parsing</em>
|
3205 |
-
the content of the editor. Depending on the language and the
|
3206 |
-
amount of functionality desired, this can be done in really easy
|
3207 |
-
or extremely complicated ways. Some parsers can be stateless,
|
3208 |
-
meaning that they look at one element (<em>token</em>) of the code
|
3209 |
-
at a time, with no memory of what came before. Most, however, will
|
3210 |
-
need to remember something. This is done by using a <em>state
|
3211 |
-
object</em>, which is an object that is always passed when
|
3212 |
-
reading a token, and which can be mutated by the tokenizer.</p>
|
3213 |
-
|
3214 |
-
<p id="startState">Modes that use a state must define
|
3215 |
-
a <code><strong>startState</strong></code> method on their mode
|
3216 |
-
object. This is a function of no arguments that produces a state
|
3217 |
-
object to be used at the start of a document.</p>
|
3218 |
-
|
3219 |
-
<p id="token">The most important part of a mode object is
|
3220 |
-
its <code><strong>token</strong>(stream, state)</code> method. All
|
3221 |
-
modes must define this method. It should read one token from the
|
3222 |
-
stream it is given as an argument, optionally update its state,
|
3223 |
-
and return a style string, or <code>null</code> for tokens that do
|
3224 |
-
not have to be styled. For your styles, you are encouraged to use
|
3225 |
-
the 'standard' names defined in the themes (without
|
3226 |
-
the <code>cm-</code> prefix). If that fails, it is also possible
|
3227 |
-
to come up with your own and write your own CSS theme file.<p>
|
3228 |
-
|
3229 |
-
<p id="token_style_line">A typical token string would
|
3230 |
-
be <code>"variable"</code> or <code>"comment"</code>. Multiple
|
3231 |
-
styles can be returned (separated by spaces), for
|
3232 |
-
example <code>"string error"</code> for a thing that looks like a
|
3233 |
-
string but is invalid somehow (say, missing its closing quote).
|
3234 |
-
When a style is prefixed by <code>"line-"</code>
|
3235 |
-
or <code>"line-background-"</code>, the style will be applied to
|
3236 |
-
the whole line, analogous to what
|
3237 |
-
the <a href="#addLineClass"><code>addLineClass</code></a> method
|
3238 |
-
does—styling the <code>"text"</code> in the simple case, and
|
3239 |
-
the <code>"background"</code> element
|
3240 |
-
when <code>"line-background-"</code> is prefixed.</p>
|
3241 |
-
|
3242 |
-
<p id="StringStream">The stream object that's passed
|
3243 |
-
to <code>token</code> encapsulates a line of code (tokens may
|
3244 |
-
never span lines) and our current position in that line. It has
|
3245 |
-
the following API:</p>
|
3246 |
-
|
3247 |
-
<dl>
|
3248 |
-
<dt><code><strong>eol</strong>() → boolean</code></dt>
|
3249 |
-
<dd>Returns true only if the stream is at the end of the
|
3250 |
-
line.</dd>
|
3251 |
-
<dt><code><strong>sol</strong>() → boolean</code></dt>
|
3252 |
-
<dd>Returns true only if the stream is at the start of the
|
3253 |
-
line.</dd>
|
3254 |
-
|
3255 |
-
<dt><code><strong>peek</strong>() → string</code></dt>
|
3256 |
-
<dd>Returns the next character in the stream without advancing
|
3257 |
-
it. Will return a <code>null</code> at the end of the
|
3258 |
-
line.</dd>
|
3259 |
-
<dt><code><strong>next</strong>() → string</code></dt>
|
3260 |
-
<dd>Returns the next character in the stream and advances it.
|
3261 |
-
Also returns <code>null</code> when no more characters are
|
3262 |
-
available.</dd>
|
3263 |
-
|
3264 |
-
<dt><code><strong>eat</strong>(match: string|regexp|function(char: string) → boolean) → string</code></dt>
|
3265 |
-
<dd><code>match</code> can be a character, a regular expression,
|
3266 |
-
or a function that takes a character and returns a boolean. If
|
3267 |
-
the next character in the stream 'matches' the given argument,
|
3268 |
-
it is consumed and returned. Otherwise, <code>undefined</code>
|
3269 |
-
is returned.</dd>
|
3270 |
-
<dt><code><strong>eatWhile</strong>(match: string|regexp|function(char: string) → boolean) → boolean</code></dt>
|
3271 |
-
<dd>Repeatedly calls <code>eat</code> with the given argument,
|
3272 |
-
until it fails. Returns true if any characters were eaten.</dd>
|
3273 |
-
<dt><code><strong>eatSpace</strong>() → boolean</code></dt>
|
3274 |
-
<dd>Shortcut for <code>eatWhile</code> when matching
|
3275 |
-
white-space.</dd>
|
3276 |
-
<dt><code><strong>skipToEnd</strong>()</code></dt>
|
3277 |
-
<dd>Moves the position to the end of the line.</dd>
|
3278 |
-
<dt><code><strong>skipTo</strong>(str: string) → boolean</code></dt>
|
3279 |
-
<dd>Skips to the start of the next occurrence of the given string, if
|
3280 |
-
found on the current line (doesn't advance the stream if the
|
3281 |
-
string does not occur on the line). Returns true if the
|
3282 |
-
string was found.</dd>
|
3283 |
-
<dt><code><strong>match</strong>(pattern: string, ?consume: boolean, ?caseFold: boolean) → boolean</code></dt>
|
3284 |
-
<dt><code><strong>match</strong>(pattern: regexp, ?consume: boolean) → array<string></code></dt>
|
3285 |
-
<dd>Act like a
|
3286 |
-
multi-character <code>eat</code>—if <code>consume</code> is true
|
3287 |
-
or not given—or a look-ahead that doesn't update the stream
|
3288 |
-
position—if it is false. <code>pattern</code> can be either a
|
3289 |
-
string or a regular expression starting with <code>^</code>.
|
3290 |
-
When it is a string, <code>caseFold</code> can be set to true to
|
3291 |
-
make the match case-insensitive. When successfully matching a
|
3292 |
-
regular expression, the returned value will be the array
|
3293 |
-
returned by <code>match</code>, in case you need to extract
|
3294 |
-
matched groups.</dd>
|
3295 |
-
|
3296 |
-
<dt><code><strong>backUp</strong>(n: integer)</code></dt>
|
3297 |
-
<dd>Backs up the stream <code>n</code> characters. Backing it up
|
3298 |
-
further than the start of the current token will cause things to
|
3299 |
-
break, so be careful.</dd>
|
3300 |
-
<dt><code><strong>column</strong>() → integer</code></dt>
|
3301 |
-
<dd>Returns the column (taking into account tabs) at which the
|
3302 |
-
current token starts.</dd>
|
3303 |
-
<dt><code><strong>indentation</strong>() → integer</code></dt>
|
3304 |
-
<dd>Tells you how far the current line has been indented, in
|
3305 |
-
spaces. Corrects for tab characters.</dd>
|
3306 |
-
|
3307 |
-
<dt><code><strong>current</strong>() → string</code></dt>
|
3308 |
-
<dd>Get the string between the start of the current token and
|
3309 |
-
the current stream position.</dd>
|
3310 |
-
|
3311 |
-
<dt><code><strong>lookAhead</strong>(n: number) → ?string</code></dt>
|
3312 |
-
<dd>Get the line <code>n</code> (>0) lines after the current
|
3313 |
-
one, in order to scan ahead across line boundaries. Note that
|
3314 |
-
you want to do this carefully, since looking far ahead will make
|
3315 |
-
mode state caching much less effective.</dd>
|
3316 |
-
|
3317 |
-
<dt id="baseToken"><code><strong>baseToken</strong>() → ?{type: ?string, size: number}</code></dt>
|
3318 |
-
<dd>Modes added
|
3319 |
-
through <a href="#addOverlay"><code>addOverlay</code></a>
|
3320 |
-
(and <em>only</em> such modes) can use this method to inspect
|
3321 |
-
the current token produced by the underlying mode.</dd>
|
3322 |
-
</dl>
|
3323 |
-
|
3324 |
-
<p id="blankLine">By default, blank lines are simply skipped when
|
3325 |
-
tokenizing a document. For languages that have significant blank
|
3326 |
-
lines, you can define
|
3327 |
-
a <code><strong>blankLine</strong>(state)</code> method on your
|
3328 |
-
mode that will get called whenever a blank line is passed over, so
|
3329 |
-
that it can update the parser state.</p>
|
3330 |
-
|
3331 |
-
<p id="copyState">Because state object are mutated, and CodeMirror
|
3332 |
-
needs to keep valid versions of a state around so that it can
|
3333 |
-
restart a parse at any line, copies must be made of state objects.
|
3334 |
-
The default algorithm used is that a new state object is created,
|
3335 |
-
which gets all the properties of the old object. Any properties
|
3336 |
-
which hold arrays get a copy of these arrays (since arrays tend to
|
3337 |
-
be used as mutable stacks). When this is not correct, for example
|
3338 |
-
because a mode mutates non-array properties of its state object, a
|
3339 |
-
mode object should define
|
3340 |
-
a <code><strong>copyState</strong></code> method, which is given a
|
3341 |
-
state and should return a safe copy of that state.</p>
|
3342 |
-
|
3343 |
-
<p id="indent">If you want your mode to provide smart indentation
|
3344 |
-
(through the <a href="#indentLine"><code>indentLine</code></a>
|
3345 |
-
method and the <code>indentAuto</code>
|
3346 |
-
and <code>newlineAndIndent</code> commands, to which keys can be
|
3347 |
-
<a href="#option_extraKeys">bound</a>), you must define
|
3348 |
-
an <code><strong>indent</strong>(state, textAfter)</code> method
|
3349 |
-
on your mode object.</p>
|
3350 |
-
|
3351 |
-
<p>The indentation method should inspect the given state object,
|
3352 |
-
and optionally the <code>textAfter</code> string, which contains
|
3353 |
-
the text on the line that is being indented, and return an
|
3354 |
-
integer, the amount of spaces to indent. It should usually take
|
3355 |
-
the <a href="#option_indentUnit"><code>indentUnit</code></a>
|
3356 |
-
option into account. An indentation method may
|
3357 |
-
return <code>CodeMirror.Pass</code> to indicate that it
|
3358 |
-
could not come up with a precise indentation.</p>
|
3359 |
-
|
3360 |
-
<p id="mode_comment">To work well with
|
3361 |
-
the <a href="#addon_comment">commenting addon</a>, a mode may
|
3362 |
-
define <code><strong>lineComment</strong></code> (string that
|
3363 |
-
starts a line
|
3364 |
-
comment), <code><strong>blockCommentStart</strong></code>, <code><strong>blockCommentEnd</strong></code>
|
3365 |
-
(strings that start and end block comments),
|
3366 |
-
and <code>blockCommentLead</code> (a string to put at the start of
|
3367 |
-
continued lines in a block comment). All of these are
|
3368 |
-
optional.</p>
|
3369 |
-
|
3370 |
-
<p id="electricChars">Finally, a mode may define either
|
3371 |
-
an <code>electricChars</code> or an <code>electricInput</code>
|
3372 |
-
property, which are used to automatically reindent the line when
|
3373 |
-
certain patterns are typed and
|
3374 |
-
the <a href="#option_electricChars"><code>electricChars</code></a>
|
3375 |
-
option is enabled. <code>electricChars</code> may be a string, and
|
3376 |
-
will trigger a reindent whenever one of the characters in that
|
3377 |
-
string are typed. Often, it is more appropriate to
|
3378 |
-
use <code>electricInput</code>, which should hold a regular
|
3379 |
-
expression, and will trigger indentation when the part of the
|
3380 |
-
line <em>before</em> the cursor matches the expression. It should
|
3381 |
-
usually end with a <code>$</code> character, so that it only
|
3382 |
-
matches when the indentation-changing pattern was just typed, not when something was
|
3383 |
-
typed after the pattern.</p>
|
3384 |
-
|
3385 |
-
<p>So, to summarize, a mode <em>must</em> provide
|
3386 |
-
a <code>token</code> method, and it <em>may</em>
|
3387 |
-
provide <code>startState</code>, <code>copyState</code>,
|
3388 |
-
and <code>indent</code> methods. For an example of a trivial mode,
|
3389 |
-
see the <a href="../mode/diff/diff.js">diff mode</a>, for a more
|
3390 |
-
involved example, see the <a href="../mode/clike/clike.js">C-like
|
3391 |
-
mode</a>.</p>
|
3392 |
-
|
3393 |
-
<p>Sometimes, it is useful for modes to <em>nest</em>—to have one
|
3394 |
-
mode delegate work to another mode. An example of this kind of
|
3395 |
-
mode is the <a href="../mode/htmlmixed/htmlmixed.js">mixed-mode HTML
|
3396 |
-
mode</a>. To implement such nesting, it is usually necessary to
|
3397 |
-
create mode objects and copy states yourself. To create a mode
|
3398 |
-
object, there are <code>CodeMirror.getMode(options,
|
3399 |
-
parserConfig)</code>, where the first argument is a configuration
|
3400 |
-
object as passed to the mode constructor function, and the second
|
3401 |
-
argument is a mode specification as in
|
3402 |
-
the <a href="#option_mode"><code>mode</code></a> option. To copy a
|
3403 |
-
state object, call <code>CodeMirror.copyState(mode, state)</code>,
|
3404 |
-
where <code>mode</code> is the mode that created the given
|
3405 |
-
state.</p>
|
3406 |
-
|
3407 |
-
<p id="innerMode">In a nested mode, it is recommended to add an
|
3408 |
-
extra method, <code><strong>innerMode</strong></code> which, given
|
3409 |
-
a state object, returns a <code>{state, mode}</code> object with
|
3410 |
-
the inner mode and its state for the current position. These are
|
3411 |
-
used by utility scripts such as the <a href="#addon_closetag">tag
|
3412 |
-
closer</a> to get context information. Use
|
3413 |
-
the <code>CodeMirror.innerMode</code> helper function to, starting
|
3414 |
-
from a mode and a state, recursively walk down to the innermost
|
3415 |
-
mode and state.</p>
|
3416 |
-
|
3417 |
-
<p>To make indentation work properly in a nested parser, it is
|
3418 |
-
advisable to give the <code>startState</code> method of modes that
|
3419 |
-
are intended to be nested an optional argument that provides the
|
3420 |
-
base indentation for the block of code. The JavaScript and CSS
|
3421 |
-
parser do this, for example, to allow JavaScript and CSS code
|
3422 |
-
inside the mixed-mode HTML mode to be properly indented.</p>
|
3423 |
-
|
3424 |
-
<p id="defineMIME">It is possible, and encouraged, to associate
|
3425 |
-
your mode, or a certain configuration of your mode, with
|
3426 |
-
a <a href="http://en.wikipedia.org/wiki/MIME">MIME</a> type. For
|
3427 |
-
example, the JavaScript mode associates itself
|
3428 |
-
with <code>text/javascript</code>, and its JSON variant
|
3429 |
-
with <code>application/json</code>. To do this,
|
3430 |
-
call <code><strong>CodeMirror.defineMIME</strong>(mime,
|
3431 |
-
modeSpec)</code>, where <code>modeSpec</code> can be a string or
|
3432 |
-
object specifying a mode, as in
|
3433 |
-
the <a href="#option_mode"><code>mode</code></a> option.</p>
|
3434 |
-
|
3435 |
-
<p>If a mode specification wants to add some properties to the
|
3436 |
-
resulting mode object, typically for use
|
3437 |
-
with <a href="#getHelpers"><code>getHelpers</code></a>, it may
|
3438 |
-
contain a <code>modeProps</code> property, which holds an object.
|
3439 |
-
This object's properties will be copied to the actual mode
|
3440 |
-
object.</p>
|
3441 |
-
|
3442 |
-
<p id="extendMode">Sometimes, it is useful to add or override mode
|
3443 |
-
object properties from external code.
|
3444 |
-
The <code><strong>CodeMirror.extendMode</strong></code> function
|
3445 |
-
can be used to add properties to mode objects produced for a
|
3446 |
-
specific mode. Its first argument is the name of the mode, its
|
3447 |
-
second an object that specifies the properties that should be
|
3448 |
-
added. This is mostly useful to add utilities that can later be
|
3449 |
-
looked up through <a href="#getMode"><code>getMode</code></a>.</p>
|
3450 |
-
</section>
|
3451 |
-
|
3452 |
-
<section id="vimapi">
|
3453 |
-
<h2>VIM Mode API</h2>
|
3454 |
-
|
3455 |
-
<p>CodeMirror has a robust VIM mode that attempts to faithfully
|
3456 |
-
emulate VIM's most useful features. It can be enabled by
|
3457 |
-
including <a href="../keymap/vim.js"><code>keymap/vim.js</code>
|
3458 |
-
</a> and setting the <code>keyMap</code> option to
|
3459 |
-
<code>"vim"</code>.</p>
|
3460 |
-
|
3461 |
-
<h3 id="vimapi_configuration">Configuration</h3>
|
3462 |
-
|
3463 |
-
<p>VIM mode accepts configuration options for customizing
|
3464 |
-
behavior at run time. These methods can be called at any time
|
3465 |
-
and will affect all existing CodeMirror instances unless
|
3466 |
-
specified otherwise. The methods are exposed on the
|
3467 |
-
<code><strong>CodeMirror.Vim</strong></code> object.</p>
|
3468 |
-
|
3469 |
-
<dl>
|
3470 |
-
<dt id="vimapi_setOption"><code><strong>setOption(name: string, value: any, ?cm: CodeMirror, ?cfg: object)</strong></code></dt>
|
3471 |
-
<dd>Sets the value of a VIM option. <code>name</code> should
|
3472 |
-
be the name of an option. If <code>cfg.scope</code> is not set
|
3473 |
-
and <code>cm</code> is provided, then sets the global and
|
3474 |
-
instance values of the option. Otherwise, sets either the
|
3475 |
-
global or instance value of the option depending on whether
|
3476 |
-
<code>cfg.scope</code> is <code>global</code> or
|
3477 |
-
<code>local</code>.</dd>
|
3478 |
-
<dt id="vimapi_getOption"><code><strong>getOption(name: string, ?cm: CodeMirror: ?cfg: object)</strong></code></dt>
|
3479 |
-
<dd>Gets the current value of a VIM option. If
|
3480 |
-
<code>cfg.scope</code> is not set and <code>cm</code> is
|
3481 |
-
provided, then gets the instance value of the option, falling
|
3482 |
-
back to the global value if not set. If <code>cfg.scope</code> is provided, then gets the <code>global</code> or
|
3483 |
-
<code>local</code> value without checking the other.</dd>
|
3484 |
-
|
3485 |
-
<dt id="vimapi_map"><code><strong>map(lhs: string, rhs: string, ?context: string)</strong></code></dt>
|
3486 |
-
<dd>Maps a key sequence to another key sequence. Implements
|
3487 |
-
VIM's <code>:map</code> command. To map ; to : in VIM would be
|
3488 |
-
<code><strong>:map ; :</strong></code>. That would translate to
|
3489 |
-
<code><strong>CodeMirror.Vim.map(';', ':');</strong></code>.
|
3490 |
-
The <code>context</code> can be <code>normal</code>,
|
3491 |
-
<code>visual</code>, or <code>insert</code>, which correspond
|
3492 |
-
to <code>:nmap</code>, <code>:vmap</code>, and
|
3493 |
-
<code>:imap</code>
|
3494 |
-
respectively.</dd>
|
3495 |
-
|
3496 |
-
<dt id="vimapi_mapCommand"><code><strong>mapCommand(keys: string, type: string, name: string, ?args: object, ?extra: object)</strong></code></dt>
|
3497 |
-
<dd>Maps a key sequence to a <code>motion</code>,
|
3498 |
-
<code>operator</code>, or <code>action</code> type command.
|
3499 |
-
The args object is passed through to the command when it is
|
3500 |
-
invoked by the provided key sequence.
|
3501 |
-
<code>extras.context</code> can be <code>normal</code>,
|
3502 |
-
<code>visual</code>, or <code>insert</code>, to map the key
|
3503 |
-
sequence only in the corresponding mode.
|
3504 |
-
<code>extras.isEdit</code> is applicable only to actions,
|
3505 |
-
determining whether it is recorded for replay for the
|
3506 |
-
<code>.</code> single-repeat command.
|
3507 |
-
</dl>
|
3508 |
-
|
3509 |
-
<h3 id="vimapi_extending">Extending VIM</h3>
|
3510 |
-
|
3511 |
-
<p>CodeMirror's VIM mode implements a large subset of VIM's core
|
3512 |
-
editing functionality. But since there's always more to be
|
3513 |
-
desired, there is a set of APIs for extending VIM's
|
3514 |
-
functionality. As with the configuration API, the methods are
|
3515 |
-
exposed on <code><strong>CodeMirror.Vim</strong></code> and may
|
3516 |
-
be called at any time.</p>
|
3517 |
-
|
3518 |
-
<dl>
|
3519 |
-
<dt id="vimapi_defineOption"><code><strong>defineOption(name: string, default: any, type: string, ?aliases: array<string>, ?callback: function (?value: any, ?cm: CodeMirror) → ?any)</strong></code></dt>
|
3520 |
-
<dd>Defines a VIM style option and makes it available to the
|
3521 |
-
<code>:set</code> command. Type can be <code>boolean</code> or
|
3522 |
-
<code>string</code>, used for validation and by
|
3523 |
-
<code>:set</code> to determine which syntax to accept. If a
|
3524 |
-
<code>callback</code> is passed in, VIM does not store the value of the
|
3525 |
-
option itself, but instead uses the callback as a setter/getter. If the
|
3526 |
-
first argument to the callback is <code>undefined</code>, then the
|
3527 |
-
callback should return the value of the option. Otherwise, it should set
|
3528 |
-
instead. Since VIM options have global and instance values, whether a
|
3529 |
-
<code>CodeMirror</code> instance is passed in denotes whether the global
|
3530 |
-
or local value should be used. Consequently, it's possible for the
|
3531 |
-
callback to be called twice for a single <code>setOption</code> or
|
3532 |
-
<code>getOption</code> call. Note that right now, VIM does not support
|
3533 |
-
defining buffer-local options that do not have global values. If an
|
3534 |
-
option should not have a global value, either always ignore the
|
3535 |
-
<code>cm</code> parameter in the callback, or always pass in a
|
3536 |
-
<code>cfg.scope</code> to <code>setOption</code> and
|
3537 |
-
<code>getOption</code>.</dd>
|
3538 |
-
|
3539 |
-
<dt id="vimapi_defineMotion"><code><strong>defineMotion(name: string, fn: function(cm: CodeMirror, head: {line, ch}, ?motionArgs: object}) → {line, ch})</strong></code></dt>
|
3540 |
-
<dd>Defines a motion command for VIM. The motion should return
|
3541 |
-
the desired result position of the cursor. <code>head</code>
|
3542 |
-
is the current position of the cursor. It can differ from
|
3543 |
-
<code>cm.getCursor('head')</code> if VIM is in visual mode.
|
3544 |
-
<code>motionArgs</code> is the object passed into
|
3545 |
-
<strong><code>mapCommand()</code></strong>.</dd>
|
3546 |
-
|
3547 |
-
<dt id="vimapi_defineOperator"><strong><code>defineOperator(name: string, fn: function(cm: CodeMirror, ?operatorArgs: object, ranges: array<{anchor, head}>) → ?{line, ch})</code></strong></dt>
|
3548 |
-
<dd>Defines an operator command, similar to <strong><code>
|
3549 |
-
defineMotion</code></strong>. <code>ranges</code> is the range
|
3550 |
-
of text the operator should operate on. If the cursor should
|
3551 |
-
be set to a certain position after the operation finishes, it
|
3552 |
-
can return a cursor object.</dd>
|
3553 |
-
|
3554 |
-
<dt id="vimapi_defineActon"><strong><code>defineAction(name: string, fn: function(cm: CodeMirror, ?actionArgs: object))</code></strong></dt>
|
3555 |
-
<dd>Defines an action command, similar to
|
3556 |
-
<strong><code>defineMotion</code></strong>. Action commands
|
3557 |
-
can have arbitrary behavior, making them more flexible than
|
3558 |
-
motions and operators, at the loss of orthogonality.</dd>
|
3559 |
-
|
3560 |
-
<dt id="vimapi_defineEx"><strong><code>defineEx(name: string, ?prefix: string, fn: function(cm: CodeMirror, ?params: object))</code></strong></dt>
|
3561 |
-
<dd>Defines an Ex command, and maps it to <code>:name</code>.
|
3562 |
-
If a prefix is provided, it, and any prefixed substring of the
|
3563 |
-
<code>name</code> beginning with the <code>prefix</code> can
|
3564 |
-
be used to invoke the command. If the <code>prefix</code> is
|
3565 |
-
falsy, then <code>name</code> is used as the prefix. <code>
|
3566 |
-
params.argString</code> contains the part of the prompted
|
3567 |
-
string after the command name. <code>params.args</code> is
|
3568 |
-
<code>params.argString</code> split by whitespace. If the
|
3569 |
-
command was prefixed with a
|
3570 |
-
<code><strong><a href="http://vimdoc.sourceforge.net/htmldoc/cmdline.html#cmdline-ranges">line range</a></strong></code>,
|
3571 |
-
<code>params.line</code> and <code>params.lineEnd</code> will
|
3572 |
-
be set.
|
3573 |
-
</dl>
|
3574 |
-
|
3575 |
-
</section>
|
3576 |
-
|
3577 |
-
</article>
|
3578 |
-
|
3579 |
-
<script>setTimeout(function(){CodeMirror.colorize();}, 20);</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/doc/realworld.html
DELETED
@@ -1,192 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Real-world Uses</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="docs.css">
|
6 |
-
|
7 |
-
<div id=nav>
|
8 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
|
9 |
-
|
10 |
-
<ul>
|
11 |
-
<li><a href="../index.html">Home</a>
|
12 |
-
<li><a href="manual.html">Manual</a>
|
13 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
14 |
-
</ul>
|
15 |
-
<ul>
|
16 |
-
<li><a class=active href="#">Real-world uses</a>
|
17 |
-
</ul>
|
18 |
-
</div>
|
19 |
-
|
20 |
-
<article>
|
21 |
-
|
22 |
-
<h2>CodeMirror real-world uses</h2>
|
23 |
-
|
24 |
-
<p>Create a <a href="https://github.com/codemirror/codemirror">pull
|
25 |
-
request</a> if you'd like your project to be added to this list.</p>
|
26 |
-
|
27 |
-
<ul>
|
28 |
-
<li><a href="http://brackets.io">Adobe Brackets</a> (code editor)</li>
|
29 |
-
<li><a href="http://alm.tools">ALM Tools</a> (TypeScript powered IDE)</li>
|
30 |
-
<li><a href="http://amber-lang.net/">Amber</a> (JavaScript-based Smalltalk system)</li>
|
31 |
-
<li><a href="http://apeye.org/">APEye</a> (tool for testing & documenting APIs)</li>
|
32 |
-
<li><a href="https://github.com/google/appengine-codiad">Appengine Codiad</a></li>
|
33 |
-
<li><a href="https://chrome.google.com/webstore/detail/better-text-viewer/lcaidopdffhfemoefoaadecppnjdknkc">Better Text Viewer</a> (plain text reader app for Chrome)</li>
|
34 |
-
<li><a href="http://blog.bitbucket.org/2013/05/14/edit-your-code-in-the-cloud-with-bitbucket/">Bitbucket</a> (code hosting)</li>
|
35 |
-
<li><a href="https://blogger.googleblog.com/2013/04/improvements-to-blogger-template-html.html">Blogger's theme editor</a></li>
|
36 |
-
<li><a href="http://bluegriffon.org/">BlueGriffon</a> (HTML editor)</li>
|
37 |
-
<li><a href="https://bnfplayground.pauliankline.com/">BNF Playground</a> (grammar workbench)</li>
|
38 |
-
<li><a href="https://github.com/isdampe/BosonEditorExperimental">Boson Editor</a> (code editor)</li>
|
39 |
-
<li><a href="http://cargocollective.com/">Cargo Collective</a> (creative publishing platform)</li>
|
40 |
-
<li><a href="https://developers.google.com/chrome-developer-tools/">Chrome DevTools</a></li>
|
41 |
-
<li><a href="http://clickhelp.co/">ClickHelp</a> (technical writing tool)</li>
|
42 |
-
<li><a href="https://electronjs.org/apps/colon">Colon</a> (A flexible text editor or IDE)</li>
|
43 |
-
<li><a href="http://code.world/">CodeWorld</a> (Haskell playground)</li>
|
44 |
-
<li><a href="http://complete-ly.appspot.com/playground/code.playground.html">Complete.ly playground</a></li>
|
45 |
-
<li><a href="https://codeanywhere.com/">Codeanywhere</a> (multi-platform cloud editor)</li>
|
46 |
-
<li><a href="http://drupal.org/project/cpn">Code per Node</a> (Drupal module)</li>
|
47 |
-
<li><a href="https://codebitt.com/">CodeBitt</a> (Code snippet sharing)</li>
|
48 |
-
<li><a href="http://www.codebugapp.com/">Codebug</a> (PHP Xdebug front-end)</li>
|
49 |
-
<li><a href="http://codefights.com/">CodeFights</a> (practice programming)</li>
|
50 |
-
<li><a href="https://github.com/angelozerr/CodeMirror-Eclipse">CodeMirror Eclipse</a> (embed CM in Eclipse)</li>
|
51 |
-
<li><a href="http://emmet.io/blog/codemirror-movie/">CodeMirror movie</a> (scripted editing demos)</li>
|
52 |
-
<li><a href="http://code.google.com/p/codemirror2-gwt/">CodeMirror2-GWT</a> (Google Web Toolkit wrapper)</li>
|
53 |
-
<li><a href="http://www.crunchzilla.com/code-monster">Code Monster</a> & <a href="http://www.crunchzilla.com/code-maven">Code Maven</a> (learning environment)</li>
|
54 |
-
<li><a href="http://codepen.io">Codepen</a> (gallery of animations)</li>
|
55 |
-
<li><a href="https://coderpad.io/">Coderpad</a> (interviewing tool)</li>
|
56 |
-
<li><a href="http://sasstwo.codeschool.com/levels/1/challenges/1">Code School</a> (online tech learning environment)</li>
|
57 |
-
<li><a href="http://code-snippets.bungeshea.com/">Code Snippets</a> (WordPress snippet management plugin)</li>
|
58 |
-
<li><a href="http://antonmi.github.io/code_together/">Code together</a> (collaborative editing)</li>
|
59 |
-
<li><a href="http://codev.it/">Codev</a> (collaborative IDE)</li>
|
60 |
-
<li><a href="https://www.codevolve.com/">Codevolve</a> (programming lessons as-a-service)</li>
|
61 |
-
<li><a href="http://www.codezample.com">CodeZample</a> (code snippet sharing)</li>
|
62 |
-
<li><a href="http://codio.com">Codio</a> (Web IDE)</li>
|
63 |
-
<li><a href="https://www.codiva.io/">Codiva.io</a> (Online Java Compiler and IDE with auto-completion and error highlighting)</li>
|
64 |
-
<li><a href="http://www.communitycodecamp.com/">Community Code Camp</a> (code snippet sharing)</li>
|
65 |
-
<li><a href="http://www.compilejava.net/">compilejava.net</a> (online Java sandbox)</li>
|
66 |
-
<li><a href="http://www.ckwnc.com/">CKWNC</a> (UML editor)</li>
|
67 |
-
<li><a href="http://www.crossui.com/">CrossUI</a> (cross-platform UI builder)</li>
|
68 |
-
<li><a href="http://rsnous.com/cruncher/">Cruncher</a> (notepad with calculation features)</li>
|
69 |
-
<li><a href="http://www.crudzilla.com/">Crudzilla</a> (self-hosted web IDE)</li>
|
70 |
-
<li><a href="http://cssdeck.com/">CSSDeck</a> (CSS showcase)</li>
|
71 |
-
<li><a href="http://ireneros.com/deck/deck.js-codemirror/introduction/#textarea-code">Deck.js integration</a> (slides with editors)</li>
|
72 |
-
<li><a href="http://www.dbninja.com">DbNinja</a> (MySQL access interface)</li>
|
73 |
-
<li><a href="http://www.ecsspert.com/">eCSSpert</a> (CSS demos and experiments)</li>
|
74 |
-
<li><a href="https://edabit.com">Edabit</a> (coding challenges)</li>
|
75 |
-
<li><a href="http://elm-lang.org/Examples.elm">Elm language examples</a></li>
|
76 |
-
<li><a href="http://eloquentjavascript.net/chapter1.html">Eloquent JavaScript</a> (book)</li>
|
77 |
-
<li><a href="http://emmet.io">Emmet</a> (fast XML editing)</li>
|
78 |
-
<li><a href="https://github.com/espruino/EspruinoWebIDE">Espruino Web IDE</a> (Chrome App for writing code on Espruino devices)</li>
|
79 |
-
<li><a href="http://www.fastfig.com/">Fastfig</a> (online computation/math tool)</li>
|
80 |
-
<li><a href="https://metacpan.org/module/Farabi">Farabi</a> (modern Perl IDE)</li>
|
81 |
-
<li><a href="http://blog.pamelafox.org/2012/02/interactive-html5-slides-with-fathomjs.html">FathomJS integration</a> (slides with editors, again)</li>
|
82 |
-
<li><a href="http://fiddlesalad.com/">Fiddle Salad</a> (web development environment)</li>
|
83 |
-
<li><a href="https://github.com/simogeo/Filemanager">Filemanager</a></li>
|
84 |
-
<li><a href="https://hacks.mozilla.org/2013/11/firefox-developer-tools-episode-27-edit-as-html-codemirror-more/">Firefox Developer Tools</a></li>
|
85 |
-
<li><a href="http://www.firepad.io">Firepad</a> (collaborative text editor)</li>
|
86 |
-
<li><a href="https://gerritcodereview.com/">Gerrit</a>'s diff view and inline editor</li>
|
87 |
-
<li><a href="https://github.com/maks/git-crx">Git Crx</a> (Chrome App for browsing local git repos)</li>
|
88 |
-
<li><a href="https://github.com/github/android">GitHub's Android app</a></li>
|
89 |
-
<li><a href="https://github.com/">Github</a>'s in-browser edit feature</li>
|
90 |
-
<li><a href="https://glitch.com/">Glitch</a> (community-driven app building)</li>
|
91 |
-
<li><a href="http://tour.golang.org">Go language tour</a></li>
|
92 |
-
<li><a href="https://script.google.com/">Google Apps Script</a></li>
|
93 |
-
<li><a href="http://web.uvic.ca/~siefkenj/graphit/graphit.html">Graphit</a> (function graphing)</li>
|
94 |
-
<li><a href="https://hackmd.io">HackMD</a> (Realtime collaborative markdown notes on all platforms)</li>
|
95 |
-
<li><a href="http://www.handcraft.com/">Handcraft</a> (HTML prototyping)</li>
|
96 |
-
<li><a href="http://hawkee.com/">Hawkee</a></li>
|
97 |
-
<li><a href="http://try.haxe.org">Haxe</a> (Haxe Playground) </li>
|
98 |
-
<li><a href="http://haxpad.com/">HaxPad</a> (editor for Win RT)</li>
|
99 |
-
<li><a href="http://megafonweblab.github.com/histone-javascript/">Histone template engine playground</a></li>
|
100 |
-
<li><a href="http://www.homegenie.it/docs/automation_getstarted.php">Homegenie</a> (home automation server)</li>
|
101 |
-
<li><a href="http://icecoder.net">ICEcoder</a> (web IDE)</li>
|
102 |
-
<li><a href="http://ipython.org/">IPython</a> (interactive computing shell)</li>
|
103 |
-
<li><a href="https://joelpinheiro.github.io/itrading/">iTrading</a> (Algorithmic Trading)</li>
|
104 |
-
<li><a href="http://i-mos.org/imos/">i-MOS</a> (modeling and simulation platform)</li>
|
105 |
-
<li><a href="http://www.janvas.com/">Janvas</a> (vector graphics editor)</li>
|
106 |
-
<li><a href="https://code.wetrafa.xyz/">JdBEdit</a> (web IDE)</li>
|
107 |
-
<li><a href="http://extensions.joomla.org/extensions/edition/editors/8723">Joomla plugin</a></li>
|
108 |
-
<li><a href="http://jqfundamentals.com/">jQuery fundamentals</a> (interactive tutorial)</li>
|
109 |
-
<li><a href="http://jsbin.com">jsbin.com</a> (JS playground)</li>
|
110 |
-
<li><a href="http://tool.jser.com/preprocessor">JSER preprocessor</a></li>
|
111 |
-
<li><a href="https://github.com/kucherenko/jscpd">jscpd</a> (code duplication detector)</li>
|
112 |
-
<li><a href="http://jsfiddle.net">JSFiddle</a> (another JS playground)</li>
|
113 |
-
<li><a href="http://www.jshint.com/">JSHint</a> (JS linter)</li>
|
114 |
-
<li><a href="http://jumpseller.com/">Jumpseller</a> (online store builder)</li>
|
115 |
-
<li><a href="http://kl1p.com/cmtest/1">kl1p</a> (paste service)</li>
|
116 |
-
<li><a href="http://www.kodhus.com/kodity/">Kodit</a></li>
|
117 |
-
<li><a href="http://kodtest.com/">Kodtest</a> (HTML/JS/CSS playground)</li>
|
118 |
-
<li><a href="http://try.kotlinlang.org">Kotlin</a> (web-based mini-IDE for Kotlin)</li>
|
119 |
-
<li><a href="http://lighttable.com/">Light Table</a> (experimental IDE)</li>
|
120 |
-
<li><a href="http://liveweave.com/">Liveweave</a> (HTML/CSS/JS scratchpad)</li>
|
121 |
-
<li><a href="https://github.com/TuvaLabs/markdown-delight-editor">Markdown Delight Editor</a> (extensible markdown editor polymer component)</li>
|
122 |
-
<li><a href="http://marklighteditor.com/">Marklight editor</a> (lightweight markup editor)</li>
|
123 |
-
<li><a href="http://www.mergely.com/">Mergely</a> (interactive diffing)</li>
|
124 |
-
<li><a href="http://www.iunbug.com/mihtool">MIHTool</a> (iOS web-app debugging tool)</li>
|
125 |
-
<li><a href="http://mscgen.js.org/index.html">mscgen_js</a> (online sequence chart editor)</li>
|
126 |
-
<li><a href="http://mvcplayground.apphb.com/">MVC Playground</a></li>
|
127 |
-
<li><a href="http://www.navigatecms.com">Navigate CMS</a></li>
|
128 |
-
<li><a href="https://github.com/soliton4/nodeMirror">nodeMirror</a> (IDE project)</li>
|
129 |
-
<li><a href="https://notex.ch">NoTex</a> (rST authoring)</li>
|
130 |
-
<li><a href="https://nteract.io">nteract</a> (interactive literate coding notebook)</li>
|
131 |
-
<li><a href="http://oakoutliner.com">Oak</a> (online outliner)</li>
|
132 |
-
<li><a href="http://www.greycampus.com/opencampus">OpenCampus</a></li>
|
133 |
-
<li><a href="http://clrhome.org/asm/">ORG</a> (z80 assembly IDE)</li>
|
134 |
-
<li><a href="https://github.com/mamacdon/orion-codemirror">Orion-CodeMirror integration</a> (running CodeMirror modes in Orion)</li>
|
135 |
-
<li><a href="http://paperjs.org/">Paper.js</a> (graphics scripting)</li>
|
136 |
-
<li><a href="http://pharaoh.js.org/">Pharaoh</a> (browser & desktop editor for the classroom)</li>
|
137 |
-
<li><a href="http://prinbit.com/">PrinBit</a> (collaborative coding tool)</li>
|
138 |
-
<li><a href="https://www.pramp.com/ref/codemirror">Pramp</a> (free platform to practice mock interviews and coding problems)</li>
|
139 |
-
<li><a href="http://prose.io/">Prose.io</a> (github content editor)</li>
|
140 |
-
<li><a href="https://pypi.python.org/pypi/PubliForge/">PubliForge</a> (online publishing system)</li>
|
141 |
-
<li><a href="http://www.puzzlescript.net/">Puzzlescript</a> (puzzle game engine)</li>
|
142 |
-
<li><a href="https://chrome.google.com/webstore/detail/quantum/hmnlklahndgbhdoclhdnoafhafbhmnkm?hl=en-US">Quantum</a> (code editor for Chrome OS)</li>
|
143 |
-
<li><a href="http://ariya.ofilabs.com/2011/09/hybrid-webnative-desktop-codemirror.html">Qt+Webkit integration</a> (building a desktop CodeMirror app)</li>
|
144 |
-
<li><a href="http://www.quivive-file-manager.com">Quivive File Manager</a></li>
|
145 |
-
<li><a href="http://rascalmicro.com/docs/basic-tutorial-getting-started.html">Rascal</a> (tiny computer)</li>
|
146 |
-
<li><a href="https://www.realtime.io/">RealTime.io</a> (Internet-of-Things infrastructure)</li>
|
147 |
-
<li><a href="http://refork.com/">Refork</a> (animation demo gallery and sharing)</li>
|
148 |
-
<li><a href="http://sagecell.sagemath.org">SageMathCell</a> (interactive mathematical software)</li>
|
149 |
-
<li><a href="https://cloud.sagemath.com/">SageMathCloud</a> (interactive mathematical software environment)</li>
|
150 |
-
<li><a href="https://github.com/szekelymilan/salvare">salvare</a> (real-time collaborative code editor)</li>
|
151 |
-
<li><a href="https://chrome.google.com/webstore/detail/servephp/mnpikomdchjhkhbhmbboehfdjkobbfpo">ServePHP</a> (PHP code testing in Chrome dev tools)</li>
|
152 |
-
<li><a href="http://scala-lang.org/blog/2017/02/20/introducing-scastie.html">Scastie</a> (Scala playground)</li>
|
153 |
-
<li><a href="https://www.shadertoy.com/">Shadertoy</a> (shader sharing)</li>
|
154 |
-
<li><a href="http://www.sketchpatch.net/labs/livecodelabIntro.html">sketchPatch Livecodelab</a></li>
|
155 |
-
<li><a href="http://www.skulpt.org/">Skulpt</a> (in-browser Python environment)</li>
|
156 |
-
<li><a href="https://www.sourcelair.com">SourceLair</a> (in-browser IDE for Django, Node.js, PHP and HTML5)</li>
|
157 |
-
<li><a href="http://snaptomato.appspot.com/editor.html">Snap Tomato</a> (HTML editing/testing page)</li>
|
158 |
-
<li><a href="http://snippets.pro/">Snippets.pro</a> (code snippet sharing)</li>
|
159 |
-
<li><a href="http://www.solidshops.com/">SolidShops</a> (hosted e-commerce platform)</li>
|
160 |
-
<li><a href="http://www.cemetech.net/sc/">SourceCoder 3</a> (online calculator IDE and editor)</li>
|
161 |
-
<li><a href="http://sqlfiddle.com">SQLFiddle</a> (SQL playground)</li>
|
162 |
-
<li><a href="http://www.subte.org/page/programar-ta-te-ti-online/">SubTe</a> (AI bot programming environment)</li>
|
163 |
-
<li><a href="http://xuanji.appspot.com/isicp/">Structure and Interpretation of Computer Programs</a>, Interactive Version</li>
|
164 |
-
<li><a href="http://syframework.alwaysdata.net">SyBox</a> (PHP playground)</li>
|
165 |
-
<li><a href="http://www.tagspaces.org/">TagSpaces</a> (personal data manager)</li>
|
166 |
-
<li><a href="https://textbox.io/">Textbox.io</a> (WYSIWYG rich text editor)</a></li>
|
167 |
-
<li><a href="https://thefiletree.com">The File Tree</a> (collab editor)</li>
|
168 |
-
<li><a href="http://www.mapbox.com/tilemill/">TileMill</a> (map design tool)</li>
|
169 |
-
<li><a href="http://doc.tiki.org/Syntax+Highlighter">Tiki</a> (wiki CMS groupware)</li>
|
170 |
-
<li><a href="http://www.toolsverse.com/products/data-explorer/">Toolsverse Data Explorer</a> (database management)</li>
|
171 |
-
<li><a href="http://blog.englard.net/post/39608000629/codeintumblr">Tumblr code highlighting shim</a></li>
|
172 |
-
<li><a href="http://turbopy.com/">TurboPY</a> (web publishing framework)</li>
|
173 |
-
<li><a href="http://cruise.eecs.uottawa.ca/umpleonline/">UmpleOnline</a> (model-oriented programming tool)</li>
|
174 |
-
<li><a href="https://upsource.jetbrains.com/idea-ce/file/idea-ce-7706e7832aa9e2fd0c2decdb5cbef2225692c696/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorFactoryImpl.java">Upsource</a> (code browser and review tool)</li>
|
175 |
-
<li><a href="https://github.com/mgaitan/waliki">Waliki</a> (wiki engine)</li>
|
176 |
-
<li><a href="http://wamer.net/">Wamer</a> (web application builder)</li>
|
177 |
-
<li><a href="https://github.com/brettz9/webappfind">webappfind</a> (windows file bindings for webapps)</li>
|
178 |
-
<li><a href="http://www.webglacademy.com/">WebGL academy</a> (learning WebGL)</li>
|
179 |
-
<li><a href="http://webglplayground.net/">WebGL playground</a></li>
|
180 |
-
<li><a href="https://www.webkit.org/blog/2518/state-of-web-inspector/#source-code">WebKit Web inspector</a></li>
|
181 |
-
<li><a href="http://www.wescheme.org/">WeScheme</a> (learning tool)</li>
|
182 |
-
<li><a href="https://github.com/b3log/wide">Wide</a> (golang web IDE)</li>
|
183 |
-
<li><a href="http://wordpress.org/extend/plugins/codemirror-for-codeeditor/">WordPress plugin</a></li>
|
184 |
-
<li><a href="https://www.writelatex.com">writeLaTeX</a> (Collaborative LaTeX Editor)</li>
|
185 |
-
<li><a href="http://www.xosystem.org/home/applications_websites/xosystem_website/xoside_EN.php">XOSide</a> (online editor)</li>
|
186 |
-
<li><a href="http://videlibri.sourceforge.net/cgi-bin/xidelcgi">XQuery tester</a></li>
|
187 |
-
<li><a href="http://q42jaap.github.io/xsd2codemirror/">xsd2codemirror</a> (convert XSD to CM XML completion info)</li>
|
188 |
-
<li><a href="http://www.yacas.org/yacas_online/yacas_online.html">Yacas Online</a> (interactive mathematical software)</li>
|
189 |
-
</ul>
|
190 |
-
|
191 |
-
</article>
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inc/static/libs/codemirror-5.44.0/doc/releases.html
DELETED
@@ -1,1732 +0,0 @@
|
|
1 |
-
<!doctype html>
|
2 |
-
|
3 |
-
<title>CodeMirror: Release History</title>
|
4 |
-
<meta charset="utf-8"/>
|
5 |
-
<link rel=stylesheet href="docs.css">
|
6 |
-
<script src="activebookmark.js"></script>
|
7 |
-
|
8 |
-
<div id=nav>
|
9 |
-
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
|
10 |
-
|
11 |
-
<ul>
|
12 |
-
<li><a href="../index.html">Home</a>
|
13 |
-
<li><a href="manual.html">Manual</a>
|
14 |
-
<li><a href="https://github.com/codemirror/codemirror">Code</a>
|
15 |
-
</ul>
|
16 |
-
<ul>
|
17 |
-
<li><a class=active data-default="true" href="#v5">Version 5.x</a>
|
18 |
-
<li><a href="#v4">Version 4.x</a>
|
19 |
-
<li><a href="#v3">Version 3.x</a>
|
20 |
-
<li><a href="#v2">Version 2.x</a>
|
21 |
-
<li><a href="#v1">Version 0.x</a>
|
22 |
-
</ul>
|
23 |
-
</div>
|
24 |
-
|
25 |
-
<article>
|
26 |
-
|
27 |
-
<h2>Release notes and version history</h2>
|
28 |
-
|
29 |
-
<section id=v5 class=first>
|
30 |
-
|
31 |
-
<h2>Version 5.x</h2>
|
32 |
-
|
33 |
-
<p class="rel">21-02-2019: <a href="https://codemirror.net/codemirror-5.44.0.zip">Version 5.44.0</a>:</p>
|
34 |
-
|
35 |
-
<ul class="rel-note">
|
36 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Properly emulate forward-delete.</li>
|
37 |
-
<li>New theme: <a href="https://codemirror.net/demo/theme.html#nord">nord</a>.</li>
|
38 |
-
<li>Fix issue where lines that only contained a zero-height widget got assigned an invalid height.</li>
|
39 |
-
<li>Improve support for middle-click paste on X Windows.</li>
|
40 |
-
<li>Fix a bug where a paste that doesn't contain any text caused the next input event to be treated as a paste.</li>
|
41 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix accidental global variable.</li>
|
42 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Support TypeScript <code>this</code> parameter declaration, prefixed <code>|</code> and <code>&</code> sigils in types, and improve parsing of <code>for</code>/<code>in</code> loops.</li>
|
43 |
-
</ul>
|
44 |
-
|
45 |
-
<p class="rel">21-01-2019: <a href="https://codemirror.net/codemirror-5.43.0.zip">Version 5.43.0</a>:</p>
|
46 |
-
|
47 |
-
<ul class="rel-note">
|
48 |
-
<li>Fix mistakes in passing through the arguments to <code>indent</code> in several wrapping modes.</li>
|
49 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Fix parsing for a number of new and obscure TypeScript features.</li>
|
50 |
-
<li><a href="https://codemirror.net/mode/ruby">ruby mode</a>: Support indented end tokens for heredoc strings.</li>
|
51 |
-
<li>New options <code>autocorrect</code> and <code>autocapitalize</code> to turn on those browser features.</li>
|
52 |
-
</ul>
|
53 |
-
|
54 |
-
<p class="rel">21-12-2018: <a href="https://codemirror.net/codemirror-5.42.2.zip">Version 5.42.2</a>:</p>
|
55 |
-
|
56 |
-
<ul class="rel-note">
|
57 |
-
<li>Fix problem where canceling a change via the <code>"beforeChange"</code> event could corrupt the textarea input.</li>
|
58 |
-
<li>Fix issues that sometimes caused the context menu hack to fail, or even leave visual artifacts on IE.</li>
|
59 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Make it possible to select text between angle brackets.</li>
|
60 |
-
<li><a href="https://codemirror.net/mode/css/">css mode</a>: Fix tokenizing of CSS variables.</li>
|
61 |
-
<li><a href="https://codemirror.net/mode/python/">python mode</a>: Fix another bug in tokenizing of format strings.</li>
|
62 |
-
<li><a href="https://codemirror.net/mode/soy/">soy mode</a>: More accurate highlighting.</li>
|
63 |
-
</ul>
|
64 |
-
|
65 |
-
<p class="rel">20-11-2018: <a href="https://codemirror.net/codemirror-5.42.0.zip">Version 5.42.0</a>:</p>
|
66 |
-
|
67 |
-
<ul class="rel-note">
|
68 |
-
<li>The <a href="https://codemirror.net/doc/manual.html#markText"><code>markText</code> method</a> now takes an <a href="https://codemirror.net/doc/manual.html#mark_attributes"><code>attributes</code></a> option that can be used to add attributes text's HTML representation.</li>
|
69 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Add support for the <code>=</code> binding.</li>
|
70 |
-
<li>Fix an issue where wide characters could cause lines to be come wider than the editor's horizontal scroll width.</li>
|
71 |
-
<li>Optimize handling of window resize events.</li>
|
72 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_show-hint">show-hint addon</a>: Don't assume the hints are shown in the same document the library was loaded in.</li>
|
73 |
-
<li><a href="https://codemirror.net/mode/python/">python mode</a>: Fix bug where a string inside a template string broke highlighting.</li>
|
74 |
-
<li><a href="https://codemirror.net/mode/swift">swift mode</a>: Support multi-line strings.</li>
|
75 |
-
</ul>
|
76 |
-
|
77 |
-
<p class="rel">25-10-2018: <a href="https://codemirror.net/codemirror-5.41.0.zip">Version 5.41.0</a>:</p>
|
78 |
-
|
79 |
-
<ul class="rel-note">
|
80 |
-
<li>A new <a href="https://codemirror.net/doc/manual.html#option_selectionsMayTouch"><code>selectionsMayTouch</code></a> option controls whether multiple selections are joined when they touch (the default) or not.</li>
|
81 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Add <code>noremap</code> binding command.</li>
|
82 |
-
<li>Fix firing of <a href="https://codemirror.net/doc/manual.html#event_gutterContextMenu"><code>"gutterContextMenu"</code></a> event on Firefox.</li>
|
83 |
-
<li>Solve an issue where copying multiple selections might mess with subsequent typing.</li>
|
84 |
-
<li>Don't crash when <a href="https://codemirror.net/doc/manual.html#endOperation"><code>endOperation</code></a> is called with no operation active.</li>
|
85 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Fix insert mode repeat after visualBlock edits.</li>
|
86 |
-
<li><a href="https://codemirror.net/mode/scheme/index.html">scheme mode</a>: Improve highlighting of quoted expressions.</li>
|
87 |
-
<li><a href="https://codemirror.net/mode/soy/">soy mode</a>: Support injected data and <code>@param</code> in comments.</li>
|
88 |
-
<li><a href="https://codemirror.net/mode/clike/">objective c mode</a>: Improve conformance to the actual language.</li>
|
89 |
-
</ul>
|
90 |
-
|
91 |
-
<p class="rel">20-09-2018: <a href="https://codemirror.net/codemirror-5.40.2.zip">Version 5.40.2</a>:</p>
|
92 |
-
|
93 |
-
<ul class="rel-note">
|
94 |
-
<li>Fix firing of <code>gutterContextMenu</code> event on Firefox.</li>
|
95 |
-
<li>Add <code>hintWords</code> (basic completion) helper to <a href="https://codemirror.net/mode/clojure/index.html">clojure</a>, <a href="https://codemirror.net/mode/mllike/index.html">mllike</a>, <a href="https://codemirror.net/mode/julia/">julia</a>, <a href="https://codemirror.net/mode/shell/">shell</a>, and <a href="https://codemirror.net/mode/r/">r</a> modes.</li>
|
96 |
-
<li><a href="https://codemirror.net/mode/clojure/index.html">clojure mode</a>: Clean up and improve.</li>
|
97 |
-
</ul>
|
98 |
-
|
99 |
-
<p class="rel">25-08-2018: <a href="https://codemirror.net/codemirror-5.40.0.zip">Version 5.40.0</a>:</p>
|
100 |
-
|
101 |
-
<ul class="rel-note">
|
102 |
-
<li>New method <a href="https://codemirror.net/doc/manual.html#phrase"><code>phrase</code></a> and option <a href="https://codemirror.net/doc/manual.html#option_phrases"><code>phrases</code></a> to make translating UI text in addons easier.</li>
|
103 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Fix issue where bracket-closing wouldn't work before punctuation.</li>
|
104 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_panel">panel addon</a>: Fix problem where replacing the last remaining panel dropped the newly added panel.</li>
|
105 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_hardwrap">hardwrap addon</a>: Fix an infinite loop when the indention is greater than the target column.</li>
|
106 |
-
<li><a href="https://codemirror.net/mode/jinja2/">jinja2</a> and <a href="https://codemirror.net/mode/markdown/">markdown</a> modes: Add comment metadata.</li>
|
107 |
-
</ul>
|
108 |
-
|
109 |
-
<p class="rel">20-07-2018: <a href="https://codemirror.net/codemirror-5.39.2.zip">Version 5.39.2</a>:</p>
|
110 |
-
|
111 |
-
<ul class="rel-note">
|
112 |
-
<li>Fix issue where when you pass the document as a <code>Doc</code> instance to the <code>CodeMirror</code> constructor, the <code>mode</code> option was ignored.</li>
|
113 |
-
<li>Fix bug where line height could be computed wrong with a line widget below a collapsed line.</li>
|
114 |
-
<li>Fix overeager <code>.npmignore</code> dropping the <code>bin/source-highlight</code> utility from the distribution.</li>
|
115 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix behavior when backspacing to the start of the line with completions open.</li>
|
116 |
-
</ul>
|
117 |
-
|
118 |
-
<p class="rel">20-06-2018: <a href="https://codemirror.net/codemirror-5.39.0.zip">Version 5.39.0</a>:</p>
|
119 |
-
|
120 |
-
<ul class="rel-note">
|
121 |
-
<li>Fix issue that in some circumstances caused content to be clipped off at the bottom after a resize.</li>
|
122 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Improve handling of blank lines in HTML tags.</li>
|
123 |
-
<li><a href="https://codemirror.net/mode/stex/">stex mode</a>: Add an <code>inMathMode</code> option to start the mode in math mode.</li>
|
124 |
-
</ul>
|
125 |
-
|
126 |
-
<p class="rel">21-05-2018: <a href="https://codemirror.net/codemirror-5.38.0.zip">Version 5.38.0</a>:</p>
|
127 |
-
|
128 |
-
<ul class="rel-note">
|
129 |
-
<li>Improve reliability of noticing a missing mouseup event during dragging.</li>
|
130 |
-
<li>Make sure <code>getSelection</code> is always called on the correct document.</li>
|
131 |
-
<li>Fix interpretation of line breaks and non-breaking spaces inserted by renderer in contentEditable mode.</li>
|
132 |
-
<li>Work around some browsers inexplicably making the fake scrollbars focusable.</li>
|
133 |
-
<li>Make sure <code>coordsChar</code> doesn't return positions inside collapsed ranges.</li>
|
134 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Support block scopes, bindingless catch, bignum suffix, <code>s</code> regexp flag.</li>
|
135 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Adjust a wasteful regexp.</li>
|
136 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_show-hint">show-hint addon</a>: Allow opening the control without any item selected.</li>
|
137 |
-
<li>New theme: <a href="https://codemirror.net/demo/theme.html#darcula">darcula</a>.</li>
|
138 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_dialog">dialog addon</a>: Add a CSS class (<code>dialog-opened</code>) to the editor when a dialog is open.</li>
|
139 |
-
</ul>
|
140 |
-
|
141 |
-
<p class="rel">20-04-2018: <a href="https://codemirror.net/codemirror-5.37.0.zip">Version 5.37.0</a>:</p>
|
142 |
-
|
143 |
-
<ul class="rel-note">
|
144 |
-
<li>Suppress keypress events during composition, for platforms that don't properly do this themselves.</li>
|
145 |
-
<li><a href="https://codemirror.net/demo/folding.html">xml-fold addon</a>: Improve handling of line-wrapped opening tags.</li>
|
146 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Improve TypeScript support.</li>
|
147 |
-
<li><a href="https://codemirror.net/mode/python/">python mode</a>: Highlight expressions inside format strings.</li>
|
148 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Add support for '(' and ')' movement.</li>
|
149 |
-
<li>New themes: <a href="https://codemirror.net/demo/theme.html#idea">idea</a>, <a href="https://codemirror.net/demo/theme.html#ssms">ssms</a>, <a href="https://codemirror.net/demo/theme.html#gruvbox-dark">gruvbox-dark</a>.</li>
|
150 |
-
</ul>
|
151 |
-
|
152 |
-
<p class="rel">20-03-2018: <a href="https://codemirror.net/codemirror-5.36.0.zip">Version 5.36.0</a>:</p>
|
153 |
-
|
154 |
-
<ul class="rel-note">
|
155 |
-
<li>Make sure all document-level event handlers are registered on the document that the editor is part of.</li>
|
156 |
-
<li>Fix issue that prevented edits whose origin starts with <code>+</code> from being combined in history events for an editor-less document.</li>
|
157 |
-
<li><a href="https://codemirror.net/demo/multiplex.html">multiplex addon</a>: Improve handling of indentation.</li>
|
158 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_merge">merge addon</a>: Use CSS <code>:after</code> element to style the scroll-lock icon.</li>
|
159 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_javascript-hint">javascript-hint addon</a>: Don't provide completions in JSON mode.</li>
|
160 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_continuelist">continuelist addon</a>: Fix numbering error.</li>
|
161 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_show-hint">show-hint addon</a>: Make <code>fromList</code> completion strategy act on the current token up to the cursor, rather than the entire token.</li>
|
162 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Fix a regexp with potentially exponental complexity.</li>
|
163 |
-
<li>New theme: <a href="https://codemirror.net/demo/theme.html#lucario">lucario</a>.</li>
|
164 |
-
</ul>
|
165 |
-
|
166 |
-
<p class="rel">20-02-2018: <a href="https://codemirror.net/codemirror-5.35.0.zip">Version 5.35.0</a>:</p>
|
167 |
-
|
168 |
-
<ul class="rel-note">
|
169 |
-
<li>Fix problem where selection undo might change read-only documents.</li>
|
170 |
-
<li>Fix crash when calling <code>addLineWidget</code> on a document that has no attached editor.</li>
|
171 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Fix behavior of <code>^</code> in multiline regexp mode.</li>
|
172 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_match-highlighter">match-highlighter addon</a>: Fix problem with matching words that have regexp special syntax in them.</li>
|
173 |
-
<li><a href="https://codemirror.net/demo/sublime.html">sublime bindings</a>: Fix <code>addCursorToSelection</code> for short lines.</li>
|
174 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Support alternative delimiters in replace command.</li>
|
175 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Support TypeScript intersection types, dynamic <code>import</code>.</li>
|
176 |
-
<li><a href="https://codemirror.net/mode/stex/">stex mode</a>: Fix parsing of <code>\(</code> <code>\)</code> delimiters, recognize more atom arguments.</li>
|
177 |
-
<li><a href="https://codemirror.net/mode/haskell/">haskell mode</a>: Highlight more builtins, support <code><*</code> and <code>*></code>.</li>
|
178 |
-
<li><a href="https://codemirror.net/mode/sql/">sql mode</a>: Make it possible to disable backslash escapes in strings for dialects that don't have them, do this for MS SQL.</li>
|
179 |
-
<li><a href="https://codemirror.net/mode/dockerfile/">dockerfile mode</a>: Highlight strings and ports, recognize more instructions.</li>
|
180 |
-
</ul>
|
181 |
-
|
182 |
-
<p class="rel">29-01-2018: <a href="https://codemirror.net/codemirror-5.34.0.zip">Version 5.34.0</a>:</p>
|
183 |
-
|
184 |
-
<ul class="rel-note">
|
185 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Fix a problem where inline styles would persist across list items.</li>
|
186 |
-
<li><a href="https://codemirror.net/demo/sublime.html">sublime bindings</a>: Fix the <code>toggleBookmark</code> command.</li>
|
187 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Improve behavior when closing triple quotes.</li>
|
188 |
-
<li><a href="https://codemirror.net/demo/folding.html">xml-fold addon</a>: Fix folding of line-broken XML tags.</li>
|
189 |
-
<li><a href="https://codemirror.net/mode/shell/">shell mode</a>: Better handling of nested quoting.</li>
|
190 |
-
<li><a href="https://codemirror.net/demo/lint.html">javascript-lint addon</a>: Clean up and simplify.</li>
|
191 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Fix support for multiple editors at the same time.</li>
|
192 |
-
<li>New themes: <a href="https://codemirror.net/demo/theme.html#oceanic-next">oceanic-next</a> and <a href="https://codemirror.net/demo/theme.html#shadowfox">shadowfox</a>.</li>
|
193 |
-
</ul>
|
194 |
-
|
195 |
-
<p class="rel">21-12-2017: <a href="https://codemirror.net/codemirror-5.33.0.zip">Version 5.33.0</a>:</p>
|
196 |
-
|
197 |
-
<ul class="rel-note">
|
198 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_lint">lint addon</a>: Make updates more efficient.</li>
|
199 |
-
<li><a href="https://codemirror.net/mode/css/">css mode</a>: The mode is now properly case-insensitive.</li>
|
200 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_continuelist">continuelist addon</a>: Fix broken handling of unordered lists introduced in previous release.</li>
|
201 |
-
<li><a href="https://codemirror.net/mode/swift">swift</a> and <a href="https://codemirror.net/mode/clike/">scala</a> modes: Support nested block comments.</li>
|
202 |
-
<li><a href="https://codemirror.net/mode/mllike/index.html">mllike mode</a>: Improve OCaml support.</li>
|
203 |
-
<li><a href="https://codemirror.net/demo/sublime.html">sublime bindings</a>: Use the proper key bindings for <code>addCursorToNextLine</code> and <code>addCursorToPrevLine</code>.</li>
|
204 |
-
<li><a href="https://codemirror.net/mode/jsx/index.html">jsx mode</a>: Support JSX fragments.</li>
|
205 |
-
<li><a href="https://codemirror.net/demo/closetag.html">closetag addon</a>: Add an option to disable auto-indenting.</li>
|
206 |
-
</ul>
|
207 |
-
|
208 |
-
<p class="rel">22-11-2017: <a href="https://codemirror.net/codemirror-5.32.0.zip">Version 5.32.0</a>:</p>
|
209 |
-
|
210 |
-
<ul class="rel-note">
|
211 |
-
<li>Increase contrast on default bracket-matching colors.</li>
|
212 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Recognize TypeScript type parameters for calls, type guards, and type parameter defaults. Improve handling of <code>enum</code> and <code>module</code> keywords.</li>
|
213 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_comment">comment addon</a>: Fix bug when uncommenting a comment that spans all but the last selected line.</li>
|
214 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Fix bug in case folding.</li>
|
215 |
-
<li><a href="https://codemirror.net/demo/emacs.html">emacs bindings</a>: Prevent single-character deletions from resetting the kill ring.</li>
|
216 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Tweak quote matching behavior.</li>
|
217 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_continuelist">continuelist addon</a>: Increment ordered list numbers when adding one.</li>
|
218 |
-
</ul>
|
219 |
-
|
220 |
-
<p class="rel">20-10-2017: <a href="https://codemirror.net/codemirror-5.31.0.zip">Version 5.31.0</a>:</p>
|
221 |
-
|
222 |
-
<ul class="rel-note">
|
223 |
-
<li>Modes added with <a href="https://codemirror.net/doc/manual.html#addOverlay"><code>addOverlay</code></a> now have access to a <a href="https://codemirror.net/doc/manual.html#baseToken"><code>baseToken</code></a> method on their input stream, giving access to the tokens of the underlying mode.</li>
|
224 |
-
<li>Further improve selection drawing and cursor motion in right-to-left documents.</li>
|
225 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable <a href="https://codemirror.net/doc/manual.html#option_contentEditable">input mode</a>.</li>
|
226 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_continuecomment">continuecomment addon</a>: Fix bug when pressing enter after a single-line block comment.</li>
|
227 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Fix issue with leaving indented fenced code blocks.</li>
|
228 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.</li>
|
229 |
-
</ul>
|
230 |
-
|
231 |
-
<p class="rel">20-09-2017: <a href="https://codemirror.net/codemirror-5.30.0.zip">Version 5.30.0</a>:</p>
|
232 |
-
|
233 |
-
<ul class="rel-note">
|
234 |
-
<li>Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.</li>
|
235 |
-
<li><a href="https://codemirror.net/demo/search/">search addon</a>: Fix crash when restarting search after doing empty search.</li>
|
236 |
-
<li><a href="http://cm/doc/manual.html#addon_mark-selection">mark-selection addon</a>: Fix off-by-one bug.</li>
|
237 |
-
<li><a href="https://codemirror.net/demo/tern.html">tern addon</a>: Fix bad request made when editing at the bottom of a large document.</li>
|
238 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Improve parsing in a number of corner cases.</li>
|
239 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.</li>
|
240 |
-
<li><a href="https://codemirror.net/mode/gfm/">gfm mode</a>: Don't highlight SHA1 'hashes' without numbers to avoid false positives.</li>
|
241 |
-
<li><a href="https://codemirror.net/mode/soy/">soy mode</a>: Support injected data and <code>@param</code> in comments.</li>
|
242 |
-
<li><a href="https://codemirror.net/demo/simplemode.html">simple mode addon</a>: Allow groups in regexps when <code>token</code> isn't an array.</li>
|
243 |
-
</ul>
|
244 |
-
|
245 |
-
<p class="rel">24-08-2017: <a href="https://codemirror.net/codemirror-5.29.0.zip">Version 5.29.0</a>:</p>
|
246 |
-
|
247 |
-
<ul class="rel-note">
|
248 |
-
<li>Fix crash in contentEditable input style when editing near a bookmark.</li>
|
249 |
-
<li>Make sure change origins are preserved when splitting changes on <a href="https://codemirror.net/doc/manual.html#mark_readOnly">read-only marks</a>.</li>
|
250 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: More support for TypeScript syntax.</li>
|
251 |
-
<li><a href="https://codemirror.net/mode/d/">d mode</a>: Support nested comments.</li>
|
252 |
-
<li><a href="https://codemirror.net/mode/python/">python mode</a>: Improve tokenizing of operators.</li>
|
253 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Further improve CommonMark conformance.</li>
|
254 |
-
<li><a href="https://codemirror.net/mode/css/">css mode</a>: Don't run comment tokens through the mode's state machine.</li>
|
255 |
-
<li><a href="https://codemirror.net/mode/shell/">shell mode</a>: Allow strings to span lines.</li>
|
256 |
-
<li><a href="https://codemirror.net/demo/search/">search addon</a>: Fix crash in persistent search when <code>extraKeys</code> is null.</li>
|
257 |
-
</ul>
|
258 |
-
|
259 |
-
<p class="rel">21-07-2017: <a href="https://codemirror.net/codemirror-5.28.0.zip">Version 5.28.0</a>:</p>
|
260 |
-
|
261 |
-
<ul class="rel-note">
|
262 |
-
<li>Fix copying of, or replacing editor content with, a single dash character when copying a big selection in some corner cases.</li>
|
263 |
-
<li>Make <a href="https://codemirror.net/doc/manual.html#command_goLineLeft"><code>"goLineLeft"</code></a>/<code>"goLineRight"</code> behave better on wrapped lines.</li>
|
264 |
-
<li><a href="https://codemirror.net/mode/sql/">sql mode</a>: Fix tokenizing of multi-dot operator and allow digits in subfield names.</li>
|
265 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Fix infinite loop on some composed character inputs.</li>
|
266 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Make list parsing more CommonMark-compliant.</li>
|
267 |
-
<li><a href="https://codemirror.net/mode/gfm/">gfm mode</a>: Highlight colon syntax for emoji.</li>
|
268 |
-
</ul>
|
269 |
-
|
270 |
-
<p class="rel">29-06-2017: <a href="https://codemirror.net/codemirror-5.27.4.zip">Version 5.27.4</a>:</p>
|
271 |
-
|
272 |
-
<ul class="rel-note">
|
273 |
-
<li>Fix crash when using mode lookahead.</li>
|
274 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Don't block inner mode's indentation support.</li>
|
275 |
-
</ul>
|
276 |
-
|
277 |
-
<p class="rel">22-06-2017: <a href="https://codemirror.net/codemirror-5.27.2.zip">Version 5.27.2</a>:</p>
|
278 |
-
|
279 |
-
<ul class="rel-note">
|
280 |
-
<li>Fix crash in the <a href="https://codemirror.net/demo/simplemode.html">simple mode</a> addon.</li>
|
281 |
-
</ul>
|
282 |
-
|
283 |
-
<p class="rel">22-06-2017: <a href="https://codemirror.net/codemirror-5.27.0.zip">Version 5.27.0</a>:</p>
|
284 |
-
|
285 |
-
<ul class="rel-note">
|
286 |
-
<li>Fix infinite loop in forced display update.</li>
|
287 |
-
<li>Properly disable the hidden textarea when <code>readOnly</code> is <code>"nocursor"</code>.</li>
|
288 |
-
<li>Calling the <code>Doc</code> constructor without <code>new</code> works again.</li>
|
289 |
-
<li><a href="https://codemirror.net/mode/sql/">sql mode</a>: Handle nested comments.</li>
|
290 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Improve support for TypeScript syntax.</li>
|
291 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Fix bug where markup was ignored on indented paragraph lines.</li>
|
292 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Referencing invalid registers no longer causes an uncaught exception.</li>
|
293 |
-
<li><a href="https://codemirror.net/mode/rust/">rust mode</a>: Add the correct MIME type.</li>
|
294 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Document options.</li>
|
295 |
-
<li>Mouse button clicks can now be bound in keymaps by using names like <code>"LeftClick"</code> or <code>"Ctrl-Alt-MiddleTripleClick"</code>. When bound to a function, that function will be passed the position of the click as second argument.</li>
|
296 |
-
<li>The behavior of mouse selection and dragging can now be customized with the <a href="https://codemirror.net/doc/manual.html#option_configureMouse"><code>configureMouse</code></a> option.</li>
|
297 |
-
<li>Modes can now look ahead across line boundaries with the <a href="https://codemirror.net/doc/manual.html#StringStream"><code>StringStream</code></a><code>.lookahead</code> method.</li>
|
298 |
-
<li>Introduces a <code>"type"</code> token type, makes modes that recognize types output it, and add styling for it to the themes.</li>
|
299 |
-
<li>New <a href="https://codemirror.net/doc/manual.html#option_pasteLinesPerSelection"><code>pasteLinesPerSelection</code></a> option to control the behavior of pasting multiple lines into multiple selections.</li>
|
300 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Support multi-line regular expression matches, and normalize strings when matching.</li>
|
301 |
-
</ul>
|
302 |
-
|
303 |
-
<p class="rel">22-05-2017: <a href="https://codemirror.net/codemirror-5.26.0.zip">Version 5.26.0</a>:</p>
|
304 |
-
|
305 |
-
<ul class="rel-note">
|
306 |
-
<li>In textarea-mode, don't reset the input field during composition.</li>
|
307 |
-
<li>More careful restoration of selections in widgets, during editor redraw.</li>
|
308 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Parse line offsets in line or range specs.</li>
|
309 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: More TypeScript parsing fixes.</li>
|
310 |
-
<li><a href="https://codemirror.net/mode/julia/">julia mode</a>: Fix issue where the mode gets stuck.</li>
|
311 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Understand cross-line links, parse all bracketed things as links.</li>
|
312 |
-
<li><a href="https://codemirror.net/mode/soy/">soy mode</a>: Support single-quoted strings.</li>
|
313 |
-
<li><a href="https://codemirror.net/mode/go/">go mode</a>: Don't try to indent inside strings or comments.</li>
|
314 |
-
</ul>
|
315 |
-
|
316 |
-
<p class="rel">20-04-2017: <a href="https://codemirror.net/codemirror-5.25.2.zip">Version 5.25.2</a>:</p>
|
317 |
-
|
318 |
-
<ul class="rel-note">
|
319 |
-
<li>Better handling of selections that cover the whole viewport in contentEditable-mode.</li>
|
320 |
-
<li>No longer accidentally scroll the editor into view when calling <code>setValue</code>.</li>
|
321 |
-
<li>Work around Chrome Android bug when converting screen coordinates to editor positions.</li>
|
322 |
-
<li>Make sure long-clicking a selection sets a cursor and doesn't show the editor losing focus.</li>
|
323 |
-
<li>Fix issue where pointer events were incorrectly disabled on Chrome's overlay scrollbars.</li>
|
324 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Recognize annotations and TypeScript-style type parameters.</li>
|
325 |
-
<li><a href="https://codemirror.net/mode/shell/">shell mode</a>: Handle nested braces.</li>
|
326 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Make parsing of strong/em delimiters CommonMark-compliant.</li>
|
327 |
-
</ul>
|
328 |
-
|
329 |
-
<p class="rel">20-03-2017: <a href="https://codemirror.net/codemirror-5.25.0.zip">Version 5.25.0</a>:</p>
|
330 |
-
|
331 |
-
<ul class=rel-note>
|
332 |
-
<li>In contentEditable-mode, properly locate changes that repeat a character when inserted with IME.</li>
|
333 |
-
<li>Fix handling of selections bigger than the viewport in contentEditable mode.</li>
|
334 |
-
<li>Improve handling of changes that insert or delete lines in contentEditable mode.</li>
|
335 |
-
<li>Count Unicode control characters 0x80 to 0x9F as special (non-printing) chars.</li>
|
336 |
-
<li>Fix handling of shadow DOM roots when finding the active element.</li>
|
337 |
-
<li>Add <code>role=presentation</code> to more DOM elements to improve screen reader support.</li>
|
338 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_merge">merge addon</a>: Make aligning of unchanged chunks more robust.</li>
|
339 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_comment">comment addon</a>: Fix comment-toggling on a block of text that starts and ends in a (differnet) block comment.</li>
|
340 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Improve support for TypeScript syntax.</li>
|
341 |
-
<li><a href="https://codemirror.net/mode/r/">r mode</a>: Fix indentation after semicolon-less statements.</li>
|
342 |
-
<li><a href="https://codemirror.net/mode/shell/">shell mode</a>: Properly handle escaped parentheses in parenthesized expressions.</li>
|
343 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Fix a few bugs around leaving fenced code blocks.</li>
|
344 |
-
<li><a href="https://codemirror.net/mode/soy/">soy mode</a>: Improve indentation.</li>
|
345 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_lint">lint addon</a>: Support asynchronous linters that return promises.</li>
|
346 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_continuelist">continuelist addon</a>: Support continuing task lists.</li>
|
347 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Make Y behave like yy.</li>
|
348 |
-
<li><a href="https://codemirror.net/mode/sql/">sql mode</a>: Support sqlite dialect.</li>
|
349 |
-
</ul>
|
350 |
-
|
351 |
-
<p class="rel">22-02-2017: <a href="https://codemirror.net/codemirror-5.24.2.zip">Version 5.24.2</a>:</p>
|
352 |
-
|
353 |
-
<ul class=rel-note>
|
354 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Support computed class method names.</li>
|
355 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_merge">merge addon</a>: Improve aligning of unchanged code in the presence of marks and line widgets.</li>
|
356 |
-
</ul>
|
357 |
-
|
358 |
-
<p class="rel">20-02-2017: <a href="https://codemirror.net/codemirror-5.24.0.zip">Version 5.24.0</a>:</p>
|
359 |
-
|
360 |
-
<ul class=rel-note>
|
361 |
-
<li>Positions now support a <code>sticky</code> property which determines whether they should be associated with the character before (value <code>"before"</code>) or after (value <code>"after"</code>) them.</li>
|
362 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Make it possible to remove built-in bindings through the API.</li>
|
363 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_comment">comment addon</a>: Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.</li>
|
364 |
-
<li>A cursor directly before a line-wrapping break is now drawn before or after the line break depending on which direction you arrived from.</li>
|
365 |
-
<li>Visual cursor motion in line-wrapped right-to-left text should be much more correct.</li>
|
366 |
-
<li>Fix bug in handling of read-only marked text.</li>
|
367 |
-
<li><a href="https://codemirror.net/mode/shell/">shell mode</a>: Properly tokenize nested parentheses.</li>
|
368 |
-
<li><a href="https://codemirror.net/mode/python/">python mode</a>: Support underscores in number literals.</li>
|
369 |
-
<li><a href="https://codemirror.net/mode/sass/">sass mode</a>: Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset. Now depends on the css mode.</li>
|
370 |
-
<li><a href="https://codemirror.net/mode/css/">css mode</a>: Expose <code>lineComment</code> property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.</li>
|
371 |
-
<li><a href="https://codemirror.net/mode/julia/">julia mode</a>: Properly indent <code>elseif</code> lines.</li>
|
372 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Properly recognize the end of fenced code blocks when inside other markup.</li>
|
373 |
-
<li><a href="https://codemirror.net/mode/clike/">scala mode</a>: Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.</li>
|
374 |
-
<li><a href="https://codemirror.net/mode/xml/">xml mode</a>: Allow dashes in HTML tag names.</li>
|
375 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Improve parsing of async methods, TypeScript-style comma-separated superclass lists.</li>
|
376 |
-
<li><a href="https://codemirror.net/demo/folding.html">indent-fold addon</a>: Ignore comment lines.</li>
|
377 |
-
</ul>
|
378 |
-
|
379 |
-
<p class="rel">19-01-2017: <a href="https://codemirror.net/codemirror-5.23.0.zip">Version 5.23.0</a>:</p>
|
380 |
-
|
381 |
-
<ul class=rel-note>
|
382 |
-
<li>Presentation-related elements DOM elements are now marked as such to help screen readers.</li>
|
383 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Be more picky about what HTML tags look like to avoid false positives.</li>
|
384 |
-
<li><code>findModeByMIME</code> now understands <code>+json</code> and <code>+xml</code> MIME suffixes.</li>
|
385 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Add support for an <code>override</code> option to ignore language-specific defaults.</li>
|
386 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_panel">panel addon</a>: Add a <code>stable</code> option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.</li>
|
387 |
-
</ul>
|
388 |
-
|
389 |
-
<p class="rel">20-12-2016: <a href="https://codemirror.net/codemirror-5.22.0.zip">Version 5.22.0</a>:</p>
|
390 |
-
|
391 |
-
<ul class=rel-note>
|
392 |
-
<li><a href="https://codemirror.net/demo/sublime.html">sublime bindings</a>: Make <code>selectBetweenBrackets</code> work with multiple cursors.</li>
|
393 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Fix issues with parsing complex TypeScript types, imports, and exports.</li>
|
394 |
-
<li>A contentEditable editor instance with autofocus enabled no longer crashes during initializing.</li>
|
395 |
-
<li><a href="https://codemirror.net/demo/emacs.html">emacs bindings</a>: Export <code>CodeMirror.emacs</code> to allow other addons to hook into Emacs-style functionality.</li>
|
396 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_active-line">active-line addon</a>: Add <code>nonEmpty</code> option.</li>
|
397 |
-
<li>New event: <a href="https://codemirror.net/doc/manual.html#event_optionChange"><code>optionChange</code></a>.</li>
|
398 |
-
</ul>
|
399 |
-
|
400 |
-
<p class="rel">21-11-2016: <a href="https://codemirror.net/codemirror-5.21.0.zip">Version 5.21.0</a>:</p>
|
401 |
-
|
402 |
-
<ul class=rel-note>
|
403 |
-
<li>Tapping/clicking the editor in <a href="https://codemirror.net/doc/manual.html#option_inputStyle">contentEditable mode</a> on Chrome now puts the cursor at the tapped position.</li>
|
404 |
-
<li>Fix various crashes and misbehaviors when reading composition events in <a href="https://codemirror.net/doc/manual.html#option_inputStyle">contentEditable mode</a>.</li>
|
405 |
-
<li>Catches and ignores an IE 'Unspecified Error' when creating an editor in an iframe before there is a <code><body></code>.</li>
|
406 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_merge">merge addon</a>: Fix several issues in the chunk-aligning feature.</li>
|
407 |
-
<li><a href="https://codemirror.net/mode/verilog">verilog mode</a>: Rewritten to address various issues.</li>
|
408 |
-
<li><a href="https://codemirror.net/mode/julia">julia mode</a>: Recognize Julia 0.5 syntax.</li>
|
409 |
-
<li><a href="https://codemirror.net/mode/swift">swift mode</a>: Various fixes and adjustments to current syntax.</li>
|
410 |
-
<li><a href="https://codemirror.net/mode/markdown">markdown mode</a>: Allow lists without a blank line above them.</li>
|
411 |
-
<li>The <a href="https://codemirror.net/doc/manual.html#setGutterMarker"><code>setGutterMarker</code></a>, <a href="https://codemirror.net/doc/manual.html#clearGutter"><code>clearGutter</code></a>, and <a href="https://codemirror.net/doc/manual.html#lineInfo"><code>lineInfo</code></a> methods are now available on <code>Doc</code> objects.</li>
|
412 |
-
<li>The <a href="https://codemirror.net/doc/manual.html#heightAtLine"><code>heightAtLine</code></a> method now takes an extra argument to allow finding the height at the top of the line's line widgets.</li>
|
413 |
-
<li><a href="https://codemirror.net/mode/ruby">ruby mode</a>: <code>else</code> and <code>elsif</code> are now immediately indented.</li>
|
414 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Bind Ctrl-T and Ctrl-D to in- and dedent in insert mode.</li>
|
415 |
-
</ul>
|
416 |
-
|
417 |
-
<p class="rel">20-10-2016: <a href="https://codemirror.net/codemirror-5.20.0.zip">Version 5.20.0</a>:</p>
|
418 |
-
|
419 |
-
<ul class=rel-note>
|
420 |
-
<li>Make <code>newlineAndIndent</code> command work with multiple cursors on the same line.</li>
|
421 |
-
<li>Make sure keypress events for backspace are ignored.</li>
|
422 |
-
<li>Tokens styled with overlays no longer get a nonsense <code>cm-cm-overlay</code> class.</li>
|
423 |
-
<li>Line endings for pasted content are now normalized to the editor's <a href="https://codemirror.net/doc/manual.html#option_lineSeparator">preferred ending</a>.</li>
|
424 |
-
<li><a href="https://codemirror.net/mode/javascript">javascript mode</a>: Improve support for class expressions. Support TypeScript optional class properties, the <code>abstract</code> keyword, and return type declarations for arrow functions.</li>
|
425 |
-
<li><a href="https://codemirror.net/mode/css">css mode</a>: Fix highlighting of mixed-case keywords.</li>
|
426 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Improve behavior when typing a quote before a string.</li>
|
427 |
-
<li>The core is now maintained as a number of small files, using ES6 syntax and modules, under the <code>src/</code> directory. A git checkout no longer contains a working <code>codemirror.js</code> until you <code>npm run build</code> (but when installing from NPM, it is included).</li>
|
428 |
-
<li>The <a href="https://codemirror.net/doc/manual.html#event_refresh"><code>refresh</code></a> event is now documented and stable.</li>
|
429 |
-
</ul>
|
430 |
-
|
431 |
-
<p class="rel">20-09-2016: <a href="https://codemirror.net/codemirror-5.19.0.zip">Version 5.19.0</a>:</p>
|
432 |
-
|
433 |
-
<ul class=rel-note>
|
434 |
-
<li><a href="https://codemirror.net/mode/erlang">erlang mode</a>: Fix mode crash when trying to read an empty context.</li>
|
435 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_comment">comment addon</a>: Fix broken behavior when toggling comments inside a comment.</li>
|
436 |
-
<li>xml-fold addon: Fix a null-dereference bug.</li>
|
437 |
-
<li>Page up and page down now do something even in single-line documents.</li>
|
438 |
-
<li>Fix an issue where the cursor position could be off in really long (~8000 character) tokens.</li>
|
439 |
-
<li><a href="https://codemirror.net/mode/javascript">javascript mode</a>: Better indentation when semicolons are missing. Better support for TypeScript classes, optional parameters, and the <code>type</code> keyword.</li>
|
440 |
-
<li>The <a href="https://codemirror.net/doc/manual.html#event_blur"><code>blur</code></a> and <a href="https://codemirror.net/doc/manual.html#event_focus"><code>focus</code></a> events now pass the DOM event to their handlers.</li>
|
441 |
-
</ul>
|
442 |
-
|
443 |
-
<p class="rel">23-08-2016: <a href="https://codemirror.net/codemirror-5.18.2.zip">Version 5.18.2</a>:</p>
|
444 |
-
|
445 |
-
<ul class=rel-note>
|
446 |
-
<li><a href="https://codemirror.net/mode/vue">vue mode</a>: Fix outdated references to renamed Pug mode dependency.</li>
|
447 |
-
</ul>
|
448 |
-
|
449 |
-
<p class="rel">22-08-2016: <a href="https://codemirror.net/codemirror-5.18.0.zip">Version 5.18.0</a>:</p>
|
450 |
-
|
451 |
-
<ul class=rel-note>
|
452 |
-
<li>Make sure <a href="https://codemirror.net/doc/manual.html#addLineClass">gutter backgrounds</a> stick to the rest of the gutter during horizontal scrolling.</li>
|
453 |
-
<li>The contenteditable <a href="https://codemirror.net/doc/manual.html#option_inputStyle"><code>inputStyle</code></a> now properly supports pasting on pre-Edge IE versions.</li>
|
454 |
-
<li><a href="https://codemirror.net/mode/javascript">javascript mode</a>: Fix some small parsing bugs and improve TypeScript support.</li>
|
455 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Fix bug where active highlighting was left in editor when the addon was disabled.</li>
|
456 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_match-highlighter">match-highlighter addon</a>: Only start highlighting things when the editor gains focus.</li>
|
457 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_javascript-hint">javascript-hint addon</a>: Also complete non-enumerable properties.</li>
|
458 |
-
<li>The <a href="https://codemirror.net/doc/manual.html#addOverlay"><code>addOverlay</code></a> method now supports a <code>priority</code> option to control the order in which overlays are applied.</li>
|
459 |
-
<li>MIME types that end in <code>+json</code> now default to the JSON mode when the MIME itself is not defined.</li>
|
460 |
-
<li>The mode formerly known as Jade was renamed to <a href="https://codemirror.net/mode/pug">Pug</a>.</li>
|
461 |
-
<li>The <a href="https://codemirror.net/mode/python">Python mode</a> now defaults to Python 3 (rather than 2) syntax.</li>
|
462 |
-
</ul>
|
463 |
-
|
464 |
-
<p class="rel">19-07-2016: <a href="https://codemirror.net/codemirror-5.17.0.zip">Version 5.17.0</a>:</p>
|
465 |
-
|
466 |
-
<ul class="rel-note">
|
467 |
-
<li>Fix problem with wrapped trailing whitespace displaying incorrectly.</li>
|
468 |
-
<li>Prevent IME dialog from overlapping typed content in Chrome.</li>
|
469 |
-
<li>Improve measuring of characters near a line wrap.</li>
|
470 |
-
<li><a href="https://codemirror.net/mode/javascript">javascript mode</a>: Improve support for <code>async</code>, allow trailing commas in <code>import</code> lists.</li>
|
471 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Fix backspace in replace mode.</li>
|
472 |
-
<li><a href="https://codemirror.net/demo/sublime.html">sublime bindings</a>: Fix some key bindings on OS X to match Sublime Text.</li>
|
473 |
-
<li><a href="https://codemirror.net/mode/markdown">markdown mode</a>: Add more classes to image links in highlight-formatting mode.</li>
|
474 |
-
</ul>
|
475 |
-
|
476 |
-
<p class="rel">20-06-2016: <a href="https://codemirror.net/codemirror-5.16.0.zip">Version 5.16.0</a>:</p>
|
477 |
-
|
478 |
-
<ul class="rel-note">
|
479 |
-
<li>Fix glitches when dragging content caused by the drop indicator receiving mouse events.</li>
|
480 |
-
<li>Make Control-drag work on Firefox.</li>
|
481 |
-
<li>Make clicking or selection-dragging at the end of a wrapped line select the right position.</li>
|
482 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_show-hint">show-hint addon</a>: Prevent widget scrollbar from hiding part of the hint text.</li>
|
483 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_rulers">rulers addon</a>: Prevent rulers from forcing a horizontal editor scrollbar.</li>
|
484 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_search">search addon</a>: Automatically bind search-related keys in persistent dialog.</li>
|
485 |
-
<li><a href="https://codemirror.net/demo/sublime.html">sublime keymap</a>: Add a multi-cursor aware smart backspace binding.</li>
|
486 |
-
</ul>
|
487 |
-
|
488 |
-
<p class="rel">20-05-2016: <a href="https://codemirror.net/codemirror-5.15.2.zip">Version 5.15.2</a>:</p>
|
489 |
-
|
490 |
-
<ul class="rel-note">
|
491 |
-
<li>Fix a critical document corruption bug that occurs when a document is gradually grown.</li>
|
492 |
-
</ul>
|
493 |
-
|
494 |
-
<p class="rel">20-05-2016: <a href="https://codemirror.net/codemirror-5.15.0.zip">Version 5.15.0</a>:</p>
|
495 |
-
|
496 |
-
<ul class="rel-note">
|
497 |
-
<li>Fix bug that caused the selection to reset when focusing the editor in contentEditable input mode.</li>
|
498 |
-
<li>Fix issue where not all ASCII control characters were being replaced by placeholders.</li>
|
499 |
-
<li>Remove the assumption that all modes have a <code>startState</code> method from several wrapping modes.</li>
|
500 |
-
<li>Fix issue where the editor would complain about overlapping collapsed ranges when there weren't any.</li>
|
501 |
-
<li>Optimize document tree building when loading or pasting huge chunks of content.</li>
|
502 |
-
<li>Explicitly bind Ctrl-O on OS X to make that binding (“open line”) act as expected.</li>
|
503 |
-
<li>Pasting <a href="https://codemirror.net/doc/manual.html#option_lineWiseCopyCut">linewise-copied</a> content when there is no selection now inserts the lines above the current line.</li>
|
504 |
-
<li><a href="https://codemirror.net/mode/markdown/">markdown mode</a>: Fix several issues in matching link targets.</li>
|
505 |
-
<li><a href="https://codemirror.net/mode/clike/">clike mode</a>: Improve indentation of C++ template declarations.</li>
|
506 |
-
<li><a href="https://codemirror.net/mode/javascript/">javascript mode</a>: Support <code>async</code>/<code>await</code> and improve support for TypeScript type syntax.</li>
|
507 |
-
</ul>
|
508 |
-
|
509 |
-
<p class="rel">20-04-2016: <a href="https://codemirror.net/codemirror-5.14.0.zip">Version 5.14.0</a>:</p>
|
510 |
-
|
511 |
-
<ul class="rel-note">
|
512 |
-
<li><a href="https://codemirror.net/doc/manual.html#posFromIndex"><code>posFromIndex</code></a> and <a href="https://codemirror.net/doc/manual.html#indexFromPos"><code>indexFromPos</code></a> now take <a href="https://codemirror.net/doc/manual.html#option_lineSeparator"><code>lineSeparator</code></a> into account</li>
|
513 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Only call <code>.save()</code> when it is actually available</li>
|
514 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_comment">comment addon</a>: Be careful not to mangle multi-line strings</li>
|
515 |
-
<li><a href="https://codemirror.net/mode/python/index.html">Python mode</a>: Improve distinguishing of decorators from <code>@</code> operators</li>
|
516 |
-
<li><a href="https://codemirror.net/doc/manual.html#findMarks"><code>findMarks</code></a>: No longer return marks that touch but don't overlap given range</li>
|
517 |
-
<li><a href="https://codemirror.net/demo/vim.html">vim bindings</a>: Add yank command</li>
|
518 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_match-highlighter">match-highlighter addon</a>: Add <code>trim</code> option to disable ignoring of whitespace</li>
|
519 |
-
<li><a href="https://codemirror.net/mode/powershell/index.html">PowerShell mode</a>: Added</li>
|
520 |
-
<li><a href="https://codemirror.net/mode/yacas/index.html">Yacas mode</a>: Added</li>
|
521 |
-
<li><a href="https://codemirror.net/mode/webidl/index.html">Web IDL mode</a>: Added</li>
|
522 |
-
<li><a href="https://codemirror.net/mode/sas/index.html">SAS mode</a>: Added</li>
|
523 |
-
<li><a href="https://codemirror.net/mode/mbox/index.html">mbox mode</a>: Added</li>
|
524 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.13.4...5.14.0">list of patches</a></li>
|
525 |
-
</ul>
|
526 |
-
|
527 |
-
<p class="rel">21-03-2016: <a href="https://codemirror.net/codemirror-5.13.2.zip">Version 5.13.2</a>:</p>
|
528 |
-
|
529 |
-
<ul class="rel-note">
|
530 |
-
<li>Solves a problem where the gutter would sometimes not extend all the way to the end of the document.</li>
|
531 |
-
</ul>
|
532 |
-
|
533 |
-
<p class="rel">21-03-2016: <a href="https://codemirror.net/codemirror-5.13.zip">Version 5.13</a>:</p>
|
534 |
-
|
535 |
-
<ul class="rel-note">
|
536 |
-
<li>New DOM event forwarded: <a href="https://codemirror.net/doc/manual.html#event_dom"><code>"dragleave"</code></a>.</li>
|
537 |
-
<li><a href="https://codemirror.net/mode/protobuf/index.html">protobuf mode</a>: Newly added.</li>
|
538 |
-
<li>Fix problem where <a href="https://codemirror.net/doc/manual.html#findMarks"><code>findMarks</code></a> sometimes failed to find multi-line marks.</li>
|
539 |
-
<li>Fix crash that showed up when atomic ranges and bidi text were combined.</li>
|
540 |
-
<li><a href="https://codemirror.net/demo/complete.html">show-hint addon</a>: Completion widgets no longer close when the line indented or dedented.</li>
|
541 |
-
<li><a href="https://codemirror.net/demo/merge.html">merge addon</a>: Fix bug when merging chunks at the end of the file.</li>
|
542 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_placeholder">placeholder addon</a>: No longer gets confused by <a href="https://codemirror.net/doc/manual.html#swapDoc"><code>swapDoc</code></a>.</li>
|
543 |
-
<li><a href="https://codemirror.net/doc/manual.html#addon_simplescrollbars">simplescrollbars addon</a>: Fix invalid state when deleting at end of document.</li>
|
544 |
-
<li><a href="https://codemirror.net/mode/clike/index.html">clike mode</a>: No longer gets confused when a comment starts after an operator.</li>
|
545 |
-
<li><a href="https://codemirror.net/mode/markdown/index.html">markdown mode</a>: Now supports CommonMark-style flexible list indentation.</li>
|
546 |
-
<li><a href="https://codemirror.net/mode/dylan/index.html">dylan mode</a>: Several improvements and fixes.</li>
|
547 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.12.0...5.13.0">list of patches</a></li>
|
548 |
-
</ul>
|
549 |
-
|
550 |
-
<p class="rel">19-02-2016: <a href="https://codemirror.net/codemirror-5.12.zip">Version 5.12</a>:</p>
|
551 |
-
|
552 |
-
<ul class="rel-note">
|
553 |
-
<li><a href="https://codemirror.net/demo/vim.html">Vim bindings</a>: Ctrl-Q is now an alias for Ctrl-V.</li>
|
554 |
-
<li><a href="https://codemirror.net/demo/vim.html">Vim bindings</a>: The Vim API now exposes an <code>unmap</code> method to unmap bindings.</li>
|
555 |
-
<li><a href="https://codemirror.net/demo/activeline.html">active-line addon</a>: This addon can now style the active line's gutter.</li>
|
556 |
-
<li><a href="https://codemirror.net/mode/fcl/">FCL mode</a>: Newly added.</li>
|
557 |
-
<li><a href="https://codemirror.net/mode/sql/">SQL mode</a>: Now has a Postgresql dialect.</li>
|
558 |
-
<li>Fix <a href="https://github.com/codemirror/CodeMirror/issues/3781">issue</a> where trying to scroll to a horizontal position outside of the document's width could cause the gutter to be positioned incorrectly.</li>
|
559 |
-
<li>Use absolute, rather than fixed positioning in the context-menu intercept hack, to work around a <a href="https://github.com/codemirror/CodeMirror/issues/3238">problem</a> when the editor is inside a transformed parent container.</li>
|
560 |
-
<li>Solve a <a href="https://github.com/codemirror/CodeMirror/issues/3821">problem</a> where the horizontal scrollbar could hide text in Firefox.</li>
|
561 |
-
<li>Fix a <a href="https://github.com/codemirror/CodeMirror/issues/3834">bug</a> that caused phantom scroll space under the text in some situations.</li>
|
562 |
-
<li><a href="https://codemirror.net/demo/sublime.html">Sublime Text bindings</a>: Bind delete-line to Shift-Ctrl-K on OS X.</li>
|
563 |
-
<li><a href="https://codemirror.net/mode/markdown/">Markdown mode</a>: Fix <a href="https://github.com/codemirror/CodeMirror/issues/3787">issue</a> where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.</li>
|
564 |
-
<li><a href="https://codemirror.net/mode/markdown/">Markdown mode</a>: Ignore backslashes in code fragments.</li>
|
565 |
-
<li><a href="https://codemirror.net/mode/markdown/">Markdown mode</a>: Use whichever mode is registered as <code>text/html</code> to parse HTML.</li>
|
566 |
-
<li><a href="https://codemirror.net/mode/clike/">Clike mode</a>: Improve indentation of Scala <code>=></code> functions.</li>
|
567 |
-
<li><a href="https://codemirror.net/mode/python/">Python mode</a>: Improve indentation of bracketed code.</li>
|
568 |
-
<li><a href="https://codemirror.net/mode/htmlmixed/">HTMLMixed mode</a>: Support multi-line opening tags for sub-languages (<code><script></code>, <code><style></code>, etc).</li>
|
569 |
-
<li><a href="https://codemirror.net/mode/spreadsheet/">Spreadsheet mode</a>: Fix bug where the mode did not advance the stream when finding a backslash.</li>
|
570 |
-
<li><a href="https://codemirror.net/mode/xml/">XML mode</a>: The mode now takes a <code>matchClosing</code> option to configure whether mismatched closing tags should be highlighted as errors.</li>
|
571 |
-
</ul>
|
572 |
-
|
573 |
-
<p class="rel">20-01-2016: <a href="https://codemirror.net/codemirror-5.11.zip">Version 5.11</a>:</p>
|
574 |
-
|
575 |
-
<ul class="rel-note">
|
576 |
-
<li>New modes: <a href="../mode/jsx/index.html">JSX</a>, <a href="../mode/haskell-literate/index.html">literate Haskell</a></li>
|
577 |
-
<li>The editor now forwards more <a href="manual.html#event_dom">DOM events</a>: <code>cut</code>, <code>copy</code>, <code>paste</code>, and <code>touchstart</code>. It will also forward <code>mousedown</code> for drag events</li>
|
578 |
-
<li>Fixes a bug where bookmarks next to collapsed spans were not rendered</li>
|
579 |
-
<li>The <a href="../mode/swift/index.html">Swift</a> mode now supports auto-indentation</li>
|
580 |
-
<li>Frontmatters in the <a href="../mode/yaml-frontmatter/index.html">YAML frontmatter</a> mode are now optional as intended</li>
|
581 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.10.0...5.11.0">list of patches</a></li>
|
582 |
-
</ul>
|
583 |
-
|
584 |
-
<p class="rel">21-12-2015: <a href="https://codemirror.net/codemirror-5.10.zip">Version 5.10</a>:</p>
|
585 |
-
|
586 |
-
<ul class="rel-note">
|
587 |
-
<li>Modify the way <a href="manual.html#mark_atomic">atomic ranges</a> are skipped by selection to try and make it less surprising.</li>
|
588 |
-
<li>The <a href="../mode/swift/index.html">Swift mode</a> was rewritten.</li>
|
589 |
-
<li>New addon: <a href="manual.html#addon_jump-to-line">jump-to-line</a>.</li>
|
590 |
-
<li>New method: <a href="manual.html#isReadOnly"><code>isReadOnly</code></a>.</li>
|
591 |
-
<li>The <a href="manual.html#addon_show-hint">show-hint addon</a> now defaults to picking completions on single click.</li>
|
592 |
-
<li>The object passed to <a href="manual.html#event_beforeSelectionChange"><code>"beforeSelectionChange"</code></a> events now has an <code>origin</code> property.</li>
|
593 |
-
<li>New mode: <a href="../mode/crystal/index.html">Crystal</a>.</li>
|
594 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.9.0...5.10.0">list of patches</a></li>
|
595 |
-
</ul>
|
596 |
-
|
597 |
-
<p class="rel">23-11-2015: <a href="https://codemirror.net/codemirror-5.9.zip">Version 5.9</a>:</p>
|
598 |
-
|
599 |
-
<ul class="rel-note">
|
600 |
-
<li>Improve the way overlay (OS X-style) scrollbars are handled</li>
|
601 |
-
<li>Make <a href="manual.html#addon_annotatescrollbar">annotatescrollbar</a> and scrollpastend addons work properly together</li>
|
602 |
-
<li>Make <a href="manual.html#addon_show-hint">show-hint</a> addon select options on single click by default, move selection to hovered item</li>
|
603 |
-
<li>Properly fold comments that include block-comment-start markers</li>
|
604 |
-
<li>Many small language mode fixes</li>
|
605 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.8.0...5.9.0">list of patches</a></li>
|
606 |
-
</ul>
|
607 |
-
|
608 |
-
<p class="rel">20-10-2015: <a href="https://codemirror.net/codemirror-5.8.zip">Version 5.8</a>:</p>
|
609 |
-
|
610 |
-
<ul class="rel-note">
|
611 |
-
<li>Fixes an infinite loop in
|
612 |
-
the <a href="manual.html#addon_hardwrap">hardwrap
|
613 |
-
addon</a></li>
|
614 |
-
<li>New modes: <a href="../mode/nsis/index.html">NSIS</a>, <a href="../mode/clike/index.html">Ceylon</a></li>
|
615 |
-
<li>The Kotlin mode is now a <a href="../mode/clike/index.html">clike</a> dialect, rather than a stand-alone mode</li>
|
616 |
-
<li>New option: <a href="manual.html#option_allowDropFileTypes"><code>allowDropFileTypes</code></a>. Binary files can no longer be dropped into CodeMirror</li>
|
617 |
-
<li>New themes: <a href="../demo/theme.html#bespin">bespin</a>, <a href="../demo/theme.html#hopscotch">hopscotch</a>, <a href="../demo/theme.html#isotope">isotope</a>, <a href="../demo/theme.html#railscasts">railscasts</a></li>
|
618 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.7.0...5.8.0">list of patches</a></li>
|
619 |
-
</ul>
|
620 |
-
|
621 |
-
<p class="rel">20-09-2015: <a href="https://codemirror.net/codemirror-5.7.zip">Version 5.7</a>:</p>
|
622 |
-
|
623 |
-
<ul class="rel-note">
|
624 |
-
<li>New modes: <a href="../mode/vue/index.html">Vue</a>, <a href="../mode/oz/index.html">Oz</a>, <a href="../mode/mscgen/index.html">MscGen</a> (and dialects), <a href="../mode/css/gss.html">Closure Stylesheets</a></li>
|
625 |
-
<li>Implement <a href="http://commonmark.org">CommonMark</a>-style flexible list indent and cross-line code spans in <a href="../mode/markdown/index.html">Markdown</a> mode</li>
|
626 |
-
<li>Add a replace-all button to the <a href="manual.html#addon_search">search addon</a>, and make the persistent search dialog transparent when it obscures the match</li>
|
627 |
-
<li>Handle <code>acync</code>/<code>await</code> and ocal and binary numbers in <a href="../mode/javascript/index.html">JavaScript mode</a></li>
|
628 |
-
<li>Fix various issues with the <a href="../mode/haxe/index.html">Haxe mode</a></li>
|
629 |
-
<li>Make the <a href="manual.html#addon_closebrackets">closebrackets addon</a> select only the wrapped text when wrapping selection in brackets</li>
|
630 |
-
<li>Tokenize properties as properties in the <a href="../mode/coffeescript/index.html">CoffeeScript mode</a></li>
|
631 |
-
<li>The <a href="manual.html#addon_placeholder">placeholder addon</a> now accepts a DOM node as well as a string placeholder</li>
|
632 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.6.0...5.7.0">list of patches</a></li>
|
633 |
-
</ul>
|
634 |
-
|
635 |
-
<p class="rel">20-08-2015: <a href="https://codemirror.net/codemirror-5.6.zip">Version 5.6</a>:</p>
|
636 |
-
|
637 |
-
<ul class="rel-note">
|
638 |
-
<li>Fix bug where you could paste into a <code>readOnly</code> editor</li>
|
639 |
-
<li>Show a cursor at the drop location when dragging over the editor</li>
|
640 |
-
<li>The <a href="../mode/rust/index.html">Rust mode</a> was rewritten to handle modern Rust</li>
|
641 |
-
<li>The editor and theme CSS was cleaned up. Some selectors are now less specific than before</li>
|
642 |
-
<li>New theme: <a href="../demo/theme.html#abcdef">abcdef</a></li>
|
643 |
-
<li>Lines longer than <a href="manual.html#option_maxHighlightLength"><code>maxHighlightLength</code></a> are now less likely to mess up indentation</li>
|
644 |
-
<li>New addons: <a href="manual.html#addon_autorefresh"><code>autorefresh</code></a> for refreshing an editor the first time it becomes visible, and <code>html-lint</code> for using <a href="http://htmlhint.com/">HTMLHint</a></li>
|
645 |
-
<li>The <a href="manual.html#addon_search"><code>search</code></a> addon now recognizes <code>\r</code> and <code>\n</code> in pattern and replacement input</li>
|
646 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.5.0...5.6.0">list of patches</a></li>
|
647 |
-
</ul>
|
648 |
-
|
649 |
-
<p class="rel">20-07-2015: <a href="https://codemirror.net/codemirror-5.5.zip">Version 5.5</a>:</p>
|
650 |
-
|
651 |
-
<ul class="rel-note">
|
652 |
-
<li>New option: <a href="manual.html#option_lineSeparator"><code>lineSeparator</code></a> (with corresponding <a href="manual.html#lineSeparator">method</a>)
|
653 |
-
<li>New themes: <a href="../demo/theme.html#dracula">dracula</a>, <a href="../demo/theme.html#seti">seti</a>, <a href="../demo/theme.html#yeti">yeti</a>, <a href="../demo/theme.html#material">material</a>, and <a href="../demo/theme.html#icecoder">icecoder</a></li>
|
654 |
-
<li>New modes: <a href="../mode/brainfuck/index.html">Brainfuck</a>, <a href="../mode/vhdl/index.html">VHDL</a>, Squirrel (<a href="../mode/clike/index.html">clike</a> dialect)</li>
|
655 |
-
<li>Define a <code>findPersistent</code> command in
|
656 |
-
the <a href="../demo/search.html">search</a> addon, for a dialog
|
657 |
-
that stays open as you cycle through matches</li>
|
658 |
-
<li>From this release on, the NPM module doesn't include documentation and demos</li>
|
659 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.4.0...5.5.0">list of patches</a></li>
|
660 |
-
</ul>
|
661 |
-
|
662 |
-
<p class="rel">25-06-2015: <a href="https://codemirror.net/codemirror-5.4.zip">Version 5.4</a>:</p>
|
663 |
-
|
664 |
-
<ul class="rel-note">
|
665 |
-
<li>New modes: <a href="../mode/twig/index.html">Twig</a>, <a href="../mode/elm/index.html">Elm</a>, <a href="../mode/factor/index.html">Factor</a>, <a href="../mode/swift/index.html">Swift</a></li>
|
666 |
-
<li>Prefer clipboard API (if available) when pasting</li>
|
667 |
-
<li>Refined definition highlighting in <a href="../mode/clike/index.html">clike</a> mode</li>
|
668 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.3.0...5.4.0">list of patches</a></li>
|
669 |
-
</ul>
|
670 |
-
|
671 |
-
<p class="rel">20-05-2015: <a href="https://codemirror.net/codemirror-5.3.zip">Version 5.3</a>:</p>
|
672 |
-
|
673 |
-
<ul class="rel-note">
|
674 |
-
<li>Fix several regressions in the <a href="manual.html#addon_show-hint"><code>show-hint</code></a> addon (<code>completeSingle</code> option, <code>"shown"</code> and <code>"close"</code> events)</li>
|
675 |
-
<li>The <a href="../demo/vim.html">vim mode</a> API was <a href="manual.html#vimapi">documented</a></li>
|
676 |
-
<li>New modes: <a href="../mode/asn.1/index.html">ASN.1</a>, <a href="../mode/ttcn/index.html">TTCN</a>, and <a href="../mode/ttcn-cfg/index.html">TTCN-CFG</a></li>
|
677 |
-
<li>The <a href="../mode/clike/index.html">clike</a> mode can now deep-indent <code>switch</code> statements, and roughly recognizes types and defined identifiers</li>
|
678 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.2.0...5.3.0">list of patches</a></li>
|
679 |
-
</ul>
|
680 |
-
|
681 |
-
<p class="rel">20-04-2015: <a href="https://codemirror.net/codemirror-5.2.zip">Version 5.2</a>:</p>
|
682 |
-
|
683 |
-
<ul class="rel-note">
|
684 |
-
<li>Fix several race conditions
|
685 |
-
in <a href="manual.html#addon_show-hint"><code>show-hint</code></a>'s
|
686 |
-
asynchronous mode</li>
|
687 |
-
<li>Fix backspace binding in <a href="../demo/sublime.html">Sublime bindings</a></li>
|
688 |
-
<li>Change the way IME is handled in the <code>"textarea"</code> <a href="manual.html#option_inputStyle">input style</a></li>
|
689 |
-
|
690 |
-
<li>New modes: <a href="../mode/mumps/index.html">MUMPS</a>, <a href="../mode/handlebars/index.html">Handlebars</a></li>
|
691 |
-
<li>Rewritten modes: <a href="../mode/django/index.html">Django</a>, <a href="../mode/z80/index.html">Z80</a></li>
|
692 |
-
<li>New theme: <a href="../demo/theme.html#liquibyte">Liquibyte</a></li>
|
693 |
-
<li>New option: <a href="manual.html#option_lineWiseCopyCut"><code>lineWiseCopyCut</code></a></li>
|
694 |
-
<li>The <a href="../demo/vim.html">Vim mode</a> now supports buffer-local options and the <code>filetype</code> setting</li>
|
695 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.1.0...5.2.0">list of patches</a></li>
|
696 |
-
</ul>
|
697 |
-
|
698 |
-
<p class="rel">23-03-2015: <a href="https://codemirror.net/codemirror-5.1.zip">Version 5.1</a>:</p>
|
699 |
-
|
700 |
-
<ul class="rel-note">
|
701 |
-
<li>New modes: <a href="../mode/asciiarmor/index.html">ASCII armor</a> (PGP data), <a href="../mode/troff/index.html">Troff</a>, and <a href="../mode/cmake/index.html">CMake</a>.</li>
|
702 |
-
<li>Remove SmartyMixed mode, rewrite <a href="../mode/smarty/index.html">Smarty</a> mode to supersede it.</li>
|
703 |
-
<li>New commands in the <a href="manual.html#addon_merge">merge
|
704 |
-
addon</a>: <code>goNextDiff</code> and <code>goPrevDiff</code>.</li>
|
705 |
-
<li>The <a href="manual.html#addon_closebrackets">closebrackets addon</a> can now be configured per mode.</li>
|
706 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.0.0...5.1.0">list of patches</a>.</li>
|
707 |
-
</ul>
|
708 |
-
|
709 |
-
<p class="rel">20-02-2015: <a href="https://codemirror.net/codemirror-5.0.zip">Version 5.0</a>:</p>
|
710 |
-
|
711 |
-
<ul class="rel-note">
|
712 |
-
<li>Experimental mobile support (tested on iOS, Android Chrome, stock Android browser)</li>
|
713 |
-
<li>New option <a href="manual.html#option_inputStyle"><code>inputStyle</code></a> to switch between hidden textarea and contenteditable input.</li>
|
714 |
-
<li>The <a href="manual.html#getInputField"><code>getInputField</code></a>
|
715 |
-
method is no longer guaranteed to return a textarea.</li>
|
716 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.13.0...5.0.0">list of patches</a>.</li>
|
717 |
-
</ul>
|
718 |
-
|
719 |
-
</section>
|
720 |
-
|
721 |
-
<section id=v4 class=first>
|
722 |
-
|
723 |
-
<h2>Version 4.x</h2>
|
724 |
-
|
725 |
-
<p class="rel">20-02-2015: <a href="https://codemirror.net/codemirror-4.13.zip">Version 4.13</a>:</p>
|
726 |
-
|
727 |
-
<ul class="rel-note">
|
728 |
-
<li>Fix the way the <a href="../demo/closetag.html"><code>closetag</code></a> demo handles the slash character.</li>
|
729 |
-
<li>New modes: <a href="../mode/forth/index.html">Forth</a>, <a href="../mode/stylus/index.html">Stylus</a>.</li>
|
730 |
-
<li>Make the <a href="../mode/css/index.html">CSS mode</a> understand some modern CSS extensions.</li>
|
731 |
-
<li>Have the <a href="../mode/clike/index.html">Scala mode</a> handle symbols and triple-quoted strings.</li>
|
732 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.12.0...4.13.0">list of patches</a>.</li>
|
733 |
-
</ul>
|
734 |
-
|
735 |
-
<p class="rel">22-01-2015: <a href="https://codemirror.net/codemirror-4.12.zip">Version 4.12</a>:</p>
|
736 |
-
|
737 |
-
<ul class="rel-note">
|
738 |
-
<li>The <a href="manual.html#addon_closetag"><code>closetag</code></a>
|
739 |
-
addon now defines a <code>"closeTag"</code> command.</li>
|
740 |
-
<li>Adds a <code>findModeByFileName</code> to the <a href="manual.html#addon_meta">mode metadata</a>
|
741 |
-
addon.</li>
|
742 |
-
<li><a href="../demo/simplemode.html">Simple mode</a> rules can
|
743 |
-
now contain a <code>sol</code> property to only match at the start
|
744 |
-
of a line.</li>
|
745 |
-
<li>New
|
746 |
-
addon: <a href="manual.html#addon_selection-pointer"><code>selection-pointer</code></a>
|
747 |
-
to style the mouse cursor over the selection.</li>
|
748 |
-
<li>Improvements to the <a href="../mode/sass/index.html">Sass mode</a>'s indentation.</li>
|
749 |
-
<li>The <a href="../demo/vim.html">Vim keymap</a>'s search functionality now
|
750 |
-
supports <a href="manual.html#addon_matchesonscrollbar">scrollbar
|
751 |
-
annotation</a>.</li>
|
752 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.11.0...4.12.0">list of patches</a>.</li>
|
753 |
-
</ul>
|
754 |
-
|
755 |
-
<p class="rel">9-01-2015: <a href="https://codemirror.net/codemirror-4.11.zip">Version 4.11</a>:</p>
|
756 |
-
|
757 |
-
<p class="rel-note">Unfortunately, 4.10 did not take care of the
|
758 |
-
Firefox scrolling issue entirely. This release adds two more patches
|
759 |
-
to address that.</p>
|
760 |
-
|
761 |
-
<p class="rel">29-12-2014: <a href="https://codemirror.net/codemirror-4.10.zip">Version 4.10</a>:</p>
|
762 |
-
|
763 |
-
<p class="rel-note">Emergency single-patch update to 4.9. Fixes
|
764 |
-
Firefox-specific problem where the cursor could end up behind the
|
765 |
-
horizontal scrollbar.</p>
|
766 |
-
|
767 |
-
<p class="rel">23-12-2014: <a href="https://codemirror.net/codemirror-4.9.zip">Version 4.9</a>:</p>
|
768 |
-
|
769 |
-
<ul class="rel-note">
|
770 |
-
<li>Overhauled scroll bar handling.
|
771 |
-
Add pluggable <a href="../demo/simplescrollbars.html">scrollbar
|
772 |
-
implementations</a>.</li>
|
773 |
-
<li>Tweaked behavior for
|
774 |
-
the <a href="manual.html#addon_show-hint">completion addons</a> to
|
775 |
-
not take text after cursor into account.</li>
|
776 |
-
<li>Two new optional features in
|
777 |
-
the <a href="manual.html#addon_merge">merge addon</a>: aligning
|
778 |
-
editors, and folding unchanged text.</li>
|
779 |
-
<li>New
|
780 |
-
modes: <a href="../mode/dart/index.html">Dart</a>, <a href="../mode/ebnf/index.html">EBNF</a>, <a href="../mode/spreadsheet/index.html">spreadsheet</a>,
|
781 |
-
and <a href="../mode/soy/index.html">Soy</a>.</li>
|
782 |
-
<li>New <a href="../demo/panel.html">addon</a> to show persistent panels below/above an editor.</li>
|
783 |
-
<li>New themes: <a href="../demo/theme.html#zenburn">zenburn</a>
|
784 |
-
and <a href="../demo/theme.html#tomorrow-night-bright">tomorrow night
|
785 |
-
bright</a>.</li>
|
786 |
-
<li>Allow ctrl-click to clear existing cursors.</li>
|
787 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.8.0...4.9.0">list of patches</a>.</li>
|
788 |
-
</ul>
|
789 |
-
|
790 |
-
<p class="rel">22-11-2014: <a href="https://codemirror.net/codemirror-4.8.zip">Version 4.8</a>:</p>
|
791 |
-
|
792 |
-
<ul class="rel-note">
|
793 |
-
<li>Built-in support for <a href="manual.html#normalizeKeyMap">multi-stroke key bindings</a>.</li>
|
794 |
-
<li>New method: <a href="manual.html#getLineTokens"><code>getLineTokens</code></a>.</li>
|
795 |
-
<li>New modes: <a href="../mode/dockerfile/index.html">dockerfile</a>, <a href="../mode/idl/index.html">IDL</a>, <a href="../mode/clike/index.html">Objective C</a> (crude).</li>
|
796 |
-
<li>Support styling of gutter backgrounds, allow <code>"gutter"</code> styles in <a href="manual.html#addLineClass"><code>addLineClass</code></a>.</li>
|
797 |
-
<li>Many improvements to the <a href="../demo/vim.html">Vim mode</a>, rewritten visual mode.</li>
|
798 |
-
<li>Improvements to modes: <a href="../mode/gfm/index.html">gfm</a> (strikethrough), <a href="../mode/sparql/index.html">SPARQL</a> (version 1.1 support), and <a href="../mode/stex/index.html">sTeX</a> (no more runaway math mode).
|
799 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.7.0...4.8.0">list of patches</a>.</li>
|
800 |
-
</ul>
|
801 |
-
|
802 |
-
<p class="rel">20-10-2014: <a href="https://codemirror.net/codemirror-4.7.zip">Version 4.7</a>:</p>
|
803 |
-
|
804 |
-
<ul class="rel-note">
|
805 |
-
<li><strong>Incompatible</strong>:
|
806 |
-
The <a href="../demo/lint.html">lint addon</a> now passes the
|
807 |
-
editor's value as first argument to asynchronous lint functions,
|
808 |
-
for consistency. The editor is still passed, as fourth
|
809 |
-
argument.</li>
|
810 |
-
<li>Improved handling of unicode identifiers in modes for
|
811 |
-
languages that support them.</li>
|
812 |
-
<li>More mode
|
813 |
-
improvements: <a href="../mode/coffeescript/index.html">CoffeeScript</a>
|
814 |
-
(indentation), <a href="../mode/verilog/index.html">Verilog</a>
|
815 |
-
(indentation), <a href="../mode/clike/index.html">Scala</a>
|
816 |
-
(indentation, triple-quoted strings),
|
817 |
-
and <a href="../mode/php/index.html">PHP</a> (interpolated
|
818 |
-
variables in heredoc strings).</li>
|
819 |
-
<li>New modes: <a href="../mode/textile/index.html">Textile</a> and <a href="../mode/tornado/index.html">Tornado templates</a>.</li>
|
820 |
-
<li>Experimental new <a href="../demo/simplemode.html">way to define modes</a>.</li>
|
821 |
-
<li>Improvements to the <a href="../demo/vim.html">Vim
|
822 |
-
bindings</a>: Arbitrary insert mode key mappings are now possible,
|
823 |
-
and text objects are supported in visual mode.</li>
|
824 |
-
<li>The mode <a href="../mode/meta.js">meta-information file</a>
|
825 |
-
now includes information about file extensions,
|
826 |
-
and <a href="manual.html#addon_meta">helper
|
827 |
-
functions</a> <code>findModeByMIME</code>
|
828 |
-
and <code>findModeByExtension</code>.</li>
|
829 |
-
<li>New logo!</li>
|
830 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.6.0...4.7.0">list of patches</a>.</li>
|
831 |
-
</ul>
|
832 |
-
|
833 |
-
<p class="rel">19-09-2014: <a href="https://codemirror.net/codemirror-4.6.zip">Version 4.6</a>:</p>
|
834 |
-
|
835 |
-
<ul class="rel-note">
|
836 |
-
<li>New mode: <a href="../mode/modelica/index.html">Modelica</a></li>
|
837 |
-
<li>New method: <a href="manual.html#findWordAt"><code>findWordAt</code></a></li>
|
838 |
-
<li>Make it easier to <a href="../demo/markselection.html">use text background styling</a></li>
|
839 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.5.0...4.6.0">list of patches</a>.</li>
|
840 |
-
</ul>
|
841 |
-
|
842 |
-
<p class="rel">21-08-2014: <a href="https://codemirror.net/codemirror-4.5.zip">Version 4.5</a>:</p>
|
843 |
-
|
844 |
-
<ul class="rel-note">
|
845 |
-
<li>Fix several serious bugs with horizontal scrolling</li>
|
846 |
-
<li>New mode: <a href="../mode/slim/index.html">Slim</a></li>
|
847 |
-
<li>New command: <a href="manual.html#command_goLineLeftSmart"><code>goLineLeftSmart</code></a></li>
|
848 |
-
<li>More fixes and extensions for the <a href="../demo/vim.html">Vim</a> visual block mode</li>
|
849 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.4.0...4.5.0">list of patches</a>.</li>
|
850 |
-
</ul>
|
851 |
-
|
852 |
-
<p class="rel">21-07-2014: <a href="https://codemirror.net/codemirror-4.4.zip">Version 4.4</a>:</p>
|
853 |
-
|
854 |
-
<ul class="rel-note">
|
855 |
-
<li><strong>Note:</strong> Some events might now fire in slightly
|
856 |
-
different order (<code>"change"</code> is still guaranteed to fire
|
857 |
-
before <code>"cursorActivity"</code>)</li>
|
858 |
-
<li>Nested operations in multiple editors are now synced (complete
|
859 |
-
at same time, reducing DOM reflows)</li>
|
860 |
-
<li>Visual block mode for <a href="../demo/vim.html">vim</a> (<C-v>) is nearly complete</li>
|
861 |
-
<li>New mode: <a href="../mode/kotlin/index.html">Kotlin</a></li>
|
862 |
-
<li>Better multi-selection paste for text copied from multiple CodeMirror selections</li>
|
863 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.3.0...4.4.0">list of patches</a>.</li>
|
864 |
-
</ul>
|
865 |
-
|
866 |
-
<p class="rel">23-06-2014: <a href="https://codemirror.net/codemirror-4.3.zip">Version 4.3</a>:</p>
|
867 |
-
|
868 |
-
<ul class="rel-note">
|
869 |
-
<li>Several <a href="../demo/vim.html">vim bindings</a>
|
870 |
-
improvements: search and exCommand history, global flag
|
871 |
-
for <code>:substitute</code>, <code>:global</code> command.
|
872 |
-
<li>Allow hiding the cursor by
|
873 |
-
setting <a href="manual.html#option_cursorBlinkRate"><code>cursorBlinkRate</code></a>
|
874 |
-
to a negative value.</li>
|
875 |
-
<li>Make gutter markers themeable, use this in foldgutter.</li>
|
876 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.2.0...4.3.0">list of patches</a>.</li>
|
877 |
-
</ul>
|
878 |
-
|
879 |
-
<p class="rel">19-05-2014: <a href="https://codemirror.net/codemirror-4.2.zip">Version 4.2</a>:</p>
|
880 |
-
|
881 |
-
<ul class="rel-note">
|
882 |
-
<li>Fix problem where some modes were broken by the fact that empty tokens were forbidden.</li>
|
883 |
-
<li>Several fixes to context menu handling.</li>
|
884 |
-
<li>On undo, scroll <em>change</em>, not cursor, into view.</li>
|
885 |
-
<li>Rewritten <a href="../mode/jade/index.html">Jade</a> mode.</li>
|
886 |
-
<li>Various improvements to <a href="../mode/shell/index.html">Shell</a> (support for more syntax) and <a href="../mode/python/index.html">Python</a> (better indentation) modes.</li>
|
887 |
-
<li>New mode: <a href="../mode/cypher/index.html">Cypher</a>.</li>
|
888 |
-
<li>New theme: <a href="../demo/theme.html#neo">Neo</a>.</li>
|
889 |
-
<li>Support direct styling options (color, line style, width) in the <a href="manual.html#addon_rulers">rulers</a> addon.</li>
|
890 |
-
<li>Recognize per-editor configuration for the <a href="manual.html#addon_show-hint">show-hint</a> and <a href="manual.html#addon_foldcode">foldcode</a> addons.</li>
|
891 |
-
<li>More intelligent scanning for existing close tags in <a href="manual.html#addon_closetag">closetag</a> addon.</li>
|
892 |
-
<li>In the <a href="../demo/vim.html">Vim bindings</a>: Fix bracket matching, support case conversion in visual mode, visual paste, append action.</li>
|
893 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.1.0...4.2.0">list of patches</a>.</li>
|
894 |
-
</ul>
|
895 |
-
|
896 |
-
<p class="rel">22-04-2014: <a href="https://codemirror.net/codemirror-4.1.zip">Version 4.1</a>:</p>
|
897 |
-
|
898 |
-
<ul class="rel-note">
|
899 |
-
<li><em>Slightly incompatible</em>:
|
900 |
-
The <a href="manual.html#event_cursorActivity"><code>"cursorActivity"</code></a>
|
901 |
-
event now fires after all other events for the operation (and only
|
902 |
-
for handlers that were actually registered at the time the
|
903 |
-
activity happened).</li>
|
904 |
-
<li>New command: <a href="manual.html#command_insertSoftTab"><code>insertSoftTab</code></a>.</li>
|
905 |
-
<li>New mode: <a href="../mode/django/index.html">Django</a>.</li>
|
906 |
-
<li>Improved modes: <a href="../mode/verilog/index.html">Verilog</a> (rewritten), <a href="../mode/jinja2/index.html">Jinja2</a>, <a href="../mode/haxe/index.html">Haxe</a>, <a href="../mode/php/index.html">PHP</a> (string interpolation highlighted), <a href="../mode/javascript/index.html">JavaScript</a> (indentation of trailing else, template strings), <a href="../mode/livescript/index.html">LiveScript</a> (multi-line strings).</li>
|
907 |
-
<li>Many small issues from the 3.x→4.x transition were found and fixed.</li>
|
908 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.0.3...4.1.0">list of patches</a>.</li>
|
909 |
-
</ul>
|
910 |
-
|
911 |
-
<p class="rel">20-03-2014: <a href="https://codemirror.net/codemirror-4.0.zip">Version 4.0</a>:</p>
|
912 |
-
|
913 |
-
<p class="rel-note">This is a new major version of CodeMirror. There
|
914 |
-
are a few <strong>incompatible</strong> changes in the API. Upgrade
|
915 |
-
with care, and read the <a href="upgrade_v4.html">upgrading
|
916 |
-
guide</a>.</p>
|
917 |
-
|
918 |
-
<ul class="rel-note">
|
919 |
-
<li>Multiple selections (ctrl-click, alt-drag, <a href="manual.html#setSelections">API</a>).</li>
|
920 |
-
<li>Sublime Text <a href="../demo/sublime.html">bindings</a>.</li>
|
921 |
-
<li><a href="manual.html#modloader">Module loader shims</a> wrapped around all modules.</li>
|
922 |
-
<li>Selection <a href="manual.html#command_undoSelection">undo</a>/<a href="manual.html#command_redoSelection">redo</a>.</li>
|
923 |
-
<li>Improved character measuring (faster, handles wrapped lines more robustly).</li>
|
924 |
-
<li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.23.0...4.0.3">list of
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|