joplin-plugin-explorer 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joplin-plugin-explorer",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "A unified sidebar that displays notebooks and notes together in a single tree view",
5
5
  "author": "lim0513",
6
6
  "homepage": "https://github.com/lim0513/joplin-explorer",
package/publish/index.js CHANGED
@@ -260,6 +260,18 @@ joplin.plugins.register({
260
260
  var allFoldersCache = [];
261
261
  var isFirstLoad = true;
262
262
 
263
+ function expandToFolder(folderId) {
264
+ var parentId = folderId;
265
+ while (parentId) {
266
+ delete collapsedFolders[parentId];
267
+ var found = null;
268
+ for (var i = 0; i < allFoldersCache.length; i++) {
269
+ if (allFoldersCache[i].id === parentId) { found = allFoldersCache[i]; break; }
270
+ }
271
+ parentId = found ? found.parent_id : null;
272
+ }
273
+ }
274
+
263
275
  function sortNotes(notes, sortMode) {
264
276
  var sorted = notes.slice();
265
277
  switch (sortMode) {
@@ -367,9 +379,13 @@ joplin.plugins.register({
367
379
  await refreshPanel();
368
380
  } else if (msg.name === 'newNote') {
369
381
  await joplin.commands.execute('newNote');
382
+ var nn = await joplin.workspace.selectedNote();
383
+ if (nn) { selectedNoteId = nn.id; expandToFolder(nn.parent_id); }
370
384
  await refreshPanel();
371
385
  } else if (msg.name === 'newTodo') {
372
386
  await joplin.commands.execute('newTodo');
387
+ var nt = await joplin.workspace.selectedNote();
388
+ if (nt) { selectedNoteId = nt.id; expandToFolder(nt.parent_id); }
373
389
  await refreshPanel();
374
390
  } else if (msg.name === 'search') {
375
391
  var query = msg.query;
@@ -454,11 +470,13 @@ joplin.plugins.register({
454
470
  var newNote = await joplin.data.post(['notes'], null, { title: t.newNote, parent_id: id });
455
471
  await joplin.commands.execute('openNote', newNote.id);
456
472
  selectedNoteId = newNote.id;
473
+ expandToFolder(id);
457
474
  break;
458
475
  case 'newTodo':
459
476
  var newTodo = await joplin.data.post(['notes'], null, { title: t.newTodo, parent_id: id, is_todo: 1 });
460
477
  await joplin.commands.execute('openNote', newTodo.id);
461
478
  selectedNoteId = newTodo.id;
479
+ expandToFolder(id);
462
480
  break;
463
481
  case 'newSubNotebook':
464
482
  await joplin.data.post(['folders'], null, { title: t.newNotebook, parent_id: id });
@@ -2,7 +2,7 @@
2
2
  "manifest_version": 1,
3
3
  "id": "com.github.joplin-explorer",
4
4
  "app_min_version": "2.6.0",
5
- "version": "1.1.2",
5
+ "version": "1.1.3",
6
6
  "name": "Joplin Explorer",
7
7
  "description": "A unified sidebar that displays notebooks and notes together in a single tree view",
8
8
  "author": "lim0513",
Binary file
@@ -408,9 +408,9 @@ html, body {
408
408
  }
409
409
 
410
410
  .inline-input-ok {
411
- background: var(--joplin-color2, #4a9cf5) !important;
411
+ background: #1a73e8 !important;
412
412
  color: #fff !important;
413
- border-color: var(--joplin-color2, #4a9cf5) !important;
413
+ border-color: #1a73e8 !important;
414
414
  }
415
415
 
416
416
  .inline-input-buttons button:hover {
@@ -150,7 +150,6 @@ document.addEventListener('contextmenu', function(e) {
150
150
  menuHtml += '<div class="ctx-item" data-action="toggleTodo" data-id="' + id + '" data-type="note">' + T('ctxToggleTodo') + '</div>';
151
151
  menuHtml += '<div class="ctx-sep"></div>';
152
152
  menuHtml += '<div class="ctx-item" data-action="renameNote" data-id="' + id + '" data-type="note" data-title="' + title.replace(/"/g, '&quot;') + '">' + T('ctxRenameNote') + '</div>';
153
- menuHtml += '<div class="ctx-item" data-action="moveNote" data-id="' + id + '" data-type="note">' + T('ctxMoveNote') + '</div>';
154
153
  menuHtml += '<div class="ctx-item" data-action="noteInfo" data-id="' + id + '" data-type="note">' + T('ctxNoteInfo') + '</div>';
155
154
  menuHtml += '<div class="ctx-sep"></div>';
156
155
  menuHtml += '<div class="ctx-item ctx-danger" data-action="deleteNote" data-id="' + id + '" data-type="note">' + T('ctxDeleteNote') + '</div>';