|
|
@ -4,9 +4,6 @@ const EventEmitter = require('events') |
|
|
|
|
|
|
|
|
|
|
|
require('remix-tabs') |
|
|
|
require('remix-tabs') |
|
|
|
|
|
|
|
|
|
|
|
var styles = require('./styles/editor-panel-styles') |
|
|
|
|
|
|
|
var css = styles.css |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export class TabProxy { |
|
|
|
export class TabProxy { |
|
|
|
constructor (fileManager, editor, appStore, appManager) { |
|
|
|
constructor (fileManager, editor, appStore, appManager) { |
|
|
|
this.event = new EventEmitter() |
|
|
|
this.event = new EventEmitter() |
|
|
@ -103,22 +100,16 @@ export class TabProxy { |
|
|
|
this._view.filetabs.canAdd = false |
|
|
|
this._view.filetabs.canAdd = false |
|
|
|
|
|
|
|
|
|
|
|
this._view.tabs = yo` |
|
|
|
this._view.tabs = yo` |
|
|
|
<div class=${css.tabs} onmouseenter=${toggleScrollers} onmouseleave=${toggleScrollers}> |
|
|
|
<div> |
|
|
|
<div onclick=${scrollLeft} class="${css.scroller} ${css.hide} ${css.scrollerleft}"> |
|
|
|
|
|
|
|
<i class="fa fa-chevron-left "></i> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
${this._view.filetabs} |
|
|
|
${this._view.filetabs} |
|
|
|
<div onclick=${scrollRight} class="${css.scroller} ${css.hide} ${css.scrollerright}"> |
|
|
|
|
|
|
|
<i class="fa fa-chevron-right "></i> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
` |
|
|
|
` |
|
|
|
let tabsbar = yo` |
|
|
|
let tabsbar = yo` |
|
|
|
<div class=${css.tabsbar}> |
|
|
|
<div class="d-flex"> |
|
|
|
<div class=${css.buttons}> |
|
|
|
<div class="m-1"> |
|
|
|
<span class=${css.changeeditorfontsize} > |
|
|
|
<span class="p-1"> |
|
|
|
<i class="increditorsize fa fa-plus" onclick=${increase} aria-hidden="true" title="increase editor font size"></i> |
|
|
|
<i class="m-1 fa fa-plus" onclick=${increase} aria-hidden="true" title="increase editor font size"></i> |
|
|
|
<i class="decreditorsize fa fa-minus" onclick=${decrease} aria-hidden="true" title="decrease editor font size"></i> |
|
|
|
<i class="m-1 fa fa-minus" onclick=${decrease} aria-hidden="true" title="decrease editor font size"></i> |
|
|
|
</span> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
${this._view.tabs} |
|
|
|
${this._view.tabs} |
|
|
@ -145,68 +136,8 @@ export class TabProxy { |
|
|
|
return false |
|
|
|
return false |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
function toggleScrollers (event = {}) { |
|
|
|
|
|
|
|
if (event.type) self.data._focus = event.type |
|
|
|
|
|
|
|
var isMouseEnter = self.data._focus === 'mouseenter' |
|
|
|
|
|
|
|
var leftArrow = this.children[0] |
|
|
|
|
|
|
|
var rightArrow = this.children[2] |
|
|
|
|
|
|
|
if (isMouseEnter && this.children[1].offsetWidth > this.offsetWidth) { |
|
|
|
|
|
|
|
var hiddenLength = self._view.filetabs.offsetWidth - self._view.tabs.offsetWidth |
|
|
|
|
|
|
|
var currentLeft = self._view.filetabs.offsetLeft || 0 |
|
|
|
|
|
|
|
var hiddenRight = hiddenLength + currentLeft |
|
|
|
|
|
|
|
if (currentLeft < 0) { |
|
|
|
|
|
|
|
leftArrow.classList.add(css.show) |
|
|
|
|
|
|
|
leftArrow.classList.remove(css.hide) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (hiddenRight > 0) { |
|
|
|
|
|
|
|
rightArrow.classList.add(css.show) |
|
|
|
|
|
|
|
rightArrow.classList.remove(css.hide) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
leftArrow.classList.remove(css.show) |
|
|
|
|
|
|
|
leftArrow.classList.add(css.hide) |
|
|
|
|
|
|
|
rightArrow.classList.remove(css.show) |
|
|
|
|
|
|
|
rightArrow.classList.add(css.hide) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function increase () { self.editor.editorFontSize(1) } |
|
|
|
function increase () { self.editor.editorFontSize(1) } |
|
|
|
function decrease () { self.editor.editorFontSize(-1) } |
|
|
|
function decrease () { self.editor.editorFontSize(-1) } |
|
|
|
function scrollLeft (event) { |
|
|
|
|
|
|
|
var leftArrow = this |
|
|
|
|
|
|
|
var rightArrow = this.nextElementSibling.nextElementSibling |
|
|
|
|
|
|
|
var currentLeft = self._view.filetabs.offsetLeft || 0 |
|
|
|
|
|
|
|
if (currentLeft < 0) { |
|
|
|
|
|
|
|
rightArrow.classList.add(css.show) |
|
|
|
|
|
|
|
rightArrow.classList.remove(css.hide) |
|
|
|
|
|
|
|
if (currentLeft < -self.data._FILE_SCROLL_DELTA) { |
|
|
|
|
|
|
|
self._view.filetabs.style.left = `${currentLeft + self.data._FILE_SCROLL_DELTA}px` |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
self._view.filetabs.style.left = `${currentLeft - currentLeft}px` |
|
|
|
|
|
|
|
leftArrow.classList.remove(css.show) |
|
|
|
|
|
|
|
leftArrow.classList.add(css.hide) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function scrollRight (event) { |
|
|
|
|
|
|
|
var rightArrow = this |
|
|
|
|
|
|
|
var leftArrow = this.previousElementSibling.previousElementSibling |
|
|
|
|
|
|
|
var hiddenLength = self._view.filetabs.offsetWidth - self._view.tabs.offsetWidth |
|
|
|
|
|
|
|
var currentLeft = self._view.filetabs.offsetLeft || 0 |
|
|
|
|
|
|
|
var hiddenRight = hiddenLength + currentLeft |
|
|
|
|
|
|
|
if (hiddenRight > 0) { |
|
|
|
|
|
|
|
leftArrow.classList.add(css.show) |
|
|
|
|
|
|
|
leftArrow.classList.remove(css.hide) |
|
|
|
|
|
|
|
if (hiddenRight > self.data._FILE_SCROLL_DELTA) { |
|
|
|
|
|
|
|
self._view.filetabs.style.left = `${currentLeft - self.data._FILE_SCROLL_DELTA}px` |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
self._view.filetabs.style.left = `${currentLeft - hiddenRight}px` |
|
|
|
|
|
|
|
rightArrow.classList.remove(css.show) |
|
|
|
|
|
|
|
rightArrow.classList.add(css.hide) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return tabsbar |
|
|
|
return tabsbar |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|