@teipublisher/pb-components 1.40.1 → 1.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/demo/pb-code-editor.html +12 -9
  3. package/dist/{iron-form-f540b15b.js → iron-form-9e72ac45.js} +1 -1
  4. package/dist/jinn-codemirror-c1a4b755.js +1 -0
  5. package/dist/{paper-checkbox-f6a70487.js → paper-checkbox-102e3b43.js} +120 -120
  6. package/dist/pb-code-editor.js +22 -0
  7. package/dist/pb-components-bundle.js +234 -234
  8. package/dist/pb-edit-app.js +33 -33
  9. package/dist/pb-elements.json +100 -16
  10. package/dist/pb-i18n-6ad23bcf.js +1 -0
  11. package/dist/pb-message-0fb0b538.js +911 -0
  12. package/dist/pb-odd-editor.js +110 -82
  13. package/package.json +4 -5
  14. package/pb-elements.json +100 -16
  15. package/src/pb-code-editor.js +51 -663
  16. package/src/pb-components.js +0 -1
  17. package/src/pb-load.js +11 -0
  18. package/src/pb-odd-model-editor.js +33 -23
  19. package/src/pb-odd-parameter-editor.js +17 -9
  20. package/src/pb-odd-rendition-editor.js +19 -9
  21. package/css/codemirror/3024-day.css +0 -41
  22. package/css/codemirror/3024-night.css +0 -39
  23. package/css/codemirror/abbott.css +0 -268
  24. package/css/codemirror/abcdef.css +0 -32
  25. package/css/codemirror/ambiance-mobile.css +0 -5
  26. package/css/codemirror/ambiance.css +0 -74
  27. package/css/codemirror/ayu-dark.css +0 -44
  28. package/css/codemirror/ayu-mirage.css +0 -45
  29. package/css/codemirror/base16-dark.css +0 -40
  30. package/css/codemirror/base16-light.css +0 -38
  31. package/css/codemirror/bespin.css +0 -34
  32. package/css/codemirror/blackboard.css +0 -32
  33. package/css/codemirror/cobalt.css +0 -25
  34. package/css/codemirror/colorforth.css +0 -33
  35. package/css/codemirror/darcula.css +0 -53
  36. package/css/codemirror/dracula.css +0 -40
  37. package/css/codemirror/duotone-dark.css +0 -35
  38. package/css/codemirror/duotone-light.css +0 -36
  39. package/css/codemirror/eclipse.css +0 -23
  40. package/css/codemirror/elegant.css +0 -13
  41. package/css/codemirror/erlang-dark.css +0 -34
  42. package/css/codemirror/gruvbox-dark.css +0 -39
  43. package/css/codemirror/hopscotch.css +0 -34
  44. package/css/codemirror/icecoder.css +0 -43
  45. package/css/codemirror/idea.css +0 -42
  46. package/css/codemirror/isotope.css +0 -34
  47. package/css/codemirror/juejin.css +0 -30
  48. package/css/codemirror/lesser-dark.css +0 -47
  49. package/css/codemirror/liquibyte.css +0 -95
  50. package/css/codemirror/lucario.css +0 -37
  51. package/css/codemirror/material-darker.css +0 -135
  52. package/css/codemirror/material-ocean.css +0 -141
  53. package/css/codemirror/material-palenight.css +0 -141
  54. package/css/codemirror/material.css +0 -141
  55. package/css/codemirror/mbo.css +0 -37
  56. package/css/codemirror/mdn-like.css +0 -46
  57. package/css/codemirror/midnight.css +0 -39
  58. package/css/codemirror/monokai.css +0 -41
  59. package/css/codemirror/moxer.css +0 -143
  60. package/css/codemirror/neat.css +0 -12
  61. package/css/codemirror/neo.css +0 -43
  62. package/css/codemirror/night.css +0 -27
  63. package/css/codemirror/nord.css +0 -42
  64. package/css/codemirror/oceanic-next.css +0 -46
  65. package/css/codemirror/panda-syntax.css +0 -85
  66. package/css/codemirror/paraiso-dark.css +0 -38
  67. package/css/codemirror/paraiso-light.css +0 -38
  68. package/css/codemirror/pastel-on-dark.css +0 -52
  69. package/css/codemirror/railscasts.css +0 -34
  70. package/css/codemirror/rubyblue.css +0 -25
  71. package/css/codemirror/seti.css +0 -44
  72. package/css/codemirror/shadowfox.css +0 -52
  73. package/css/codemirror/solarized.css +0 -168
  74. package/css/codemirror/ssms.css +0 -16
  75. package/css/codemirror/the-matrix.css +0 -30
  76. package/css/codemirror/tomorrow-night-bright.css +0 -35
  77. package/css/codemirror/tomorrow-night-eighties.css +0 -38
  78. package/css/codemirror/ttcn.css +0 -64
  79. package/css/codemirror/twilight.css +0 -32
  80. package/css/codemirror/vibrant-ink.css +0 -34
  81. package/css/codemirror/xq-dark.css +0 -53
  82. package/css/codemirror/xq-light.css +0 -43
  83. package/css/codemirror/yeti.css +0 -44
  84. package/css/codemirror/yonce.css +0 -59
  85. package/css/codemirror/zenburn.css +0 -37
  86. package/dist/pb-message-1a0c0c52.js +0 -1360
  87. package/lib/codemirror/addon/display/placeholder.js +0 -70
  88. package/lib/codemirror/addon/edit/matchbrackets.js +0 -152
  89. package/lib/codemirror/addon/lint/lint.js +0 -282
  90. package/lib/codemirror/mode/css/css.js +0 -855
  91. package/lib/codemirror/mode/stex/stex.js +0 -249
  92. package/lib/codemirror/mode/xml/xml.js +0 -404
  93. package/lib/codemirror/mode/xquery/xquery.js +0 -434
