index.js000644 0000035502 14104527777007374 0ustar00000000 000000 !function(e){var t={};function o(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(i,n,function(t){return e[t]}.bind(null,n));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=3)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=joplin},function(e,t,o){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.ContentScriptType=t.SettingStorage=t.AppType=t.SettingItemType=t.ToolbarButtonLocation=t.isContextMenuItemLocation=t.MenuItemLocation=t.ImportModuleOutputFormat=t.FileSystemItem=void 0,function(e){e.File="file",e.Directory="directory"}(t.FileSystemItem||(t.FileSystemItem={})),function(e){e.Markdown="md",e.Html="html"}(t.ImportModuleOutputFormat||(t.ImportModuleOutputFormat={})),function(e){e.File="file",e.Edit="edit",e.View="view",e.Note="note",e.Tools="tools",e.Help="help",e.Context="context",e.NoteListContextMenu="noteListContextMenu",e.EditorContextMenu="editorContextMenu",e.FolderContextMenu="folderContextMenu",e.TagContextMenu="tagContextMenu"}(i=t.MenuItemLocation||(t.MenuItemLocation={})),t.isContextMenuItemLocation=function(e){return[i.Context,i.NoteListContextMenu,i.EditorContextMenu,i.FolderContextMenu,i.TagContextMenu].includes(e)},function(e){e.NoteToolbar="noteToolbar",e.EditorToolbar="editorToolbar"}(t.ToolbarButtonLocation||(t.ToolbarButtonLocation={})),function(e){e[e.Int=1]="Int",e[e.String=2]="String",e[e.Bool=3]="Bool",e[e.Array=4]="Array",e[e.Object=5]="Object",e[e.Button=6]="Button"}(t.SettingItemType||(t.SettingItemType={})),function(e){e.Desktop="desktop",e.Mobile="mobile",e.Cli="cli"}(t.AppType||(t.AppType={})),function(e){e[e.Database=1]="Database",e[e.File=2]="File"}(t.SettingStorage||(t.SettingStorage={})),function(e){e.MarkdownItPlugin="markdownItPlugin",e.CodeMirrorPlugin="codeMirrorPlugin"}(t.ContentScriptType||(t.ContentScriptType={}))},function(e,t,o){"use strict";var i=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))((function(n,c){function u(e){try{s(i.next(e))}catch(e){c(e)}}function r(e){try{s(i.throw(e))}catch(e){c(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(u,r)}s((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DA=void 0;const n=o(0);class c{static getAll(e,t){return i(this,void 0,void 0,(function*(){t.page=1;let o=yield n.default.data.get(e,t),i=o.items?o.items:[];for(;o.has_more;)t.page+=1,o=yield n.default.data.get(e,t),i.concat(o.items);return i}))}static getFolders(e){return i(this,void 0,void 0,(function*(){try{const t=["id","title","parent_id"];return e&&t.push(...e),yield c.getAll(["folders"],{fields:t,order_by:"title",order_dir:"ASC",page:1})}catch(e){return[]}}))}static getFoldersFiltered(e,t){return i(this,void 0,void 0,(function*(){try{const o=["id","title","parent_id"];t&&o.push(...t);return(yield c.getAll(["folders"],{fields:o,order_by:"title",order_dir:"ASC",page:1})).filter(e)}catch(e){return[]}}))}static getFolder(e,t){return i(this,void 0,void 0,(function*(){try{const o=["id","title","parent_id"];return t&&o.push(...t),yield n.default.data.get(["folders",e],{fields:o})}catch(e){return null}}))}static getNotes(e){return i(this,void 0,void 0,(function*(){return yield c.getAll(["notes"],{fields:["id","title","is_todo","todo_completed"],page:1})}))}static getNote(e,t){return i(this,void 0,void 0,(function*(){try{const o=["id","title","is_todo","todo_completed"];return t&&o.push(...t),yield n.default.data.get(["notes",e],{fields:o})}catch(e){return null}}))}}t.DA=c},function(e,t,o){"use strict";var i=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))((function(n,c){function u(e){try{s(i.next(e))}catch(e){c(e)}}function r(e){try{s(i.throw(e))}catch(e){c(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(u,r)}s((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=o(0),c=o(1),u=o(4),r=o(2);n.default.plugins.register({onStart:function(){return i(this,void 0,void 0,(function*(){const e=n.default.commands,t=n.default.data,o=n.default.settings,s=n.default.workspace,a=new u.Settings;function l(o,c,l){return i(this,void 0,void 0,(function*(){if(void 0===c||c===u.SettingDefaults.Empty)return;let i=l;if(i||(i=yield s.selectedNoteIds()),!i)return;try{yield r.DA.getFolder(c)}catch(e){return void(yield n.default.views.dialogs.showMessageBox(`Selected notebook of quick move action ${o} does not exist. Please select another notebook in the settings.`))}let d="";for(const e of i)d=e,yield t.put(["notes",e],null,{parent_id:c});a.keepMovedNoteSelected&&d&&e.execute("openNote",d)}))}yield a.register(),yield e.register({name:"quickMove1",label:"Quick move action 1",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(1,a.quickMove1,e)}))}),yield e.register({name:"quickMove2",label:"Quick move action 2",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(2,a.quickMove2,e)}))}),yield e.register({name:"quickMove3",label:"Quick move action 3",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(3,a.quickMove3,e)}))}),yield e.register({name:"quickMove4",label:"Quick move action 4",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(4,a.quickMove4,e)}))}),yield e.register({name:"quickMove5",label:"Quick move action 5",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(5,a.quickMove5,e)}))}),yield e.register({name:"quickMove6",label:"Quick move action 6",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(6,a.quickMove6,e)}))}),yield e.register({name:"quickMove7",label:"Quick move action 7",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(7,a.quickMove7,e)}))}),yield e.register({name:"quickMove8",label:"Quick move action 8",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(8,a.quickMove8,e)}))}),yield e.register({name:"quickMove9",label:"Quick move action 9",iconName:"fas fa-shipping-fast",enabledCondition:"someNotesSelected",execute:e=>i(this,void 0,void 0,(function*(){l(9,a.quickMove9,e)}))});const d=[{commandName:"quickMove1",accelerator:u.DefaultKeys.QuickMove1},{commandName:"quickMove2",accelerator:u.DefaultKeys.QuickMove2},{commandName:"quickMove3",accelerator:u.DefaultKeys.QuickMove3},{commandName:"quickMove4",accelerator:u.DefaultKeys.QuickMove4},{commandName:"quickMove5",accelerator:u.DefaultKeys.QuickMove5},{commandName:"quickMove6",accelerator:u.DefaultKeys.QuickMove6},{commandName:"quickMove7",accelerator:u.DefaultKeys.QuickMove7},{commandName:"quickMove8",accelerator:u.DefaultKeys.QuickMove8},{commandName:"quickMove9",accelerator:u.DefaultKeys.QuickMove9}];yield n.default.views.menus.create("menNoteQuickMove","Quick move",d,c.MenuItemLocation.Note),o.onChange(e=>i(this,void 0,void 0,(function*(){yield a.read(e)})))}))}})},function(e,t,o){"use strict";var i=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))((function(n,c){function u(e){try{s(i.next(e))}catch(e){c(e)}}function r(e){try{s(i.throw(e))}catch(e){c(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(u,r)}s((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Settings=t.SettingDefaults=t.DefaultKeys=void 0;const n=o(0),c=o(1),u=o(2);var r;!function(e){e.QuickMove1="CmdOrCtrl+Shift+1",e.QuickMove2="CmdOrCtrl+Shift+2",e.QuickMove3="CmdOrCtrl+Shift+3",e.QuickMove4="CmdOrCtrl+Shift+4",e.QuickMove5="CmdOrCtrl+Shift+5",e.QuickMove6="CmdOrCtrl+Shift+6",e.QuickMove7="CmdOrCtrl+Shift+7",e.QuickMove8="CmdOrCtrl+Shift+8",e.QuickMove9="CmdOrCtrl+Shift+9"}(t.DefaultKeys||(t.DefaultKeys={})),function(e){e.Empty="0",e.Default="default",e.FontFamily="Roboto",e.FontSize="var(--joplin-font-size)",e.Background="var(--joplin-background-color3)",e.HoverBackground="var(--joplin-background-color-hover3)",e.Foreground="var(--joplin-color-faded)",e.ActiveBackground="var(--joplin-background-color)",e.ActiveForeground="var(--joplin-color)",e.DividerColor="var(--joplin-divider-color)"}(r=t.SettingDefaults||(t.SettingDefaults={}));t.Settings=class{constructor(){this._keepMovedNoteSelected=!1,this._quickMove1=r.Empty,this._quickMove2=r.Empty,this._quickMove3=r.Empty,this._quickMove4=r.Empty,this._quickMove5=r.Empty,this._quickMove6=r.Empty,this._quickMove7=r.Empty,this._quickMove8=r.Empty,this._quickMove9=r.Empty,this._defaultRegExp=new RegExp(r.Default,"i")}get keepMovedNoteSelected(){return this._keepMovedNoteSelected}get quickMove1(){return this._quickMove1}get quickMove2(){return this._quickMove2}get quickMove3(){return this._quickMove3}get quickMove4(){return this._quickMove4}get quickMove5(){return this._quickMove5}get quickMove6(){return this._quickMove6}get quickMove7(){return this._quickMove7}get quickMove8(){return this._quickMove8}get quickMove9(){return this._quickMove9}getFoldersToSelect(){return i(this,void 0,void 0,(function*(){const e=yield u.DA.getFoldersFiltered(e=>!e.parent_id),t=new Map;t.set(" ","0");const o=(e,n,c)=>i(this,void 0,void 0,(function*(){for(let i=0;ie.parent_id===c.id);s&&(yield o(s,n+1<15?n+1:15,c))}}));yield o(e,0);const n=Array.from(t)[t.size-1][1];let c="{";return t.forEach((e,t)=>{c+=`"${e}": "${t}"${n==e?"":","} `}),c+="}",JSON.parse(c)}))}register(){return i(this,void 0,void 0,(function*(){const e=yield this.getFoldersToSelect();yield n.default.settings.registerSection("qm.settings",{label:"Quick Move",iconName:"fas fa-shipping-fast",description:"The notebook selection lists are only updated at startup. To display new or renamed notebooks, Joplin must be restarted."}),yield n.default.settings.registerSettings({keepMovedNoteSelected:{value:this._keepMovedNoteSelected,type:c.SettingItemType.Bool,section:"qm.settings",public:!0,label:"Keep moved note selected",description:"If the selected note is moved via one of the quick move actions, it is still selected afterwards. Otherwise, the next note within the current notebook is selected. If several notes have been moved, the last one remains selected."},quickMove1:{value:this._quickMove1,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 1",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove1".'},quickMove2:{value:this._quickMove2,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 2",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove2".'},quickMove3:{value:this._quickMove3,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 3",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove3".'},quickMove4:{value:this._quickMove4,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 4",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove4".'},quickMove5:{value:this._quickMove5,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 5",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove5".'},quickMove6:{value:this._quickMove6,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 6",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove6".'},quickMove7:{value:this._quickMove7,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 7",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove7".'},quickMove8:{value:this._quickMove8,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 8",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove8".'},quickMove9:{value:this._quickMove9,type:c.SettingItemType.String,section:"qm.settings",isEnum:!0,public:!0,options:e,label:"Notebook for quick move action 9",description:'Select notebook to which the selected note(s) can be moved directly without interaction. Assign keyboard shortcut to command "quickMove9".'}}),yield this.read()}))}getOrDefault(e,t,o,c){return i(this,void 0,void 0,(function*(){if(!e||e.keys.includes(o)){const e=yield n.default.settings.value(o);return c&&e.match(this._defaultRegExp)?c:e}return t}))}read(e){return i(this,void 0,void 0,(function*(){this._keepMovedNoteSelected=yield this.getOrDefault(e,this._keepMovedNoteSelected,"keepMovedNoteSelected"),this._quickMove1=yield this.getOrDefault(e,this._quickMove1,"quickMove1"),this._quickMove2=yield this.getOrDefault(e,this._quickMove2,"quickMove2"),this._quickMove3=yield this.getOrDefault(e,this._quickMove3,"quickMove3"),this._quickMove4=yield this.getOrDefault(e,this._quickMove4,"quickMove4"),this._quickMove5=yield this.getOrDefault(e,this._quickMove5,"quickMove5"),this._quickMove6=yield this.getOrDefault(e,this._quickMove6,"quickMove6"),this._quickMove7=yield this.getOrDefault(e,this._quickMove7,"quickMove7"),this._quickMove8=yield this.getOrDefault(e,this._quickMove8,"quickMove8"),this._quickMove9=yield this.getOrDefault(e,this._quickMove9,"quickMove9")}))}}}]);manifest.json000644 0000000767 14104527777010435 0ustar00000000 000000 { "manifest_version": 1, "id": "joplin.plugin.benji.quick-move", "app_min_version": "1.8.2", "version": "1.1.0", "name": "Quick Move", "description": "Collection of commands to quickly move notes to other notebooks.", "author": "Benji300", "homepage_url": "https://github.com/benji300/joplin-quick-move", "repository_url": "https://github.com/benji300/joplin-quick-move", "keywords": [ "commands", "keyboard", "shortcut", "notebook", "note" ] }webview_dialog.css000644 0000000514 14104527777011423 0ustar00000000 000000 /* INPUT DIALOG STYLES */ #joplin-plugin-content { min-width: 400px; } h3 { margin: 5px; } form { display: grid; } label { padding: 4px; } input { padding: 4px; } textarea { padding: 4px; resize: vertical; width: auto !important; word-break: break-all; } i { padding-right: 4px; }