mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-07 00:56:48 +01:00
Refining Prettier use a littl
This commit is contained in:
@@ -18,8 +18,6 @@ var ICEcoder = {
|
||||
minFilesW: 14, // Min width of files pane
|
||||
maxFilesW: 250, // Max width of files pane
|
||||
selectedTab: 0, // The tab that's currently selected
|
||||
selectedTabFileExt: '', // File extension of selected tab
|
||||
selectedTabLangMode: '', // Language mode of selected tab
|
||||
savedPoints: [], // Ints array to indicate save points for docs
|
||||
savedContents: [], // Array of last known saved contents
|
||||
canSwitchTabs: true, // Stops switching of tabs when trying to close
|
||||
@@ -1998,9 +1996,11 @@ var ICEcoder = {
|
||||
|
||||
// Save a file
|
||||
saveFile: function(saveAs, newFileAutoSave) {
|
||||
let changes, saveType, filePath, pathPrefix;
|
||||
if ("undefined" !== typeof prettier && ["js", "json", "ts", "css", "scss", "less", "html", "xml", "yaml", "md", "php"].indexOf(this.selectedTabFileExt) > -1) {
|
||||
switch (this.selectedTabFileExt) {
|
||||
let changes, saveType, filePath, fileExt, pathPrefix;
|
||||
filePath = this.openFiles[this.selectedTab - 1];
|
||||
fileExt = filePath.substr(filePath.lastIndexOf(".") + 1);
|
||||
if ("undefined" !== typeof prettier && ["js", "json", "ts", "css", "scss", "less", "html", "xml", "yaml", "md", "php"].indexOf(fileExt) > -1) {
|
||||
switch (fileExt) {
|
||||
case "js": parser = "babel"; break;
|
||||
case "json": parser = "json"; break;
|
||||
case "ts": parser = "typescript"; break;
|
||||
|
||||
@@ -298,8 +298,6 @@ parent.ICEcoder.switchMode = function(mode) {
|
||||
}
|
||||
} else if (cM && fileName) {
|
||||
<?php include(dirname(__FILE__) . "/assets/js/language-modes-partial.js");?>
|
||||
parent.ICEcoder.selectedTabFileExt = fileExt;
|
||||
parent.ICEcoder.selectedTabLangMode = mode;
|
||||
if (mode != cM.getOption("mode")) {
|
||||
cM.setOption("mode", mode);
|
||||
cM.setOption("lint", ("js" === fileExt || "json" === fileExt) && parent.ICEcoder.codeAssist ? true : false);
|
||||
|
||||
@@ -87,7 +87,13 @@ $t = $text['index'];
|
||||
</script>
|
||||
<script language="JavaScript" src="<?php echo $iceURLPath;?>/assets/js/icecoder.js?microtime=<?php echo microtime(true);?>"></script>
|
||||
<?php
|
||||
if (true === file_exists(dirname(__FILE__) . "/plugins/prettier/standalone.js")) {
|
||||
$havePrettier = false;
|
||||
foreach ($ICEcoder['plugins'] as $plugin) {
|
||||
if ("Prettier" === $plugin[0]) {
|
||||
$havePrettier = true;
|
||||
}
|
||||
}
|
||||
if (true === $havePrettier && true === file_exists(dirname(__FILE__) . "/plugins/prettier/standalone.js")) {
|
||||
?>
|
||||
<script language="JavaScript" src="<?php echo $iceURLPath;?>/plugins/prettier/standalone.js?microtime=<?php echo microtime(true);?>"></script>
|
||||
<script language="JavaScript" src="<?php echo $iceURLPath;?>/plugins/prettier/parser-babel.js?microtime=<?php echo microtime(true);?>"></script>
|
||||
|
||||
Reference in New Issue
Block a user