feat(mindspace): 公开页分享组件、workspace 路径与 Plaza 发布增强

- 新增 public share widget 与 workspace relative path 解析
- 增强 publications/chat-plaza 发布链路与缩略图 demo
- 补充 schema、cover 检查脚本与回归测试

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-05 23:14:41 +08:00
parent 69be1e5293
commit e2ad3bf62b
39 changed files with 2184 additions and 256 deletions
+27 -16
View File
@@ -152,29 +152,40 @@ export function renderPlazaPostRedirectHtml(post, targetUrl, { preview = false }
(function () {
var frame = document.querySelector('.post-frame');
if (!frame) return;
var appliedHeight = 420;
function applyHeight(height) {
frame.style.height = Math.max(Number(height) || 0, window.innerHeight, 420) + 'px';
var next = Math.max(Number(height) || 0, 420);
if (
appliedHeight > 420 &&
next > appliedHeight &&
frame.offsetHeight > 420 &&
next <= frame.offsetHeight + 24
) {
return appliedHeight;
}
appliedHeight = Math.max(next, window.innerHeight, 420);
frame.style.height = appliedHeight + 'px';
return appliedHeight;
}
function measureFrameDocument() {
try {
var doc = frame.contentDocument;
var body = doc && doc.body;
var root = doc && doc.documentElement;
if (!body && !root) return 0;
var measured = Math.max(
body ? body.scrollHeight : 0,
body ? body.offsetHeight : 0,
root ? root.scrollHeight : 0,
root ? root.offsetHeight : 0
);
if (body) {
for (var i = 0; i < body.children.length; i += 1) {
var child = body.children[i];
var rect = child.getBoundingClientRect();
measured = Math.max(measured, rect.bottom + (root ? root.scrollTop : 0));
}
if (!body) return 0;
var scrollTop = (doc.documentElement && doc.documentElement.scrollTop) || body.scrollTop || 0;
var measured = 0;
var blocks = body.querySelectorAll('.hero,.section,.quote-section,.footer,main,article');
for (var i = 0; i < blocks.length; i += 1) {
var el = blocks[i];
var rect = el.getBoundingClientRect();
measured = Math.max(measured, rect.bottom + scrollTop, el.offsetTop + el.offsetHeight);
}
return Math.ceil(measured);
for (var j = 0; j < body.children.length; j += 1) {
var child = body.children[j];
var childRect = child.getBoundingClientRect();
measured = Math.max(measured, childRect.bottom + scrollTop, child.offsetTop + child.offsetHeight);
}
return Math.ceil(Math.max(measured, 420));
} catch (error) {
return 0;
}