mirror of
https://github.com/d0zingcat/obsidian-send-to-ghost.git
synced 2026-06-04 15:11:16 +00:00
Line breaks are now LF
This commit is contained in:
42
.eslintrc
42
.eslintrc
@@ -1,23 +1,21 @@
|
|||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"env": { "node": true },
|
"env": { "node": true },
|
||||||
"plugins": [
|
"plugins": ["@typescript-eslint"],
|
||||||
"@typescript-eslint"
|
"extends": [
|
||||||
],
|
"eslint:recommended",
|
||||||
"extends": [
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
"eslint:recommended",
|
"plugin:@typescript-eslint/recommended"
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
],
|
||||||
"plugin:@typescript-eslint/recommended"
|
"parserOptions": {
|
||||||
],
|
"sourceType": "module"
|
||||||
"parserOptions": {
|
},
|
||||||
"sourceType": "module"
|
"rules": {
|
||||||
},
|
"no-unused-vars": "off",
|
||||||
"rules": {
|
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
||||||
"no-unused-vars": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
"no-prototype-builtins": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/no-empty-function": "off"
|
||||||
"no-prototype-builtins": "off",
|
}
|
||||||
"@typescript-eslint/no-empty-function": "off"
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -43,4 +43,4 @@ This plugin uses PNPM for dependency management.
|
|||||||
|
|
||||||
### Issues & Support
|
### Issues & Support
|
||||||
|
|
||||||
If you find a bug in the plugin, please submit an [issue](https://github.com/Southpaw1496/obsidian-send-to-ghost). Otherwise, please contact me via [my website](https://southpaw1496.me).
|
If you find a bug, please submit an [issue](https://github.com/Southpaw1496/obsidian-send-to-ghost). Otherwise, please contact me via [my website](https://southpaw1496.me).
|
||||||
|
|||||||
@@ -1,52 +1,54 @@
|
|||||||
import esbuild from "esbuild";
|
import esbuild from "esbuild";
|
||||||
import process from "process";
|
import process from "process";
|
||||||
import builtins from 'builtin-modules'
|
import builtins from "builtin-modules";
|
||||||
|
|
||||||
const banner =
|
const banner = `/*
|
||||||
`/*
|
|
||||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
if you want to view the source, please visit the github repository of this plugin
|
if you want to view the source, please visit the github repository of this plugin
|
||||||
*/
|
*/
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const prod = (process.argv[2] === 'production');
|
const prod = process.argv[2] === "production";
|
||||||
|
|
||||||
esbuild.build({
|
esbuild
|
||||||
banner: {
|
.build({
|
||||||
js: banner,
|
banner: {
|
||||||
},
|
js: banner,
|
||||||
entryPoints: ['src/main.ts'],
|
},
|
||||||
bundle: true,
|
entryPoints: ["src/main.ts"],
|
||||||
external: [
|
bundle: true,
|
||||||
'obsidian',
|
external: [
|
||||||
'electron',
|
"obsidian",
|
||||||
'@codemirror/autocomplete',
|
"electron",
|
||||||
'@codemirror/closebrackets',
|
"@codemirror/autocomplete",
|
||||||
'@codemirror/collab',
|
"@codemirror/closebrackets",
|
||||||
'@codemirror/commands',
|
"@codemirror/collab",
|
||||||
'@codemirror/comment',
|
"@codemirror/commands",
|
||||||
'@codemirror/fold',
|
"@codemirror/comment",
|
||||||
'@codemirror/gutter',
|
"@codemirror/fold",
|
||||||
'@codemirror/highlight',
|
"@codemirror/gutter",
|
||||||
'@codemirror/history',
|
"@codemirror/highlight",
|
||||||
'@codemirror/language',
|
"@codemirror/history",
|
||||||
'@codemirror/lint',
|
"@codemirror/language",
|
||||||
'@codemirror/matchbrackets',
|
"@codemirror/lint",
|
||||||
'@codemirror/panel',
|
"@codemirror/matchbrackets",
|
||||||
'@codemirror/rangeset',
|
"@codemirror/panel",
|
||||||
'@codemirror/rectangular-selection',
|
"@codemirror/rangeset",
|
||||||
'@codemirror/search',
|
"@codemirror/rectangular-selection",
|
||||||
'@codemirror/state',
|
"@codemirror/search",
|
||||||
'@codemirror/stream-parser',
|
"@codemirror/state",
|
||||||
'@codemirror/text',
|
"@codemirror/stream-parser",
|
||||||
'@codemirror/tooltip',
|
"@codemirror/text",
|
||||||
'@codemirror/view',
|
"@codemirror/tooltip",
|
||||||
...builtins],
|
"@codemirror/view",
|
||||||
format: 'cjs',
|
...builtins,
|
||||||
watch: !prod,
|
],
|
||||||
target: 'es2016',
|
format: "cjs",
|
||||||
logLevel: "info",
|
watch: !prod,
|
||||||
sourcemap: prod ? false : 'inline',
|
target: "es2016",
|
||||||
treeShaking: true,
|
logLevel: "info",
|
||||||
outfile: 'main.js',
|
sourcemap: prod ? false : "inline",
|
||||||
}).catch(() => process.exit(1));
|
treeShaking: true,
|
||||||
|
outfile: "main.js",
|
||||||
|
})
|
||||||
|
.catch(() => process.exit(1));
|
||||||
|
|||||||
3406
pnpm-lock.yaml
generated
3406
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
116
src/main.ts
116
src/main.ts
@@ -1,58 +1,58 @@
|
|||||||
import { MarkdownView, Notice, Plugin } from "obsidian";
|
import { MarkdownView, Notice, Plugin } from "obsidian";
|
||||||
|
|
||||||
import { DEFAULT_SETTINGS, SettingsProp } from "./types/index";
|
import { DEFAULT_SETTINGS, SettingsProp } from "./types/index";
|
||||||
import { SettingTab } from "./settingTab";
|
import { SettingTab } from "./settingTab";
|
||||||
import { publishPost } from "./methods/publishPost";
|
import { publishPost } from "./methods/publishPost";
|
||||||
export default class GhostPublish extends Plugin {
|
export default class GhostPublish extends Plugin {
|
||||||
settings: SettingsProp;
|
settings: SettingsProp;
|
||||||
|
|
||||||
async onload() {
|
async onload() {
|
||||||
// load the settings first
|
// load the settings first
|
||||||
await this.loadSettings();
|
await this.loadSettings();
|
||||||
|
|
||||||
// 2 ways to publish:
|
// 2 ways to publish:
|
||||||
// 1. Click on the ghost icon on the left
|
// 1. Click on the ghost icon on the left
|
||||||
this.addRibbonIcon("ghost", "Publish Ghost", () => {
|
this.addRibbonIcon("ghost", "Publish Ghost", () => {
|
||||||
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
|
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
|
||||||
if (!view) {
|
if (!view) {
|
||||||
new Notice(
|
new Notice(
|
||||||
"Open the markdown file first before publish your post"
|
"Open the markdown file first before publish your post"
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
publishPost(view, this.settings);
|
publishPost(view, this.settings);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 2. Run the by command + P
|
// 2. Run the by command + P
|
||||||
this.addCommand({
|
this.addCommand({
|
||||||
id: "publish",
|
id: "publish",
|
||||||
name: "Publish current document",
|
name: "Publish current document",
|
||||||
editorCallback: (_, view: MarkdownView) => {
|
editorCallback: (_, view: MarkdownView) => {
|
||||||
if (!view) {
|
if (!view) {
|
||||||
new Notice(
|
new Notice(
|
||||||
"Open the markdown file first before publish your post"
|
"Open the markdown file first before publish your post"
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
publishPost(view, this.settings);
|
publishPost(view, this.settings);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// This adds a settings tab so the user can configure various aspects of the plugin
|
// This adds a settings tab so the user can configure various aspects of the plugin
|
||||||
this.addSettingTab(new SettingTab(this.app, this));
|
this.addSettingTab(new SettingTab(this.app, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
onunload() {}
|
onunload() {}
|
||||||
async loadSettings() {
|
async loadSettings() {
|
||||||
this.settings = Object.assign(
|
this.settings = Object.assign(
|
||||||
{},
|
{},
|
||||||
DEFAULT_SETTINGS,
|
DEFAULT_SETTINGS,
|
||||||
await this.loadData()
|
await this.loadData()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
async saveSettings() {
|
async saveSettings() {
|
||||||
await this.saveData(this.settings);
|
await this.saveData(this.settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"inlineSourceMap": true,
|
"inlineSourceMap": true,
|
||||||
"inlineSources": true,
|
"inlineSources": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"target": "ES6",
|
"target": "ES6",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"lib": ["DOM", "ES5", "ES6", "ES7"],
|
"lib": ["DOM", "ES5", "ES6", "ES7"],
|
||||||
"types": ["node"]
|
"types": ["node"]
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts"]
|
"include": ["**/*.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,4 +3,4 @@
|
|||||||
"1.0.1": "0.12.0",
|
"1.0.1": "0.12.0",
|
||||||
"1.2.0": "0.12.0",
|
"1.2.0": "0.12.0",
|
||||||
"1.3.0": "0.12.0"
|
"1.3.0": "0.12.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user