Move upload button into toolbar
Currently we have the odd situation to have two toolbars. One inside the header and one in the editor. Since we only show the image upload button when the editor is visible we should move the upload button into the editor toolbar. This patch does this by adding the image upload button besides the image tag button. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
@@ -138,6 +138,7 @@ export default class Editor {
|
||||
}
|
||||
|
||||
addToolBar () {
|
||||
var inlineAttach = inlineAttachment.editors.codemirror4.attach(this.editor)
|
||||
this.toolBar = $(toolBarTemplate)
|
||||
this.toolbarPanel = this.editor.addPanel(this.toolBar[0], {
|
||||
position: 'top'
|
||||
@@ -157,6 +158,7 @@ export default class Editor {
|
||||
var makeTable = $('#makeTable')
|
||||
var makeLine = $('#makeLine')
|
||||
var makeComment = $('#makeComment')
|
||||
var uploadImage = $('#uploadImage')
|
||||
|
||||
makeBold.click(() => {
|
||||
utils.wrapTextWith(this.editor, this.editor, '**')
|
||||
@@ -217,6 +219,13 @@ export default class Editor {
|
||||
makeComment.click(() => {
|
||||
utils.insertText(this.editor, '> []')
|
||||
})
|
||||
uploadImage.bind('change', function (e) {
|
||||
console.log("tiggered")
|
||||
var files = e.target.files || e.dataTransfer.files
|
||||
e.dataTransfer = {}
|
||||
e.dataTransfer.files = files
|
||||
inlineAttach.onDrop(e)
|
||||
})
|
||||
}
|
||||
|
||||
addStatusBar () {
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
<a id="makeImage" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Image">
|
||||
<i class="fa fa-image fa-fw"></i>
|
||||
</a>
|
||||
<span id="uploadImage" class="btn btn-sm btn-dark btn-file ui-upload-image" title="Upload Image">
|
||||
<i class="fa fa-upload fa-fw"></i><input type="file" accept="image/*" name="upload" multiple>
|
||||
</span>
|
||||
<a id="makeTable" class="btn btn-sm btn-dark text-uppercase" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" title="Table">
|
||||
<i class="fa fa-table fa-fw"></i>
|
||||
</a>
|
||||
|
||||
@@ -35,8 +35,7 @@ export const getUIElements = () => ({
|
||||
edit: $('.ui-edit'),
|
||||
view: $('.ui-view'),
|
||||
both: $('.ui-both'),
|
||||
night: $('.ui-night'),
|
||||
uploadImage: $('.ui-upload-image')
|
||||
night: $('.ui-night')
|
||||
},
|
||||
infobar: {
|
||||
lastchange: $('.ui-lastchange'),
|
||||
|
||||
Reference in New Issue
Block a user