PluginProbe
WP Coder – Insert & Manage Code Snippets / 2.5.6
WP Coder – Insert & Manage Code Snippets v2.5.6
4.5.1 1.1 2.3.1 2.3.2 2.4.1 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.1 3.1.1 3.2 3.2.1 3.3 3.4 3.5 3.5.1 All 39 releases
wp-coder / assets / js / script-codemirror.js

script-codemirror.js in WP Coder – Insert & Manage Code Snippets 2.5.6, at assets/js/script-codemirror.js

125 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* ========= INFORMATION ============================
2 - author: Dmytro Lobov
3 - url: https://wow-estore.com
4 - email: givememoney1982@gmail.com
5 ==================================================== */
6
7 'use strict';
8 (function ($) {
9 $(function () {
10 const editorSettings = wp.codeEditor.defaultSettings ? _.clone(wp.codeEditor.defaultSettings) : {};
11 const codemirror_gen =
12 {
13 "indentUnit": 2,
14 "indentWithTabs": true,
15 "inputStyle": "contenteditable",
16 "lineNumbers": true,
17 "lineWrapping": true,
18 "styleActiveLine": true,
19 "continueComments": true,
20 "extraKeys": {
21 "Ctrl-Space": "autocomplete",
22 "Ctrl-\/": "toggleComment",
23 "Cmd-\/": "toggleComment",
24 "Alt-F": "findPersistent",
25 "Ctrl-F": "findPersistent",
26 "Cmd-F": "findPersistent"
27 },
28 "direction": "ltr",
29 "gutters": ["CodeMirror-lint-markers"],
30 "lint": true,
31 "autoCloseBrackets": true,
32 "autoCloseTags": true,
33 "matchTags": {
34 "bothTags": true
35 },
36 "tabSize": 2,
37
38 };
39
40 if ($('#wow_html_code').length) {
41 let codemirror_el =
42 {
43 "tagname-lowercase": true,
44 "attr-lowercase": true,
45 "attr-value-double-quotes": false,
46 "doctype-first": false,
47 "tag-pair": true,
48 "spec-char-escape": true,
49 "id-unique": true,
50 "src-not-empty": true,
51 "attr-no-duplication": true,
52 "alt-require": true,
53 "space-tab-mixed-disabled": "tab",
54 "attr-unsafe-chars": true,
55 "mode": 'htmlmixed',
56
57 };
58
59 editorSettings.codemirror = _.extend(
60 {},
61 editorSettings.codemirror,
62 codemirror_gen,
63 codemirror_el,
64 );
65
66 let editor = wp.codeEditor.initialize($('#wow_html_code'), editorSettings);
67 }
68
69 if ($('#wow_css_code').length) {
70 let codemirror_el =
71 {
72
73
74 "mode": 'css',
75 };
76
77 editorSettings.codemirror = _.extend(
78 {},
79 editorSettings.codemirror,
80 codemirror_gen,
81 codemirror_el,
82 );
83
84 let editor = wp.codeEditor.initialize($('#wow_css_code'), editorSettings);
85 }
86 if ($('#wow_js_code').length) {
87 let codemirror_el =
88 {
89
90 "boss": true,
91 "curly": true,
92 "eqeqeq": true,
93 "eqnull": true,
94 "es3": true,
95 "expr": true,
96 "immed": true,
97 "noarg": true,
98 "nonbsp": true,
99 "onevar": true,
100 "quotmark": "single",
101 "trailing": true,
102 "undef": true,
103 "unused": true,
104 "browser": true,
105 "globals": {
106 "_": false,
107 "Backbone": false,
108 "jQuery": true,
109 "JSON": false,
110 "wp": false
111 },
112 "mode": 'javascript',
113 };
114
115 editorSettings.codemirror = _.extend(
116 {},
117 editorSettings.codemirror,
118 codemirror_gen,
119 codemirror_el,
120 );
121
122 let editor = wp.codeEditor.initialize($('#wow_js_code'), editorSettings);
123 }
124 });
125 })(jQuery);