mirror of
https://github.com/olcubo/obsidian-cubox.git
synced 2026-07-22 05:43:25 +00:00
Merge branch 'develop'
# Conflicts: # manifest.json # package-lock.json # package.json # versions.json
This commit is contained in:
commit
d84129617d
7 changed files with 89 additions and 10 deletions
46
.github/workflows/release.yml
vendored
Normal file
46
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
name: Release Obsidian plugin
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # 获取完整历史以确保版本信息正确
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "18.x"
|
||||
cache: 'npm'
|
||||
|
||||
- name: Build plugin
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
tag="${GITHUB_REF#refs/tags/}"
|
||||
|
||||
# 确保版本号一致
|
||||
plugin_version=$(grep '"version"' manifest.json | cut -d'"' -f4)
|
||||
if [ "$tag" != "$plugin_version" ]; then
|
||||
echo "Error: Tag version ($tag) does not match plugin version ($plugin_version) in manifest.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 创建发布
|
||||
gh release create "$tag" \
|
||||
--title="$tag" \
|
||||
--draft \
|
||||
main.js manifest.json styles.css
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "cubox-sync",
|
||||
"name": "Cubox",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Sync your Cubox articles & annotation",
|
||||
"author": "delphi-2015",
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "obsidian-cubox",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "obsidian-cubox",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"luxon": "^3.1.1",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "obsidian-cubox",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "This is a cubox plugin for Obsidian (https://obsidian.md)",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { App, Notice, PluginSettingTab, Setting } from 'obsidian';
|
||||
import { App, Notice, PluginSettingTab, Setting, TextComponent } from 'obsidian';
|
||||
import type CuboxSyncPlugin from './main';
|
||||
import { FRONT_MATTER_VARIABLES } from './templateProcessor';
|
||||
import { ALL_FOLDERS_ID, FolderSelectModal } from './modal/folderSelectModal';
|
||||
import { filenameTemplateInstructions, metadataVariablesInstructions, contentTemplateInstructions, cuboxDateFormat, getFilenameReferenceLink, getMetadataReferenceLink, getContentReferenceLink, getDateReferenceLink } from './templateInstructions';
|
||||
import { filenameTemplateInstructions, metadataVariablesInstructions, contentTemplateInstructions, cuboxDateFormat, getFilenameReferenceLink, getMetadataReferenceLink, getContentReferenceLink, getDateReferenceLink, getInstructionUrl } from './templateInstructions';
|
||||
import { ALL_CONTENT_TYPES, TypeSelectModal } from './modal/typeSelectModal';
|
||||
import { ALL_STATUS_ID, StatusSelectModal } from './modal/statusSelectModal';
|
||||
import { ALL_ITEMS, TagSelectModal } from './modal/tagSelectModal';
|
||||
|
|
@ -484,7 +484,7 @@ export class CuboxSyncSettingTab extends PluginSettingTab {
|
|||
// 更新 API Key 设置的描述和状态
|
||||
private updateApiKeySetting(): void {
|
||||
const domain = this.plugin.settings.domain;
|
||||
const textComponent = this.apiKeySetting.components[0] as any;
|
||||
const textComponent = this.apiKeySetting.components[0] as TextComponent;
|
||||
|
||||
if (!domain) {
|
||||
// 未选择域名
|
||||
|
|
@ -528,7 +528,34 @@ export class CuboxSyncSettingTab extends PluginSettingTab {
|
|||
const updateDomainReference = (selector: string, getLinkFunction: (domain: string) => string) => {
|
||||
const element = document.querySelector(selector);
|
||||
if (element) {
|
||||
element.innerHTML = getLinkFunction(domain);
|
||||
element.empty();
|
||||
|
||||
// 创建包含文本的span元素
|
||||
const textSpan = element.createSpan({
|
||||
text: "For more, refer to "
|
||||
});
|
||||
|
||||
// 从getLinkFunction获取URL
|
||||
const url = domain ? getInstructionUrl(domain, selector.includes('filename') ? 'filename' :
|
||||
selector.includes('metadata') ? 'metadata' :
|
||||
selector.includes('content') ? 'content' : 'date') : '#';
|
||||
|
||||
// 创建链接元素
|
||||
const linkEl = textSpan.createEl('a', {
|
||||
text: "reference",
|
||||
cls: "reference-link",
|
||||
href: url
|
||||
});
|
||||
|
||||
// 如果有域名,添加target属性
|
||||
if (domain) {
|
||||
linkEl.setAttribute('target', '_blank');
|
||||
}
|
||||
|
||||
// 添加句号
|
||||
textSpan.createSpan({
|
||||
text: "."
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ export class TemplateProcessor {
|
|||
continue;
|
||||
}
|
||||
|
||||
const value = (article as any)[variable];
|
||||
const value = this.getArticleProperty(article, variable);
|
||||
if (value) {
|
||||
frontMatter[alias] = value;
|
||||
}
|
||||
|
|
@ -308,4 +308,9 @@ export class TemplateProcessor {
|
|||
|
||||
return highlightedContent;
|
||||
}
|
||||
|
||||
// 类型安全的辅助函数
|
||||
private getArticleProperty(article: CuboxArticle, propertyName: string): unknown {
|
||||
return (article as unknown as Record<string, unknown>)[propertyName];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"1.0.0": "0.15.0",
|
||||
"1.0.1": "0.15.0"
|
||||
"1.0.1": "0.15.0",
|
||||
"1.0.2": "0.15.0"
|
||||
}
|
||||
Loading…
Reference in a new issue