@aiyiran/myclaw 1.0.224 → 1.0.225

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.
@@ -286,9 +286,6 @@
286
286
  if (isLatest && !isLatestSeen) localStorage.setItem(latestSeenKey, '1');
287
287
  if (isUpdated && !isUpdateSeen) localStorage.setItem(updateSeenKey, '1');
288
288
  openPreviewModal(data, asset);
289
- if (asset.type === 'html') {
290
- window.open(buildPreviewUrl(data, asset.path), '_blank');
291
- }
292
289
  };
293
290
 
294
291
  // 更新时间
@@ -380,13 +377,32 @@
380
377
  ].join(';');
381
378
  header.innerHTML = '<span>\uD83C\uDFA8 ' + (asset.name || '预览') + '</span>';
382
379
 
380
+ var headerRight = document.createElement('span');
381
+ headerRight.style.cssText = 'display:flex;align-items:center;gap:10px;';
382
+
383
+ var openBtn = document.createElement('span');
384
+ openBtn.textContent = '\u5728\u65B0\u9875\u9762\u6253\u5F00';
385
+ openBtn.style.cssText = 'cursor:pointer;padding:4px 10px;border-radius:4px;font-size:12px;background:rgba(255,255,255,0.08);transition:background 0.15s;';
386
+ openBtn.onmouseenter = function () { openBtn.style.background = 'rgba(255,255,255,0.18)'; };
387
+ openBtn.onmouseleave = function () { openBtn.style.background = 'rgba(255,255,255,0.08)'; };
388
+ var previewUrl = buildPreviewUrl(data, asset.path);
389
+ openBtn.onclick = function () {
390
+ window.open(previewUrl, '_blank');
391
+ navigator.clipboard.writeText(previewUrl).then(function () {
392
+ openBtn.textContent = '\u2713 \u5DF2\u590D\u5236';
393
+ setTimeout(function () { openBtn.textContent = '\u5728\u65B0\u9875\u9762\u6253\u5F00'; }, 1500);
394
+ });
395
+ };
396
+ headerRight.appendChild(openBtn);
397
+
383
398
  var closeBtn = document.createElement('span');
384
399
  closeBtn.textContent = '\u2715';
385
400
  closeBtn.style.cssText = 'cursor:pointer;padding:4px 10px;border-radius:4px;font-size:18px;font-weight:bold;transition:background 0.15s;';
386
401
  closeBtn.onmouseenter = function () { closeBtn.style.background = 'rgba(255,255,255,0.15)'; };
387
402
  closeBtn.onmouseleave = function () { closeBtn.style.background = 'none'; };
388
403
  closeBtn.onclick = function () { closePreviewModal(); };
389
- header.appendChild(closeBtn);
404
+ headerRight.appendChild(closeBtn);
405
+ header.appendChild(headerRight);
390
406
 
391
407
  // iframe
392
408
  var iframe = document.createElement('iframe');
@@ -419,6 +435,10 @@
419
435
  console.log('[myclaw-artifacts-publish] html assets:', cachedData.assets.filter(function (a) { return a.type && a.type.toLowerCase() === 'html'; }));
420
436
  console.log('[myclaw-artifacts-publish] image assets:', cachedData.assets.filter(function (a) { return a.type && a.type.toLowerCase() === 'image'; }));
421
437
 
438
+ // 读取上次发布缓存
439
+ var savedForm = {};
440
+ try { savedForm = JSON.parse(localStorage.getItem('myclaw-publish-cache')) || {}; } catch (e) {}
441
+
422
442
  var overlay = document.createElement('div');
423
443
  overlay.id = 'myclaw-artifacts-publish-modal';
424
444
  overlay.style.cssText = [
@@ -483,7 +503,7 @@
483
503
  var titleInput = document.createElement('input');
484
504
  titleInput.type = 'text';
485
505
  titleInput.placeholder = '\u8F93\u5165\u5C55\u793A\u6807\u9898';
486
- titleInput.value = cachedData.title || '';
506
+ titleInput.value = savedForm.title || cachedData.title || '';
487
507
  titleInput.style.cssText = 'padding:8px 10px;background:#252536;border:1px solid #3d3d5c;border-radius:4px;color:#cdd6f4;font-size:13px;font-family:monospace;outline:none;';
488
508
  titleInput.onfocus = function () { titleInput.style.borderColor = '#6c6caa'; };
489
509
  titleInput.onblur = function () { titleInput.style.borderColor = '#3d3d5c'; };
@@ -527,6 +547,14 @@
527
547
  }
528
548
  };
529
549
  coverRow.appendChild(coverSelect);
550
+ // 恢复缓存选中
551
+ if (savedForm.cover_path) {
552
+ coverSelect.value = savedForm.cover_path;
553
+ if (coverSelect.value) {
554
+ coverPreview.src = buildPreviewUrl(cachedData, coverSelect.value);
555
+ coverPreview.style.display = 'block';
556
+ }
557
+ }
530
558
  coverRow.appendChild(coverPreview);
531
559
  coverGroup.appendChild(coverLabel);
532
560
  coverGroup.appendChild(coverRow);
@@ -555,6 +583,10 @@
555
583
  });
556
584
  entryGroup.appendChild(entryLabel);
557
585
  entryGroup.appendChild(entrySelect);
586
+ // 恢复缓存选中
587
+ if (savedForm.entry_path) {
588
+ entrySelect.value = savedForm.entry_path;
589
+ }
558
590
  form.appendChild(entryGroup);
559
591
 
560
592
  // 确认发布按钮
@@ -589,6 +621,11 @@
589
621
  .then(function (res) { return res.json(); })
590
622
  .then(function (data) {
591
623
  console.log('[myclaw-artifacts-publish]', payload, data);
624
+ localStorage.setItem('myclaw-publish-cache', JSON.stringify({
625
+ title: titleVal,
626
+ cover_path: coverSelect.value || '',
627
+ entry_path: entrySelect.value || '',
628
+ }));
592
629
  closePublishModal();
593
630
  })
594
631
  .catch(function (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.224",
3
+ "version": "1.0.225",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {