fixed image upload and eslint

This commit is contained in:
azivner 2018-03-25 20:18:08 -04:00
parent 341f47f0f2
commit a69d8737ce
5 changed files with 24 additions and 15 deletions

View File

@ -14,7 +14,7 @@ import dragAndDropSetup from './drag_and_drop.js';
import exportService from './export.js';
import link from './link.js';
import messaging from './messaging.js';
import noteDetail from './note_detail.js';
import noteDetailService from './note_detail.js';
import noteType from './note_type.js';
import protected_session from './protected_session.js';
import searchTreeService from './search_tree.js';
@ -25,9 +25,19 @@ import treeService from './tree.js';
import treeChanges from './tree_changes.js';
import treeUtils from './tree_utils.js';
import utils from './utils.js';
import server from './server.js';
import './init.js';
// required for CKEditor image upload plugin
window.glob.getCurrentNode = treeService.getCurrentNode;
window.glob.getHeaders = server.getHeaders;
// required for ESLint plugin
window.glob.getCurrentNote = noteDetailService.getCurrentNote;
window.glob.requireLibrary = utils.requireLibrary;
window.glob.ESLINT = utils.ESLINT;
utils.bindShortcut('ctrl+l', addLinkDialog.showDialog);
$("#jump-to-note-button").click(jumpToNoteDialog.showDialog);

View File

@ -520,29 +520,29 @@ function initFancyTree(branch) {
},
"backspace": node => {
if (!utils.isTopLevelNode(node)) {
node.getParent().setActive().then(() => clearSelectedNodes());
node.getParent().setActive().then(clearSelectedNodes);
}
},
// code below shouldn't be necessary normally, however there's some problem with interaction with context menu plugin
// after opening context menu, standard shortcuts don't work, but they are detected here
// so we essentially takeover the standard handling with our implementation.
"left": node => {
node.navigate($.ui.keyCode.LEFT, true).then(() => clearSelectedNodes());
node.navigate($.ui.keyCode.LEFT, true).then(clearSelectedNodes);
return false;
},
"right": node => {
node.navigate($.ui.keyCode.RIGHT, true).then(() => clearSelectedNodes());
node.navigate($.ui.keyCode.RIGHT, true).then(clearSelectedNodes);
return false;
},
"up": node => {
node.navigate($.ui.keyCode.UP, true).then(() => clearSelectedNodes());
node.navigate($.ui.keyCode.UP, true).then(clearSelectedNodes);
return false;
},
"down": node => {
node.navigate($.ui.keyCode.DOWN, true).then(() => clearSelectedNodes());
node.navigate($.ui.keyCode.DOWN, true).then(clearSelectedNodes);
return false;
}

File diff suppressed because one or more lines are too long

View File

@ -28,13 +28,12 @@
}
async function validatorJavaScript(text, options) {
// FIXME!!!
// if (noteEditor.getCurrentNote().detail.mime === 'application/json') {
// // eslint doesn't seem to validate pure JSON well
// return [];
// }
if (glob.getCurrentNote().detail.mime === 'application/json') {
// eslint doesn't seem to validate pure JSON well
return [];
}
await requireLibrary(ESLINT);
await glob.requireLibrary(glob.ESLINT);
if (text.length > 20000) {
console.log("Skipping linting because of large size: ", text.length);

View File

@ -484,8 +484,8 @@
<div id="tooltip" style="display: none;"></div>
<script type="text/javascript">
const baseApiUrl = 'api/';
const glob = {
window.baseApiUrl = 'api/';
window.glob = {
activeDialog: null,
sourceId: '<%= sourceId %>',
maxSyncIdAtLoad: <%= maxSyncIdAtLoad %>