mirror of
https://github.com/TiddlyWiki/TiddlyWiki5.git
synced 2026-04-28 21:44:41 +00:00
Bump codemirror 5 plugin version to 5.65.19 (#9114)
* Bump codemirror 5 plugin version to 5.65.19 * Update autocomplete * Update closebrackets * Update fullscreen * Update keymap * Update modes * Update search * Update trailingspace * Fix broken markdown mode * Add all codemirror plugins to codemirrordemo edition
This commit is contained in:
@@ -1,3 +1 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(C){var r={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},x=C.Pos;function P(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:r[t]}C.defineOption("autoCloseBrackets",!1,function(e,t,r){r&&r!=C.Init&&(e.removeKeyMap(i),e.state.closeBrackets=null),t&&(n(P(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(i))});var i={Backspace:function(e){var t=k(e);if(!t||e.getOption("disableInput"))return C.Pass;for(var r=P(t,"pairs"),n=e.listSelections(),i=0;i<n.length;i++){if(!n[i].empty())return C.Pass;var a=s(e,n[i].head);if(!a||r.indexOf(a)%2!=0)return C.Pass}for(i=n.length-1;0<=i;i--){var o=n[i].head;e.replaceRange("",x(o.line,o.ch-1),x(o.line,o.ch+1),"+delete")}},Enter:function(n){var e=k(n),t=e&&P(e,"explode");if(!t||n.getOption("disableInput"))return C.Pass;for(var i=n.listSelections(),r=0;r<i.length;r++){if(!i[r].empty())return C.Pass;var a=s(n,i[r].head);if(!a||t.indexOf(a)%2!=0)return C.Pass}n.operation(function(){var e=n.lineSeparator()||"\n";n.replaceSelection(e+e,null),n.execCommand("goCharLeft"),i=n.listSelections();for(var t=0;t<i.length;t++){var r=i[t].head.line;n.indentLine(r,null,!0),n.indentLine(r+1,null,!0)}})}};function n(e){for(var t=0;t<e.length;t++){var r=e.charAt(t),n="'"+r+"'";i[n]||(i[n]=function(t){return function(e){return function(i,e){var t=k(i);if(!t||i.getOption("disableInput"))return C.Pass;var r=P(t,"pairs"),n=r.indexOf(e);if(-1==n)return C.Pass;for(var a,o=P(t,"closeBefore"),s=P(t,"triples"),l=r.charAt(n+1)==e,c=i.listSelections(),f=n%2==0,h=0;h<c.length;h++){var u,d=c[h],p=d.head,g=i.getRange(p,x(p.line,p.ch+1));if(f&&!d.empty())u="surround";else if(!l&&f||g!=e)if(l&&1<p.ch&&0<=s.indexOf(e)&&i.getRange(x(p.line,p.ch-2),p)==e+e){if(2<p.ch&&/\bstring/.test(i.getTokenTypeAt(x(p.line,p.ch-2))))return C.Pass;u="addFour"}else if(l){var v=0==p.ch?" ":i.getRange(x(p.line,p.ch-1),p);if(C.isWordChar(g)||v==e||C.isWordChar(v))return C.Pass;u="both"}else{if(!f||!(0===g.length||/\s/.test(g)||-1<o.indexOf(g)))return C.Pass;u="both"}else u=l&&function(e,t){var r=e.getTokenAt(x(t.line,t.ch+1));return/\bstring/.test(r.type)&&r.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}(i,p)?"both":0<=s.indexOf(e)&&i.getRange(p,x(p.line,p.ch+3))==e+e+e?"skipThree":"skip";if(a){if(a!=u)return C.Pass}else a=u}var m=n%2?r.charAt(n-1):e,b=n%2?e:r.charAt(n+1);i.operation(function(){if("skip"==a)i.execCommand("goCharRight");else if("skipThree"==a)for(var e=0;e<3;e++)i.execCommand("goCharRight");else if("surround"==a){for(var t=i.getSelections(),e=0;e<t.length;e++)t[e]=m+t[e]+b;i.replaceSelections(t,"around"),t=i.listSelections().slice();for(e=0;e<t.length;e++)t[e]=(r=t[e],n=0<C.cmpPos(r.anchor,r.head),{anchor:new x(r.anchor.line,r.anchor.ch+(n?-1:1)),head:new x(r.head.line,r.head.ch+(n?1:-1))});i.setSelections(t)}else"both"==a?(i.replaceSelection(m+b,null),i.triggerElectric(m+b),i.execCommand("goCharLeft")):"addFour"==a&&(i.replaceSelection(m+m+m+m,"before"),i.execCommand("goCharRight"));var r,n})}(e,t)}}(r))}}function k(e){var t=e.state.closeBrackets;return t&&!t.override&&e.getModeAt(e.getCursor()).closeBrackets||t}function s(e,t){var r=e.getRange(x(t.line,t.ch-1),x(t.line,t.ch+1));return 2==r.length?r:null}n(r.pairs+"`")});
|
||||
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(S){var n={pairs:"()[]{}''\"\"",closeBefore:")]}'\":;>",triples:"",explode:"[]{}"},k=S.Pos;function y(e,t){return"pairs"==t&&"string"==typeof e?e:("object"==typeof e&&null!=e[t]?e:n)[t]}S.defineOption("autoCloseBrackets",!1,function(e,t,n){n&&n!=S.Init&&(e.removeKeyMap(i),e.state.closeBrackets=null),t&&(r(y(t,"pairs")),e.state.closeBrackets=t,e.addKeyMap(i))});var i={Backspace:function(e){var t=O(e);if(!t||e.getOption("disableInput"))return S.Pass;for(var n=y(t,"pairs"),r=e.listSelections(),i=0;i<r.length;i++){if(!r[i].empty())return S.Pass;var a=s(e,r[i].head);if(!a||n.indexOf(a)%2!=0)return S.Pass}for(i=r.length-1;0<=i;i--){var o=r[i].head;e.replaceRange("",k(o.line,o.ch-1),k(o.line,o.ch+1),"+delete")}},Enter:function(r){var e=O(r),t=e&&y(e,"explode");if(!t||r.getOption("disableInput"))return S.Pass;for(var i=r.listSelections(),n=0;n<i.length;n++){if(!i[n].empty())return S.Pass;var a=s(r,i[n].head);if(!a||t.indexOf(a)%2!=0)return S.Pass}r.operation(function(){var e=r.lineSeparator()||"\n";r.replaceSelection(e+e,null),m(r,-1),i=r.listSelections();for(var t=0;t<i.length;t++){var n=i[t].head.line;r.indentLine(n,null,!0),r.indentLine(n+1,null,!0)}})}};function r(e){for(var t=0;t<e.length;t++){var n=e.charAt(t),r="'"+n+"'";i[r]||(i[r]=function(P){return function(e){var i=e,t=P,e=O(i);if(!e||i.getOption("disableInput"))return S.Pass;var n=y(e,"pairs"),r=n.indexOf(t);if(-1==r)return S.Pass;for(var a,o=y(e,"closeBefore"),s=y(e,"triples"),l=n.charAt(r+1)==t,c=i.listSelections(),h=r%2==0,f=0;f<c.length;f++){var u,d=c[f],p=d.head,g=i.getRange(p,k(p.line,p.ch+1));if(h&&!d.empty())u="surround";else if(!l&&h||g!=t)if(l&&1<p.ch&&0<=s.indexOf(t)&&i.getRange(k(p.line,p.ch-2),p)==t+t){if(2<p.ch&&/\bstring/.test(i.getTokenTypeAt(k(p.line,p.ch-2))))return S.Pass;u="addFour"}else if(l){d=0==p.ch?" ":i.getRange(k(p.line,p.ch-1),p);if(S.isWordChar(g)||d==t||S.isWordChar(d))return S.Pass;u="both"}else{if(!h||!(0===g.length||/\s/.test(g)||-1<o.indexOf(g)))return S.Pass;u="both"}else u=l&&function(e,t){var n=e.getTokenAt(k(t.line,t.ch+1));return/\bstring/.test(n.type)&&n.start==t.ch&&(0==t.ch||!/\bstring/.test(e.getTokenTypeAt(t)))}(i,p)?"both":0<=s.indexOf(t)&&i.getRange(p,k(p.line,p.ch+3))==t+t+t?"skipThree":"skip";if(a){if(a!=u)return S.Pass}else a=u}var v=r%2?n.charAt(r-1):t,b=r%2?t:n.charAt(r+1);i.operation(function(){if("skip"==a)m(i,1);else if("skipThree"==a)m(i,3);else if("surround"==a){for(var e=i.getSelections(),t=0;t<e.length;t++)e[t]=v+e[t]+b;i.replaceSelections(e,"around");for(e=i.listSelections().slice(),t=0;t<e.length;t++)e[t]=(n=e[t],r=void 0,r=0<S.cmpPos(n.anchor,n.head),{anchor:new k(n.anchor.line,n.anchor.ch+(r?-1:1)),head:new k(n.head.line,n.head.ch+(r?1:-1))});i.setSelections(e)}else"both"==a?(i.replaceSelection(v+b,null),i.triggerElectric(v+b),m(i,-1)):"addFour"==a&&(i.replaceSelection(v+v+v+v,"before"),m(i,1));var n,r})}}(n))}}function O(e){var t=e.state.closeBrackets;return t&&!t.override&&e.getModeAt(e.getCursor()).closeBrackets||t}function m(e,t){for(var n=[],r=e.listSelections(),i=0,a=0;a<r.length;a++){var o=r[a],o=(o.head==e.getCursor()&&(i=a),o.head.ch||0<t?{line:o.head.line,ch:o.head.ch+t}:{line:o.head.line-1});n.push({anchor:o,head:o})}e.setSelections(n,i)}function s(e,t){e=e.getRange(k(t.line,t.ch-1),k(t.line,t.ch+1));return 2==e.length?e:null}r(n.pairs+"`")});
|
||||
@@ -1,3 +1 @@
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
||||
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(i){var h=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),k=i.Pos,p={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function v(t){return t&&t.bracketRegex||/[(){}[\]]/}function u(t,e,n){var r=t.getLineHandle(e.line),i=e.ch-1,c=n&&n.afterCursor;null==c&&(c=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className));var a=v(n),o=!c&&0<=i&&a.test(r.text.charAt(i))&&p[r.text.charAt(i)]||a.test(r.text.charAt(i+1))&&p[r.text.charAt(++i)];if(!o)return null;var l=">"==o.charAt(1)?1:-1;if(n&&n.strict&&0<l!=(i==e.ch))return null;var s=t.getTokenTypeAt(k(e.line,i+1)),h=f(t,k(e.line,i+(0<l?1:0)),l,s||null,n);return null==h?null:{from:k(e.line,i),to:h&&h.pos,match:h&&h.ch==o.charAt(0),forward:0<l}}function f(t,e,n,r,i){for(var c=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,o=[],l=v(i),s=0<n?Math.min(e.line+a,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-a),h=e.line;h!=s;h+=n){var u=t.getLine(h);if(u){var f=0<n?0:u.length-1,m=0<n?u.length:-1;if(!(u.length>c))for(h==e.line&&(f=e.ch-(n<0?1:0));f!=m;f+=n){var g=u.charAt(f);if(l.test(g)&&(void 0===r||t.getTokenTypeAt(k(h,f+1))==r)){var d=p[g];if(d&&">"==d.charAt(1)==0<n)o.push(g);else{if(!o.length)return{pos:k(h,f),ch:g};o.pop()}}}}}return h-n!=(0<n?t.lastLine():t.firstLine())&&null}function e(t,e,n){for(var r=t.state.matchBrackets.maxHighlightLineLength||1e3,i=[],c=t.listSelections(),a=0;a<c.length;a++){var o,l=c[a].empty()&&u(t,c[a].head,n);l&&t.getLine(l.from.line).length<=r&&(o=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",i.push(t.markText(l.from,k(l.from.line,l.from.ch+1),{className:o})),l.to&&t.getLine(l.to.line).length<=r&&i.push(t.markText(l.to,k(l.to.line,l.to.ch+1),{className:o})))}if(i.length){h&&t.state.focused&&t.focus();function s(){t.operation(function(){for(var t=0;t<i.length;t++)i[t].clear()})}if(!e)return s;setTimeout(s,800)}}function c(t){t.operation(function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=e(t,!1,t.state.matchBrackets)})}i.defineOption("matchBrackets",!1,function(t,e,n){function r(t){t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)}n&&n!=i.Init&&(t.off("cursorActivity",c),t.off("focus",c),t.off("blur",r),r(t)),e&&(t.state.matchBrackets="object"==typeof e?e:{},t.on("cursorActivity",c),t.on("focus",c),t.on("blur",r))}),i.defineExtension("matchBrackets",function(){e(this,!0)}),i.defineExtension("findMatchingBracket",function(t,e,n){return!n&&"boolean"!=typeof e||(e=n?(n.strict=e,n):e?{strict:!0}:null),u(this,t,e)}),i.defineExtension("scanForBracket",function(t,e,n,r){return f(this,t,e,n,r)})});
|
||||
!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(r){var u=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),k=r.Pos,p={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function y(t){return t&&t.bracketRegex||/[(){}[\]]/}function f(t,e,n){var r=t.getLineHandle(e.line),i=e.ch-1,c=n&&n.afterCursor,a=(null==c&&(c=/(^| )cm-fat-cursor($| )/.test(t.getWrapperElement().className)),y(n)),c=!c&&0<=i&&a.test(r.text.charAt(i))&&p[r.text.charAt(i)]||a.test(r.text.charAt(i+1))&&p[r.text.charAt(++i)];if(!c)return null;a=">"==c.charAt(1)?1:-1;if(n&&n.strict&&0<a!=(i==e.ch))return null;r=t.getTokenTypeAt(k(e.line,i+1)),t=o(t,k(e.line,i+(0<a?1:0)),a,r,n);return null==t?null:{from:k(e.line,i),to:t&&t.pos,match:t&&t.ch==c.charAt(0),forward:0<a}}function o(t,e,n,r,i){for(var c=i&&i.maxScanLineLength||1e4,a=i&&i.maxScanLines||1e3,o=[],h=y(i),l=0<n?Math.min(e.line+a,t.lastLine()+1):Math.max(t.firstLine()-1,e.line-a),s=e.line;s!=l;s+=n){var u=t.getLine(s);if(u){var f=0<n?0:u.length-1,m=0<n?u.length:-1;if(!(u.length>c))for(s==e.line&&(f=e.ch-(n<0?1:0));f!=m;f+=n){var g=u.charAt(f);if(h.test(g)&&(void 0===r||(t.getTokenTypeAt(k(s,f+1))||"")==(r||""))){var d=p[g];if(d&&">"==d.charAt(1)==0<n)o.push(g);else{if(!o.length)return{pos:k(s,f),ch:g};o.pop()}}}}}return s-n!=(0<n?t.lastLine():t.firstLine())&&null}function e(t,e,n){for(var r=t.state.matchBrackets.maxHighlightLineLength||1e3,i=n&&n.highlightNonMatching,c=[],a=t.listSelections(),o=0;o<a.length;o++){var h,l=a[o].empty()&&f(t,a[o].head,n);l&&(l.match||!1!==i)&&t.getLine(l.from.line).length<=r&&(h=l.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",c.push(t.markText(l.from,k(l.from.line,l.from.ch+1),{className:h})),l.to&&t.getLine(l.to.line).length<=r&&c.push(t.markText(l.to,k(l.to.line,l.to.ch+1),{className:h})))}if(c.length){u&&t.state.focused&&t.focus();function s(){t.operation(function(){for(var t=0;t<c.length;t++)c[t].clear()})}if(!e)return s;setTimeout(s,800)}}function i(t){t.operation(function(){t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null),t.state.matchBrackets.currentlyHighlighted=e(t,!1,t.state.matchBrackets)})}function c(t){t.state.matchBrackets&&t.state.matchBrackets.currentlyHighlighted&&(t.state.matchBrackets.currentlyHighlighted(),t.state.matchBrackets.currentlyHighlighted=null)}r.defineOption("matchBrackets",!1,function(t,e,n){n&&n!=r.Init&&(t.off("cursorActivity",i),t.off("focus",i),t.off("blur",c),c(t)),e&&(t.state.matchBrackets="object"==typeof e?e:{},t.on("cursorActivity",i),t.on("focus",i),t.on("blur",c))}),r.defineExtension("matchBrackets",function(){e(this,!0)}),r.defineExtension("findMatchingBracket",function(t,e,n){return f(this,t,e=!n&&"boolean"!=typeof e?e:n?(n.strict=e,n):e?{strict:!0}:null)}),r.defineExtension("scanForBracket",function(t,e,n,r){return o(this,t,e,n,r)})});
|
||||
Reference in New Issue
Block a user