@blockslides/core 0.3.2 → 0.4.0

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.
package/dist/index.d.mts CHANGED
@@ -3016,6 +3016,27 @@ declare module '@blockslides/core' {
3016
3016
  }
3017
3017
  declare const unsetMark: RawCommands['unsetMark'];
3018
3018
 
3019
+ declare module '@blockslides/core' {
3020
+ interface Commands<ReturnType> {
3021
+ updateAssetUrls: {
3022
+ /**
3023
+ * Update asset URLs across the entire document in a single transaction.
3024
+ * The map keys can be either an `assetId` (preferred for imageBlock nodes)
3025
+ * or the current URL (used as a fallback, and for nodes without an assetId
3026
+ * such as slide/columnGroup backgrounds and video embeds).
3027
+ *
3028
+ * @example
3029
+ * editor.commands.updateAssetUrls({
3030
+ * 'asset-123': 'https://cdn.example.com/fresh-url.jpg',
3031
+ * 'https://old.example.com/bg.jpg': 'https://cdn.example.com/fresh-bg.jpg',
3032
+ * })
3033
+ */
3034
+ updateAssetUrls: (urlMap: Record<string, string>) => ReturnType;
3035
+ };
3036
+ }
3037
+ }
3038
+ declare const updateAssetUrls: RawCommands['updateAssetUrls'];
3039
+
3019
3040
  declare module '@blockslides/core' {
3020
3041
  interface Commands<ReturnType> {
3021
3042
  updateAttributes: {
@@ -3127,11 +3148,12 @@ declare const index$2_toggleWrap: typeof toggleWrap;
3127
3148
  declare const index$2_undoInputRule: typeof undoInputRule;
3128
3149
  declare const index$2_unsetAllMarks: typeof unsetAllMarks;
3129
3150
  declare const index$2_unsetMark: typeof unsetMark;
3151
+ declare const index$2_updateAssetUrls: typeof updateAssetUrls;
3130
3152
  declare const index$2_updateAttributes: typeof updateAttributes;
3131
3153
  declare const index$2_wrapIn: typeof wrapIn;
3132
3154
  declare const index$2_wrapInList: typeof wrapInList;
3133
3155
  declare namespace index$2 {
3134
- export { type index$2_InsertContentAtOptions as InsertContentAtOptions, type index$2_InsertContentOptions as InsertContentOptions, type index$2_SetContentOptions as SetContentOptions, index$2_blur as blur, index$2_clearContent as clearContent, index$2_clearNodes as clearNodes, index$2_command as command, index$2_createParagraphNear as createParagraphNear, index$2_cut as cut, index$2_deleteCurrentNode as deleteCurrentNode, index$2_deleteNode as deleteNode, index$2_deleteRange as deleteRange, index$2_deleteSelection as deleteSelection, index$2_enter as enter, index$2_exitCode as exitCode, index$2_extendMarkRange as extendMarkRange, index$2_first as first, index$2_focus as focus, index$2_forEach as forEach, index$2_insertContent as insertContent, index$2_insertContentAt as insertContentAt, index$2_joinBackward as joinBackward, index$2_joinDown as joinDown, index$2_joinForward as joinForward, index$2_joinItemBackward as joinItemBackward, index$2_joinItemForward as joinItemForward, index$2_joinTextblockBackward as joinTextblockBackward, index$2_joinTextblockForward as joinTextblockForward, index$2_joinUp as joinUp, index$2_keyboardShortcut as keyboardShortcut, index$2_lift as lift, index$2_liftEmptyBlock as liftEmptyBlock, index$2_liftListItem as liftListItem, index$2_newlineInCode as newlineInCode, index$2_resetAttributes as resetAttributes, index$2_scrollIntoView as scrollIntoView, index$2_selectAll as selectAll, index$2_selectNodeBackward as selectNodeBackward, index$2_selectNodeForward as selectNodeForward, index$2_selectParentNode as selectParentNode, index$2_selectTextblockEnd as selectTextblockEnd, index$2_selectTextblockStart as selectTextblockStart, index$2_setContent as setContent, index$2_setMark as setMark, index$2_setMeta as setMeta, index$2_setNode as setNode, index$2_setNodeSelection as setNodeSelection, index$2_setTextSelection as setTextSelection, index$2_sinkListItem as sinkListItem, index$2_splitBlock as splitBlock, index$2_splitListItem as splitListItem, index$2_toggleList as toggleList, index$2_toggleMark as toggleMark, index$2_toggleNode as toggleNode, index$2_toggleWrap as toggleWrap, index$2_undoInputRule as undoInputRule, index$2_unsetAllMarks as unsetAllMarks, index$2_unsetMark as unsetMark, index$2_updateAttributes as updateAttributes, index$2_wrapIn as wrapIn, index$2_wrapInList as wrapInList };
3156
+ export { type index$2_InsertContentAtOptions as InsertContentAtOptions, type index$2_InsertContentOptions as InsertContentOptions, type index$2_SetContentOptions as SetContentOptions, index$2_blur as blur, index$2_clearContent as clearContent, index$2_clearNodes as clearNodes, index$2_command as command, index$2_createParagraphNear as createParagraphNear, index$2_cut as cut, index$2_deleteCurrentNode as deleteCurrentNode, index$2_deleteNode as deleteNode, index$2_deleteRange as deleteRange, index$2_deleteSelection as deleteSelection, index$2_enter as enter, index$2_exitCode as exitCode, index$2_extendMarkRange as extendMarkRange, index$2_first as first, index$2_focus as focus, index$2_forEach as forEach, index$2_insertContent as insertContent, index$2_insertContentAt as insertContentAt, index$2_joinBackward as joinBackward, index$2_joinDown as joinDown, index$2_joinForward as joinForward, index$2_joinItemBackward as joinItemBackward, index$2_joinItemForward as joinItemForward, index$2_joinTextblockBackward as joinTextblockBackward, index$2_joinTextblockForward as joinTextblockForward, index$2_joinUp as joinUp, index$2_keyboardShortcut as keyboardShortcut, index$2_lift as lift, index$2_liftEmptyBlock as liftEmptyBlock, index$2_liftListItem as liftListItem, index$2_newlineInCode as newlineInCode, index$2_resetAttributes as resetAttributes, index$2_scrollIntoView as scrollIntoView, index$2_selectAll as selectAll, index$2_selectNodeBackward as selectNodeBackward, index$2_selectNodeForward as selectNodeForward, index$2_selectParentNode as selectParentNode, index$2_selectTextblockEnd as selectTextblockEnd, index$2_selectTextblockStart as selectTextblockStart, index$2_setContent as setContent, index$2_setMark as setMark, index$2_setMeta as setMeta, index$2_setNode as setNode, index$2_setNodeSelection as setNodeSelection, index$2_setTextSelection as setTextSelection, index$2_sinkListItem as sinkListItem, index$2_splitBlock as splitBlock, index$2_splitListItem as splitListItem, index$2_toggleList as toggleList, index$2_toggleMark as toggleMark, index$2_toggleNode as toggleNode, index$2_toggleWrap as toggleWrap, index$2_undoInputRule as undoInputRule, index$2_unsetAllMarks as unsetAllMarks, index$2_unsetMark as unsetMark, index$2_updateAssetUrls as updateAssetUrls, index$2_updateAttributes as updateAttributes, index$2_wrapIn as wrapIn, index$2_wrapInList as wrapInList };
3135
3157
  }
3136
3158
 
3137
3159
  declare const Commands$1: Extension<any, any>;
@@ -4066,6 +4088,86 @@ declare function objectIncludes(object1: Record<string, any>, object2: Record<st
4066
4088
  strict: boolean;
4067
4089
  }): boolean;
4068
4090
 
4091
+ /**
4092
+ * The node types that can carry asset URLs.
4093
+ */
4094
+ type AssetNodeType = 'imageBlock' | 'slide' | 'columnGroup' | 'video';
4095
+ /**
4096
+ * A reference to an asset found in the document.
4097
+ *
4098
+ * - `assetId` is the stable identifier set by the application when the asset
4099
+ * was inserted (only available on `imageBlock` nodes). Use it as the key when
4100
+ * building the URL map for `updateAssetUrls` or `refreshAssets`.
4101
+ * - `currentUrl` is the URL currently stored in the document. Use it as the
4102
+ * key for nodes that have no `assetId` (slides, columnGroups, videos).
4103
+ * - `nodeType` lets you filter by content type if needed.
4104
+ */
4105
+ interface AssetRef {
4106
+ assetId: string | null;
4107
+ currentUrl: string;
4108
+ nodeType: AssetNodeType;
4109
+ }
4110
+ /**
4111
+ * A map of lookup key → fresh URL passed to `updateAssetUrls` or returned
4112
+ * from an `AssetResolver`. Keys may be either `assetId` values or raw URLs.
4113
+ */
4114
+ type AssetUrlMap = Record<string, string>;
4115
+ /**
4116
+ * An async function that receives the current assets and returns a map of
4117
+ * fresh URLs. This is the integration point with your storage provider
4118
+ * (S3, Supabase, Cloudflare R2, your own CDN, etc.).
4119
+ *
4120
+ * @example
4121
+ * const resolver: AssetResolver = async (assets) => {
4122
+ * const ids = assets.map(a => a.assetId).filter(Boolean)
4123
+ * const fresh = await myApi.refreshSignedUrls(ids)
4124
+ * return Object.fromEntries(
4125
+ * assets.map(a => [a.assetId ?? a.currentUrl, fresh[a.assetId ?? '']])
4126
+ * )
4127
+ * }
4128
+ */
4129
+ type AssetResolver = (assets: AssetRef[]) => Promise<AssetUrlMap>;
4130
+ /**
4131
+ * Collect all asset references from the editor document.
4132
+ *
4133
+ * Traverses every node and returns one `AssetRef` per URL-bearing node:
4134
+ * - `imageBlock` nodes (src + optional assetId)
4135
+ * - `slide` nodes with a backgroundImage
4136
+ * - `columnGroup` nodes with a backgroundImage
4137
+ * - `video` nodes (src)
4138
+ *
4139
+ * @example
4140
+ * const assets = getEditorAssets(editor)
4141
+ * // → [{ assetId: 'abc', currentUrl: 'https://...', nodeType: 'imageBlock' }, ...]
4142
+ */
4143
+ declare function getEditorAssets(editor: SlideEditor): AssetRef[];
4144
+ /**
4145
+ * Refresh all asset URLs in the editor document.
4146
+ *
4147
+ * Collects every asset reference, passes the list to your `resolver` function,
4148
+ * then applies the returned URL map in a single ProseMirror transaction.
4149
+ *
4150
+ * The resolver is where you integrate with your storage provider — fetch
4151
+ * presigned URLs from S3, generate Supabase tokens, call your own API, etc.
4152
+ * Blockslides only handles the document traversal and patching.
4153
+ *
4154
+ * @param editor - The SlideEditor instance.
4155
+ * @param resolver - Async function that receives the asset list and returns
4156
+ * a map of `{ assetId | currentUrl → freshUrl }`.
4157
+ *
4158
+ * @example
4159
+ * import { refreshAssets } from '@blockslides/core'
4160
+ *
4161
+ * await refreshAssets(editor, async (assets) => {
4162
+ * const ids = assets.map(a => a.assetId).filter(Boolean)
4163
+ * const fresh = await myStorage.getSignedUrls(ids)
4164
+ * return Object.fromEntries(
4165
+ * assets.map(a => [a.assetId ?? a.currentUrl, fresh[a.assetId ?? '']])
4166
+ * )
4167
+ * })
4168
+ */
4169
+ declare function refreshAssets(editor: SlideEditor, resolver: AssetResolver): Promise<void>;
4170
+
4069
4171
  /**
4070
4172
  * Removes duplicated values within an array.
4071
4173
  * Supports numbers, strings and objects.
@@ -4130,4 +4232,4 @@ interface Commands<ReturnType = any> {
4130
4232
  interface Storage {
4131
4233
  }
4132
4234
 
4133
- export { type AnyCommands, type AnyConfig, type AnyExtension, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DocumentType, SlideEditor as Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, type PartialTheme, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResolvedTheme, type SetContentOptions, type SingleCommands, SlideEditor, type Storage, type TextSerializer, type TextType, type Theme, type ThemeConfig, type ThemeInput, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, applyAllLayouts, applyLayoutToColumnGroup, applyLayoutToRow, applyTheme, blur, callOrReturn, canInsertNode, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createNodeFromContent, createParagraphNear, createStyleTag, cut, darkTheme, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getTheme, getThemeNames, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, lightTheme, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, parseLayout, pasteRulesPlugin, posToDOMRect, registerTheme, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, resolveTheme, rewriteUnknownContent, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
4235
+ export { type AnyCommands, type AnyConfig, type AnyExtension, type AssetNodeType, type AssetRef, type AssetResolver, type AssetUrlMap, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DocumentType, SlideEditor as Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, type PartialTheme, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResolvedTheme, type SetContentOptions, type SingleCommands, SlideEditor, type Storage, type TextSerializer, type TextType, type Theme, type ThemeConfig, type ThemeInput, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, applyAllLayouts, applyLayoutToColumnGroup, applyLayoutToRow, applyTheme, blur, callOrReturn, canInsertNode, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createNodeFromContent, createParagraphNear, createStyleTag, cut, darkTheme, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getEditorAssets, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getTheme, getThemeNames, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, lightTheme, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, parseLayout, pasteRulesPlugin, posToDOMRect, refreshAssets, registerTheme, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, resolveTheme, rewriteUnknownContent, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, updateAssetUrls, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
package/dist/index.d.ts CHANGED
@@ -3016,6 +3016,27 @@ declare module '@blockslides/core' {
3016
3016
  }
3017
3017
  declare const unsetMark: RawCommands['unsetMark'];
3018
3018
 
3019
+ declare module '@blockslides/core' {
3020
+ interface Commands<ReturnType> {
3021
+ updateAssetUrls: {
3022
+ /**
3023
+ * Update asset URLs across the entire document in a single transaction.
3024
+ * The map keys can be either an `assetId` (preferred for imageBlock nodes)
3025
+ * or the current URL (used as a fallback, and for nodes without an assetId
3026
+ * such as slide/columnGroup backgrounds and video embeds).
3027
+ *
3028
+ * @example
3029
+ * editor.commands.updateAssetUrls({
3030
+ * 'asset-123': 'https://cdn.example.com/fresh-url.jpg',
3031
+ * 'https://old.example.com/bg.jpg': 'https://cdn.example.com/fresh-bg.jpg',
3032
+ * })
3033
+ */
3034
+ updateAssetUrls: (urlMap: Record<string, string>) => ReturnType;
3035
+ };
3036
+ }
3037
+ }
3038
+ declare const updateAssetUrls: RawCommands['updateAssetUrls'];
3039
+
3019
3040
  declare module '@blockslides/core' {
3020
3041
  interface Commands<ReturnType> {
3021
3042
  updateAttributes: {
@@ -3127,11 +3148,12 @@ declare const index$2_toggleWrap: typeof toggleWrap;
3127
3148
  declare const index$2_undoInputRule: typeof undoInputRule;
3128
3149
  declare const index$2_unsetAllMarks: typeof unsetAllMarks;
3129
3150
  declare const index$2_unsetMark: typeof unsetMark;
3151
+ declare const index$2_updateAssetUrls: typeof updateAssetUrls;
3130
3152
  declare const index$2_updateAttributes: typeof updateAttributes;
3131
3153
  declare const index$2_wrapIn: typeof wrapIn;
3132
3154
  declare const index$2_wrapInList: typeof wrapInList;
3133
3155
  declare namespace index$2 {
3134
- export { type index$2_InsertContentAtOptions as InsertContentAtOptions, type index$2_InsertContentOptions as InsertContentOptions, type index$2_SetContentOptions as SetContentOptions, index$2_blur as blur, index$2_clearContent as clearContent, index$2_clearNodes as clearNodes, index$2_command as command, index$2_createParagraphNear as createParagraphNear, index$2_cut as cut, index$2_deleteCurrentNode as deleteCurrentNode, index$2_deleteNode as deleteNode, index$2_deleteRange as deleteRange, index$2_deleteSelection as deleteSelection, index$2_enter as enter, index$2_exitCode as exitCode, index$2_extendMarkRange as extendMarkRange, index$2_first as first, index$2_focus as focus, index$2_forEach as forEach, index$2_insertContent as insertContent, index$2_insertContentAt as insertContentAt, index$2_joinBackward as joinBackward, index$2_joinDown as joinDown, index$2_joinForward as joinForward, index$2_joinItemBackward as joinItemBackward, index$2_joinItemForward as joinItemForward, index$2_joinTextblockBackward as joinTextblockBackward, index$2_joinTextblockForward as joinTextblockForward, index$2_joinUp as joinUp, index$2_keyboardShortcut as keyboardShortcut, index$2_lift as lift, index$2_liftEmptyBlock as liftEmptyBlock, index$2_liftListItem as liftListItem, index$2_newlineInCode as newlineInCode, index$2_resetAttributes as resetAttributes, index$2_scrollIntoView as scrollIntoView, index$2_selectAll as selectAll, index$2_selectNodeBackward as selectNodeBackward, index$2_selectNodeForward as selectNodeForward, index$2_selectParentNode as selectParentNode, index$2_selectTextblockEnd as selectTextblockEnd, index$2_selectTextblockStart as selectTextblockStart, index$2_setContent as setContent, index$2_setMark as setMark, index$2_setMeta as setMeta, index$2_setNode as setNode, index$2_setNodeSelection as setNodeSelection, index$2_setTextSelection as setTextSelection, index$2_sinkListItem as sinkListItem, index$2_splitBlock as splitBlock, index$2_splitListItem as splitListItem, index$2_toggleList as toggleList, index$2_toggleMark as toggleMark, index$2_toggleNode as toggleNode, index$2_toggleWrap as toggleWrap, index$2_undoInputRule as undoInputRule, index$2_unsetAllMarks as unsetAllMarks, index$2_unsetMark as unsetMark, index$2_updateAttributes as updateAttributes, index$2_wrapIn as wrapIn, index$2_wrapInList as wrapInList };
3156
+ export { type index$2_InsertContentAtOptions as InsertContentAtOptions, type index$2_InsertContentOptions as InsertContentOptions, type index$2_SetContentOptions as SetContentOptions, index$2_blur as blur, index$2_clearContent as clearContent, index$2_clearNodes as clearNodes, index$2_command as command, index$2_createParagraphNear as createParagraphNear, index$2_cut as cut, index$2_deleteCurrentNode as deleteCurrentNode, index$2_deleteNode as deleteNode, index$2_deleteRange as deleteRange, index$2_deleteSelection as deleteSelection, index$2_enter as enter, index$2_exitCode as exitCode, index$2_extendMarkRange as extendMarkRange, index$2_first as first, index$2_focus as focus, index$2_forEach as forEach, index$2_insertContent as insertContent, index$2_insertContentAt as insertContentAt, index$2_joinBackward as joinBackward, index$2_joinDown as joinDown, index$2_joinForward as joinForward, index$2_joinItemBackward as joinItemBackward, index$2_joinItemForward as joinItemForward, index$2_joinTextblockBackward as joinTextblockBackward, index$2_joinTextblockForward as joinTextblockForward, index$2_joinUp as joinUp, index$2_keyboardShortcut as keyboardShortcut, index$2_lift as lift, index$2_liftEmptyBlock as liftEmptyBlock, index$2_liftListItem as liftListItem, index$2_newlineInCode as newlineInCode, index$2_resetAttributes as resetAttributes, index$2_scrollIntoView as scrollIntoView, index$2_selectAll as selectAll, index$2_selectNodeBackward as selectNodeBackward, index$2_selectNodeForward as selectNodeForward, index$2_selectParentNode as selectParentNode, index$2_selectTextblockEnd as selectTextblockEnd, index$2_selectTextblockStart as selectTextblockStart, index$2_setContent as setContent, index$2_setMark as setMark, index$2_setMeta as setMeta, index$2_setNode as setNode, index$2_setNodeSelection as setNodeSelection, index$2_setTextSelection as setTextSelection, index$2_sinkListItem as sinkListItem, index$2_splitBlock as splitBlock, index$2_splitListItem as splitListItem, index$2_toggleList as toggleList, index$2_toggleMark as toggleMark, index$2_toggleNode as toggleNode, index$2_toggleWrap as toggleWrap, index$2_undoInputRule as undoInputRule, index$2_unsetAllMarks as unsetAllMarks, index$2_unsetMark as unsetMark, index$2_updateAssetUrls as updateAssetUrls, index$2_updateAttributes as updateAttributes, index$2_wrapIn as wrapIn, index$2_wrapInList as wrapInList };
3135
3157
  }
3136
3158
 
3137
3159
  declare const Commands$1: Extension<any, any>;
@@ -4066,6 +4088,86 @@ declare function objectIncludes(object1: Record<string, any>, object2: Record<st
4066
4088
  strict: boolean;
4067
4089
  }): boolean;
4068
4090
 
4091
+ /**
4092
+ * The node types that can carry asset URLs.
4093
+ */
4094
+ type AssetNodeType = 'imageBlock' | 'slide' | 'columnGroup' | 'video';
4095
+ /**
4096
+ * A reference to an asset found in the document.
4097
+ *
4098
+ * - `assetId` is the stable identifier set by the application when the asset
4099
+ * was inserted (only available on `imageBlock` nodes). Use it as the key when
4100
+ * building the URL map for `updateAssetUrls` or `refreshAssets`.
4101
+ * - `currentUrl` is the URL currently stored in the document. Use it as the
4102
+ * key for nodes that have no `assetId` (slides, columnGroups, videos).
4103
+ * - `nodeType` lets you filter by content type if needed.
4104
+ */
4105
+ interface AssetRef {
4106
+ assetId: string | null;
4107
+ currentUrl: string;
4108
+ nodeType: AssetNodeType;
4109
+ }
4110
+ /**
4111
+ * A map of lookup key → fresh URL passed to `updateAssetUrls` or returned
4112
+ * from an `AssetResolver`. Keys may be either `assetId` values or raw URLs.
4113
+ */
4114
+ type AssetUrlMap = Record<string, string>;
4115
+ /**
4116
+ * An async function that receives the current assets and returns a map of
4117
+ * fresh URLs. This is the integration point with your storage provider
4118
+ * (S3, Supabase, Cloudflare R2, your own CDN, etc.).
4119
+ *
4120
+ * @example
4121
+ * const resolver: AssetResolver = async (assets) => {
4122
+ * const ids = assets.map(a => a.assetId).filter(Boolean)
4123
+ * const fresh = await myApi.refreshSignedUrls(ids)
4124
+ * return Object.fromEntries(
4125
+ * assets.map(a => [a.assetId ?? a.currentUrl, fresh[a.assetId ?? '']])
4126
+ * )
4127
+ * }
4128
+ */
4129
+ type AssetResolver = (assets: AssetRef[]) => Promise<AssetUrlMap>;
4130
+ /**
4131
+ * Collect all asset references from the editor document.
4132
+ *
4133
+ * Traverses every node and returns one `AssetRef` per URL-bearing node:
4134
+ * - `imageBlock` nodes (src + optional assetId)
4135
+ * - `slide` nodes with a backgroundImage
4136
+ * - `columnGroup` nodes with a backgroundImage
4137
+ * - `video` nodes (src)
4138
+ *
4139
+ * @example
4140
+ * const assets = getEditorAssets(editor)
4141
+ * // → [{ assetId: 'abc', currentUrl: 'https://...', nodeType: 'imageBlock' }, ...]
4142
+ */
4143
+ declare function getEditorAssets(editor: SlideEditor): AssetRef[];
4144
+ /**
4145
+ * Refresh all asset URLs in the editor document.
4146
+ *
4147
+ * Collects every asset reference, passes the list to your `resolver` function,
4148
+ * then applies the returned URL map in a single ProseMirror transaction.
4149
+ *
4150
+ * The resolver is where you integrate with your storage provider — fetch
4151
+ * presigned URLs from S3, generate Supabase tokens, call your own API, etc.
4152
+ * Blockslides only handles the document traversal and patching.
4153
+ *
4154
+ * @param editor - The SlideEditor instance.
4155
+ * @param resolver - Async function that receives the asset list and returns
4156
+ * a map of `{ assetId | currentUrl → freshUrl }`.
4157
+ *
4158
+ * @example
4159
+ * import { refreshAssets } from '@blockslides/core'
4160
+ *
4161
+ * await refreshAssets(editor, async (assets) => {
4162
+ * const ids = assets.map(a => a.assetId).filter(Boolean)
4163
+ * const fresh = await myStorage.getSignedUrls(ids)
4164
+ * return Object.fromEntries(
4165
+ * assets.map(a => [a.assetId ?? a.currentUrl, fresh[a.assetId ?? '']])
4166
+ * )
4167
+ * })
4168
+ */
4169
+ declare function refreshAssets(editor: SlideEditor, resolver: AssetResolver): Promise<void>;
4170
+
4069
4171
  /**
4070
4172
  * Removes duplicated values within an array.
4071
4173
  * Supports numbers, strings and objects.
@@ -4130,4 +4232,4 @@ interface Commands<ReturnType = any> {
4130
4232
  interface Storage {
4131
4233
  }
4132
4234
 
4133
- export { type AnyCommands, type AnyConfig, type AnyExtension, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DocumentType, SlideEditor as Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, type PartialTheme, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResolvedTheme, type SetContentOptions, type SingleCommands, SlideEditor, type Storage, type TextSerializer, type TextType, type Theme, type ThemeConfig, type ThemeInput, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, applyAllLayouts, applyLayoutToColumnGroup, applyLayoutToRow, applyTheme, blur, callOrReturn, canInsertNode, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createNodeFromContent, createParagraphNear, createStyleTag, cut, darkTheme, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getTheme, getThemeNames, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, lightTheme, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, parseLayout, pasteRulesPlugin, posToDOMRect, registerTheme, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, resolveTheme, rewriteUnknownContent, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
4235
+ export { type AnyCommands, type AnyConfig, type AnyExtension, type AssetNodeType, type AssetRef, type AssetResolver, type AssetUrlMap, type AtomBlockMarkdownSpecOptions, type Attribute, type Attributes$1 as Attributes, type BlockMarkdownSpecOptions, type BlockParserConfig, type CanCommands, type ChainedCommands, type ChangedRange, type Command, CommandManager, type CommandProps, type CommandSpec, type Commands, type Content, type CreateNodeFromContentOptions, type DOMNode, type DOMOutputSpecArray$1 as DOMOutputSpecArray, type DecorationType, type DecorationWithType, type Diff, type Dispatch, type DocumentType, SlideEditor as Editor, type EditorEvents, type EditorOptions, type EnableRules, Extendable, type ExtendableConfig, type ExtendedRegExpMatchArray, Extension, type ExtensionAttribute, type ExtensionConfig, type Extensions, type FocusPosition, Fragment, type FullMarkdownHelpers, type GlobalAttributes, type HTMLContent, type InlineMarkdownSpecOptions, InputRule, type InputRuleFinder, type InputRuleMatch, type InsertContentAtOptions, type InsertContentOptions, type JSONContent, type KeyboardShortcutCommand, type KeysWithTypeOf, Mark, type MarkConfig, type MarkRange, type MarkType, MarkView, type MarkViewProps, type MarkViewRenderer, type MarkViewRendererOptions, type MarkViewRendererProps, type MarkdownExtensionSpec, type MarkdownHelpers, type MarkdownLexerConfiguration, type MarkdownParseHelpers, type MarkdownParseResult, type MarkdownRendererHelpers, type MarkdownToken, type MarkdownTokenizer, type MaybeReturnType, type MaybeThisParameterType, Node, type NodeConfig, NodePos, type NodeRange, type NodeType, NodeView, type NodeViewProps, type NodeViewRenderer, type NodeViewRendererOptions, type NodeViewRendererProps, type NodeWithPos, type Overwrite, type ParentConfig, type ParsedBlock, type PartialTheme, PasteRule, type PasteRuleFinder, type PasteRuleMatch, type PickValue, type Predicate, type Primitive, type Range, type RawCommands, type RemoveThis, type RenderContext, type ResolvedTheme, type SetContentOptions, type SingleCommands, SlideEditor, type Storage, type TextSerializer, type TextType, type Theme, type ThemeConfig, type ThemeInput, type TiptapEditorHTMLElement, Tracker, type TrackerResult, type UnionCommands, type UnionToIntersection, type ValuesOf, applyAllLayouts, applyLayoutToColumnGroup, applyLayoutToRow, applyTheme, blur, callOrReturn, canInsertNode, clearContent, clearNodes, combineTransactionSteps, command, index$2 as commands, createAtomBlockMarkdownSpec, createBlockMarkdownSpec, createChainableState, createDocument, h as createElement, createInlineMarkdownSpec, createNodeFromContent, createParagraphNear, createStyleTag, cut, darkTheme, defaultBlockAt, deleteCurrentNode, deleteNode, deleteProps, deleteRange, deleteSelection, elementFromString, enter, escapeForRegEx, exitCode, extendMarkRange, index$1 as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, first, flattenExtensions, focus, forEach, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getEditorAssets, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, getTheme, getThemeNames, h, injectExtensionAttributesToParseRule, inputRulesPlugin, insertContent, insertContentAt, isActive, isAndroid, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, joinBackward, joinDown, joinForward, joinItemBackward, joinItemForward, joinTextblockBackward, joinTextblockForward, joinUp, keyboardShortcut, lift, liftEmptyBlock, liftListItem, lightTheme, markInputRule, markPasteRule, index as markdown, mergeAttributes, mergeDeep, minMax, newlineInCode, nodeInputRule, nodePasteRule, objectIncludes, parseAttributes, parseIndentedBlocks, parseLayout, pasteRulesPlugin, posToDOMRect, refreshAssets, registerTheme, removeDuplicates, renderNestedMarkdownContent, resetAttributes, resolveExtensions, resolveFocusPosition, resolveTheme, rewriteUnknownContent, scrollIntoView, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, selectionToInsertionEnd, serializeAttributes, setContent, setMark, setMeta, setNode, setNodeSelection, setTextSelection, sinkListItem, sortExtensions, splitBlock, splitExtensions, splitListItem, textInputRule, textPasteRule, textblockTypeInputRule, toggleList, toggleMark, toggleNode, toggleWrap, undoInputRule, unsetAllMarks, unsetMark, updateAssetUrls, updateAttributes, updateMarkViewAttributes, wrapIn, wrapInList, wrappingInputRule };
package/dist/index.js CHANGED
@@ -70,6 +70,7 @@ __export(index_exports, {
70
70
  getAttributesFromExtensions: () => getAttributesFromExtensions,
71
71
  getChangedRanges: () => getChangedRanges,
72
72
  getDebugJSON: () => getDebugJSON,
73
+ getEditorAssets: () => getEditorAssets,
73
74
  getExtensionField: () => getExtensionField,
74
75
  getHTMLFromFragment: () => getHTMLFromFragment,
75
76
  getMarkAttributes: () => getMarkAttributes,
@@ -128,6 +129,7 @@ __export(index_exports, {
128
129
  parseLayout: () => parseLayout,
129
130
  pasteRulesPlugin: () => pasteRulesPlugin,
130
131
  posToDOMRect: () => posToDOMRect,
132
+ refreshAssets: () => refreshAssets,
131
133
  registerTheme: () => registerTheme,
132
134
  removeDuplicates: () => removeDuplicates,
133
135
  renderNestedMarkdownContent: () => renderNestedMarkdownContent,
@@ -346,6 +348,7 @@ __export(commands_exports, {
346
348
  undoInputRule: () => undoInputRule,
347
349
  unsetAllMarks: () => unsetAllMarks,
348
350
  unsetMark: () => unsetMark,
351
+ updateAssetUrls: () => updateAssetUrls,
349
352
  updateAttributes: () => updateAttributes,
350
353
  wrapIn: () => wrapIn,
351
354
  wrapInList: () => wrapInList
@@ -2831,6 +2834,37 @@ var unsetMark = (typeOrName, options = {}) => ({ tr, state, dispatch }) => {
2831
2834
  return true;
2832
2835
  };
2833
2836
 
2837
+ // src/commands/updateAssetUrls.ts
2838
+ var updateAssetUrls = (urlMap) => ({ tr, state, dispatch }) => {
2839
+ if (dispatch) {
2840
+ state.doc.descendants((node, pos) => {
2841
+ if (node.type.name === "imageBlock" && node.attrs.src) {
2842
+ const key = node.attrs.assetId && urlMap[node.attrs.assetId] ? node.attrs.assetId : node.attrs.src;
2843
+ const newUrl = urlMap[key];
2844
+ if (newUrl) {
2845
+ tr.setNodeMarkup(pos, void 0, { ...node.attrs, src: newUrl });
2846
+ }
2847
+ }
2848
+ if ((node.type.name === "slide" || node.type.name === "columnGroup") && node.attrs.backgroundImage) {
2849
+ const newUrl = urlMap[node.attrs.backgroundImage];
2850
+ if (newUrl) {
2851
+ tr.setNodeMarkup(pos, void 0, {
2852
+ ...node.attrs,
2853
+ backgroundImage: newUrl
2854
+ });
2855
+ }
2856
+ }
2857
+ if (node.type.name === "video" && node.attrs.src) {
2858
+ const newUrl = urlMap[node.attrs.src];
2859
+ if (newUrl) {
2860
+ tr.setNodeMarkup(pos, void 0, { ...node.attrs, src: newUrl });
2861
+ }
2862
+ }
2863
+ });
2864
+ }
2865
+ return true;
2866
+ };
2867
+
2834
2868
  // src/commands/updateAttributes.ts
2835
2869
  var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
2836
2870
  let nodeType = null;
@@ -2950,6 +2984,7 @@ var EventEmitter = class {
2950
2984
  this.callbacks = {};
2951
2985
  }
2952
2986
  on(event, fn) {
2987
+ if (!fn) return this;
2953
2988
  if (!this.callbacks[event]) {
2954
2989
  this.callbacks[event] = [];
2955
2990
  }
@@ -6072,6 +6107,49 @@ function renderNestedMarkdownContent(node, h2, prefixOrGenerator, ctx) {
6072
6107
  return output.join("\n");
6073
6108
  }
6074
6109
 
6110
+ // src/utilities/assetRefresh.ts
6111
+ function getEditorAssets(editor) {
6112
+ const assets = [];
6113
+ editor.state.doc.descendants((node) => {
6114
+ var _a;
6115
+ if (node.type.name === "imageBlock" && node.attrs.src) {
6116
+ assets.push({
6117
+ assetId: (_a = node.attrs.assetId) != null ? _a : null,
6118
+ currentUrl: node.attrs.src,
6119
+ nodeType: "imageBlock"
6120
+ });
6121
+ }
6122
+ if (node.type.name === "slide" && node.attrs.backgroundImage) {
6123
+ assets.push({
6124
+ assetId: null,
6125
+ currentUrl: node.attrs.backgroundImage,
6126
+ nodeType: "slide"
6127
+ });
6128
+ }
6129
+ if (node.type.name === "columnGroup" && node.attrs.backgroundImage) {
6130
+ assets.push({
6131
+ assetId: null,
6132
+ currentUrl: node.attrs.backgroundImage,
6133
+ nodeType: "columnGroup"
6134
+ });
6135
+ }
6136
+ if (node.type.name === "video" && node.attrs.src) {
6137
+ assets.push({
6138
+ assetId: null,
6139
+ currentUrl: node.attrs.src,
6140
+ nodeType: "video"
6141
+ });
6142
+ }
6143
+ });
6144
+ return assets;
6145
+ }
6146
+ async function refreshAssets(editor, resolver) {
6147
+ const assets = getEditorAssets(editor);
6148
+ if (assets.length === 0) return;
6149
+ const urlMap = await resolver(assets);
6150
+ editor.commands.updateAssetUrls(urlMap);
6151
+ }
6152
+
6075
6153
  // src/MarkView.ts
6076
6154
  function updateMarkViewAttributes(checkMark, editor, attrs = {}) {
6077
6155
  const { state } = editor;
@@ -6553,6 +6631,7 @@ var Tracker = class {
6553
6631
  getAttributesFromExtensions,
6554
6632
  getChangedRanges,
6555
6633
  getDebugJSON,
6634
+ getEditorAssets,
6556
6635
  getExtensionField,
6557
6636
  getHTMLFromFragment,
6558
6637
  getMarkAttributes,
@@ -6611,6 +6690,7 @@ var Tracker = class {
6611
6690
  parseLayout,
6612
6691
  pasteRulesPlugin,
6613
6692
  posToDOMRect,
6693
+ refreshAssets,
6614
6694
  registerTheme,
6615
6695
  removeDuplicates,
6616
6696
  renderNestedMarkdownContent,