files.js 532 B

12345678910111213141516171819202122
  1. import _ from 'lodash'
  2. import App from '../../../base'
  3. export default App.factory('files', function (ide) {
  4. const Files = {
  5. getTeXFiles() {
  6. const texFiles = []
  7. ide.fileTreeManager.forEachEntity(function (entity, _folder, path) {
  8. if (
  9. entity.type === 'doc' &&
  10. /.*\.(tex|md|txt|tikz)/.test(entity.name)
  11. ) {
  12. const cloned = _.clone(entity)
  13. cloned.path = path
  14. texFiles.push(cloned)
  15. }
  16. })
  17. return texFiles
  18. },
  19. }
  20. return Files
  21. })