mirror of
https://github.com/ryanamay/inkdrop-command-palette.git
synced 2024-09-20 01:40:34 +00:00
initial commit
This commit is contained in:
commit
6023de29fe
11 changed files with 142 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.DS_Store
|
||||||
|
npm-debug.log
|
||||||
|
node_modules
|
5
.pre-commit-config.yaml
Normal file
5
.pre-commit-config.yaml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
repos:
|
||||||
|
- hooks:
|
||||||
|
- id: commitizen
|
||||||
|
repo: https://github.com/commitizen-tools/commitizen
|
||||||
|
rev: v2.29.5
|
3
CHANGELOG.md
Normal file
3
CHANGELOG.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
## 0.1.0 - First Release
|
||||||
|
* Every feature added
|
||||||
|
* Every bug fixed
|
20
LICENSE.md
Normal file
20
LICENSE.md
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
Copyright (c) 2022 <Your name here>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
7
cz.json
Normal file
7
cz.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"commitizen": {
|
||||||
|
"name": "cz_conventional_commits",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"tag_format": "v0.0.1"
|
||||||
|
}
|
||||||
|
}
|
5
keymaps/wordcount.json
Normal file
5
keymaps/wordcount.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"body": {
|
||||||
|
"ctrl-alt-o": "wordcount:toggle"
|
||||||
|
}
|
||||||
|
}
|
35
lib/wordcount-message-dialog.js
Normal file
35
lib/wordcount-message-dialog.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
'use babel';
|
||||||
|
|
||||||
|
import React, { useEffect, useCallback } from 'react'
|
||||||
|
import { logger, useModal } from 'inkdrop'
|
||||||
|
|
||||||
|
const WordcountMessageDialog = (props) => {
|
||||||
|
const modal = useModal()
|
||||||
|
const { Dialog } = inkdrop.components.classes
|
||||||
|
|
||||||
|
const toggle = useCallback(() => {
|
||||||
|
modal.show()
|
||||||
|
logger.debug('Wordcount was toggled!')
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const sub = inkdrop.commands.add(document.body, {
|
||||||
|
'wordcount:toggle': toggle
|
||||||
|
})
|
||||||
|
return () => sub.dispose()
|
||||||
|
}, [toggle])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dialog {...modal.state} onBackdropClick={modal.close}>
|
||||||
|
<Dialog.Title>Wordcount</Dialog.Title>
|
||||||
|
<Dialog.Content>Wordcount was toggled!</Dialog.Content>
|
||||||
|
<Dialog.Actions>
|
||||||
|
<button className="ui button" onClick={modal.close}>
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</Dialog.Actions>
|
||||||
|
</Dialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default WordcountMessageDialog
|
23
lib/wordcount.js
Normal file
23
lib/wordcount.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
'use babel';
|
||||||
|
|
||||||
|
import WordcountMessageDialog from './wordcount-message-dialog';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
|
||||||
|
activate() {
|
||||||
|
inkdrop.components.registerClass(WordcountMessageDialog);
|
||||||
|
inkdrop.layouts.addComponentToLayout(
|
||||||
|
'modal',
|
||||||
|
'WordcountMessageDialog'
|
||||||
|
)
|
||||||
|
},
|
||||||
|
|
||||||
|
deactivate() {
|
||||||
|
inkdrop.layouts.removeComponentFromLayout(
|
||||||
|
'modal',
|
||||||
|
'WordcountMessageDialog'
|
||||||
|
)
|
||||||
|
inkdrop.components.deleteClass(WordcountMessageDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
26
menus/wordcount.json
Normal file
26
menus/wordcount.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"context-menu": {
|
||||||
|
".CodeMirror": [
|
||||||
|
{
|
||||||
|
"label": "Toggle wordcount",
|
||||||
|
"command": "wordcount:toggle"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"menu": [
|
||||||
|
{
|
||||||
|
"label": "Plugins",
|
||||||
|
"submenu": [
|
||||||
|
{
|
||||||
|
"label": "wordcount",
|
||||||
|
"submenu": [
|
||||||
|
{
|
||||||
|
"label": "Toggle",
|
||||||
|
"command": "wordcount:toggle"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
13
package.json
Normal file
13
package.json
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "command-palette",
|
||||||
|
"main": "./lib/wordcount",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "A command palette for inkdrop",
|
||||||
|
"keywords": [],
|
||||||
|
"repository": "https://github.com/inkdropapp/wordcount",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"inkdrop": "^5.3.1"
|
||||||
|
},
|
||||||
|
"dependencies": {}
|
||||||
|
}
|
2
styles/wordcount.less
Normal file
2
styles/wordcount.less
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
.wordcount {
|
||||||
|
}
|
Loading…
Reference in a new issue