donteatfriedrice
2024-04-15 03:06:38 +00:00
parent bb1294f425
commit 7b35722288
20 changed files with 139 additions and 136 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
"private": true,
"type": "module",
"devDependencies": {
"@blocksuite/global": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/store": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/global": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/store": "0.14.0-canary-202404120943-1a1cf39",
"react": "18.2.0",
"react-dom": "18.2.0",
"vitest": "1.4.0"
+5 -5
View File
@@ -11,9 +11,9 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/blocks": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/global": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/store": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/blocks": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/global": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/store": "0.14.0-canary-202404120943-1a1cf39",
"@datastructures-js/binary-search-tree": "^5.3.2",
"foxact": "^0.2.33",
"jotai": "^2.8.0",
@@ -28,8 +28,8 @@
"devDependencies": {
"@affine-test/fixtures": "workspace:*",
"@affine/templates": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/presets": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/block-std": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/presets": "0.14.0-canary-202404120943-1a1cf39",
"@testing-library/react": "^14.2.1",
"async-call-rpc": "^6.4.0",
"react": "^18.2.0",
+3 -3
View File
@@ -32,14 +32,14 @@
}
},
"dependencies": {
"@blocksuite/global": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/global": "0.14.0-canary-202404120943-1a1cf39",
"idb": "^8.0.0",
"nanoid": "^5.0.7",
"y-provider": "workspace:*"
},
"devDependencies": {
"@blocksuite/blocks": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/store": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/blocks": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/store": "0.14.0-canary-202404120943-1a1cf39",
"fake-indexeddb": "^5.0.2",
"vite": "^5.2.8",
"vite-plugin-dts": "3.8.1",
+1 -1
View File
@@ -24,7 +24,7 @@
"build": "vite build"
},
"devDependencies": {
"@blocksuite/store": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/store": "0.14.0-canary-202404120943-1a1cf39",
"vite": "^5.1.4",
"vite-plugin-dts": "3.7.3",
"vitest": "1.4.0",
+5 -5
View File
@@ -75,12 +75,12 @@
"zod": "^3.22.4"
},
"devDependencies": {
"@blocksuite/block-std": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/blocks": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/global": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/block-std": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/blocks": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/global": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/icons": "2.1.46",
"@blocksuite/presets": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/store": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/presets": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/store": "0.14.0-canary-202404120943-1a1cf39",
"@storybook/addon-actions": "^7.6.17",
"@storybook/addon-essentials": "^7.6.17",
"@storybook/addon-interactions": "^7.6.17",
+6 -6
View File
@@ -19,13 +19,13 @@
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@affine/workspace-impl": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/blocks": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/global": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/block-std": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/blocks": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/global": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/icons": "2.1.46",
"@blocksuite/inline": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/presets": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/store": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/inline": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/presets": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/store": "0.14.0-canary-202404120943-1a1cf39",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",
@@ -155,7 +155,7 @@ export const useSnapshotPage = (
page = historyShellWorkspace.createDoc({
id: pageId,
});
page.awarenessStore.setReadonly(page, true);
page.awarenessStore.setReadonly(page.blockCollection, true);
const spaceDoc = page.spaceDoc;
page.load(() => {
applyUpdate(spaceDoc, new Uint8Array(snapshot));
@@ -186,7 +186,6 @@ export function setupAIProvider() {
return textToText({
...options,
promptName: 'Make it real',
// @ts-expect-error todo: fix this after blocksuite bump
params: options.params,
content:
options.content ||
@@ -100,7 +100,7 @@ const ImagePreviewModalImpl = (
const block = page.getBlockById(blockId);
assertExists(block);
const nextBlock = page
.getNextSiblings(block)
.getNexts(block)
.find(
(block): block is ImageBlockModel => block.flavour === 'affine:image'
);
@@ -120,7 +120,7 @@ const ImagePreviewModalImpl = (
const block = page.getBlockById(blockId);
assertExists(block);
const prevBlock = page
.getPreviousSiblings(block)
.getPrevs(block)
.findLast(
(block): block is ImageBlockModel => block.flavour === 'affine:image'
);
@@ -142,14 +142,14 @@ const ImagePreviewModalImpl = (
assertExists(block);
if (
page
.getPreviousSiblings(block)
.getPrevs(block)
.some(
(block): block is ImageBlockModel =>
block.flavour === 'affine:image'
)
) {
const prevBlock = page
.getPreviousSiblings(block)
.getPrevs(block)
.findLast(
(block): block is ImageBlockModel =>
block.flavour === 'affine:image'
@@ -159,14 +159,14 @@ const ImagePreviewModalImpl = (
}
} else if (
page
.getNextSiblings(block)
.getNexts(block)
.some(
(block): block is ImageBlockModel =>
block.flavour === 'affine:image'
)
) {
const nextBlock = page
.getNextSiblings(block)
.getNexts(block)
.find(
(block): block is ImageBlockModel =>
block.flavour === 'affine:image'
@@ -516,7 +516,7 @@ export const ImagePreviewModal = (
if (event.key === 'ArrowLeft') {
const prevBlock = page
.getPreviousSiblings(block)
.getPrevs(block)
.findLast(
(block): block is ImageBlockModel =>
block.flavour === 'affine:image'
@@ -526,7 +526,7 @@ export const ImagePreviewModal = (
}
} else if (event.key === 'ArrowRight') {
const nextBlock = page
.getNextSiblings(block)
.getNexts(block)
.find(
(block): block is ImageBlockModel =>
block.flavour === 'affine:image'
@@ -42,7 +42,7 @@ export function useDocMetaHelper(docCollection: DocCollection) {
setDocReadonly: (docId: string, readonly: boolean) => {
const page = docCollection.getDoc(docId);
assertExists(page);
page.awarenessStore.setReadonly(page, readonly);
page.awarenessStore.setReadonly(page.blockCollection, readonly);
},
setDocMeta: (docId: string, docMeta: Partial<DocMeta>) => {
docCollection.meta.setDocMeta(docId, docMeta);
@@ -63,14 +63,16 @@ export const useJournalHelper = (docCollection: DocCollection) => {
const getJournalsByDate = useCallback(
(maybeDate: MaybeDate) => {
const day = dayjs(maybeDate);
return Array.from(docCollection.docs.values()).filter(page => {
const pageId = page.id;
if (!isPageJournal(pageId)) return false;
if (page.meta?.trash) return false;
const journalDate = adapter.getJournalPageDateString(page.id);
if (!journalDate) return false;
return day.isSame(journalDate, 'day');
});
return Array.from(docCollection.docs.values())
.map(blockCollection => blockCollection.getDoc())
.filter(page => {
const pageId = page.id;
if (!isPageJournal(pageId)) return false;
if (page.meta?.trash) return false;
const journalDate = adapter.getJournalPageDateString(page.id);
if (!journalDate) return false;
return day.isSame(journalDate, 'day');
});
},
[adapter, isPageJournal, docCollection.docs]
);
@@ -167,7 +167,7 @@ export const Component = () => {
const { page } = workspace.services.get(PageManager).open(pageId);
workspace.docCollection.awarenessStore.setReadonly(
page.blockSuiteDoc,
page.blockSuiteDoc.blockCollection,
true
);
@@ -332,7 +332,7 @@ export const DetailPage = ({ pageId }: { pageId: string }): ReactElement => {
useEffect(() => {
if (page && pageRecord?.meta?.trash) {
currentWorkspace.docCollection.awarenessStore.setReadonly(
page.blockSuiteDoc,
page.blockSuiteDoc.blockCollection,
true
);
}
@@ -65,7 +65,9 @@ export const Component = (): ReactElement => {
window.exportWorkspaceSnapshot = async () => {
const zip = await ZipTransformer.exportDocs(
workspace.docCollection,
Array.from(workspace.docCollection.docs.values())
Array.from(workspace.docCollection.docs.values()).map(collection =>
collection.getDoc()
)
);
const url = URL.createObjectURL(zip);
// download url
+4 -4
View File
@@ -28,10 +28,10 @@
"@affine/env": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/native": "workspace:*",
"@blocksuite/block-std": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/blocks": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/presets": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/store": "0.14.0-canary-202404111515-fb8a834",
"@blocksuite/block-std": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/blocks": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/presets": "0.14.0-canary-202404120943-1a1cf39",
"@blocksuite/store": "0.14.0-canary-202404120943-1a1cf39",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/core": "^7.3.0",
"@electron-forge/core-utils": "^7.3.0",