Example #1
0
        $( '#fileCreateConfirmButton' ).click(function() {
            var fileTags = "";
            var rawTags = $( "#newFileNameTags" ).val().split(",");

            rawTags.forEach(function (value, index) {
                if(index == 0) {
                    fileTags = value;
                } else {
                    fileTags = fileTags + TSCORE.Config.getTagDelimiter() + value;
                }
            });

            if($("#tagWithCurrentDate").prop("checked")) {
                if(fileTags.length < 1) {
                    fileTags = TSCORE.TagUtils.formatDateTime4Tag(new Date());
                } else {
                    fileTags = fileTags + TSCORE.Config.getTagDelimiter() + TSCORE.TagUtils.formatDateTime4Tag(new Date());
                }
            }

            if(fileTags.length > 0) {
                fileTags = TSCORE.TagUtils.beginTagContainer + fileTags + TSCORE.TagUtils.endTagContainer;
            }

            var fileName = TSCORE.currentPath+TSCORE.dirSeparator+$( "#newFileName" ).val()+fileTags+"."+fileType;

            TSCORE.IO.saveTextFile(fileName,fileContent);
            
            // TODO move this functionality to postio
            TSCORE.IO.listDirectory(TSCORE.currentPath);
        });
Example #2
0
 function() {
     $("#saveDocument").hide();
     $("#editDocument").show();      
     var content = _tsEditor.getContent();
     TSCORE.IO.saveTextFile(_openedFilePath, content);
     _isEditMode = false;              
 }
Example #3
0
 var createTXTFile = function() {
     var filePath = TSCORE.currentPath+
                    TSCORE.dirSeparator+
                    TSCORE.TagUtils.beginTagContainer+
                    TSCORE.TagUtils.formatDateTime4Tag(new Date(), true)+
                    TSCORE.TagUtils.endTagContainer+".txt";
     TSCORE.IO.saveTextFile(filePath,TSCORE.Config.getNewTextFileContent());
 };
Example #4
0
 function saveFile() {
   console.log('Save current file: ' + _openedFilePath);
   var content = _tsEditor.getContent();
   /*var title = TSCORE.TagUtils.extractTitle(_openedFilePath);
       if(title.length < 1 && content.length > 1) {
           title = content.substring(0,content.indexOf("\n"));
           if(title.length > 100) {
               title = title.substring(0,99);
           }
       }*/
   TSCORE.IO.saveTextFile(_openedFilePath, content);
 }
Example #5
0
 $('#fileCreateConfirmButton').click(function() {
   var fileTags = '';
   var rawTags = $('#newFileNameTags').val().split(',');
   rawTags.forEach(function(value, index) {
     if (index === 0) {
       fileTags = value;
     } else {
       fileTags = fileTags + TSCORE.Config.getTagDelimiter() + value;
     }
   });
   if ($('#tagWithCurrentDate').prop('checked')) {
     if (fileTags.length < 1) {
       fileTags = TSCORE.TagUtils.formatDateTime4Tag(new Date());
     } else {
       fileTags = fileTags + TSCORE.Config.getTagDelimiter() + TSCORE.TagUtils.formatDateTime4Tag(new Date());
     }
   }
   if (fileTags.length > 0) {
     fileTags = TSCORE.TagUtils.beginTagContainer + fileTags + TSCORE.TagUtils.endTagContainer;
   }
   var filePath = TSCORE.currentPath + TSCORE.dirSeparator + $('#newFileName').val() + fileTags + '.' + fileType;
   TSCORE.IO.saveTextFile(filePath, fileContent);
 });
Example #6
0
 function saveFile() {
     console.log("Save current file: "+_openedFilePath);
     var content = _tsEditor.getContent();
     TSCORE.IO.saveTextFile(_openedFilePath, content);
 }