mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat: bump blocksuite (#6541)
## Features - https://github.com/toeverything/BlockSuite/pull/6737 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/6735 @pengx17 - https://github.com/toeverything/BlockSuite/pull/6740 @regischen ## Bugfix - https://github.com/toeverything/BlockSuite/pull/6744 @donteatfriedrice - https://github.com/toeverything/BlockSuite/pull/6742 @doouding ## Refactor ## Misc - https://github.com/toeverything/BlockSuite/pull/6741 @fundon
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user