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:
Sheogorath 2019-03-25 17:41:51 +01:00
parent 50c80c99a4
commit 1544b45af5
No known key found for this signature in database
GPG key ID: 1F05CC3635CDDFFD
5 changed files with 13 additions and 23 deletions

View file

@ -304,7 +304,6 @@ var editor = editorInstance.init(textit)
// FIXME: global referncing in jquery-textcomplete patch
window.editor = editor
var inlineAttach = inlineAttachment.editors.codemirror4.attach(editor)
defaultTextHeight = parseInt($('.CodeMirror').css('line-height'))
// initalize ui reference
@ -801,7 +800,6 @@ function changeMode (type) {
editor.getInputField().blur()
}
if (appState.currentMode === modeType.edit || appState.currentMode === modeType.both) {
ui.toolbar.uploadImage.fadeIn()
// add and update status bar
if (!editorInstance.statusBar) {
editorInstance.addStatusBar()
@ -814,8 +812,6 @@ function changeMode (type) {
// work around foldGutter might not init properly
editor.setOption('foldGutter', false)
editor.setOption('foldGutter', true)
} else {
ui.toolbar.uploadImage.fadeOut()
}
if (appState.currentMode !== modeType.edit) {
$(document.body).css('background-color', 'white')
@ -1051,17 +1047,6 @@ ui.toolbar.import.snippet.click(function () {
ui.spinner.hide()
})
})
// import from clipboard
ui.toolbar.import.clipboard.click(function () {
// na
})
// upload image
ui.toolbar.uploadImage.bind('change', function (e) {
var files = e.target.files || e.dataTransfer.files
e.dataTransfer = {}
e.dataTransfer.files = files
inlineAttach.onDrop(e)
})
// toc
ui.toc.dropdown.click(function (e) {
e.stopPropagation()