@@ -1,249 +0,0 @@
1
- function stex(CodeMirror) {
2
-
3
- CodeMirror.defineMode("stex", function(_config, parserConfig) {
4
-
5
- function pushCommand(state, command) {
6
- state.cmdState.push(command);
7
- }
8
-
9
- function peekCommand(state) {
10
- if (state.cmdState.length > 0) {
11
- return state.cmdState[state.cmdState.length - 1];
12
- } else {
13
- return null;
14
- }
15
- }
16
-
17
- function popCommand(state) {
18
- var plug = state.cmdState.pop();
19
- if (plug) {
20
- plug.closeBracket();
21
- }
22
- }
23
-
24
- // returns the non-default plugin closest to the end of the list
25
- function getMostPowerful(state) {
26
- var context = state.cmdState;
27
- for (var i = context.length - 1; i >= 0; i--) {
28
- var plug = context[i];
29
- if (plug.name == "DEFAULT") {
30
- continue;
31
- }
32
- return plug;
33
- }
34
- return { styleIdentifier: function() { return null; } };
35
- }
36
-
37
- function addPluginPattern(pluginName, cmdStyle, styles) {
38
- return function () {
39
- this.name = pluginName;
40
- this.bracketNo = 0;
41
- this.style = cmdStyle;
42
- this.styles = styles;
43
- this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin
44
-
45
- this.styleIdentifier = function() {
46
- return this.styles[this.bracketNo - 1] || null;
47
- };
48
- this.openBracket = function() {
49
- this.bracketNo++;
50
- return "bracket";
51
- };
52
- this.closeBracket = function() {};
53
- };
54
- }
55
-
56
- var plugins = {};
57
-
58
- plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]);
59
- plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]);
60
- plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]);
61
- plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
62
- plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
63
-
64
- plugins["label" ] = addPluginPattern("label" , "tag", ["atom"]);
65
- plugins["ref" ] = addPluginPattern("ref" , "tag", ["atom"]);
66
- plugins["eqref" ] = addPluginPattern("eqref" , "tag", ["atom"]);
67
- plugins["cite" ] = addPluginPattern("cite" , "tag", ["atom"]);
68
- plugins["bibitem" ] = addPluginPattern("bibitem" , "tag", ["atom"]);
69
- plugins["Bibitem" ] = addPluginPattern("Bibitem" , "tag", ["atom"]);
70
- plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]);
71
-
72
- plugins["DEFAULT"] = function () {
73
- this.name = "DEFAULT";
74
- this.style = "tag";
75
-
76
- this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
77
- };
78
-
79
- function setState(state, f) {
80
- state.f = f;
81
- }
82
-
83
- // called when in a normal (no environment) context
84
- function normal(source, state) {
85
- var plug;
86
- // Do we look like '\command' ? If so, attempt to apply the plugin 'command'
87
- if (source.match(/^\\[a-zA-Z@]+/)) {
88
- var cmdName = source.current().slice(1);
89
- plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"];
90
- plug = new plug();
91
- pushCommand(state, plug);
92
- setState(state, beginParams);
93
- return plug.style;
94
- }
95
-
96
- // escape characters
97
- if (source.match(/^\\[$&%#{}_]/)) {
98
- return "tag";
99
- }
100
-
101
- // white space control characters
102
- if (source.match(/^\\[,;!\/\\]/)) {
103
- return "tag";
104
- }
105
-
106
- // find if we're starting various math modes
107
- if (source.match("\\[")) {
108
- setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
109
- return "keyword";
110
- }
111
- if (source.match("\\(")) {
112
- setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
113
- return "keyword";
114
- }
115
- if (source.match("$$")) {
116
- setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
117
- return "keyword";
118
- }
119
- if (source.match("$")) {
120
- setState(state, function(source, state){ return inMathMode(source, state, "$"); });
121
- return "keyword";
122
- }
123
-
124
- var ch = source.next();
125
- if (ch == "%") {
126
- source.skipToEnd();
127
- return "comment";
128
- } else if (ch == '}' || ch == ']') {
129
- plug = peekCommand(state);
130
- if (plug) {
131
- plug.closeBracket(ch);
132
- setState(state, beginParams);
133
- } else {
134
- return "error";
135
- }
136
- return "bracket";
137
- } else if (ch == '{' || ch == '[') {
138
- plug = plugins["DEFAULT"];
139
- plug = new plug();
140
- pushCommand(state, plug);
141
- return "bracket";
142
- } else if (/\d/.test(ch)) {
143
- source.eatWhile(/[\w.%]/);
144
- return "atom";
145
- } else {
146
- source.eatWhile(/[\w\-_]/);
147
- plug = getMostPowerful(state);
148
- if (plug.name == 'begin') {
149
- plug.argument = source.current();
150
- }
151
- return plug.styleIdentifier();
152
- }
153
- }
154
-
155
- function inMathMode(source, state, endModeSeq) {
156
- if (source.eatSpace()) {
157
- return null;
158
- }
159
- if (endModeSeq && source.match(endModeSeq)) {
160
- setState(state, normal);
161
- return "keyword";
162
- }
163
- if (source.match(/^\\[a-zA-Z@]+/)) {
164
- return "tag";
165
- }
166
- if (source.match(/^[a-zA-Z]+/)) {
167
- return "variable-2";
168
- }
169
- // escape characters
170
- if (source.match(/^\\[$&%#{}_]/)) {
171
- return "tag";
172
- }
173
- // white space control characters
174
- if (source.match(/^\\[,;!\/]/)) {
175
- return "tag";
176
- }
177
- // special math-mode characters
178
- if (source.match(/^[\^_&]/)) {
179
- return "tag";
180
- }
181
- // non-special characters
182
- if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
183
- return null;
184
- }
185
- if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
186
- return "number";
187
- }
188
- var ch = source.next();
189
- if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
190
- return "bracket";
191
- }
192
-
193
- if (ch == "%") {
194
- source.skipToEnd();
195
- return "comment";
196
- }
197
- return "error";
198
- }
199
-
200
- function beginParams(source, state) {
201
- var ch = source.peek(), lastPlug;
202
- if (ch == '{' || ch == '[') {
203
- lastPlug = peekCommand(state);
204
- lastPlug.openBracket(ch);
205
- source.eat(ch);
206
- setState(state, normal);
207
- return "bracket";
208
- }
209
- if (/[ \t\r]/.test(ch)) {
210
- source.eat(ch);
211
- return null;
212
- }
213
- setState(state, normal);
214
- popCommand(state);
215
-
216
- return normal(source, state);
217
- }
218
-
219
- return {
220
- startState: function() {
221
- var f = parserConfig.inMathMode ? function(source, state){ return inMathMode(source, state); } : normal;
222
- return {
223
- cmdState: [],
224
- f: f
225
- };
226
- },
227
- copyState: function(s) {
228
- return {
229
- cmdState: s.cmdState.slice(),
230
- f: s.f
231
- };
232
- },
233
- token: function(stream, state) {
234
- return state.f(stream, state);
235
- },
236
- blankLine: function(state) {
237
- state.f = normal;
238
- state.cmdState.length = 0;
239
- },
240
- lineComment: "%"
241
- };
242
- });
243
-
244
- CodeMirror.defineMIME("text/x-stex", "stex");
245
- CodeMirror.defineMIME("text/x-latex", "stex");
246
-
247
- }
248
-
249
- export default stex;
@@ -1,404 +0,0 @@
1
- function xml(CodeMirror) {
2
-
3
- var htmlConfig = {
4
- autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
5
- 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
6
- 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
7
- 'track': true, 'wbr': true, 'menuitem': true},
8
- implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
9
- 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
10
- 'th': true, 'tr': true},
11
- contextGrabbers: {
12
- 'dd': {'dd': true, 'dt': true},
13
- 'dt': {'dd': true, 'dt': true},
14
- 'li': {'li': true},
15
- 'option': {'option': true, 'optgroup': true},
16
- 'optgroup': {'optgroup': true},
17
- 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
18
- 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
19
- 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
20
- 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
21
- 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
22
- 'rp': {'rp': true, 'rt': true},
23
- 'rt': {'rp': true, 'rt': true},
24
- 'tbody': {'tbody': true, 'tfoot': true},
25
- 'td': {'td': true, 'th': true},
26
- 'tfoot': {'tbody': true},
27
- 'th': {'td': true, 'th': true},
28
- 'thead': {'tbody': true, 'tfoot': true},
29
- 'tr': {'tr': true}
30
- },
31
- doNotIndent: {"pre": true},
32
- allowUnquoted: true,
33
- allowMissing: true,
34
- caseFold: true
35
- };
36
-
37
- var xmlConfig = {
38
- autoSelfClosers: {},
39
- implicitlyClosed: {},
40
- contextGrabbers: {},
41
- doNotIndent: {},
42
- allowUnquoted: false,
43
- allowMissing: false,
44
- allowMissingTagName: false,
45
- caseFold: false
46
- };
47
-
48
- CodeMirror.defineMode("xml", function(editorConf, config_) {
49
- var indentUnit = editorConf.indentUnit;
50
- var config = {};
51
- var defaults = config_.htmlMode ? htmlConfig : xmlConfig;
52
- for (var prop in defaults) config[prop] = defaults[prop];
53
- for (var prop in config_) config[prop] = config_[prop];
54
-
55
- // Return variables for tokenizers
56
- var type, setStyle;
57
-
58
- function inText(stream, state) {
59
- function chain(parser) {
60
- state.tokenize = parser;
61
- return parser(stream, state);
62
- }
63
-
64
- var ch = stream.next();
65
- if (ch == "<") {
66
- if (stream.eat("!")) {
67
- if (stream.eat("[")) {
68
- if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
69
- else return null;
70
- } else if (stream.match("--")) {
71
- return chain(inBlock("comment", "-->"));
72
- } else if (stream.match("DOCTYPE", true, true)) {
73
- stream.eatWhile(/[\w\._\-]/);
74
- return chain(doctype(1));
75
- } else {
76
- return null;
77
- }
78
- } else if (stream.eat("?")) {
79
- stream.eatWhile(/[\w\._\-]/);
80
- state.tokenize = inBlock("meta", "?>");
81
- return "meta";
82
- } else {
83
- type = stream.eat("/") ? "closeTag" : "openTag";
84
- state.tokenize = inTag;
85
- return "tag bracket";
86
- }
87
- } else if (ch == "&") {
88
- var ok;
89
- if (stream.eat("#")) {
90
- if (stream.eat("x")) {
91
- ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
92
- } else {
93
- ok = stream.eatWhile(/[\d]/) && stream.eat(";");
94
- }
95
- } else {
96
- ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
97
- }
98
- return ok ? "atom" : "error";
99
- } else {
100
- stream.eatWhile(/[^&<]/);
101
- return null;
102
- }
103
- }
104
- inText.isInText = true;
105
-
106
- function inTag(stream, state) {
107
- var ch = stream.next();
108
- if (ch == ">" || (ch == "/" && stream.eat(">"))) {
109
- state.tokenize = inText;
110
- type = ch == ">" ? "endTag" : "selfcloseTag";
111
- return "tag bracket";
112
- } else if (ch == "=") {
113
- type = "equals";
114
- return null;
115
- } else if (ch == "<") {
116
- state.tokenize = inText;
117
- state.state = baseState;
118
- state.tagName = state.tagStart = null;
119
- var next = state.tokenize(stream, state);
120
- return next ? next + " tag error" : "tag error";
121
- } else if (/[\'\"]/.test(ch)) {
122
- state.tokenize = inAttribute(ch);
123
- state.stringStartCol = stream.column();
124
- return state.tokenize(stream, state);
125
- } else {
126
- stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
127
- return "word";
128
- }
129
- }
130
-
131
- function inAttribute(quote) {
132
- var closure = function(stream, state) {
133
- while (!stream.eol()) {
134
- if (stream.next() == quote) {
135
- state.tokenize = inTag;
136
- break;
137
- }
138
- }
139
- return "string";
140
- };
141
- closure.isInAttribute = true;
142
- return closure;
143
- }
144
-
145
- function inBlock(style, terminator) {
146
- return function(stream, state) {
147
- while (!stream.eol()) {
148
- if (stream.match(terminator)) {
149
- state.tokenize = inText;
150
- break;
151
- }
152
- stream.next();
153
- }
154
- return style;
155
- }
156
- }
157
-
158
- function doctype(depth) {
159
- return function(stream, state) {
160
- var ch;
161
- while ((ch = stream.next()) != null) {
162
- if (ch == "<") {
163
- state.tokenize = doctype(depth + 1);
164
- return state.tokenize(stream, state);
165
- } else if (ch == ">") {
166
- if (depth == 1) {
167
- state.tokenize = inText;
168
- break;
169
- } else {
170
- state.tokenize = doctype(depth - 1);
171
- return state.tokenize(stream, state);
172
- }
173
- }
174
- }
175
- return "meta";
176
- };
177
- }
178
-
179
- function Context(state, tagName, startOfLine) {
180
- this.prev = state.context;
181
- this.tagName = tagName || "";
182
- this.indent = state.indented;
183
- this.startOfLine = startOfLine;
184
- if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
185
- this.noIndent = true;
186
- }
187
- function popContext(state) {
188
- if (state.context) state.context = state.context.prev;
189
- }
190
- function maybePopContext(state, nextTagName) {
191
- var parentTagName;
192
- while (true) {
193
- if (!state.context) {
194
- return;
195
- }
196
- parentTagName = state.context.tagName;
197
- if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
198
- !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
199
- return;
200
- }
201
- popContext(state);
202
- }
203
- }
204
-
205
- function baseState(type, stream, state) {
206
- if (type == "openTag") {
207
- state.tagStart = stream.column();
208
- return tagNameState;
209
- } else if (type == "closeTag") {
210
- return closeTagNameState;
211
- } else {
212
- return baseState;
213
- }
214
- }
215
- function tagNameState(type, stream, state) {
216
- if (type == "word") {
217
- state.tagName = stream.current();
218
- setStyle = "tag";
219
- return attrState;
220
- } else if (config.allowMissingTagName && type == "endTag") {
221
- setStyle = "tag bracket";
222
- return attrState(type, stream, state);
223
- } else {
224
- setStyle = "error";
225
- return tagNameState;
226
- }
227
- }
228
- function closeTagNameState(type, stream, state) {
229
- if (type == "word") {
230
- var tagName = stream.current();
231
- if (state.context && state.context.tagName != tagName &&
232
- config.implicitlyClosed.hasOwnProperty(state.context.tagName))
233
- popContext(state);
234
- if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
235
- setStyle = "tag";
236
- return closeState;
237
- } else {
238
- setStyle = "tag error";
239
- return closeStateErr;
240
- }
241
- } else if (config.allowMissingTagName && type == "endTag") {
242
- setStyle = "tag bracket";
243
- return closeState(type, stream, state);
244
- } else {
245
- setStyle = "error";
246
- return closeStateErr;
247
- }
248
- }
249
-
250
- function closeState(type, _stream, state) {
251
- if (type != "endTag") {
252
- setStyle = "error";
253
- return closeState;
254
- }
255
- popContext(state);
256
- return baseState;
257
- }
258
- function closeStateErr(type, stream, state) {
259
- setStyle = "error";
260
- return closeState(type, stream, state);
261
- }
262
-
263
- function attrState(type, _stream, state) {
264
- if (type == "word") {
265
- setStyle = "attribute";
266
- return attrEqState;
267
- } else if (type == "endTag" || type == "selfcloseTag") {
268
- var tagName = state.tagName, tagStart = state.tagStart;
269
- state.tagName = state.tagStart = null;
270
- if (type == "selfcloseTag" ||
271
- config.autoSelfClosers.hasOwnProperty(tagName)) {
272
- maybePopContext(state, tagName);
273
- } else {
274
- maybePopContext(state, tagName);
275
- state.context = new Context(state, tagName, tagStart == state.indented);
276
- }
277
- return baseState;
278
- }
279
- setStyle = "error";
280
- return attrState;
281
- }
282
- function attrEqState(type, stream, state) {
283
- if (type == "equals") return attrValueState;
284
- if (!config.allowMissing) setStyle = "error";
285
- return attrState(type, stream, state);
286
- }
287
- function attrValueState(type, stream, state) {
288
- if (type == "string") return attrContinuedState;
289
- if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
290
- setStyle = "error";
291
- return attrState(type, stream, state);
292
- }
293
- function attrContinuedState(type, stream, state) {
294
- if (type == "string") return attrContinuedState;
295
- return attrState(type, stream, state);
296
- }
297
-
298
- return {
299
- startState: function(baseIndent) {
300
- var state = {tokenize: inText,
301
- state: baseState,
302
- indented: baseIndent || 0,
303
- tagName: null, tagStart: null,
304
- context: null};
305
- if (baseIndent != null) state.baseIndent = baseIndent;
306
- return state
307
- },
308
-
309
- token: function(stream, state) {
310
- if (!state.tagName && stream.sol())
311
- state.indented = stream.indentation();
312
-
313
- if (stream.eatSpace()) return null;
314
- type = null;
315
- var style = state.tokenize(stream, state);
316
- if ((style || type) && style != "comment") {
317
- setStyle = null;
318
- state.state = state.state(type || style, stream, state);
319
- if (setStyle)
320
- style = setStyle == "error" ? style + " error" : setStyle;
321
- }
322
- return style;
323
- },
324
-
325
- indent: function(state, textAfter, fullLine) {
326
- var context = state.context;
327
- // Indent multi-line strings (e.g. css).
328
- if (state.tokenize.isInAttribute) {
329
- if (state.tagStart == state.indented)
330
- return state.stringStartCol + 1;
331
- else
332
- return state.indented + indentUnit;
333
- }
334
- if (context && context.noIndent) return CodeMirror.Pass;
335
- if (state.tokenize != inTag && state.tokenize != inText)
336
- return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
337
- // Indent the starts of attribute names.
338
- if (state.tagName) {
339
- if (config.multilineTagIndentPastTag !== false)
340
- return state.tagStart + state.tagName.length + 2;
341
- else
342
- return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
343
- }
344
- if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
345
- var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
346
- if (tagAfter && tagAfter[1]) { // Closing tag spotted
347
- while (context) {
348
- if (context.tagName == tagAfter[2]) {
349
- context = context.prev;
350
- break;
351
- } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
352
- context = context.prev;
353
- } else {
354
- break;
355
- }
356
- }
357
- } else if (tagAfter) { // Opening tag spotted
358
- while (context) {
359
- var grabbers = config.contextGrabbers[context.tagName];
360
- if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
361
- context = context.prev;
362
- else
363
- break;
364
- }
365
- }
366
- while (context && context.prev && !context.startOfLine)
367
- context = context.prev;
368
- if (context) return context.indent + indentUnit;
369
- else return state.baseIndent || 0;
370
- },
371
-
372
- electricInput: /<\/[\s\w:]+>$/,
373
- blockCommentStart: "<!--",
374
- blockCommentEnd: "-->",
375
-
376
- configuration: config.htmlMode ? "html" : "xml",
377
- helperType: config.htmlMode ? "html" : "xml",
378
-
379
- skipAttribute: function(state) {
380
- if (state.state == attrValueState)
381
- state.state = attrState;
382
- },
383
-
384
- xmlCurrentTag: function(state) {
385
- return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null
386
- },
387
-
388
- xmlCurrentContext: function(state) {
389
- var context = [];
390
- for (var cx = state.context; cx; cx = cx.prev)
391
- context.push(cx.tagName);
392
- return context.reverse()
393
- }
394
- };
395
- });
396
-
397
- CodeMirror.defineMIME("text/xml", "xml");
398
- CodeMirror.defineMIME("application/xml", "xml");
399
- if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
400
- CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
401
-
402
- }
403
-
404
- export default xml;