Fix issue with unnamed files causing “click to download inline image” prompt #262

This commit is contained in:
Ben Gotow 2018-01-17 17:44:19 -08:00
parent d4211d1a69
commit 5cbf7e31e5
4 changed files with 23 additions and 14 deletions

View file

@ -73,16 +73,20 @@
.inner { .inner {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap;
align-items: center; align-items: center;
background: @background-primary; background: @background-primary;
border-bottom: 1px solid @border-color-divider; border-bottom: 1px solid @border-color-divider;
z-index: 2; z-index: 2;
width: 100%; width: 100%;
padding-right: 10px;
} }
.toolbar-section { .toolbar-section {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-shrink: 0;
align-items: center; align-items: center;
} }

View file

@ -44,20 +44,22 @@ export default class ComposerEditorToolbar extends React.Component {
const { value, onChange, plugins } = this.props; const { value, onChange, plugins } = this.props;
const sections = []; const sections = [];
plugins.forEach(({ toolbarComponents, toolbarSectionClass }, idx) => { const pluginsWithToolbars = plugins.filter(
if (toolbarComponents && toolbarComponents.length) { (p, idx) => p.toolbarComponents && p.toolbarComponents.length
);
pluginsWithToolbars.forEach(({ toolbarComponents, toolbarSectionClass }, idx) => {
const sectionItems = toolbarComponents.map((Component, cdx) => ( const sectionItems = toolbarComponents.map((Component, cdx) => (
<Component key={`${idx}-${cdx}`} value={value} onChange={onChange} /> <Component key={`${idx}-${cdx}`} value={value} onChange={onChange} />
)); ));
if (sections.length) { if (idx < pluginsWithToolbars.length - 1) {
sectionItems.unshift(<div key={idx} className="divider" />); sectionItems.push(<div key="divider" className="divider" />);
} }
sections.push( sections.push(
<div key={idx} className={`toolbar-section ${toolbarSectionClass || ''}`}> <div key={idx} className={`toolbar-section ${toolbarSectionClass || ''}`}>
{sectionItems} {sectionItems}
</div> </div>
); );
}
}); });
return ( return (

View file

@ -46,6 +46,9 @@ export default class File extends Model {
// name if one is present, and falls back to appropriate default name based on // name if one is present, and falls back to appropriate default name based on
// the contentType. It will always return a non-empty string. // the contentType. It will always return a non-empty string.
displayName() { displayName() {
// BG: This logic has been moved to the sync side - all files should always have names
// as of the 1.1 release. This is just here still because people's local dbs could
// still contain unnammed files.
const defaultNames = { const defaultNames = {
'text/calendar': 'Event.ics', 'text/calendar': 'Event.ics',
'image/png': 'Unnamed Image.png', 'image/png': 'Unnamed Image.png',

@ -1 +1 @@
Subproject commit bfda4b1b9a62896fb89c84c8bf50a83c688a6f47 Subproject commit 91d6d6d75f65dc6bcac0aa276c54858c06ca1885