@ixo/editor 7.12.0 → 7.13.1
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/{chunk-H3UJUFQJ.js → chunk-EWYIYBND.js} +5 -3
- package/dist/chunk-EWYIYBND.js.map +1 -0
- package/dist/{chunk-7CYW6V5T.js → chunk-QFOAEPJT.js} +72 -11
- package/dist/chunk-QFOAEPJT.js.map +1 -0
- package/dist/{connections-Cwsj5oRD.d.ts → connections-Dg3LrIiZ.d.ts} +1 -1
- package/dist/core/index.cjs +4 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +1 -1
- package/dist/{graphql-client-DmjebTor.d.ts → graphql-client-DCgFumho.d.ts} +5 -3
- package/dist/{index-D99iLwsk.d.ts → index-Jxe3NJeY.d.ts} +5 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/mantine/index.d.ts +5 -5
- package/dist/mantine/index.js +2 -2
- package/dist/{types-DObm_Y95.d.ts → types-D-PiyyFv.d.ts} +2 -2
- package/package.json +1 -1
- package/style-core.css +35 -21
- package/style-mantine.css +35 -21
- package/style-scoped.css +35 -21
- package/style.css +35 -21
- package/dist/chunk-7CYW6V5T.js.map +0 -1
- package/dist/chunk-H3UJUFQJ.js.map +0 -1
|
@@ -71,6 +71,7 @@ function validPageBlock(value, schema, ids = /* @__PURE__ */ new Set(), depth =
|
|
|
71
71
|
// src/core/lib/pageSerializer/index.ts
|
|
72
72
|
var PAGE_FILE_SCHEMA_VERSION = 1;
|
|
73
73
|
var IXO_BLOCK_FENCE = "ixo-block";
|
|
74
|
+
var STRING_META_KEYS = ["title", "id", "author", "createdAt", "exportedAt", "icon", "cover"];
|
|
74
75
|
var yamlValue = (value) => JSON.stringify(value);
|
|
75
76
|
function frontmatter(meta) {
|
|
76
77
|
const lines = Object.entries(meta).filter(([, value]) => value !== void 0 && value !== null && value !== "").map(([key, value]) => `${key}: ${yamlValue(value)}`);
|
|
@@ -243,7 +244,7 @@ async function pageMarkdownToBlocks(converter, markdown) {
|
|
|
243
244
|
const { meta, body } = parseFrontmatter(markdown.replace(/\r\n?/g, "\n"));
|
|
244
245
|
const schemaVersion = typeof meta.schemaVersion === "number" ? meta.schemaVersion : PAGE_FILE_SCHEMA_VERSION;
|
|
245
246
|
const supportedVersion = meta.schemaVersion === void 0 || meta.schemaVersion === PAGE_FILE_SCHEMA_VERSION;
|
|
246
|
-
const validMeta =
|
|
247
|
+
const validMeta = STRING_META_KEYS.every((key) => meta[key] === void 0 || typeof meta[key] === "string") && (meta.coverPosition === void 0 || typeof meta.coverPosition === "number");
|
|
247
248
|
const diagnostics = supportedVersion ? [] : [{ code: "unsupported-schema-version" }];
|
|
248
249
|
if (!validMeta) diagnostics.push({ code: "invalid-metadata" });
|
|
249
250
|
const [{ unified }, { default: remarkParse }, { default: remarkGfm }] = await Promise.all([import("unified"), import("remark-parse"), import("remark-gfm")]);
|
|
@@ -311,9 +312,10 @@ async function pageMarkdownToBlocks(converter, markdown) {
|
|
|
311
312
|
}
|
|
312
313
|
await parseRun(body.slice(cursor));
|
|
313
314
|
const { schemaVersion: _ignored, ...rest } = meta;
|
|
314
|
-
for (const key of
|
|
315
|
+
for (const key of STRING_META_KEYS) {
|
|
315
316
|
if (meta[key] !== void 0 && typeof meta[key] !== "string") delete rest[key];
|
|
316
317
|
}
|
|
318
|
+
if (meta.coverPosition !== void 0 && typeof meta.coverPosition !== "number") delete rest.coverPosition;
|
|
317
319
|
return { meta: { ...rest, schemaVersion }, blocks, diagnostics };
|
|
318
320
|
}
|
|
319
321
|
async function pageContentHash(markdown) {
|
|
@@ -341,4 +343,4 @@ export {
|
|
|
341
343
|
pageContentHash,
|
|
342
344
|
pageDocumentHash
|
|
343
345
|
};
|
|
344
|
-
//# sourceMappingURL=chunk-
|
|
346
|
+
//# sourceMappingURL=chunk-EWYIYBND.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/lib/pageSerializer/validateBlock.ts","../src/core/lib/pageSerializer/index.ts"],"sourcesContent":["import type { BlockSchema, InlineContentSchema, PropSchema, StyleSchema } from '@blocknote/core';\n\nexport interface PageBlockSchema {\n blockSchema: BlockSchema;\n inlineContentSchema: InlineContentSchema;\n styleSchema: StyleSchema;\n}\n\nconst BLOCK_KEYS = new Set(['id', 'type', 'props', 'content', 'children']);\n\nconst record = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value);\nconst owns = (value: object, key: string) => Object.prototype.hasOwnProperty.call(value, key);\n\nfunction validProps(value: unknown, schema: PropSchema): boolean {\n if (value === undefined) return true;\n return (\n record(value) &&\n Object.entries(value).every(([key, prop]) => {\n if (!owns(schema, key)) return false;\n const spec = schema[key];\n const type = spec.default === undefined && 'type' in spec ? spec.type : typeof spec.default;\n return typeof prop === type && (typeof prop !== 'number' || Number.isFinite(prop)) && (!spec.values || spec.values.some((allowed) => allowed === prop));\n })\n );\n}\n\nfunction validInline(value: unknown, schema: PageBlockSchema): boolean {\n if (typeof value === 'string') return true;\n return (\n Array.isArray(value) &&\n value.every((item) => {\n if (typeof item === 'string') return true;\n if (!record(item)) return false;\n if (item.type === 'text') {\n return (\n typeof item.text === 'string' &&\n (item.styles === undefined ||\n (record(item.styles) && Object.entries(item.styles).every(([key, style]) => owns(schema.styleSchema, key) && typeof style === schema.styleSchema[key].propSchema)))\n );\n }\n if (item.type === 'link') return typeof item.href === 'string' && validInline(item.content, schema);\n if (typeof item.type !== 'string' || !owns(schema.inlineContentSchema, item.type)) return false;\n const config = schema.inlineContentSchema[item.type];\n if (typeof config === 'string') return false;\n return validProps(item.props, config.propSchema) && (config.content === 'none' ? item.content === undefined : validInline(item.content ?? [], schema));\n })\n );\n}\n\nfunction validTable(value: unknown, schema: PageBlockSchema): boolean {\n if (!record(value) || value.type !== 'tableContent' || !Array.isArray(value.rows) || value.rows.length === 0) return false;\n const width = record(value.rows[0]) && Array.isArray(value.rows[0].cells) ? value.rows[0].cells.length : 0;\n if (!width) return false;\n if (\n value.columnWidths !== undefined &&\n (!Array.isArray(value.columnWidths) || !value.columnWidths.every((n) => n === null || (typeof n === 'number' && Number.isFinite(n) && n > 0)))\n )\n return false;\n for (const [key, max] of [\n ['headerRows', value.rows.length],\n ['headerCols', width],\n ] as const) {\n if (value[key] !== undefined && (!Number.isInteger(value[key]) || Number(value[key]) < 0 || Number(value[key]) > max)) return false;\n }\n return value.rows.every(\n (row) =>\n record(row) &&\n Array.isArray(row.cells) &&\n row.cells.length > 0 &&\n row.cells.every((cell) => {\n if (!record(cell)) return validInline(cell, schema);\n return (\n cell.type === 'tableCell' &&\n validInline(cell.content, schema) &&\n validProps(cell.props, {\n colspan: { default: 1 },\n rowspan: { default: 1 },\n backgroundColor: { default: 'default' },\n textColor: { default: 'default' },\n textAlignment: { default: 'left', values: ['left', 'center', 'right', 'justify'] },\n })\n );\n })\n );\n}\n\nexport function validPageBlock(value: unknown, schema: PageBlockSchema, ids = new Set<string>(), depth = 0): boolean {\n if (depth > 100 || !record(value) || typeof value.type !== 'string' || !owns(schema.blockSchema, value.type)) return false;\n if (!Object.keys(value).every((key) => BLOCK_KEYS.has(key))) return false;\n if (value.id !== undefined) {\n if (typeof value.id !== 'string' || !value.id || ids.has(value.id)) return false;\n ids.add(value.id);\n }\n const config = schema.blockSchema[value.type];\n if (!validProps(value.props, config.propSchema)) return false;\n if (value.content !== undefined) {\n if (config.content === 'none') return false;\n if (config.content === 'inline' && !validInline(value.content, schema)) return false;\n if (config.content === 'table' && !validTable(value.content, schema)) return false;\n }\n return value.children === undefined || (Array.isArray(value.children) && value.children.every((child) => validPageBlock(child, schema, ids, depth + 1)));\n}\n","import { validPageBlock, type PageBlockSchema } from './validateBlock';\n\n/**\n * The page-file format: Markdown with YAML frontmatter, where every IXO block\n * (anything BlockNote does not define) is kept whole in a fenced `ixo-block`\n * JSON section so a round trip loses nothing. Standard blocks go through\n * BlockNote's own Markdown conversion. This is the canonical shape of a page\n * file in the VFS and of a page export.\n */\n\nexport const PAGE_FILE_SCHEMA_VERSION = 1;\n\nexport const IXO_BLOCK_FENCE = 'ixo-block';\n\nexport interface PageFileMeta {\n title?: string;\n /** Stable identifier of the source: a Matrix room id today, a file id later. */\n id?: string;\n author?: string;\n createdAt?: string;\n exportedAt?: string;\n /** Icon name or image URL. */\n icon?: string;\n cover?: string;\n /** Vertical position of the cover, 0–100. */\n coverPosition?: number;\n}\n\nconst STRING_META_KEYS = ['title', 'id', 'author', 'createdAt', 'exportedAt', 'icon', 'cover'] as const;\n\nexport interface PageFile {\n meta: PageFileMeta & { schemaVersion: number };\n blocks: unknown[];\n diagnostics: PageFileDiagnostic[];\n}\n\nexport interface PageFileDiagnostic {\n code: 'unsupported-schema-version' | 'invalid-block' | 'invalid-json' | 'invalid-metadata';\n blockIndex?: number;\n}\n\n/** The two BlockNote conversions the serializer needs; any editor instance satisfies it. */\nexport interface MarkdownConverter {\n schema?: PageBlockSchema;\n blocksToMarkdownLossy(blocks?: AnyBlock[]): string | Promise<string>;\n tryParseMarkdownToBlocks(markdown: string): unknown[] | Promise<unknown[]>;\n}\n\ntype AnyBlock = { type?: string; id?: string; props?: Record<string, unknown>; content?: unknown; children?: AnyBlock[] };\n\nconst yamlValue = (value: unknown): string => JSON.stringify(value);\n\nfunction frontmatter(meta: Record<string, unknown>): string {\n const lines = Object.entries(meta)\n .filter(([, value]) => value !== undefined && value !== null && value !== '')\n .map(([key, value]) => `${key}: ${yamlValue(value)}`);\n return `---\\n${lines.join('\\n')}\\n---\\n`;\n}\n\nfunction parseFrontmatter(markdown: string): { meta: Record<string, unknown>; body: string } {\n const match = /^---\\n([\\s\\S]*?)\\n---\\n?/.exec(markdown);\n if (!match) return { meta: {}, body: markdown };\n const meta: Record<string, unknown> = Object.create(null);\n for (const line of match[1].split('\\n')) {\n const separator = line.indexOf(':');\n if (separator <= 0) continue;\n const key = line.slice(0, separator).trim();\n const raw = line.slice(separator + 1).trim();\n try {\n meta[key] = JSON.parse(raw);\n } catch {\n meta[key] = raw;\n }\n }\n return { meta, body: markdown.slice(match[0].length) };\n}\n\n/** BlockNote blocks its Markdown conversion drops: fenced like IXO blocks so they survive. */\nconst NON_MARKDOWN_BLOCK_TYPES = new Set(['pageBreak', 'toggleListItem']);\n\n/** Markdown has no folding, so a toggle heading would come back as a plain heading with its content pulled out. */\nconst isToggleHeading = (block: AnyBlock) => block.type === 'heading' && (block.props?.isToggleable === true || block.props?.isToggleable === 'true');\n\nconst MARKDOWN_INLINE_TYPES = new Set(['text', 'link']);\n\nconst hasCustomInline = (content: unknown): boolean => {\n if (Array.isArray(content)) return content.some((item) => typeof item === 'object' && item !== null && !MARKDOWN_INLINE_TYPES.has((item as { type?: string }).type ?? 'text'));\n if (typeof content !== 'object' || content === null || !Array.isArray((content as { rows?: unknown }).rows)) return false;\n return (content as { rows: Array<{ cells?: unknown[] }> }).rows.some((row) =>\n (row.cells ?? []).some((cell) => hasCustomInline(typeof cell === 'object' && cell !== null && !Array.isArray(cell) ? (cell as { content?: unknown }).content : cell))\n );\n};\n\nconst hasCustomDescendant = (block: AnyBlock, requiresFence: (block: AnyBlock) => boolean): boolean =>\n (block.children ?? []).some((child) => requiresFence(child) || hasCustomDescendant(child, requiresFence));\n\nconst LIST_TYPES = new Set(['bulletListItem', 'numberedListItem', 'checkListItem']);\n\nconst CHECK_LINE = /^( *)[*+-] \\[([ xX])\\](?:[ \\t]+(.*))?$/;\nconst BULLET_LINE = /^( *)[*+-](?:[ \\t]+(.*))?$/;\nconst NUMBER_LINE = /^( *)\\d{1,9}[.)](?:[ \\t]+(.*))?$/;\nconst NOT_LIST_TEXT = /^ *(?:`{3,}|~{3,}|>|#{1,6}(?: |$)|\\|)/;\n\nconst isListItem = (block: AnyBlock) => !!block.type && LIST_TYPES.has(block.type);\n\nconst onlyListItemsBelow = (block: AnyBlock): boolean => (block.children ?? []).every((child) => isListItem(child) && onlyListItemsBelow(child));\n\n/**\n * BlockNote 0.29 cannot read its own list Markdown back: a checklist comes back as\n * empty items, and a loose bullet list as one empty bullet with the rest nested\n * under it. Lists are therefore written and read here, one tight line per item:\n * `* text`, `1. text` and `- [ ] text`, children indented under the item's text.\n * Item text still goes through BlockNote for inline styles.\n */\nasync function listToMarkdown(converter: MarkdownConverter, items: AnyBlock[], indent = 0): Promise<string[]> {\n const lines: string[] = [];\n let number = 0;\n for (const item of items) {\n number = item.type === 'numberedListItem' ? number + 1 : 0;\n const text =\n Array.isArray(item.content) && item.content.length\n ? (await converter.blocksToMarkdownLossy([{ type: 'paragraph', props: {}, content: item.content, children: [] }])).trim().replace(/\\n+/g, ' ')\n : '';\n const checked = item.props?.checked === true || item.props?.checked === 'true';\n const marker = item.type === 'checkListItem' ? `- [${checked ? 'x' : ' '}]` : item.type === 'numberedListItem' ? `${number}.` : '*';\n lines.push(`${' '.repeat(indent)}${marker}${text ? ' ' + text : ''}`);\n const childIndent = indent + (item.type === 'numberedListItem' ? marker.length + 1 : 2);\n if (item.children?.length) lines.push(...(await listToMarkdown(converter, item.children, childIndent)));\n }\n return lines;\n}\n\nfunction listLine(line: string): { indent: number; type: string; checked?: boolean; text: string } | null {\n const check = CHECK_LINE.exec(line);\n if (check) return { indent: check[1].length, type: 'checkListItem', checked: check[2].toLowerCase() === 'x', text: (check[3] ?? '').trim() };\n const numbered = NUMBER_LINE.exec(line);\n if (numbered) return { indent: numbered[1].length, type: 'numberedListItem', text: (numbered[2] ?? '').trim() };\n const bullet = BULLET_LINE.exec(line);\n if (bullet) return { indent: bullet[1].length, type: 'bulletListItem', text: (bullet[2] ?? '').trim() };\n return null;\n}\n\n/** A list made only of item lines and plain continuation text, which `markdownToList` reads without loss. */\nconst isPlainListSource = (source: string): boolean => {\n const lines = source.split('\\n').filter((line) => line.trim());\n return lines.length > 0 && !!listLine(lines[0]) && lines.every((line) => !!listLine(line) || !NOT_LIST_TEXT.test(line));\n};\n\nasync function markdownToList(converter: MarkdownConverter, source: string): Promise<AnyBlock[]> {\n const roots: AnyBlock[] = [];\n const stack: { indent: number; block: AnyBlock }[] = [];\n const items: { block: AnyBlock; text: string }[] = [];\n for (const line of source.split('\\n')) {\n const parsed = listLine(line);\n if (!parsed) {\n const last = items[items.length - 1];\n if (last && line.trim()) last.text = `${last.text} ${line.trim()}`.trim();\n continue;\n }\n const block: AnyBlock = { type: parsed.type, props: parsed.type === 'checkListItem' ? { checked: parsed.checked } : {}, content: [], children: [] };\n while (stack.length && stack[stack.length - 1].indent >= parsed.indent) stack.pop();\n const parent = stack[stack.length - 1];\n (parent ? parent.block.children! : roots).push(block);\n stack.push({ indent: parsed.indent, block });\n items.push({ block, text: parsed.text });\n }\n for (const item of items) {\n if (!item.text) continue;\n const parsed = (await converter.tryParseMarkdownToBlocks(item.text)) as AnyBlock[];\n item.block.content = parsed[0]?.content ?? [];\n }\n return roots;\n}\n\n/**\n * Serialises a document. `isCustomBlock` decides which blocks are fenced; pass\n * `(type) => type in blockSpecs` from the schema that owns the IXO blocks. A\n * standard block with an IXO block anywhere beneath it is fenced whole too:\n * Markdown cannot hold the nested block, and a fence loses nothing.\n */\nexport async function blocksToPageMarkdown(converter: MarkdownConverter, blocks: AnyBlock[], meta: PageFileMeta, isCustomBlock: (type: string) => boolean): Promise<string> {\n const sections: string[] = [];\n let run: AnyBlock[] = [];\n let list: AnyBlock[] = [];\n const requiresFence = (block: AnyBlock) =>\n !!block.type &&\n (isCustomBlock(block.type) ||\n NON_MARKDOWN_BLOCK_TYPES.has(block.type) ||\n isToggleHeading(block) ||\n hasCustomInline(block.content) ||\n (block.type === 'codeBlock' && block.props?.language === IXO_BLOCK_FENCE));\n\n const flushRun = async () => {\n if (run.length === 0) return;\n const markdown = (await converter.blocksToMarkdownLossy(run)).trim();\n if (markdown) sections.push(markdown);\n run = [];\n };\n const flushList = async () => {\n if (list.length === 0) return;\n sections.push((await listToMarkdown(converter, list)).join('\\n'));\n list = [];\n };\n\n for (const block of blocks) {\n if (requiresFence(block) || hasCustomDescendant(block, requiresFence) || (isListItem(block) && !onlyListItemsBelow(block))) {\n await flushRun();\n await flushList();\n sections.push('```' + IXO_BLOCK_FENCE + '\\n' + JSON.stringify(block, null, 2) + '\\n```');\n } else if (isListItem(block)) {\n await flushRun();\n list.push(block);\n } else {\n await flushList();\n run.push(block);\n }\n }\n await flushRun();\n await flushList();\n\n return frontmatter({ ...meta, schemaVersion: PAGE_FILE_SCHEMA_VERSION }) + '\\n' + sections.join('\\n\\n') + '\\n';\n}\n\ntype MarkdownNode = {\n type: string;\n identifier?: string;\n url?: string;\n title?: string | null;\n alt?: string | null;\n children?: MarkdownNode[];\n position?: { start: { offset?: number }; end: { offset?: number } };\n};\n\n/**\n * BlockNote's Markdown parser (0.51+) keeps `[text][ref]` references and `[ref]: url`\n * definitions as literal text, so turn each reference in `text` into an inline link\n * and drop the definitions before handing it over.\n */\nfunction inlineReferenceLinks(parse: (source: string) => MarkdownNode, text: string, definitions: string): string {\n const tree = parse(text + '\\n\\n' + definitions);\n const targets = new Map<string, MarkdownNode>();\n const collect = (node: MarkdownNode) => {\n if (node.type === 'definition' && node.identifier && !targets.has(node.identifier)) targets.set(node.identifier, node);\n node.children?.forEach(collect);\n };\n collect(tree);\n const destination = (target: MarkdownNode) => {\n const url = target.url ?? '';\n const title = target.title ? ` \"${target.title.replace(/\"/g, '\\\\\"')}\"` : '';\n return `(${/[\\s()<>]/.test(url) ? `<${url}>` : url}${title})`;\n };\n const edits: Array<{ start: number; end: number; value: string }> = [];\n const walk = (node: MarkdownNode): void => {\n const start = node.position?.start.offset;\n const end = node.position?.end.offset;\n if (start !== undefined && end !== undefined && end <= text.length) {\n if (node.type === 'definition') {\n edits.push({ start, end, value: '' });\n return;\n }\n const target = node.identifier ? targets.get(node.identifier) : undefined;\n if (node.type === 'linkReference' && target) {\n const first = node.children?.[0]?.position?.start.offset;\n const last = node.children?.at(-1)?.position?.end.offset;\n const label = first !== undefined && last !== undefined ? text.slice(first, last) : '';\n edits.push({ start, end, value: `[${label}]${destination(target)}` });\n return;\n }\n if (node.type === 'imageReference' && target) {\n edits.push({ start, end, value: `![${node.alt ?? ''}]${destination(target)}` });\n return;\n }\n }\n node.children?.forEach(walk);\n };\n walk(tree);\n return edits.sort((a, b) => b.start - a.start).reduce((out, edit) => out.slice(0, edit.start) + edit.value + out.slice(edit.end), text);\n}\n\n/** Parses a page file back into blocks, fenced IXO blocks included. */\nexport async function pageMarkdownToBlocks(converter: MarkdownConverter, markdown: string): Promise<PageFile> {\n const { meta, body } = parseFrontmatter(markdown.replace(/\\r\\n?/g, '\\n'));\n const schemaVersion = typeof meta.schemaVersion === 'number' ? meta.schemaVersion : PAGE_FILE_SCHEMA_VERSION;\n const supportedVersion = meta.schemaVersion === undefined || meta.schemaVersion === PAGE_FILE_SCHEMA_VERSION;\n const validMeta =\n STRING_META_KEYS.every((key) => meta[key] === undefined || typeof meta[key] === 'string') && (meta.coverPosition === undefined || typeof meta.coverPosition === 'number');\n const diagnostics: PageFileDiagnostic[] = supportedVersion ? [] : [{ code: 'unsupported-schema-version' }];\n if (!validMeta) diagnostics.push({ code: 'invalid-metadata' });\n const [{ unified }, { default: remarkParse }, { default: remarkGfm }] = await Promise.all([import('unified'), import('remark-parse'), import('remark-gfm')]);\n const processor = unified().use(remarkParse).use(remarkGfm);\n const tree = processor.parse(body);\n const definitions = tree.children\n .filter((node) => node.type === 'definition')\n .map((node) => body.slice(node.position?.start.offset, node.position?.end.offset))\n .join('\\n');\n const blocks: unknown[] = [];\n const ids = new Set<string>();\n let cursor = 0;\n const parseRun = async (text: string) => {\n const resolved = inlineReferenceLinks((source) => processor.parse(source) as MarkdownNode, text, definitions);\n if (resolved.trim()) blocks.push(...(await converter.tryParseMarkdownToBlocks(resolved)));\n };\n const preserveSource = async (text: string) => {\n let fenceLength = 3;\n for (const match of text.matchAll(/`+/g)) fenceLength = Math.max(fenceLength, match[0].length + 1);\n const fence = '`'.repeat(fenceLength);\n blocks.push(...(await converter.tryParseMarkdownToBlocks(fence + 'text\\n' + text + '\\n' + fence)));\n };\n if (!supportedVersion || !validMeta) {\n await preserveSource(markdown.replace(/\\r\\n?/g, '\\n'));\n cursor = body.length;\n }\n\n for (const node of tree.children) {\n if (!supportedVersion || !validMeta) continue;\n const listStart = node.position?.start.offset;\n const listEnd = node.position?.end.offset;\n if (node.type === 'list' && listStart !== undefined && listEnd !== undefined && isPlainListSource(body.slice(listStart, listEnd))) {\n await parseRun(body.slice(cursor, listStart));\n blocks.push(...(await markdownToList(converter, body.slice(listStart, listEnd))));\n cursor = listEnd;\n continue;\n }\n if (node.type !== 'code' || node.lang !== IXO_BLOCK_FENCE) continue;\n const start = node.position?.start.offset;\n const end = node.position?.end.offset;\n if (start === undefined || end === undefined) continue;\n await parseRun(body.slice(cursor, start));\n cursor = end;\n const blockIndex = blocks.length;\n const raw = body.slice(start, end);\n const opening = /^ {0,3}(`{3,}|~{3,})/.exec(raw)?.[1];\n const closing = raw.trimEnd().split('\\n').at(-1)?.trim();\n if (node.meta || !opening || !closing || !new RegExp('^' + opening[0] + '{' + opening.length + ',}$').test(closing)) {\n diagnostics.push({ code: 'invalid-block', blockIndex });\n await preserveSource(raw);\n continue;\n }\n let value: unknown;\n try {\n value = JSON.parse(node.value);\n } catch {\n diagnostics.push({ code: 'invalid-json', blockIndex });\n await preserveSource(body.slice(start, end));\n continue;\n }\n const candidateIds = new Set(ids);\n if (!converter.schema || !validPageBlock(value, converter.schema, candidateIds)) {\n diagnostics.push({ code: 'invalid-block', blockIndex });\n await preserveSource(body.slice(start, end));\n continue;\n }\n candidateIds.forEach((id) => ids.add(id));\n blocks.push(value);\n }\n await parseRun(body.slice(cursor));\n\n const { schemaVersion: _ignored, ...rest } = meta;\n for (const key of STRING_META_KEYS) {\n if (meta[key] !== undefined && typeof meta[key] !== 'string') delete rest[key];\n }\n if (meta.coverPosition !== undefined && typeof meta.coverPosition !== 'number') delete rest.coverPosition;\n return { meta: { ...rest, schemaVersion }, blocks, diagnostics };\n}\n\n/** A hash of the Markdown representation, not a complete editor-state revision. */\nexport async function pageContentHash(markdown: string): Promise<string> {\n const bytes = new TextEncoder().encode(markdown);\n const digest = await crypto.subtle.digest('SHA-256', bytes);\n return Array.from(new Uint8Array(digest))\n .map((b) => b.toString(16).padStart(2, '0'))\n .join('');\n}\n\n/** JSON with object keys sorted at every level, so equal values always serialise the same way. */\nfunction canonicalJson(value: unknown): string {\n return JSON.stringify(value, (_key, inner) =>\n inner && typeof inner === 'object' && !Array.isArray(inner)\n ? Object.fromEntries(\n Object.keys(inner as Record<string, unknown>)\n .sort()\n .map((key) => [key, (inner as Record<string, unknown>)[key]])\n )\n : inner\n );\n}\n\n/**\n * A revision hash of the page as the editor holds it: the title and every block with all\n * its props, content and children. Unlike the Markdown, it changes when only a block's\n * alignment or colours change, so an edit proposal that quotes it detects any drift.\n */\nexport async function pageDocumentHash(blocks: readonly unknown[], title?: string): Promise<string> {\n return pageContentHash(canonicalJson({ title: title ?? null, blocks }));\n}\n"],"mappings":";AAQA,IAAM,aAAa,oBAAI,IAAI,CAAC,MAAM,QAAQ,SAAS,WAAW,UAAU,CAAC;AAEzE,IAAM,SAAS,CAAC,UAAqD,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AACxI,IAAM,OAAO,CAAC,OAAe,QAAgB,OAAO,UAAU,eAAe,KAAK,OAAO,GAAG;AAE5F,SAAS,WAAW,OAAgB,QAA6B;AAC/D,MAAI,UAAU,OAAW,QAAO;AAChC,SACE,OAAO,KAAK,KACZ,OAAO,QAAQ,KAAK,EAAE,MAAM,CAAC,CAAC,KAAK,IAAI,MAAM;AAC3C,QAAI,CAAC,KAAK,QAAQ,GAAG,EAAG,QAAO;AAC/B,UAAM,OAAO,OAAO,GAAG;AACvB,UAAM,OAAO,KAAK,YAAY,UAAa,UAAU,OAAO,KAAK,OAAO,OAAO,KAAK;AACpF,WAAO,OAAO,SAAS,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS,IAAI,OAAO,CA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AAM,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAC1C,KAAK,EAAE;AACZ;AAGA,SAAS,cAAc,OAAwB;AAC7C,SAAO,KAAK;AAAA,IAAU;AAAA,IAAO,CAAC,MAAM,UAClC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IACtD,OAAO;AAAA,MACL,OAAO,KAAK,KAAgC,EACzC,KAAK,EACL,IAAI,CAAC,QAAQ,CAAC,KAAM,MAAkC,GAAG,CAAC,CAAC;AAAA,IAChE,IACA;AAAA,EACN;AACF;AAOA,eAAsB,iBAAiB,QAA4B,OAAiC;AAClG,SAAO,gBAAgB,cAAc,EAAE,OAAO,SAAS,MAAM,OAAO,CAAC,CAAC;AACxE;","names":[]}
|
|
@@ -26888,6 +26888,27 @@ var ixoStyleSpecs = {
|
|
|
26888
26888
|
code: createStyleSpecFromTipTapMark(CodeWithTrailingSpaceInputRule, "boolean")
|
|
26889
26889
|
};
|
|
26890
26890
|
|
|
26891
|
+
// src/core/lib/localPageMetadata.ts
|
|
26892
|
+
var LocalPageMetadata = class {
|
|
26893
|
+
constructor() {
|
|
26894
|
+
this.metadata = {};
|
|
26895
|
+
this.subscribers = /* @__PURE__ */ new Set();
|
|
26896
|
+
}
|
|
26897
|
+
getMetadata() {
|
|
26898
|
+
return this.metadata;
|
|
26899
|
+
}
|
|
26900
|
+
setMetadata(updates) {
|
|
26901
|
+
this.metadata = { ...this.metadata, ...updates };
|
|
26902
|
+
this.subscribers.forEach((callback) => callback(this.metadata));
|
|
26903
|
+
}
|
|
26904
|
+
subscribe(callback) {
|
|
26905
|
+
this.subscribers.add(callback);
|
|
26906
|
+
return () => {
|
|
26907
|
+
this.subscribers.delete(callback);
|
|
26908
|
+
};
|
|
26909
|
+
}
|
|
26910
|
+
};
|
|
26911
|
+
|
|
26891
26912
|
// src/mantine/hooks/useCreateIxoEditor.ts
|
|
26892
26913
|
function useCreateIxoEditor(options) {
|
|
26893
26914
|
const {
|
|
@@ -26958,6 +26979,12 @@ function useCreateIxoEditor(options) {
|
|
|
26958
26979
|
ixoEditor.docType = docType;
|
|
26959
26980
|
ixoEditor.insertProfile = insertProfile;
|
|
26960
26981
|
ixoEditor.hasBlockType = (type) => (ixoEditor.document || []).some((b) => b.type === type);
|
|
26982
|
+
if (!ixoEditor._metadataManager) {
|
|
26983
|
+
const metadata = new LocalPageMetadata();
|
|
26984
|
+
ixoEditor._metadataManager = metadata;
|
|
26985
|
+
ixoEditor.setPageMetadata = async (updates) => metadata.setMetadata(updates);
|
|
26986
|
+
ixoEditor.getPageMetadata = () => metadata.getMetadata();
|
|
26987
|
+
}
|
|
26961
26988
|
ixoEditor.isEditable = editable;
|
|
26962
26989
|
return ixoEditor;
|
|
26963
26990
|
}
|
|
@@ -28836,6 +28863,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
28836
28863
|
/* @__PURE__ */ React246.createElement("div", { style: { maxWidth: "964px", margin: "0 auto", position: "relative", minHeight: "inherit" } }, /* @__PURE__ */ React246.createElement("input", { ref: coverFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "cover") }), /* @__PURE__ */ React246.createElement("input", { ref: logoFileInputRef, type: "file", accept: "image/*", style: { display: "none" }, onChange: (e) => handleFileSelect(e, "logo") }), logoSrc && /* @__PURE__ */ React246.createElement(
|
|
28837
28864
|
Box57,
|
|
28838
28865
|
{
|
|
28866
|
+
className: "ixo-cover-icon",
|
|
28839
28867
|
style: {
|
|
28840
28868
|
position: "relative",
|
|
28841
28869
|
insetInlineStart: "32px",
|
|
@@ -28870,7 +28898,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
28870
28898
|
}
|
|
28871
28899
|
)
|
|
28872
28900
|
)
|
|
28873
|
-
), editable && (isHovering || opened) && /* @__PURE__ */ React246.createElement(Group94, { gap: 4, style: { position: "absolute", bottom: hasLogo ? -18 : 0, left:
|
|
28901
|
+
), editable && (isHovering || opened) && /* @__PURE__ */ React246.createElement(Group94, { gap: 4, style: { position: "absolute", bottom: hasLogo ? -18 : 0, left: "var(--ixo-editor-gutter, 32px)", zIndex: 10 } }, !logoSrc && /* @__PURE__ */ React246.createElement(
|
|
28874
28902
|
BaseIconPicker,
|
|
28875
28903
|
{
|
|
28876
28904
|
opened,
|
|
@@ -28960,6 +28988,7 @@ function CoverImage({ coverImageUrl, logoUrl }) {
|
|
|
28960
28988
|
/* @__PURE__ */ React246.createElement("div", { style: { maxWidth: "964px", margin: "0 auto", position: "absolute", bottom: 0, left: 0, right: 0, height: "70px" } }, /* @__PURE__ */ React246.createElement(
|
|
28961
28989
|
Box57,
|
|
28962
28990
|
{
|
|
28991
|
+
className: "ixo-cover-icon",
|
|
28963
28992
|
style: {
|
|
28964
28993
|
position: "absolute",
|
|
28965
28994
|
bottom: "4px",
|
|
@@ -29553,6 +29582,7 @@ var ExternalDropZone = ({
|
|
|
29553
29582
|
|
|
29554
29583
|
// src/mantine/IxoEditor.tsx
|
|
29555
29584
|
import React254, { useEffect as useEffect102, useMemo as useMemo115 } from "react";
|
|
29585
|
+
import { createPortal } from "react-dom";
|
|
29556
29586
|
import { FormattingToolbarController, GridSuggestionMenuController, LinkToolbarController, SuggestionMenuController as SuggestionMenuController2 } from "@blocknote/react";
|
|
29557
29587
|
import { BlockNoteView } from "@blocknote/mantine";
|
|
29558
29588
|
import { filterSuggestionItems as filterSuggestionItems2 } from "@blocknote/core";
|
|
@@ -29683,7 +29713,7 @@ function InsertMenuItem({ entry, t, onInsert }) {
|
|
|
29683
29713
|
/* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__item" }, /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__label" }, entryLabel(entry, t)), /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__description" }, entryDescription(entry, t)))
|
|
29684
29714
|
);
|
|
29685
29715
|
}
|
|
29686
|
-
function InsertToolbar({ editor, title, leading, trailing, titleMenu }) {
|
|
29716
|
+
function InsertToolbar({ editor, title, leading, trailing, titleMenu, embedded }) {
|
|
29687
29717
|
const t = useTranslate();
|
|
29688
29718
|
const profile = resolveProfile(editor);
|
|
29689
29719
|
const entries = useMemo114(() => getInsertEntries(profile, { dev: isDevInsertEnabled(editor) }), [profile, editor]);
|
|
@@ -29711,6 +29741,7 @@ function InsertToolbar({ editor, title, leading, trailing, titleMenu }) {
|
|
|
29711
29741
|
insertEntry(editor, entry, { keepEmptyBlocks: true });
|
|
29712
29742
|
editor.focus?.();
|
|
29713
29743
|
};
|
|
29744
|
+
const modifier = embedded ? " ixo-insert-toolbar--embedded" : leading || trailing ? " ixo-insert-toolbar--header" : "";
|
|
29714
29745
|
const insertLabel = t("toolbar.insert", { defaultValue: "Insert" });
|
|
29715
29746
|
const label = title || t(`toolbar.profile.${profile}`, { defaultValue: PROFILE_LABELS[profile] });
|
|
29716
29747
|
const [menuOpen, setMenuOpen] = useState118(false);
|
|
@@ -29723,9 +29754,23 @@ function InsertToolbar({ editor, title, leading, trailing, titleMenu }) {
|
|
|
29723
29754
|
setInsertedFromMenu(true);
|
|
29724
29755
|
insert(entry);
|
|
29725
29756
|
};
|
|
29726
|
-
|
|
29757
|
+
const [pickedFromTitleMenu, setPickedFromTitleMenu] = useState118(false);
|
|
29758
|
+
return /* @__PURE__ */ React250.createElement(Box61, { className: `ixo-insert-toolbar${modifier}`, role: "toolbar", "aria-label": insertLabel }, leading && /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__slot" }, leading), titleMenu ? /* @__PURE__ */ React250.createElement(
|
|
29759
|
+
Menu4,
|
|
29760
|
+
{
|
|
29761
|
+
position: "bottom-start",
|
|
29762
|
+
shadow: "md",
|
|
29763
|
+
width: 240,
|
|
29764
|
+
withinPortal: true,
|
|
29765
|
+
returnFocus: !pickedFromTitleMenu,
|
|
29766
|
+
onOpen: () => setPickedFromTitleMenu(false),
|
|
29767
|
+
classNames: { dropdown: "ixo-insert-toolbar__menu" }
|
|
29768
|
+
},
|
|
29769
|
+
/* @__PURE__ */ React250.createElement(Menu4.Target, null, /* @__PURE__ */ React250.createElement("button", { type: "button", className: "ixo-insert-toolbar__pill ixo-insert-toolbar__profile", title: label, "aria-haspopup": "menu" }, icon(IconFileText7, 16), /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__title" }, label), icon(IconChevronDown8, 14))),
|
|
29770
|
+
/* @__PURE__ */ React250.createElement(Menu4.Dropdown, { onClick: (event) => event.target.closest('[role="menuitem"]') && setPickedFromTitleMenu(true) }, titleMenu)
|
|
29771
|
+
) : /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__pill ixo-insert-toolbar__profile", title: title || void 0 }, icon(IconFileText7, 16), /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__title" }, label)), /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__pill" }, primary.map((entry) => {
|
|
29727
29772
|
const label2 = entryLabel(entry, t);
|
|
29728
|
-
return /* @__PURE__ */ React250.createElement(Tooltip27, { key: entry.id, label: label2, withArrow: true }, /* @__PURE__ */ React250.createElement(ActionIcon38, { variant: "ghost", radius: "
|
|
29773
|
+
return /* @__PURE__ */ React250.createElement(Tooltip27, { key: entry.id, label: label2, withArrow: true }, /* @__PURE__ */ React250.createElement(ActionIcon38, { variant: "ghost", radius: "md", size: "lg", className: "ixo-insert-toolbar__primary", "aria-label": label2, onClick: () => insert(entry) }, icon(entry.icon, 16)));
|
|
29729
29774
|
}), /* @__PURE__ */ React250.createElement(
|
|
29730
29775
|
Menu4,
|
|
29731
29776
|
{
|
|
@@ -29738,7 +29783,7 @@ function InsertToolbar({ editor, title, leading, trailing, titleMenu }) {
|
|
|
29738
29783
|
withinPortal: true,
|
|
29739
29784
|
classNames: { dropdown: "ixo-insert-toolbar__menu", item: "ixo-insert-toolbar__menu-item", itemLabel: "ixo-insert-toolbar__menu-label" }
|
|
29740
29785
|
},
|
|
29741
|
-
/* @__PURE__ */ React250.createElement(Menu4.Target, null, /* @__PURE__ */ React250.createElement(Tooltip27, { label: insertLabel, withArrow: true, disabled: menuOpen }, /* @__PURE__ */ React250.createElement(ActionIcon38, { variant: "ghost", radius: "
|
|
29786
|
+
/* @__PURE__ */ React250.createElement(Menu4.Target, null, /* @__PURE__ */ React250.createElement(Tooltip27, { label: insertLabel, withArrow: true, disabled: menuOpen }, /* @__PURE__ */ React250.createElement(ActionIcon38, { variant: "ghost", radius: "md", size: "lg", "aria-label": insertLabel, "aria-haspopup": "menu" }, icon(IconSquarePlus, 16)))),
|
|
29742
29787
|
/* @__PURE__ */ React250.createElement(Menu4.Dropdown, null, primary.length > 0 && /* @__PURE__ */ React250.createElement("div", { className: "ixo-insert-toolbar__quick" }, /* @__PURE__ */ React250.createElement(Menu4.Label, null, t("toolbar.quick", { defaultValue: "Quick" })), primary.map((entry) => /* @__PURE__ */ React250.createElement(InsertMenuItem, { key: entry.id, entry, t, onInsert: insertFromMenu })), /* @__PURE__ */ React250.createElement(Menu4.Divider, null)), groups.map(({ group, entries: groupEntries }) => /* @__PURE__ */ React250.createElement(React250.Fragment, { key: group }, group !== groupOrder[0] && /* @__PURE__ */ React250.createElement(Menu4.Label, null, groupLabel(group, t)), groupEntries.map((entry) => /* @__PURE__ */ React250.createElement(InsertMenuItem, { key: entry.id, entry, t, onInsert: insertFromMenu })))), /* @__PURE__ */ React250.createElement(Menu4.Divider, null), /* @__PURE__ */ React250.createElement(Text147, { size: "xs", className: "ixo-insert-toolbar__hint" }, t("toolbar.moreHint", { defaultValue: "Type / in the document for more" })))
|
|
29743
29788
|
)), trailing && /* @__PURE__ */ React250.createElement("span", { className: "ixo-insert-toolbar__slot ixo-insert-toolbar__trailing" }, trailing));
|
|
29744
29789
|
}
|
|
@@ -29945,7 +29990,7 @@ function isInsideSuggestionMenu(target) {
|
|
|
29945
29990
|
}
|
|
29946
29991
|
|
|
29947
29992
|
// src/mantine/inline/StepRefSuggestionMenu.tsx
|
|
29948
|
-
import React253, { useEffect as useEffect101, useRef as useRef38 } from "react";
|
|
29993
|
+
import React253, { useCallback as useCallback100, useEffect as useEffect101, useRef as useRef38 } from "react";
|
|
29949
29994
|
import { Box as Box63 } from "@mantine/core";
|
|
29950
29995
|
import { filterSuggestionItems } from "@blocknote/core";
|
|
29951
29996
|
import { SuggestionMenuController, useBlockNoteEditor as useBlockNoteEditor2 } from "@blocknote/react";
|
|
@@ -29984,13 +30029,26 @@ function StepRefMenu({ items, onItemClick, loadingState, selectedIndex }) {
|
|
|
29984
30029
|
}
|
|
29985
30030
|
)), items.length === 0 && loadingState !== "loading-initial" && /* @__PURE__ */ React253.createElement("div", { className: "ixo-palette__hint", role: "status" }, hasSteps ? t("stepRef.noMatch", { defaultValue: "No matching steps" }) : t("stepRef.empty", { defaultValue: "No steps to reference yet" }))));
|
|
29986
30031
|
}
|
|
30032
|
+
var FLOW_PROFILES = /* @__PURE__ */ new Set(["template", "flow"]);
|
|
29987
30033
|
function StepRefSuggestionMenuController() {
|
|
29988
30034
|
const t = useTranslate();
|
|
29989
30035
|
const editor = useBlockNoteEditor2();
|
|
29990
|
-
|
|
30036
|
+
const shouldOpen = useCallback100(() => FLOW_PROFILES.has(resolveProfile(editor)) || listStepBlocks(editor.document).length > 0, [editor]);
|
|
30037
|
+
return /* @__PURE__ */ React253.createElement(
|
|
30038
|
+
SuggestionMenuController,
|
|
30039
|
+
{
|
|
30040
|
+
triggerCharacter: "@",
|
|
30041
|
+
shouldOpen,
|
|
30042
|
+
suggestionMenuComponent: StepRefMenu,
|
|
30043
|
+
getItems: async (query) => filterSuggestionItems(getStepRefItems(editor, t), query)
|
|
30044
|
+
}
|
|
30045
|
+
);
|
|
29991
30046
|
}
|
|
29992
30047
|
|
|
29993
30048
|
// src/mantine/IxoEditor.tsx
|
|
30049
|
+
function HostedToolbar({ container, children }) {
|
|
30050
|
+
return container ? createPortal(children, container) : children;
|
|
30051
|
+
}
|
|
29994
30052
|
var FORMATTING_TOOLBAR_FLOATING = { useDismissProps: { escapeKey: false } };
|
|
29995
30053
|
function SanitizedThemeBoundary({ children }) {
|
|
29996
30054
|
const parentTheme = useMantineTheme();
|
|
@@ -30019,6 +30077,7 @@ function IxoEditorContent({
|
|
|
30019
30077
|
toolbarLeading,
|
|
30020
30078
|
toolbarTrailing,
|
|
30021
30079
|
toolbarTitleMenu,
|
|
30080
|
+
toolbarContainer,
|
|
30022
30081
|
sessionPreview
|
|
30023
30082
|
}) {
|
|
30024
30083
|
const { activePanel } = usePanelStore();
|
|
@@ -30090,7 +30149,7 @@ function IxoEditorContent({
|
|
|
30090
30149
|
},
|
|
30091
30150
|
...sessionPreview ? { inert: "" } : {}
|
|
30092
30151
|
},
|
|
30093
|
-
isEditable && config.slashMenu && config.insertToolbar !== false && !sessionPreview && /* @__PURE__ */ React254.createElement(InsertToolbar, { editor, title: toolbarTitle, leading: toolbarLeading, trailing: toolbarTrailing, titleMenu: toolbarTitleMenu }),
|
|
30152
|
+
isEditable && config.slashMenu && config.insertToolbar !== false && !sessionPreview && /* @__PURE__ */ React254.createElement(HostedToolbar, { container: toolbarContainer }, /* @__PURE__ */ React254.createElement(InsertToolbar, { editor, title: toolbarTitle, leading: toolbarLeading, trailing: toolbarTrailing, titleMenu: toolbarTitleMenu, embedded: !!toolbarContainer })),
|
|
30094
30153
|
/* @__PURE__ */ React254.createElement(CoverImage, { coverImageUrl, logoUrl }),
|
|
30095
30154
|
titleSlot ?? /* @__PURE__ */ React254.createElement(PageTitle, { editor, editable: isEditable }),
|
|
30096
30155
|
belowTitleSlot,
|
|
@@ -30154,6 +30213,7 @@ function IxoEditor({
|
|
|
30154
30213
|
toolbarLeading,
|
|
30155
30214
|
toolbarTrailing,
|
|
30156
30215
|
toolbarTitleMenu,
|
|
30216
|
+
toolbarContainer,
|
|
30157
30217
|
sessionRunId,
|
|
30158
30218
|
sessionPreview,
|
|
30159
30219
|
runEventLog,
|
|
@@ -30215,6 +30275,7 @@ function IxoEditor({
|
|
|
30215
30275
|
toolbarLeading,
|
|
30216
30276
|
toolbarTrailing,
|
|
30217
30277
|
toolbarTitleMenu,
|
|
30278
|
+
toolbarContainer,
|
|
30218
30279
|
sessionPreview
|
|
30219
30280
|
},
|
|
30220
30281
|
children
|
|
@@ -30671,7 +30732,7 @@ var FlowPermissionsPanel = ({ editor, entityDid, entityName, onGrantPermission,
|
|
|
30671
30732
|
};
|
|
30672
30733
|
|
|
30673
30734
|
// src/mantine/components/GrantPermissionModal.tsx
|
|
30674
|
-
import React258, { useState as useState122, useCallback as
|
|
30735
|
+
import React258, { useState as useState122, useCallback as useCallback101 } from "react";
|
|
30675
30736
|
import { Modal as Modal5, Stack as Stack150, Text as Text151, TextInput as TextInput9, Button as Button53, Group as Group98, Radio as Radio4, Checkbox as Checkbox8, Alert as Alert34, Paper as Paper21, Loader as Loader47, Badge as Badge45, ActionIcon as ActionIcon40, Divider as Divider25, NumberInput as NumberInput2 } from "@mantine/core";
|
|
30676
30737
|
import { IconSearch as IconSearch8, IconUser as IconUser15, IconInnerShadowBottomRight as IconInnerShadowBottomRight6, IconX as IconX15, IconShieldPlus as IconShieldPlus5 } from "@tabler/icons-react";
|
|
30677
30738
|
var MAX_GRANT_DAYS2 = 30;
|
|
@@ -30691,7 +30752,7 @@ var GrantPermissionModal = ({ opened, onClose, flowUri, blocks, targetBlockId, s
|
|
|
30691
30752
|
const [pin, setPin] = useState122("");
|
|
30692
30753
|
const [loading, setLoading] = useState122(false);
|
|
30693
30754
|
const [error, setError] = useState122(null);
|
|
30694
|
-
const handleSearch =
|
|
30755
|
+
const handleSearch = useCallback101(async () => {
|
|
30695
30756
|
if (searchQuery.length < 2) return;
|
|
30696
30757
|
setSearching(true);
|
|
30697
30758
|
try {
|
|
@@ -30978,4 +31039,4 @@ export {
|
|
|
30978
31039
|
ixoGraphQLClient,
|
|
30979
31040
|
getEntity
|
|
30980
31041
|
};
|
|
30981
|
-
//# sourceMappingURL=chunk-
|
|
31042
|
+
//# sourceMappingURL=chunk-QFOAEPJT.js.map
|