@qnote/q-ai-note 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,15 @@ function byId(targetId) {
14
14
  export function mountSandboxGrid(targetId, options) {
15
15
  const container = byId(targetId);
16
16
  if (!container) return;
17
- const { sandboxes = [], emptyText = '暂无数据', onOpen, onDelete, readonly = false } = options || {};
17
+ const {
18
+ sandboxes = [],
19
+ emptyText = '暂无数据',
20
+ onOpen,
21
+ onEdit,
22
+ onDelete,
23
+ onCopyLink,
24
+ readonly = false,
25
+ } = options || {};
18
26
 
19
27
  if (!sandboxes.length) {
20
28
  container.innerHTML = `<div class="empty-state"><p>${esc(emptyText)}</p></div>`;
@@ -26,9 +34,16 @@ export function mountSandboxGrid(targetId, options) {
26
34
  <h3>${esc(sandbox.name)}</h3>
27
35
  <p>${esc(sandbox.description || '暂无描述')}</p>
28
36
  <div class="sandbox-meta">
29
- <span>${esc(new Date(sandbox.updated_at).toLocaleDateString())}</span>
37
+ <span>创建:${esc(new Date(sandbox.created_at).toLocaleDateString())}</span>
38
+ <span>更新:${esc(new Date(sandbox.updated_at).toLocaleDateString())}</span>
39
+ </div>
40
+ ${readonly ? '' : `
41
+ <div class="sandbox-actions">
42
+ <button class="btn btn-secondary btn-sm" data-edit-id="${esc(sandbox.id)}">编辑</button>
43
+ <button class="btn btn-secondary btn-sm" data-copy-link-id="${esc(sandbox.id)}">复制链接</button>
44
+ <button class="btn btn-secondary btn-sm sandbox-delete-weak" data-delete-id="${esc(sandbox.id)}">删除</button>
30
45
  </div>
31
- ${readonly ? '' : `<button class="btn btn-secondary btn-sm sandbox-delete" data-delete-id="${esc(sandbox.id)}">删除</button>`}
46
+ `}
32
47
  </div>
33
48
  `).join('');
34
49
 
@@ -41,6 +56,18 @@ export function mountSandboxGrid(targetId, options) {
41
56
  onDelete?.(el.getAttribute('data-delete-id'));
42
57
  });
43
58
  });
59
+ container.querySelectorAll('[data-edit-id]').forEach((el) => {
60
+ el.addEventListener('click', (e) => {
61
+ e.stopPropagation();
62
+ onEdit?.(el.getAttribute('data-edit-id'));
63
+ });
64
+ });
65
+ container.querySelectorAll('[data-copy-link-id]').forEach((el) => {
66
+ el.addEventListener('click', (e) => {
67
+ e.stopPropagation();
68
+ onCopyLink?.(el.getAttribute('data-copy-link-id'));
69
+ });
70
+ });
44
71
  }
45
72
 
46
73
  export function mountHtmlList(targetId, htmlItems) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qnote/q-ai-note",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "type": "module",
5
5
  "description": "AI-assisted personal work sandbox and diary system",
6
6
  "main": "dist/server/index.js",
@@ -21,6 +21,7 @@
21
21
  "test:e2e:full": "playwright test",
22
22
  "test:watch": "vitest",
23
23
  "paths:check": "tsx scripts/print-runtime-paths.ts",
24
+ "aser:opencode:demo-smart-note": "tsx scripts/aser-opencode-demo-smart-note.ts",
24
25
  "prepack": "npm run build"
25
26
  },
26
27
  "publishConfig": {