@notis_ai/cli 0.2.0-beta.16.1 → 0.2.0-beta.20.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/package.json
CHANGED
|
@@ -43,12 +43,17 @@ function buildSeedDocuments(databases) {
|
|
|
43
43
|
const state = {};
|
|
44
44
|
for (const slug of databases) {
|
|
45
45
|
state[slug] = Array.from({ length: 3 }, (_, i) => {
|
|
46
|
+
const title = `${slug} ${i + 1}`;
|
|
47
|
+
const content = `This is a preview note for ${title}.`;
|
|
46
48
|
return {
|
|
47
49
|
id: `${slug}-seed-${i + 1}`,
|
|
48
50
|
databaseSlug: slug,
|
|
49
|
-
title
|
|
51
|
+
title,
|
|
50
52
|
properties: {},
|
|
51
53
|
icon: null,
|
|
54
|
+
contentBlocknote: [{ type: 'paragraph', content: [{ type: 'text', text: content }] }],
|
|
55
|
+
contentMarkdown: content,
|
|
56
|
+
plainText: content,
|
|
52
57
|
};
|
|
53
58
|
});
|
|
54
59
|
}
|
|
@@ -152,12 +157,31 @@ function buildPreviewHtml({ manifest, route, databases }) {
|
|
|
152
157
|
var existing = docs.find(function(d) { return d.id === (args && args.documentId); });
|
|
153
158
|
var props = Object.assign({}, existing && existing.properties, args && args.properties);
|
|
154
159
|
if (args && args.title) props[tp] = args.title;
|
|
160
|
+
var blocks = Array.isArray(args && args.contentBlocknote)
|
|
161
|
+
? JSON.parse(JSON.stringify(args.contentBlocknote))
|
|
162
|
+
: existing && existing.contentBlocknote
|
|
163
|
+
? JSON.parse(JSON.stringify(existing.contentBlocknote))
|
|
164
|
+
: [{ type: 'paragraph' }];
|
|
165
|
+
var plainText = blocks
|
|
166
|
+
.map(function(block) {
|
|
167
|
+
if (typeof block.content === 'string') return block.content;
|
|
168
|
+
if (!Array.isArray(block.content)) return '';
|
|
169
|
+
return block.content
|
|
170
|
+
.map(function(inline) { return inline && typeof inline.text === 'string' ? inline.text : ''; })
|
|
171
|
+
.join('');
|
|
172
|
+
})
|
|
173
|
+
.filter(Boolean)
|
|
174
|
+
.join('\\n')
|
|
175
|
+
.trim();
|
|
155
176
|
var doc = {
|
|
156
177
|
id: existing ? existing.id : slug + '-' + Date.now(),
|
|
157
178
|
databaseSlug: slug,
|
|
158
179
|
title: props[tp] || 'Untitled',
|
|
159
180
|
properties: props,
|
|
160
|
-
icon: null
|
|
181
|
+
icon: null,
|
|
182
|
+
contentBlocknote: blocks,
|
|
183
|
+
contentMarkdown: plainText,
|
|
184
|
+
plainText: plainText
|
|
161
185
|
};
|
|
162
186
|
if (existing) {
|
|
163
187
|
var idx = docs.indexOf(existing);
|
|
@@ -34,6 +34,11 @@ export interface DocumentRecord {
|
|
|
34
34
|
properties: Record<string, unknown>;
|
|
35
35
|
icon?: string | null;
|
|
36
36
|
databaseSlug?: string;
|
|
37
|
+
contentBlocknote?: Array<Record<string, unknown>> | null;
|
|
38
|
+
contentMarkdown?: string | null;
|
|
39
|
+
plainText?: string | null;
|
|
40
|
+
createdAt?: string | null;
|
|
41
|
+
lastEditedTime?: string | null;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
// ---------------------------------------------------------------------------
|
|
@@ -125,6 +130,7 @@ export interface NotisRuntime {
|
|
|
125
130
|
documentId?: string;
|
|
126
131
|
title?: string;
|
|
127
132
|
properties?: Record<string, unknown>;
|
|
133
|
+
contentBlocknote?: Array<Record<string, unknown>> | null;
|
|
128
134
|
}): Promise<{ status: string; document: DocumentRecord }>;
|
|
129
135
|
|
|
130
136
|
listCollectionItems(args?: {
|
|
@@ -28,14 +28,16 @@ export function notisViteConfig(appConfig: NotisAppConfig) {
|
|
|
28
28
|
fileName: () => 'app.js',
|
|
29
29
|
},
|
|
30
30
|
rollupOptions: {
|
|
31
|
-
external: ['react', 'react-dom', 'react/jsx-runtime'],
|
|
31
|
+
external: ['react', 'react-dom', 'react-dom/client', 'react/jsx-runtime', 'react/jsx-dev-runtime'],
|
|
32
32
|
output: {
|
|
33
33
|
globals: {
|
|
34
34
|
react: 'window.React',
|
|
35
35
|
'react-dom': 'window.ReactDOM',
|
|
36
|
+
'react-dom/client': 'window.ReactDOMClient',
|
|
36
37
|
'react/jsx-runtime': 'window.React',
|
|
37
38
|
},
|
|
38
39
|
assetFileNames: 'app[extname]',
|
|
40
|
+
inlineDynamicImports: true,
|
|
39
41
|
},
|
|
40
42
|
},
|
|
41
43
|
outDir: '.notis/output/bundle',
|