From b9d5741cf71451abf4c9171b481760e4a590bb51 Mon Sep 17 00:00:00 2001 From: Ryan Hecht Date: Thu, 2 May 2024 15:18:55 +0000 Subject: [PATCH 1/3] Add Groovy syntax highlighting support --- client/pages/viewerpage/editor.js | 3 ++- client/pages/viewerpage/editor/groovy.js | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 client/pages/viewerpage/editor/groovy.js diff --git a/client/pages/viewerpage/editor.js b/client/pages/viewerpage/editor.js index 3ebd5333b..215636bd6 100644 --- a/client/pages/viewerpage/editor.js +++ b/client/pages/viewerpage/editor.js @@ -211,7 +211,8 @@ export class EditorClass extends React.Component { else if (ext === "sparql") mode = "sparql"; else if (ext === "properties") mode = "properties"; else if (ext === "c" || ext === "cpp" || ext === "java" || ext === "h") mode = "clike"; - else mode = "text"; + else if (ext === "groovy" || ext === "gvy" || ext === "gy" || ext === "gsh") mode = "groovy"; + else mode = "text"; return import(/* webpackChunkName: "editor" */"./editor/"+mode) .catch(() => import("./editor/text")) diff --git a/client/pages/viewerpage/editor/groovy.js b/client/pages/viewerpage/editor/groovy.js new file mode 100644 index 000000000..98c03ec01 --- /dev/null +++ b/client/pages/viewerpage/editor/groovy.js @@ -0,0 +1,3 @@ +import "codemirror/mode/groovy/groovy"; +CodeMirror.__mode = "groovy"; +export default CodeMirror; From 0e7f3ed138c4b27d0403a1bfef3ed39cf10aedb6 Mon Sep 17 00:00:00 2001 From: Ryan Hecht Date: Thu, 2 May 2024 11:24:58 -0400 Subject: [PATCH 2/3] Add Groovy syntax highlighting support --- client/pages/viewerpage/editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/pages/viewerpage/editor.js b/client/pages/viewerpage/editor.js index 215636bd6..30a5501b4 100644 --- a/client/pages/viewerpage/editor.js +++ b/client/pages/viewerpage/editor.js @@ -211,8 +211,8 @@ export class EditorClass extends React.Component { else if (ext === "sparql") mode = "sparql"; else if (ext === "properties") mode = "properties"; else if (ext === "c" || ext === "cpp" || ext === "java" || ext === "h") mode = "clike"; - else if (ext === "groovy" || ext === "gvy" || ext === "gy" || ext === "gsh") mode = "groovy"; - else mode = "text"; + else if (ext === "groovy" || ext === "gvy" || ext === "gy" || ext === "gsh") mode = "groovy"; + else mode = "text"; return import(/* webpackChunkName: "editor" */"./editor/"+mode) .catch(() => import("./editor/text")) From 7d2d36670762955236684657056f9bd844d25d2a Mon Sep 17 00:00:00 2001 From: Ryan Hecht Date: Fri, 3 May 2024 03:31:33 +0000 Subject: [PATCH 3/3] Add Groovy syntax highlighting via CodeMirror --- public/assets/pages/viewerpage/application_editor.js | 1 + public/assets/pages/viewerpage/application_editor/groovy.js | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 public/assets/pages/viewerpage/application_editor/groovy.js diff --git a/public/assets/pages/viewerpage/application_editor.js b/public/assets/pages/viewerpage/application_editor.js index 815ff7035..2485220ab 100644 --- a/public/assets/pages/viewerpage/application_editor.js +++ b/public/assets/pages/viewerpage/application_editor.js @@ -266,6 +266,7 @@ function loadMode(ext) { else if (ext === "properties") mode = "properties"; else if (ext === "c" || ext === "cpp" || ext === "h") mode = "clike"; else if (ext === "java") mode = "java"; + else if (ext === "groovy" || ext === "gvy" || ext === "gy" || ext === "gsh") mode = "groovy"; return before.then(() => loadJS(import.meta.url, `./application_editor/${mode}.js`, { type: "module" })) .catch(() => loadJS(import.meta.url, "./application_editor/text.js", { type: "module" })) diff --git a/public/assets/pages/viewerpage/application_editor/groovy.js b/public/assets/pages/viewerpage/application_editor/groovy.js new file mode 100644 index 000000000..146fbf298 --- /dev/null +++ b/public/assets/pages/viewerpage/application_editor/groovy.js @@ -0,0 +1,3 @@ +import "../../../lib/vendor/codemirror/mode/groovy/groovy.js"; +window.CodeMirror.__mode = "groovy"; +export default window.CodeMirror;