This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

add code mirror

old
宇天 2017-03-30 02:06:15 +08:00
parent 8f37ea1971
commit 0d12b351df
6 changed files with 11 additions and 0 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
js/lib/codemirror/css.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
define(["./codemirror","./xml","./js","./css","css!./codemirror"],function(t){"use strict";function e(t,e,a){var n=t.current(),l=n.search(e);return l>-1?t.backUp(n.length-l):n.match(/<\/?$/)&&(t.backUp(n.length),t.match(e,!1)||t.match(n)),a}function a(t){var e=i[t];return e?e:i[t]=new RegExp("\\s+"+t+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function n(t,e){var n=t.match(a(e));return n?/^\s*(.*?)\s*$/.exec(n[2])[1]:""}function l(t,e){return new RegExp((e?"^":"")+"</s*"+t+"s*>","i")}function r(t,e){for(var a in t)for(var n=e[a]||(e[a]=[]),l=t[a],r=l.length-1;r>=0;r--)n.unshift(l[r])}function o(t,e){for(var a=0;a<t.length;a++){var l=t[a];if(!l[0]||l[1].test(n(e,l[0])))return l[2]}}var c={script:[["lang",/(javascript|babel)/i,"javascript"],["type",/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i,"javascript"],["type",/./,"text/plain"],[null,null,"javascript"]],style:[["lang",/^css$/i,"css"],["type",/^(text\/)?(x-)?(stylesheet|css)$/i,"css"],["type",/./,"text/plain"],[null,null,"css"]]},i={};return t.defineMode("htmlmixed",function(a,n){function i(n,r){var c,m=s.token(n,r.htmlState),d=/\btag\b/.test(m);if(d&&!/[<>\s\/]/.test(n.current())&&(c=r.htmlState.tagName&&r.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(c))r.inTag=c+" ";else if(r.inTag&&d&&/>$/.test(n.current())){var g=/^([\S]+) (.*)/.exec(r.inTag);r.inTag=null;var h=">"==n.current()&&o(u[g[1]],g[2]),f=t.getMode(a,h),p=l(g[1],!0),S=l(g[1],!1);r.token=function(t,a){return t.match(p,!1)?(a.token=i,a.localState=a.localMode=null,null):e(t,S,a.localMode.token(t,a.localState))},r.localMode=f,r.localState=t.startState(f,s.indent(r.htmlState,""))}else r.inTag&&(r.inTag+=n.current(),n.eol()&&(r.inTag+=" "));return m}var s=t.getMode(a,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},m=n&&n.tags,d=n&&n.scriptTypes;if(r(c,u),m&&r(m,u),d)for(var g=d.length-1;g>=0;g--)u.script.unshift(["type",d[g].matches,d[g].mode]);return{startState:function(){var e=t.startState(s);return{token:i,inTag:null,localMode:null,localState:null,htmlState:e}},copyState:function(e){var a;return e.localState&&(a=t.copyState(e.localMode,e.localState)),{token:e.token,inTag:e.inTag,localMode:e.localMode,localState:a,htmlState:t.copyState(s,e.htmlState)}},token:function(t,e){return e.token(t,e)},indent:function(e,a){return!e.localMode||/^\s*<\//.test(a)?s.indent(e.htmlState,a):e.localMode.indent?e.localMode.indent(e.localState,a):t.Pass},innerMode:function(t){return{state:t.localState||t.htmlState,mode:t.localMode||s}}}},"xml","javascript","css"),t.defineMIME("text/html","htmlmixed"),t});

1
js/lib/codemirror/js.js Normal file

File diff suppressed because one or more lines are too long

1
js/lib/codemirror/xml.js Normal file

File diff suppressed because one or more lines are too long