From 6a7c0194eb9b0814a1ce9c5a1fafb1663007331d Mon Sep 17 00:00:00 2001 From: JensLincke Date: Thu, 13 Jun 2024 15:19:04 +0200 Subject: [PATCH] apply cm5 lively4 patches SQUASHED: AUTO-COMMIT-src-external-code-mirror-lib-codemirror.js,AUTO-COMMIT-src-external-code-mirror-mode-htmlmixed-htmlmixed.js,AUTO-COMMIT-src-external-code-mirror-mode-markdown-markdown.js, --- src/external/code-mirror/lib/codemirror.js | 3 +++ .../code-mirror/mode/htmlmixed/htmlmixed.js | 6 +++--- .../code-mirror/mode/markdown/markdown.js | 15 ++++++++------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/external/code-mirror/lib/codemirror.js b/src/external/code-mirror/lib/codemirror.js index 7687cd053..94c97350f 100644 --- a/src/external/code-mirror/lib/codemirror.js +++ b/src/external/code-mirror/lib/codemirror.js @@ -9877,6 +9877,9 @@ addLegacyProps(CodeMirror); + // Lively Hacks + CodeMirror.posToDOM = posToDOM + CodeMirror.version = "5.65.16"; return CodeMirror; diff --git a/src/external/code-mirror/mode/htmlmixed/htmlmixed.js b/src/external/code-mirror/mode/htmlmixed/htmlmixed.js index 3f6d8b7d7..f3c2fba41 100644 --- a/src/external/code-mirror/mode/htmlmixed/htmlmixed.js +++ b/src/external/code-mirror/mode/htmlmixed/htmlmixed.js @@ -3,7 +3,7 @@ (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css")); + mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../jsx/jsx"), require("../css/css")); else if (typeof define == "function" && define.amd) // AMD define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod); else // Plain browser env @@ -13,8 +13,8 @@ var defaultTags = { script: [ - ["lang", /(javascript|babel)/i, "javascript"], - ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"], + ["lang", /(javascript|babel)/i, "jsx"], + ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "jsx"], ["type", /./, "text/plain"], [null, null, "javascript"] ], diff --git a/src/external/code-mirror/mode/markdown/markdown.js b/src/external/code-mirror/mode/markdown/markdown.js index 6eef54427..d65540de8 100644 --- a/src/external/code-mirror/mode/markdown/markdown.js +++ b/src/external/code-mirror/mode/markdown/markdown.js @@ -285,13 +285,14 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { var style = htmlMode.token(stream, state.htmlState); if (!htmlModeMissing) { var inner = CodeMirror.innerMode(htmlMode, state.htmlState) - if ((inner.mode.name == "xml" && inner.state.tagStart === null && - (!inner.state.context && inner.state.tokenize.isInText)) || - (state.md_inside && stream.current().indexOf(">") > -1)) { - state.f = inlineNormal; - state.block = blockNormal; - state.htmlState = null; - } + // #JSX in Script tag requires to disable this + // if ((inner.mode.name == "xml" && inner.state.tagStart === null && + // (!inner.state.context && inner.state.tokenize.isInText)) || + // (state.md_inside && stream.current().indexOf(">") > -1)) { + // state.f = inlineNormal; + // state.block = blockNormal; + // state.htmlState = null; + // } } return style; }