mirror of
https://github.com/woodchen-ink/obsidian-publish-to-discourse.git
synced 2025-07-18 13:52:07 +08:00
Compare commits
5 Commits
48609ce681
...
48cbc72c4a
Author | SHA1 | Date | |
---|---|---|---|
48cbc72c4a | |||
e4f73f5a6b | |||
b24bf09efc | |||
069ce44978 | |||
25982b1541 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,3 +20,4 @@ data.json
|
|||||||
|
|
||||||
# Exclude macOS Finder (System Explorer) View States
|
# Exclude macOS Finder (System Explorer) View States
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.cursor/rules/discourse.mdc
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "publish-to-discourse",
|
"id": "publish-to-discourse",
|
||||||
"name": "Publish to Discourse",
|
"name": "Publish to Discourse",
|
||||||
"version": "1.0.18",
|
"version": "1.0.20",
|
||||||
"minAppVersion": "0.15.0",
|
"minAppVersion": "0.15.0",
|
||||||
"description": "Publish notes to the Discourse forum.",
|
"description": "Publish notes to the Discourse forum.",
|
||||||
"author": "WoodChen",
|
"author": "WoodChen",
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-publish-to-discourse",
|
"name": "obsidian-publish-to-discourse",
|
||||||
"version": "1.0.18",
|
"version": "1.0.20",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "obsidian-publish-to-discourse",
|
"name": "obsidian-publish-to-discourse",
|
||||||
"version": "1.0.18",
|
"version": "1.0.20",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"yaml": "^2.7.0"
|
"yaml": "^2.7.0"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "obsidian-publish-to-discourse",
|
"name": "obsidian-publish-to-discourse",
|
||||||
"version": "1.0.18",
|
"version": "1.0.20",
|
||||||
"description": "Post notes to the Discourse forum.",
|
"description": "Post notes to the Discourse forum.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -45,5 +45,13 @@ export default {
|
|||||||
// Open in Discourse
|
// Open in Discourse
|
||||||
'OPEN_IN_DISCOURSE': 'Open in Discourse',
|
'OPEN_IN_DISCOURSE': 'Open in Discourse',
|
||||||
'NO_ACTIVE_FILE': 'No active file',
|
'NO_ACTIVE_FILE': 'No active file',
|
||||||
'NO_TOPIC_ID': 'This note has not been published to Discourse yet'
|
'NO_TOPIC_ID': 'This note has not been published to Discourse yet',
|
||||||
|
|
||||||
|
// Category conflict
|
||||||
|
'CATEGORY_CONFLICT_TITLE': 'Category Conflict',
|
||||||
|
'CATEGORY_CONFLICT_DESC': 'The local category setting differs from the remote category on Discourse. Please choose which category to use:',
|
||||||
|
'LOCAL_CATEGORY': 'Local Category (set in frontmatter)',
|
||||||
|
'REMOTE_CATEGORY': 'Remote Category (from Discourse)',
|
||||||
|
'KEEP_LOCAL_CATEGORY': 'Keep Local Category',
|
||||||
|
'USE_REMOTE_CATEGORY': 'Use Remote Category'
|
||||||
}
|
}
|
@ -45,5 +45,13 @@ export default {
|
|||||||
// Open in Discourse
|
// Open in Discourse
|
||||||
'OPEN_IN_DISCOURSE': '在 Discourse 中打开',
|
'OPEN_IN_DISCOURSE': '在 Discourse 中打开',
|
||||||
'NO_ACTIVE_FILE': '没有打开的文件',
|
'NO_ACTIVE_FILE': '没有打开的文件',
|
||||||
'NO_TOPIC_ID': '此笔记尚未发布到 Discourse'
|
'NO_TOPIC_ID': '此笔记尚未发布到 Discourse',
|
||||||
|
|
||||||
|
// 分类冲突
|
||||||
|
'CATEGORY_CONFLICT_TITLE': '分类冲突',
|
||||||
|
'CATEGORY_CONFLICT_DESC': '检测到本地设置的分类与 Discourse 上的分类不同,请选择要使用的分类:',
|
||||||
|
'LOCAL_CATEGORY': '本地分类(frontmatter中设置)',
|
||||||
|
'REMOTE_CATEGORY': '远程分类(Discourse上的分类)',
|
||||||
|
'KEEP_LOCAL_CATEGORY': '保持本地分类',
|
||||||
|
'USE_REMOTE_CATEGORY': '使用远程分类'
|
||||||
}
|
}
|
50
src/main.ts
50
src/main.ts
@ -5,7 +5,7 @@ import { t, setLocale } from './i18n';
|
|||||||
import { expandEmbeds } from './expand-embeds';
|
import { expandEmbeds } from './expand-embeds';
|
||||||
import { DiscourseAPI } from './api';
|
import { DiscourseAPI } from './api';
|
||||||
import { EmbedHandler } from './embed-handler';
|
import { EmbedHandler } from './embed-handler';
|
||||||
import { SelectCategoryModal } from './ui';
|
import { SelectCategoryModal, CategoryConflictModal } from './ui';
|
||||||
import { NotifyUser } from './notification';
|
import { NotifyUser } from './notification';
|
||||||
import { getFrontMatter, removeFrontMatter } from './utils';
|
import { getFrontMatter, removeFrontMatter } from './utils';
|
||||||
import { ActiveFile, PluginInterface } from './types';
|
import { ActiveFile, PluginInterface } from './types';
|
||||||
@ -124,13 +124,49 @@ export default class PublishToDiscourse extends Plugin implements PluginInterfac
|
|||||||
console.log(`Updated tags from Discourse: ${topicInfo.tags.join(', ')}`);
|
console.log(`Updated tags from Discourse: ${topicInfo.tags.join(', ')}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果获取到了分类ID,更新设置中的分类
|
// 处理分类冲突
|
||||||
if (topicInfo.categoryId) {
|
if (topicInfo.categoryId) {
|
||||||
// 查找分类名称
|
const localCategoryId = fm?.discourse_category_id;
|
||||||
const category = categories.find(c => c.id === topicInfo.categoryId);
|
const remoteCategoryId = topicInfo.categoryId;
|
||||||
if (category) {
|
|
||||||
this.settings.category = category.id;
|
// 如果本地有设置分类ID且与远程不同,询问用户
|
||||||
console.log(`Updated category from Discourse: ${category.name} (${category.id})`);
|
if (localCategoryId && localCategoryId !== remoteCategoryId) {
|
||||||
|
const localCategory = categories.find(c => c.id === localCategoryId);
|
||||||
|
const remoteCategory = categories.find(c => c.id === remoteCategoryId);
|
||||||
|
|
||||||
|
if (localCategory && remoteCategory) {
|
||||||
|
const conflictModal = new CategoryConflictModal(
|
||||||
|
this.app,
|
||||||
|
this,
|
||||||
|
localCategoryId,
|
||||||
|
localCategory.name,
|
||||||
|
remoteCategoryId,
|
||||||
|
remoteCategory.name
|
||||||
|
);
|
||||||
|
|
||||||
|
const useRemote = await conflictModal.showAndWait();
|
||||||
|
if (useRemote) {
|
||||||
|
this.settings.category = remoteCategoryId;
|
||||||
|
console.log(`User chose remote category: ${remoteCategory.name} (${remoteCategoryId})`);
|
||||||
|
} else {
|
||||||
|
this.settings.category = localCategoryId;
|
||||||
|
console.log(`User kept local category: ${localCategory.name} (${localCategoryId})`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果找不到分类信息,使用远程分类
|
||||||
|
this.settings.category = remoteCategoryId;
|
||||||
|
}
|
||||||
|
} else if (localCategoryId) {
|
||||||
|
// 如果本地有设置且与远程相同,使用本地设置
|
||||||
|
this.settings.category = localCategoryId;
|
||||||
|
console.log(`Using local category: ${localCategoryId}`);
|
||||||
|
} else {
|
||||||
|
// 如果本地没有设置,使用远程分类
|
||||||
|
const category = categories.find(c => c.id === remoteCategoryId);
|
||||||
|
if (category) {
|
||||||
|
this.settings.category = category.id;
|
||||||
|
console.log(`Using remote category: ${category.name} (${category.id})`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
98
src/ui.ts
98
src/ui.ts
@ -290,4 +290,102 @@ export class SelectCategoryModal extends Modal {
|
|||||||
const { contentEl } = this;
|
const { contentEl } = this;
|
||||||
contentEl.empty();
|
contentEl.empty();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分类冲突确认对话框
|
||||||
|
export class CategoryConflictModal extends Modal {
|
||||||
|
plugin: PluginInterface;
|
||||||
|
localCategoryId: number;
|
||||||
|
localCategoryName: string;
|
||||||
|
remoteCategoryId: number;
|
||||||
|
remoteCategoryName: string;
|
||||||
|
resolve: (useRemote: boolean) => void;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
app: App,
|
||||||
|
plugin: PluginInterface,
|
||||||
|
localCategoryId: number,
|
||||||
|
localCategoryName: string,
|
||||||
|
remoteCategoryId: number,
|
||||||
|
remoteCategoryName: string
|
||||||
|
) {
|
||||||
|
super(app);
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.localCategoryId = localCategoryId;
|
||||||
|
this.localCategoryName = localCategoryName;
|
||||||
|
this.remoteCategoryId = remoteCategoryId;
|
||||||
|
this.remoteCategoryName = remoteCategoryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回一个Promise,让调用者等待用户选择
|
||||||
|
showAndWait(): Promise<boolean> {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.resolve = resolve;
|
||||||
|
this.open();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpen() {
|
||||||
|
const { contentEl } = this;
|
||||||
|
contentEl.empty();
|
||||||
|
contentEl.addClass('discourse-category-conflict-modal');
|
||||||
|
|
||||||
|
// 标题
|
||||||
|
contentEl.createEl('h2', { text: t('CATEGORY_CONFLICT_TITLE') });
|
||||||
|
|
||||||
|
// 说明文字
|
||||||
|
const description = contentEl.createEl('div', { cls: 'conflict-description' });
|
||||||
|
description.createEl('p', { text: t('CATEGORY_CONFLICT_DESC') });
|
||||||
|
|
||||||
|
// 分类对比
|
||||||
|
const comparisonContainer = contentEl.createEl('div', { cls: 'category-comparison' });
|
||||||
|
|
||||||
|
// 本地分类
|
||||||
|
const localContainer = comparisonContainer.createEl('div', { cls: 'category-option local' });
|
||||||
|
localContainer.createEl('h3', { text: t('LOCAL_CATEGORY') });
|
||||||
|
localContainer.createEl('div', {
|
||||||
|
cls: 'category-name',
|
||||||
|
text: `${this.localCategoryName} (ID: ${this.localCategoryId})`
|
||||||
|
});
|
||||||
|
|
||||||
|
// 远程分类
|
||||||
|
const remoteContainer = comparisonContainer.createEl('div', { cls: 'category-option remote' });
|
||||||
|
remoteContainer.createEl('h3', { text: t('REMOTE_CATEGORY') });
|
||||||
|
remoteContainer.createEl('div', {
|
||||||
|
cls: 'category-name',
|
||||||
|
text: `${this.remoteCategoryName} (ID: ${this.remoteCategoryId})`
|
||||||
|
});
|
||||||
|
|
||||||
|
// 按钮区域
|
||||||
|
const buttonArea = contentEl.createEl('div', { cls: 'button-area' });
|
||||||
|
|
||||||
|
// 保持本地分类按钮
|
||||||
|
const keepLocalButton = buttonArea.createEl('button', {
|
||||||
|
cls: 'keep-local-button',
|
||||||
|
text: t('KEEP_LOCAL_CATEGORY')
|
||||||
|
});
|
||||||
|
keepLocalButton.onclick = () => {
|
||||||
|
this.resolve(false);
|
||||||
|
this.close();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 使用远程分类按钮
|
||||||
|
const useRemoteButton = buttonArea.createEl('button', {
|
||||||
|
cls: 'use-remote-button',
|
||||||
|
text: t('USE_REMOTE_CATEGORY')
|
||||||
|
});
|
||||||
|
useRemoteButton.onclick = () => {
|
||||||
|
this.resolve(true);
|
||||||
|
this.close();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
const { contentEl } = this;
|
||||||
|
contentEl.empty();
|
||||||
|
// 如果用户直接关闭对话框,默认保持本地设置
|
||||||
|
if (this.resolve) {
|
||||||
|
this.resolve(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
283
styles.css
283
styles.css
@ -12,10 +12,11 @@ If your plugin does not need CSS, delete this file.
|
|||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
max-height: 90vh;
|
max-height: 90vh;
|
||||||
background-color: var(--background-primary);
|
background-color: var(--background-primary);
|
||||||
border-radius: 8px;
|
border-radius: var(--radius-l);
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
box-shadow: var(--shadow-xl);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Content Area Style */
|
/* Content Area Style */
|
||||||
@ -69,53 +70,80 @@ If your plugin does not need CSS, delete this file.
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border: 2px solid var(--background-modifier-border);
|
border: 2px solid var(--background-modifier-border);
|
||||||
border-radius: 4px;
|
border-radius: var(--radius-s);
|
||||||
background-color: var(--background-primary);
|
background-color: var(--background-primary);
|
||||||
color: var(--text-normal);
|
color: var(--text-normal);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
min-height: 42px;
|
min-height: 42px;
|
||||||
|
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal select {
|
.discourse-sync-modal select {
|
||||||
height: 42px;
|
height: 42px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-sync-modal select:hover {
|
||||||
|
border-color: var(--background-modifier-border-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal select:focus {
|
.discourse-sync-modal select:focus {
|
||||||
border-color: var(--interactive-accent);
|
border-color: var(--interactive-accent) !important;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
box-shadow: 0 0 0 2px var(--interactive-accent-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .submit-button {
|
.discourse-sync-modal .submit-button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 10px 16px;
|
padding: 10px 16px;
|
||||||
background-color: var(--interactive-accent);
|
border-radius: var(--radius-m);
|
||||||
color: var(--text-on-accent);
|
|
||||||
border: none;
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
transition: background-color 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
|
/* 确保按钮有合适的尺寸和阴影 */
|
||||||
|
min-height: 42px;
|
||||||
|
box-shadow: var(--shadow-s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 确保按钮在所有主题下都可见 */
|
||||||
|
.discourse-sync-modal .submit-button {
|
||||||
|
/* 强制设置具体的样式值,避免被主题覆盖 */
|
||||||
|
background-color: var(--interactive-accent) !important;
|
||||||
|
color: var(--text-on-accent) !important;
|
||||||
|
border: 1px solid var(--interactive-accent) !important;
|
||||||
|
/* 确保按钮有足够的对比度 */
|
||||||
|
filter: contrast(1.1) saturate(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .submit-button:hover {
|
.discourse-sync-modal .submit-button:hover {
|
||||||
background-color: var(--interactive-accent-hover);
|
background-color: var(--interactive-accent-hover) !important;
|
||||||
|
border-color: var(--interactive-accent-hover) !important;
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .submit-button:disabled {
|
.discourse-sync-modal .submit-button:disabled {
|
||||||
opacity: 0.7;
|
background-color: var(--background-modifier-border) !important;
|
||||||
cursor: not-allowed;
|
color: var(--text-muted) !important;
|
||||||
|
border-color: var(--background-modifier-border) !important;
|
||||||
|
opacity: 1 !important;
|
||||||
|
filter: none;
|
||||||
|
cursor: not-allowed !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 这些规则已经被上面的 !important 规则覆盖了,移除重复 */
|
||||||
|
|
||||||
/* Notice Style */
|
/* Notice Style */
|
||||||
.discourse-sync-modal .notice {
|
.discourse-sync-modal .notice {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
border-radius: 8px;
|
border-radius: var(--radius-m);
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
box-shadow: var(--shadow-s);
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
|
transition: all 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .notice.success {
|
.discourse-sync-modal .notice.success {
|
||||||
@ -126,16 +154,20 @@ If your plugin does not need CSS, delete this file.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .notice.error {
|
.discourse-sync-modal .notice.error {
|
||||||
background: rgb(255, 235, 235);
|
/* 基础样式,会被 !important 规则覆盖 */
|
||||||
border: 1px solid rgba(255, 82, 82, 0.2);
|
}
|
||||||
color: rgb(255, 82, 82);
|
|
||||||
|
/* 确保错误通知在所有主题下都可见 */
|
||||||
|
.discourse-sync-modal .notice.error {
|
||||||
|
background: var(--background-modifier-error) !important;
|
||||||
|
border: 1px solid var(--background-modifier-error-border) !important;
|
||||||
|
color: var(--text-error) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .error-title {
|
.discourse-sync-modal .error-title {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
color: rgb(255, 82, 82);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
@ -147,28 +179,40 @@ If your plugin does not need CSS, delete this file.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .error-message {
|
.discourse-sync-modal .error-message {
|
||||||
color: rgb(255, 82, 82);
|
|
||||||
opacity: 0.8;
|
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 确保错误标题和消息在所有主题下都可见 */
|
||||||
|
.discourse-sync-modal .error-title {
|
||||||
|
color: var(--text-error) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-sync-modal .error-message {
|
||||||
|
color: var(--text-error) !important;
|
||||||
|
opacity: 0.9 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .retry-button {
|
.discourse-sync-modal .retry-button {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
padding: 6px 16px;
|
padding: 6px 16px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: rgb(255, 82, 82);
|
border-radius: var(--radius-s);
|
||||||
border: 1px solid rgb(255, 82, 82);
|
|
||||||
border-radius: 4px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 确保重试按钮在所有主题下都可见 */
|
||||||
|
.discourse-sync-modal .retry-button {
|
||||||
|
color: var(--text-error) !important;
|
||||||
|
border-color: var(--text-error) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .retry-button:hover {
|
.discourse-sync-modal .retry-button:hover {
|
||||||
background-color: rgb(255, 82, 82);
|
background-color: var(--text-error) !important;
|
||||||
color: white;
|
color: var(--text-on-accent) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tag Select Area Style */
|
/* Tag Select Area Style */
|
||||||
@ -199,9 +243,16 @@ If your plugin does not need CSS, delete this file.
|
|||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
background-color: var(--interactive-accent);
|
background-color: var(--interactive-accent);
|
||||||
color: var(--text-on-accent);
|
color: var(--text-on-accent);
|
||||||
border-radius: 4px;
|
border-radius: var(--radius-s);
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
border: 1px solid var(--interactive-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-sync-modal .tag:hover {
|
||||||
|
background-color: var(--interactive-accent-hover);
|
||||||
|
border-color: var(--interactive-accent-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .remove-tag {
|
.discourse-sync-modal .remove-tag {
|
||||||
@ -213,12 +264,17 @@ If your plugin does not need CSS, delete this file.
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: rgba(255, 255, 255, 0.2);
|
background-color: var(--background-modifier-hover);
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
opacity: 0.7;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .remove-tag:hover {
|
.discourse-sync-modal .remove-tag:hover {
|
||||||
background-color: rgba(255, 255, 255, 0.3);
|
background-color: var(--background-modifier-error);
|
||||||
|
color: var(--text-on-accent);
|
||||||
|
opacity: 1;
|
||||||
|
transform: scale(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal input[type="text"] {
|
.discourse-sync-modal input[type="text"] {
|
||||||
@ -229,6 +285,17 @@ If your plugin does not need CSS, delete this file.
|
|||||||
color: var(--text-normal);
|
color: var(--text-normal);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-sync-modal input[type="text"]:focus {
|
||||||
|
background-color: var(--background-modifier-hover);
|
||||||
|
border-radius: var(--radius-s);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-sync-modal input[type="text"]::placeholder {
|
||||||
|
color: var(--text-muted);
|
||||||
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .suggestions-container {
|
.discourse-sync-modal .suggestions-container {
|
||||||
@ -248,13 +315,14 @@ If your plugin does not need CSS, delete this file.
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
background-color: var(--background-primary);
|
background-color: var(--background-primary);
|
||||||
border: 1px solid var(--background-modifier-border);
|
border: 1px solid var(--background-modifier-border);
|
||||||
border-radius: 4px;
|
border-radius: var(--radius-m);
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
box-shadow: var(--shadow-l);
|
||||||
z-index: 1001;
|
z-index: 1001;
|
||||||
max-height: 180px;
|
max-height: 180px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
display: none; /* Hidden by default */
|
display: none; /* Hidden by default */
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .tag-suggestions:not(:empty) {
|
.discourse-sync-modal .tag-suggestions:not(:empty) {
|
||||||
@ -273,28 +341,40 @@ If your plugin does not need CSS, delete this file.
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
background-color: var(--background-primary);
|
background-color: var(--background-primary);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
border-radius: var(--radius-s);
|
||||||
|
margin: 2px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .tag-suggestion:hover {
|
.discourse-sync-modal .tag-suggestion:hover {
|
||||||
background-color: var(--background-modifier-hover);
|
background-color: var(--background-modifier-hover);
|
||||||
|
color: var(--text-accent);
|
||||||
|
transform: translateX(2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-sync-modal .tag-suggestion:active {
|
||||||
|
background-color: var(--interactive-accent);
|
||||||
|
color: var(--text-on-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tag Suggestion Scrollbar Style */
|
/* Tag Suggestion Scrollbar Style */
|
||||||
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar {
|
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar {
|
||||||
width: 4px;
|
width: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-track {
|
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-track {
|
||||||
background: transparent;
|
background: var(--background-secondary);
|
||||||
|
border-radius: var(--radius-s);
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-thumb {
|
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-thumb {
|
||||||
background-color: var(--background-modifier-border);
|
background-color: var(--background-modifier-border);
|
||||||
border-radius: 2px;
|
border-radius: var(--radius-s);
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-thumb:hover {
|
.discourse-sync-modal .tag-suggestions::-webkit-scrollbar-thumb:hover {
|
||||||
background-color: var(--background-modifier-border-hover);
|
background-color: var(--interactive-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove tag-container z-index to avoid interference */
|
/* Remove tag-container z-index to avoid interference */
|
||||||
@ -308,9 +388,6 @@ If your plugin does not need CSS, delete this file.
|
|||||||
left: 50%;
|
left: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
padding: 12px 20px;
|
padding: 12px 20px;
|
||||||
background-color: rgb(255, 235, 235);
|
|
||||||
border: 1px solid rgba(255, 82, 82, 0.2);
|
|
||||||
color: rgb(255, 82, 82);
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@ -322,6 +399,13 @@ If your plugin does not need CSS, delete this file.
|
|||||||
animation: fadeInOut 2s ease-in-out forwards;
|
animation: fadeInOut 2s ease-in-out forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 确保标签通知在所有主题下都可见 */
|
||||||
|
.discourse-sync-modal .tag-notice {
|
||||||
|
background-color: var(--background-modifier-error) !important;
|
||||||
|
border: 1px solid var(--background-modifier-error-border) !important;
|
||||||
|
color: var(--text-error) !important;
|
||||||
|
}
|
||||||
|
|
||||||
@keyframes fadeInOut {
|
@keyframes fadeInOut {
|
||||||
0% {
|
0% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@ -336,3 +420,128 @@ If your plugin does not need CSS, delete this file.
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Category Conflict Modal Styles */
|
||||||
|
.discourse-category-conflict-modal {
|
||||||
|
padding: 24px;
|
||||||
|
max-width: 600px;
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
border-radius: var(--radius-l);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal h2 {
|
||||||
|
margin: 0 0 16px 0;
|
||||||
|
font-size: 1.4em;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-normal);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .conflict-description {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .conflict-description p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--text-muted);
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .category-comparison {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .category-option {
|
||||||
|
flex: 1;
|
||||||
|
padding: 16px;
|
||||||
|
border: 2px solid var(--background-modifier-border);
|
||||||
|
border-radius: var(--radius-m);
|
||||||
|
text-align: center;
|
||||||
|
background-color: var(--background-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .category-option.local {
|
||||||
|
border-color: var(--color-blue);
|
||||||
|
background-color: var(--color-blue-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .category-option.remote {
|
||||||
|
border-color: var(--color-orange);
|
||||||
|
background-color: var(--color-orange-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .category-option h3 {
|
||||||
|
margin: 0 0 8px 0;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .category-name {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .button-area {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .keep-local-button,
|
||||||
|
.discourse-category-conflict-modal .use-remote-button {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 180px;
|
||||||
|
padding: 10px 16px;
|
||||||
|
border-radius: var(--radius-m);
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
min-height: 42px;
|
||||||
|
box-shadow: var(--shadow-s);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .keep-local-button {
|
||||||
|
background-color: var(--color-blue);
|
||||||
|
color: white;
|
||||||
|
border: 1px solid var(--color-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .keep-local-button:hover {
|
||||||
|
background-color: var(--color-blue-hover);
|
||||||
|
border-color: var(--color-blue-hover);
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .use-remote-button {
|
||||||
|
background-color: var(--color-orange);
|
||||||
|
color: white;
|
||||||
|
border: 1px solid var(--color-orange);
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .use-remote-button:hover {
|
||||||
|
background-color: var(--color-orange-hover);
|
||||||
|
border-color: var(--color-orange-hover);
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 响应式设计 */
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.discourse-category-conflict-modal .category-comparison {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .button-area {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.discourse-category-conflict-modal .keep-local-button,
|
||||||
|
.discourse-category-conflict-modal .use-remote-button {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -17,5 +17,7 @@
|
|||||||
"1.0.15": "0.15.0",
|
"1.0.15": "0.15.0",
|
||||||
"1.0.16": "0.15.0",
|
"1.0.16": "0.15.0",
|
||||||
"1.0.17": "0.15.0",
|
"1.0.17": "0.15.0",
|
||||||
"1.0.18": "0.15.0"
|
"1.0.18": "0.15.0",
|
||||||
|
"1.0.19": "0.15.0",
|
||||||
|
"1.0.20": "0.15.0"
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user