|
|
@ -2,9 +2,16 @@ var yo = require('yo-yo') |
|
|
|
var $ = require('jquery') |
|
|
|
var $ = require('jquery') |
|
|
|
const EventEmitter = require('events') |
|
|
|
const EventEmitter = require('events') |
|
|
|
const globalRegistry = require('../../global/registry') |
|
|
|
const globalRegistry = require('../../global/registry') |
|
|
|
|
|
|
|
const csjs = require('csjs-inject') |
|
|
|
|
|
|
|
|
|
|
|
require('remix-tabs') |
|
|
|
require('remix-tabs') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const css = csjs` |
|
|
|
|
|
|
|
.remix_tabs div[title]{ |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
` |
|
|
|
|
|
|
|
|
|
|
|
export class TabProxy { |
|
|
|
export class TabProxy { |
|
|
|
constructor (fileManager, editor, appManager) { |
|
|
|
constructor (fileManager, editor, appManager) { |
|
|
|
this.event = new EventEmitter() |
|
|
|
this.event = new EventEmitter() |
|
|
@ -140,11 +147,10 @@ export class TabProxy { |
|
|
|
const tabPath = slash.reverse() |
|
|
|
const tabPath = slash.reverse() |
|
|
|
const tempTitle = [] |
|
|
|
const tempTitle = [] |
|
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i < tabPath.length; i++) { |
|
|
|
if(!title) { |
|
|
|
tempTitle.push(tabPath[i]) |
|
|
|
for(let i = 0; i < tabPath.length; i++) { |
|
|
|
const formatPath = [...tempTitle].reverse() |
|
|
|
tempTitle.push(tabPath[i]) |
|
|
|
|
|
|
|
const formatPath = [...tempTitle].reverse() |
|
|
|
if(!title) { |
|
|
|
|
|
|
|
const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/')) |
|
|
|
const index = this.loadedTabs.findIndex(({ title }) => title === formatPath.join('/')) |
|
|
|
|
|
|
|
|
|
|
|
if (index === -1) { |
|
|
|
if (index === -1) { |
|
|
@ -175,12 +181,12 @@ export class TabProxy { |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
this.loadedTabs.push({ |
|
|
|
|
|
|
|
name, |
|
|
|
|
|
|
|
title |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.loadedTabs.push({ |
|
|
|
|
|
|
|
name, |
|
|
|
|
|
|
|
title |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this._view.filetabs.addTab({ |
|
|
|
this._view.filetabs.addTab({ |
|
|
@ -213,7 +219,7 @@ export class TabProxy { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
renderTabsbar () { |
|
|
|
renderTabsbar () { |
|
|
|
this._view.filetabs = yo`<remix-tabs></remix-tabs>` |
|
|
|
this._view.filetabs = yo`<remix-tabs class=${css.remix_tabs}></remix-tabs>` |
|
|
|
this._view.filetabs.addEventListener('tabClosed', (event) => { |
|
|
|
this._view.filetabs.addEventListener('tabClosed', (event) => { |
|
|
|
if (this._handlers[event.detail]) this._handlers[event.detail].close() |
|
|
|
if (this._handlers[event.detail]) this._handlers[event.detail].close() |
|
|
|
this.event.emit('tabCountChanged', this._view.filetabs.tabs.length) |
|
|
|
this.event.emit('tabCountChanged', this._view.filetabs.tabs.length) |
|
|
|