1
0
Fork 0
mirror of https://github.com/overleaf/overleaf.git synced 2025-04-23 08:57:51 +00:00

Merge pull request from sharelatex/ns-tikz-highlight

Better TikZ support

GitOrigin-RevId: 963853cea4e3bdd9046b5b44b5719cc1a82ece5f
This commit is contained in:
Chrystal Maria Griffiths 2019-02-04 11:08:52 +00:00 committed by sharelatex
parent 210e2700a9
commit 11b6ae0982
2 changed files with 6 additions and 35 deletions
services/web/public/src/ide
editor/directives
files/services

View file

@ -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)) {

View file

@ -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
}
}