Merge remote-tracking branch 'gitea/develop' into fix/review-batch-2
# Conflicts: # AGENTS.md # CHANGELOG.md # README.md # apps/server/src/collaboration/collaboration.handler.ts # apps/server/src/common/helpers/prosemirror/html-embed.spec.ts # apps/server/src/common/helpers/prosemirror/html-embed.util.ts # apps/server/src/core/ai-chat/public-share-chat.service.ts # apps/server/src/core/ai-chat/public-share-chat.spec.ts # apps/server/src/core/ai-chat/public-share-workspace-limiter.ts # apps/server/src/core/page/services/page.service.ts # apps/server/src/core/page/transclusion/transclusion.service.ts # apps/server/src/integrations/import/services/file-import-task.service.ts # apps/server/src/integrations/import/services/import.service.ts
This commit is contained in:
@@ -7,8 +7,10 @@ export interface HtmlEmbedOptions {
|
||||
}
|
||||
|
||||
export interface HtmlEmbedAttributes {
|
||||
// Raw HTML/CSS/JS string that is injected verbatim into the wiki origin.
|
||||
// Raw HTML/CSS/JS string rendered inside a sandboxed iframe by the NodeView.
|
||||
source?: string;
|
||||
// Fixed iframe height in pixels. null/absent => auto-resize via postMessage.
|
||||
height?: number | null;
|
||||
}
|
||||
|
||||
declare module "@tiptap/core" {
|
||||
@@ -98,6 +100,21 @@ export const HtmlEmbed = Node.create<HtmlEmbedOptions>({
|
||||
"data-source": encodeHtmlEmbedSource(attributes.source || ""),
|
||||
}),
|
||||
},
|
||||
// Fixed iframe height in px. null/absent => auto-resize on the client.
|
||||
height: {
|
||||
default: null,
|
||||
parseHTML: (el) => {
|
||||
const v = el.getAttribute("data-height");
|
||||
if (!v) return null;
|
||||
const n = parseInt(v, 10);
|
||||
// A non-numeric data-height (e.g. crafted/corrupted import) must not
|
||||
// become NaN: NaN is typeof "number" and would disable auto-resize and
|
||||
// yield an unclamped iframe height downstream. Treat it as auto (null).
|
||||
return Number.isFinite(n) ? n : null;
|
||||
},
|
||||
renderHTML: (attrs: HtmlEmbedAttributes) =>
|
||||
attrs.height ? { "data-height": String(attrs.height) } : {},
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user