Forum Discussion
Document Library Preview Web Part Not Uploading
Yes, I have this issue too. Even for something in preview, not being able to upload to a document library is pretty basic. Does Microsoft want us to use this new experience?!
I ended up creating an Application Customizers extension. Use the code below on the public OnInit method to inject CSS to change the link color and hide the upload toolbar. I needed the link color white on my dark theme.
@override
public onInit(): Promise<void> {
// Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
// let message: string = this.properties.testMessage;
// if (!message) {
// message = '(No properties were provided.)';
// }
// Dialog.alert(`Hello from ${strings.Title}:\n\n${message}`);
(() => {
/** hack styles for the document library preview links and hide upload toolbar */
const style1 = document.createElement('style');
style1.innerText = `
.detailsListCellName a.ms-Link {
color: #fff;
}
.ms-CommandBar {
display:none;
}
`;
style1.setAttribute('target', 'pagination');
document.head.appendChild(style1);
})();
return Promise.resolve();
}
- Rod MerrittMar 29, 2018Copper Contributor
Updated code to work in IE and Chrome
@overridepublic onInit(): Promise<void> {// Log.info(LOG_SOURCE, `Initialized ${strings.Title}`);
// let message: string = this.properties.testMessage;// if (!message) {// message = '(No properties were provided.)';// }
// Dialog.alert(`Hello from ${strings.Title}:\n\n${message}`);
// (() => {// /** hack styles for the pagination buttons */// const style1 = document.createElement('style');// style1.innerText = `// .detailsListCellName a.ms-Link {// color: #fff !important;// }// .ms-Link {// color:#fff !important;// }// .ms-CommandBar {// display:none !important;// }// `;// style1.setAttribute('target', 'pagination');// document.head.appendChild(style1);// })();
var sheet = document.createElement('style');sheet.innerHTML = `.detailsListCellName a.ms-Link {color: #fff !important;}.ms-Link {color:#fff !important;}.ms-CommandBar {display:none !important;}`;document.body.appendChild(sheet); // append in body//document.head.appendChild(sheet); // append in head
return Promise.resolve();}