Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements file-upload via dropzone #2508

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/client/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = [
'classnames',
'color',
'display-name',
'elemental',
'elemental-octicons-3.5.0',
'expression-match',
'history',
'i',
Expand Down
Binary file modified admin/public/fonts/octicons/octicons.eot
Binary file not shown.
53 changes: 29 additions & 24 deletions admin/public/fonts/octicons/octicons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified admin/public/fonts/octicons/octicons.ttf
Binary file not shown.
Binary file modified admin/public/fonts/octicons/octicons.woff
Binary file not shown.
70,646 changes: 70,620 additions & 26 deletions admin/public/js/packages.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion admin/public/styles/keystone.less
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
// REACT FIELDS
@import "react/react.less";


// DayPicker styles
// ------------------------------

Expand Down
1 change: 1 addition & 0 deletions admin/public/styles/react/react.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@
@import "@{reactSelectPath}/less/select.less";

@import "../../../../fields/types/markdown/less/bootstrap-markdown.less";
@import (inline) "../../../../fields/types/markdown/css/dropzone.css";
@import "../../../public/js/lib/tinymce/skins/keystone/skin.less";
73 changes: 42 additions & 31 deletions fields/types/markdown/MarkdownField.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { FormInput } from 'elemental';

// Scope jQuery and the bootstrap-markdown editor so it will mount
var $ = require('jquery');
var marked = require('marked');
require('./lib/bootstrap-markdown');
require('./lib/dropzone');

// Append/remove ### surround the selection
// Source: https://github.com/toopay/bootstrap-markdown/blob/master/js/bootstrap-markdown.js#L909
Expand Down Expand Up @@ -59,41 +61,50 @@ var renderMarkdown = function (component) {
savable: false,
resize: 'vertical',
height: component.props.height,
dropZoneOptions: component.props.dropZoneOptions,
parser: marked,
iconlibrary: 'octicons',
hiddenButtons: ['Heading'],

// Heading buttons
additionalButtons: [{
name: 'groupHeaders',
data: [{
name: 'cmdH1',
title: 'Heading 1',
btnText: 'H1',
callback: function (e) {
toggleHeading(e, '#');
},
}, {
name: 'cmdH2',
title: 'Heading 2',
btnText: 'H2',
callback: function (e) {
toggleHeading(e, '##');
},
}, {
name: 'cmdH3',
title: 'Heading 3',
btnText: 'H3',
callback: function (e) {
toggleHeading(e, '###');
},
}, {
name: 'cmdH4',
title: 'Heading 4',
btnText: 'H4',
callback: function (e) {
toggleHeading(e, '####');
},
additionalButtons: [
[{
name: 'groupHeaders',
data: [{
name: 'cmdH1',
title: 'Heading 1',
icon: 'octicon octicon-text-size heading-1',
btnText: '',
callback: function (e) {
toggleHeading(e, '#');
},
}, {
name: 'cmdH2',
title: 'Heading 2',
icon: 'octicon octicon-text-size heading-2',
btnText: '',
callback: function (e) {
toggleHeading(e, '##');
},
}, {
name: 'cmdH3',
title: 'Heading 3',
icon: 'octicon octicon-text-size heading-3',
btnText: '',
callback: function (e) {
toggleHeading(e, '###');
},
}, {
name: 'cmdH4',
title: 'Heading 4',
icon: 'octicon octicon-text-size heading-4',
btnText: '',
callback: function (e) {
toggleHeading(e, '####');
},
}],
}],
}],
],

// Insert Header buttons into the toolbar
reorderButtonGroups: ['groupFont', 'groupHeaders', 'groupLink', 'groupMisc', 'groupUtil'],
Expand Down
4 changes: 3 additions & 1 deletion fields/types/markdown/MarkdownType.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ function markdown (list, path, options) {
this.height = options.height || 90;
this.wysiwyg = ('wysiwyg' in options) ? options.wysiwyg : true;

this._properties = ['wysiwyg', 'height', 'toolbarOptions'];
this._properties = ['wysiwyg', 'height', 'toolbarOptions', 'dropZoneOptions'];
this.dropZoneOptions = options.dropZoneOptions;

markdown.super_.call(this, list, path, options);
}
util.inherits(markdown, FieldType);
Expand Down
Loading