Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return ret;
}
else if (shiftKey) {
// enable split view ONLY for code editors for now...
if (!this.isSupportedEditor(activePage.$editor, page.$editor))
return;
// tabs can be merged into and unmerged from a splitview by clicking a
// tab while holding shift
//console.log("is clone?",apf.isTrue(page.$doc.getNode().getAttribute("clone")));
if (apf.isTrue(page.$doc.getNode().getAttribute("clone"))) {
tabs.remove(page, null, true);
ret = false;
}
else {
ret = !splits.mutate(split, page);
this.save();
}
return ret;
}
},
return;
// tabs can be merged into and unmerged from a splitview by clicking a
// tab while holding shift
//console.log("is clone?",apf.isTrue(page.$doc.getNode().getAttribute("clone")));
if (split && apf.isTrue(page.$doc.getNode().getAttribute("clone"))) {
// close the page that contains the clone editor
var cloneEditor = Splits.getCloneEditor(page);
for (i = 0, l = split.pairs.length; i < l; ++i) {
if (split.pairs[i].editor !== cloneEditor)
continue;
tabs.remove(split.pairs[i].page, null, true);
return false;
}
}
else {
ret = !Splits.mutate(split, page);
this.save();
}
return ret;
}
},
// if the max amount of tabs has been reached inside a split view,
// then the user may remove the last or first tab from it.
idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
}
else {
var currIdx = pages.indexOf(curr);
idx = currIdx + (bRight ? 1 : -1);
}
if (idx < 0 || idx > pages.length - 1)
return;
// enable split view ONLY for code editors for now...
if (!this.isSupportedEditor(curr.$editor, pages[idx].$editor))
return;
// pass in null to mutate the active split view
splits.mutate(null, pages[idx]);
splits.update();
this.save();
return false;
},
// if the max amount of tabs has been reached inside a split view,
// then the user may remove the last or first tab from it.
idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
}
else {
var currIdx = pages.indexOf(curr);
idx = currIdx + (bRight ? 1 : -1);
}
if (idx < 0 || idx > pages.length - 1)
return;
// enable split view ONLY for code editors for now...
if (!this.isSupportedEditor(curr.$editor, pages[idx].$editor))
return;
// pass in null to mutate the active split view
Splits.mutate(null, pages[idx]);
Splits.update(Splits.getActive());
this.save();
return false;
},
tabs.set(split.pairs[0].page);
ret = false;
}
if (!shiftKey)
return true;
return ret;
}
else if (shiftKey) {
// enable split view ONLY for code editors for now...
if (page.$editor.name.indexOf("Code Editor") == -1)
return;
// tabs can be merged into and unmerged from a splitview by clicking a
// tab while holding shift
ret = !Splits.mutate(split, page);
this.save();
return ret;
}
},
// if the max amount of tabs has been reached inside a split view,
// then the user may remove the last or first tab from it.
idx = pages.indexOf(split.pairs[bRight ? splitLen - 1 : 0].page);
}
else {
var currIdx = pages.indexOf(curr);
idx = currIdx + (bRight ? 1 : -1);
}
if (idx < 0 || idx > pages.length - 1)
return;
// enable split view ONLY for code editors for now...
if (pages[idx].$editor.name.indexOf("Code Editor") == -1)
return;
// pass in null to mutate the active split view
Splits.mutate(null, pages[idx]);
Splits.update();
this.save();
return false;
},
onFileClose: function(e) {
var page = e.page;
var splits = Splits.get(page);
for (var i = 0, l = splits.length; i < l; ++i)
Splits.mutate(splits[i], page);
this.save();
},
fake.setAttribute("tooltip", "[@path]");
fake.setAttribute("class",
"{parseInt([@saving], 10) || parseInt([@lookup], 10) ? (tabEditors.getPage(tabEditors.activepage) == this ? 'saving_active' : 'saving') : \
([@loading] ? (tabEditors.getPage(tabEditors.activepage) == this ? 'loading_active' : 'loading') : '')}"
);
fake.setAttribute("model", fake.$model = page.$model);
page.addEventListener("DOMNodeRemovedFromDocument", function(e) {
if (typeof tabEditors == "undefined" || !fake || !fake.parentNode)
return;
tabEditors.remove(fake);
});
Editors.initEditorEvents(fake, page.$model);
Splits.mutate(null, fake);
split = Splits.get(fake)[0];
split.clone = fake;
Splits.update(split);
this.save();
return fake;
},
if (page) {
if (!pageSet) {
tabs.set(page);
pageSet = true;
}
this.startCloneView(page);
}
}
else {
page = tabs.getPage(ids[j]);
if (page) {
if (!pageSet) {
tabs.set(page);
pageSet = true;
}
Splits.mutate(null, page);
}
}
}
if (gridLayout)
Splits.update(null, gridLayout);
if (apf.isTrue(nodes[i].getAttribute("active")))
active = Splits.getActive();
}
if (!active || Splits.indexOf(active, activePage) == -1)
tabs.set(activePage);
else
Splits.show(active);
},
onFileClose: function(e) {
var page = e.page;
var splits = Splits.get(page);
for (var i = 0, l = splits.length; i < l; ++i)
Splits.mutate(splits[i], page);
Splits.update();
this.save();
},