Commit c4a74659 authored by Matthieu Le Corre's avatar Matthieu Le Corre
Browse files

Fix scrolling issue and mindmap navigation


Signed-off-by: Matthieu Le Corre's avatarMatthieu Le Corre <matthieu.lecorre@univ-nantes.fr>
parent df4754c2
node_modules
.vscode/
\ No newline at end of file
## 1.0.3 NOT RELEASED YET
### Fix
- Fix scroll problem with long file list
[#12] (https://gitlab.univ-nantes.fr/uncloud/files_readmemd/issues/12#)
- Fix Mindmap navigation break
[#10] (https://gitlab.univ-nantes.fr/uncloud/files_readmemd/issues/10#)
- Fix ui bug when using table and selecting files
[#9] (https://gitlab.univ-nantes.fr/uncloud/files_readmemd/issues/9#)
### Changed
- Do not hide HEADER.md anymore when selecting file.
## 1.0.2 09-04-2019
### Added
- check for dot file, and prefer them ( .HEADER.md & .README.md)
......
......@@ -17,10 +17,6 @@
text-align: initial ;
}
.down {
margin-top:70px ;
}
.headermd ul,
.readmemd ul
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,101 +8,115 @@ OCA.ReadmeMD = {};
*/
OCA.ReadmeMD.App = {
/**
* Holds the MDs objects
*/
/**
* Holds the MDs objects
*/
header: null,
readme: null,
/**
* Setup on page load
*/
initialize: function (header,readme,mode) {
var self = this ;
/**
* Setup on page load
*/
initialize: function (header,readme,mode) {
var self = this ;
//public share or private view
this.mode = mode ;
// container creation
this.header = header;
this.readme = readme;
this.createContainer(this.header) ;
this.createContainer(this.readme) ;
// trigger on filetable to check if README/HEADER are present
$("#filestable").on('updated',function() { self.checkMD() ; })
// trigger on hide filetable to prevent showing in trash favorite recent ...
// we need mutationobserver for that !
var observer = new MutationObserver(
function(mutations) {
mutations.forEach(function(mutation){
if (mutation.attributeName === 'class') {
if ($(mutation.target).hasClass("hidden")) {
self.header.container.addClass("hidden") ;
self.readme.container.addClass("hidden") ;
} else {
self.header.container.removeClass("hidden") ;
self.readme.container.removeClass("hidden") ;
}
}
});
}
)
//public share or private view
this.mode = mode ;
observer.observe($('#app-content-files')[0],{
attributes: true
})
},
// container creation
this.header = header;
this.readme = readme;
this.createContainer(this.header) ;
this.createContainer(this.readme) ;
/**
* check MD handler
*/
checkMD: function() {
// trigger on filetable to check if README/HEADER are present
$("#filestable").on('updated',function() { self.checkMD() ; })
//trigger on multiselect to handle the infamous fixed position toolsbar
$("#filestable").on('updated',function() {
$("#filestable input:checkbox").change(function() {
self.handleMultiselect() ;
});
//cleanup "old" MDs before checking for new ones
this.header.container.addClass("hidden") ;
this.header.container.children().remove() ;
this.header.content= null ;
});
this.readme.container.addClass("hidden") ;
this.readme.container.children().remove() ;
this.readme.content = null ;
},
if (this.mode == "public") {
var FL = OCA.Sharing.PublicApp.fileList.files ;
}else {
var FL = OCA.Files.App.fileList.files ;
}
/**
* check MD handler
*/
checkMD: function() {
//list file from current dir and check
for (var filenum in FL ) {
if ( FL[filenum].name == this.header.filename ) {
this.header.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.header) ;
} ;
//cleanup "old" MDs before checking for new ones
this.header.container.addClass("hidden") ;
this.header.container.children().remove() ;
this.header.content= null ;
this.readme.container.addClass("hidden") ;
this.readme.container.children().remove() ;
this.readme.content = null ;
if (this.mode == "public") {
var FL = OCA.Sharing.PublicApp.fileList.files ;
}else {
var FL = OCA.Files.App.fileList.files ;
}
if ( FL[filenum].name == this.readme.filename ) {
this.readme.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.readme) ;
} ;
//list file from current dir and check
for (var filenum in FL ) {
if ( FL[filenum].name == this.header.filename ) {
this.header.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.header) ;
} ;
if ( FL[filenum].name == this.readme.filename ) {
this.readme.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.readme) ;
} ;
//also check for dot files an prefer them.
if ( FL[filenum].name == "." + this.header.filename ) {
this.header.filename = "." +this.header.filename ;
this.header.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.header) ;
} ;
if ( FL[filenum].name == "." + this.readme.filename ) {
this.readme.filename = "." +this.readme.filename ;
this.readme.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.readme) ;
} ;
//also check for dot files an prefer them.
if ( FL[filenum].name == "." + this.header.filename ) {
this.header.filename = "." +this.header.filename ;
this.header.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.header) ;
} ;
},
/**
* show contenair
*/
createContainer: function(zone) {
if (zone.position == "before")
{ $('#filestable').before(zone.container) ; }
if ( FL[filenum].name == "." + this.readme.filename ) {
this.readme.filename = "." +this.readme.filename ;
this.readme.container.removeClass("hidden") ;
this.fillContainer(OCA.ReadmeMD.readme) ;
} ;
} ;
},
if (zone.position == "after")
{ $('#filestable').after(zone.container) ; }
},
/**
* show contenair
*/
createContainer: function(zone) {
if (zone.position == "before")
{ $('#filestable').before(zone.container) ; }
if (zone.position == "after")
{ $('#app-content-files').after(zone.container) ; }
},
/**
......@@ -129,32 +143,15 @@ OCA.ReadmeMD.App = {
}) ;
},
/**
* Render Markdown
**/
renderMD: function(zone) {
/**
* Render Markdown
**/
renderMD: function(zone) {
//render MD
var converter = require('markdown-it')() ;
zone.container.html(converter.render(zone.content)) ;
$("#filestable > tfoot > tr").height("auto") ;
},
/**
* Handle Multiselect
**/
handleMultiselect: function() {
// on checkbox change on filestable, check the multiselect class to hide header
// and move footer 70px down, see css
if ($("#filestable input:checked").size() > 0 ) {
this.header.container.addClass("hidden") ;
this.readme.container.addClass("down") ;
} else {
if (this.header.content != null) {
this.header.container.removeClass("hidden") ;
}
this.readme.container.removeClass("down") ;
}
}
},
};
......@@ -173,14 +170,14 @@ $(document).ready(function () {
} ;
var header = {
container: $('<div id="headerMD" class="hidden markdown-body headermd"></div>'),
container: $('<div id="app-content-headerMD" class="hidden markdown-body headermd"></div>'),
position : "before",
filename : "HEADER.md",
content : null
} ;
var footer = {
container: $('<div id="readmeMD" class="hidden markdown-body readmemd"></div>'),
container: $('<div id="app-content-readmeMD" class="hidden markdown-body readmemd"></div>'),
position : "after",
filename : "README.md",
content : null
......
......@@ -3,7 +3,7 @@ const path = require("path");
module.exports = {
devtool: 'source-map',
mode: 'production',
mode: 'none',
entry: {
'script.js': "./src/script.js"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment