initial commit

This commit is contained in:
fuwaa 2022-08-17 02:45:23 +08:00
commit 6023de29fe
No known key found for this signature in database
GPG key ID: 61CF2722CAB10289
11 changed files with 142 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.DS_Store
npm-debug.log
node_modules

5
.pre-commit-config.yaml Normal file
View 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
View file

@ -0,0 +1,3 @@
## 0.1.0 - First Release
* Every feature added
* Every bug fixed

20
LICENSE.md Normal file
View 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
View 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
View file

@ -0,0 +1,5 @@
{
"body": {
"ctrl-alt-o": "wordcount:toggle"
}
}

View 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
View 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
View 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
View 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
View file

@ -0,0 +1,2 @@
.wordcount {
}