Răsfoiți Sursa

Merge pull request #1457 from sharelatex/ns-tikz-highlight

Better TikZ support

GitOrigin-RevId: 963853cea4e3bdd9046b5b44b5719cc1a82ece5f
Chrystal Maria Griffiths 7 ani în urmă
părinte
comite
11b6ae0982

+ 1 - 1
services/web/public/src/ide/editor/directives/aceEditor.js

@@ -700,7 +700,7 @@ define([
           // see if we can lookup a suitable mode from ace
           // but fall back to text by default
           try {
-            if (/\.(Rtex|bbl)$/i.test(scope.fileName)) {
+            if (/\.(Rtex|bbl|tikz)$/i.test(scope.fileName)) {
               // recognise Rtex and bbl as latex
               mode = 'ace/mode/latex'
             } else if (/\.(sty|cls|clo)$/.test(scope.fileName)) {

+ 5 - 34
services/web/public/src/ide/files/services/files.js

@@ -1,50 +1,21 @@
-/* eslint-disable
-    max-len,
-    no-undef,
-*/
-// TODO: This file was created by bulk-decaffeinate.
-// Fix any style issues and re-enable lint.
-/*
- * decaffeinate suggestions:
- * DS102: Remove unnecessary code created because of implicit returns
- * DS103: Rewrite code to no longer use __guard__
- * DS207: Consider shorter variations of null checks
- * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
- */
+/* global _ */
 define(['base'], App =>
   App.factory('files', function(ide) {
     const Files = {
       getTeXFiles() {
-        const texFiles = []
-        ide.fileTreeManager.forEachEntity(function(entity, folder, path) {
+        let texFiles = []
+        ide.fileTreeManager.forEachEntity(function(entity, _folder, path) {
           if (
             entity.type === 'doc' &&
-            __guardMethod__(
-              entity != null ? entity.name : undefined,
-              'match',
-              o => o.match(/.*\.(tex|txt|md)/)
-            )
+            /.*\.(tex|md|txt|tikz)/.test(entity.name)
           ) {
             const cloned = _.clone(entity)
             cloned.path = path
-            return texFiles.push(cloned)
+            texFiles.push(cloned)
           }
         })
         return texFiles
       }
     }
-
     return Files
   }))
-
-function __guardMethod__(obj, methodName, transform) {
-  if (
-    typeof obj !== 'undefined' &&
-    obj !== null &&
-    typeof obj[methodName] === 'function'
-  ) {
-    return transform(obj, methodName)
-  } else {
-    return undefined
-  }
-}