mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-24 05:07:06 +08:00
chore: remove citation feature flag (#12567)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Footnote definitions and "Sources" headings are now always included in notes, without requiring a feature flag. - Enhanced footnote-related content with additional citation-style blocks such as bookmarks, embedded documents, and attachments. - **Chores** - Removed the citation feature flag and its related configuration, logic, and translations from the application. - **Documentation** - Updated localization files to remove entries related to the citation experimental feature. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -4393,6 +4393,61 @@ hhh
|
|||||||
},
|
},
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
id: 'matchesReplaceMap[2]',
|
||||||
|
flavour: 'affine:paragraph',
|
||||||
|
props: {
|
||||||
|
type: 'h6',
|
||||||
|
text: {
|
||||||
|
'$blocksuite:internal:text$': true,
|
||||||
|
delta: [
|
||||||
|
{
|
||||||
|
insert: 'Sources',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
collapsed: true,
|
||||||
|
},
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
id: 'matchesReplaceMap[3]',
|
||||||
|
flavour: 'affine:bookmark',
|
||||||
|
props: {
|
||||||
|
style: 'citation',
|
||||||
|
url,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
icon: favicon,
|
||||||
|
footnoteIdentifier: '1',
|
||||||
|
},
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
id: 'matchesReplaceMap[4]',
|
||||||
|
flavour: 'affine:embed-linked-doc',
|
||||||
|
props: {
|
||||||
|
style: 'citation',
|
||||||
|
pageId: 'deadbeef',
|
||||||
|
footnoteIdentifier: '2',
|
||||||
|
},
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
id: 'matchesReplaceMap[5]',
|
||||||
|
flavour: 'affine:attachment',
|
||||||
|
props: {
|
||||||
|
name: 'test.txt',
|
||||||
|
sourceId: 'abcdefg',
|
||||||
|
footnoteIdentifier: '3',
|
||||||
|
style: 'citation',
|
||||||
|
},
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4469,6 +4524,38 @@ hhh
|
|||||||
},
|
},
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
id: 'matchesReplaceMap[2]',
|
||||||
|
flavour: 'affine:paragraph',
|
||||||
|
props: {
|
||||||
|
type: 'h6',
|
||||||
|
text: {
|
||||||
|
'$blocksuite:internal:text$': true,
|
||||||
|
delta: [
|
||||||
|
{
|
||||||
|
insert: 'Sources',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
collapsed: true,
|
||||||
|
},
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'block',
|
||||||
|
id: 'matchesReplaceMap[3]',
|
||||||
|
flavour: 'affine:bookmark',
|
||||||
|
props: {
|
||||||
|
style: 'citation',
|
||||||
|
url,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
icon: favicon,
|
||||||
|
footnoteIdentifier: '1',
|
||||||
|
},
|
||||||
|
children: [],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
isFootnoteDefinitionNode,
|
isFootnoteDefinitionNode,
|
||||||
type MarkdownAST,
|
type MarkdownAST,
|
||||||
} from '@blocksuite/affine-shared/adapters';
|
} from '@blocksuite/affine-shared/adapters';
|
||||||
import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
|
||||||
import { nanoid } from '@blocksuite/store';
|
import { nanoid } from '@blocksuite/store';
|
||||||
|
|
||||||
const isAttachmentFootnoteDefinitionNode = (node: MarkdownAST) => {
|
const isAttachmentFootnoteDefinitionNode = (node: MarkdownAST) => {
|
||||||
@@ -36,15 +35,7 @@ export const attachmentBlockMarkdownAdapterMatcher: BlockMarkdownAdapterMatcher
|
|||||||
fromMatch: o => o.node.flavour === AttachmentBlockSchema.model.flavour,
|
fromMatch: o => o.node.flavour === AttachmentBlockSchema.model.flavour,
|
||||||
toBlockSnapshot: {
|
toBlockSnapshot: {
|
||||||
enter: (o, context) => {
|
enter: (o, context) => {
|
||||||
const { provider } = context;
|
if (!isFootnoteDefinitionNode(o.node)) {
|
||||||
let enableCitation = false;
|
|
||||||
try {
|
|
||||||
const featureFlagService = provider?.get(FeatureFlagService);
|
|
||||||
enableCitation = !!featureFlagService?.getFlag('enable_citation');
|
|
||||||
} catch {
|
|
||||||
enableCitation = false;
|
|
||||||
}
|
|
||||||
if (!isFootnoteDefinitionNode(o.node) || !enableCitation) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,6 +64,7 @@ export const attachmentBlockMarkdownAdapterMatcher: BlockMarkdownAdapterMatcher
|
|||||||
name: fileName,
|
name: fileName,
|
||||||
sourceId: blobId,
|
sourceId: blobId,
|
||||||
footnoteIdentifier,
|
footnoteIdentifier,
|
||||||
|
style: 'citation',
|
||||||
},
|
},
|
||||||
children: [],
|
children: [],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
isFootnoteDefinitionNode,
|
isFootnoteDefinitionNode,
|
||||||
type MarkdownAST,
|
type MarkdownAST,
|
||||||
} from '@blocksuite/affine-shared/adapters';
|
} from '@blocksuite/affine-shared/adapters';
|
||||||
import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
|
||||||
import { nanoid } from '@blocksuite/store';
|
import { nanoid } from '@blocksuite/store';
|
||||||
|
|
||||||
const isUrlFootnoteDefinitionNode = (node: MarkdownAST) => {
|
const isUrlFootnoteDefinitionNode = (node: MarkdownAST) => {
|
||||||
@@ -33,15 +32,7 @@ export const bookmarkBlockMarkdownAdapterMatcher =
|
|||||||
toMatch: o => isUrlFootnoteDefinitionNode(o.node),
|
toMatch: o => isUrlFootnoteDefinitionNode(o.node),
|
||||||
toBlockSnapshot: {
|
toBlockSnapshot: {
|
||||||
enter: (o, context) => {
|
enter: (o, context) => {
|
||||||
const { provider } = context;
|
if (!isFootnoteDefinitionNode(o.node)) {
|
||||||
let enableCitation = false;
|
|
||||||
try {
|
|
||||||
const featureFlagService = provider?.get(FeatureFlagService);
|
|
||||||
enableCitation = !!featureFlagService?.getFlag('enable_citation');
|
|
||||||
} catch {
|
|
||||||
enableCitation = false;
|
|
||||||
}
|
|
||||||
if (!isFootnoteDefinitionNode(o.node) || !enableCitation) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import {
|
|||||||
isFootnoteDefinitionNode,
|
isFootnoteDefinitionNode,
|
||||||
type MarkdownAST,
|
type MarkdownAST,
|
||||||
} from '@blocksuite/affine-shared/adapters';
|
} from '@blocksuite/affine-shared/adapters';
|
||||||
import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
|
||||||
import { nanoid } from '@blocksuite/store';
|
import { nanoid } from '@blocksuite/store';
|
||||||
|
|
||||||
const isLinkedDocFootnoteDefinitionNode = (node: MarkdownAST) => {
|
const isLinkedDocFootnoteDefinitionNode = (node: MarkdownAST) => {
|
||||||
@@ -36,15 +35,7 @@ export const embedLinkedDocBlockMarkdownAdapterMatcher: BlockMarkdownAdapterMatc
|
|||||||
fromMatch: o => o.node.flavour === EmbedLinkedDocBlockSchema.model.flavour,
|
fromMatch: o => o.node.flavour === EmbedLinkedDocBlockSchema.model.flavour,
|
||||||
toBlockSnapshot: {
|
toBlockSnapshot: {
|
||||||
enter: (o, context) => {
|
enter: (o, context) => {
|
||||||
const { provider } = context;
|
if (!isFootnoteDefinitionNode(o.node)) {
|
||||||
let enableCitation = false;
|
|
||||||
try {
|
|
||||||
const featureFlagService = provider?.get(FeatureFlagService);
|
|
||||||
enableCitation = !!featureFlagService?.getFlag('enable_citation');
|
|
||||||
} catch {
|
|
||||||
enableCitation = false;
|
|
||||||
}
|
|
||||||
if (!isFootnoteDefinitionNode(o.node) || !enableCitation) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
isFootnoteDefinitionNode,
|
isFootnoteDefinitionNode,
|
||||||
type MarkdownAST,
|
type MarkdownAST,
|
||||||
} from '@blocksuite/affine-shared/adapters';
|
} from '@blocksuite/affine-shared/adapters';
|
||||||
import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
|
||||||
import type { Root } from 'mdast';
|
import type { Root } from 'mdast';
|
||||||
|
|
||||||
const isRootNode = (node: MarkdownAST): node is Root => node.type === 'root';
|
const isRootNode = (node: MarkdownAST): node is Root => node.type === 'root';
|
||||||
@@ -66,34 +65,19 @@ const createNoteBlockMarkdownAdapterMatcher = (
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const { provider } = context;
|
// if there are footnoteDefinition nodes, add a heading node to the noteAst before the first footnoteDefinition node
|
||||||
let enableCitation = false;
|
const footnoteDefinitionIndex = noteAst.children.findIndex(child =>
|
||||||
try {
|
isFootnoteDefinitionNode(child)
|
||||||
const featureFlagService = provider?.get(FeatureFlagService);
|
);
|
||||||
enableCitation = !!featureFlagService?.getFlag('enable_citation');
|
if (footnoteDefinitionIndex !== -1) {
|
||||||
} catch {
|
noteAst.children.splice(footnoteDefinitionIndex, 0, {
|
||||||
enableCitation = false;
|
type: 'heading',
|
||||||
}
|
depth: 6,
|
||||||
if (enableCitation) {
|
data: {
|
||||||
// if there are footnoteDefinition nodes, add a heading node to the noteAst before the first footnoteDefinition node
|
collapsed: true,
|
||||||
const footnoteDefinitionIndex = noteAst.children.findIndex(child =>
|
},
|
||||||
isFootnoteDefinitionNode(child)
|
children: [{ type: 'text', value: 'Sources' }],
|
||||||
);
|
});
|
||||||
if (footnoteDefinitionIndex !== -1) {
|
|
||||||
noteAst.children.splice(footnoteDefinitionIndex, 0, {
|
|
||||||
type: 'heading',
|
|
||||||
depth: 6,
|
|
||||||
data: {
|
|
||||||
collapsed: true,
|
|
||||||
},
|
|
||||||
children: [{ type: 'text', value: 'Sources' }],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Remove the footnoteDefinition node from the noteAst
|
|
||||||
noteAst.children = noteAst.children.filter(
|
|
||||||
child => !isFootnoteDefinitionNode(child)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ export interface BlockSuiteFlags {
|
|||||||
enable_table_virtual_scroll: boolean;
|
enable_table_virtual_scroll: boolean;
|
||||||
enable_embed_doc_with_alias: boolean;
|
enable_embed_doc_with_alias: boolean;
|
||||||
enable_turbo_renderer: boolean;
|
enable_turbo_renderer: boolean;
|
||||||
enable_citation: boolean;
|
|
||||||
enable_link_preview_cache: boolean;
|
enable_link_preview_cache: boolean;
|
||||||
enable_dom_renderer: boolean;
|
enable_dom_renderer: boolean;
|
||||||
}
|
}
|
||||||
@@ -49,7 +48,6 @@ export class FeatureFlagService extends StoreExtension {
|
|||||||
enable_table_virtual_scroll: false,
|
enable_table_virtual_scroll: false,
|
||||||
enable_embed_doc_with_alias: false,
|
enable_embed_doc_with_alias: false,
|
||||||
enable_turbo_renderer: false,
|
enable_turbo_renderer: false,
|
||||||
enable_citation: false,
|
|
||||||
enable_link_preview_cache: false,
|
enable_link_preview_cache: false,
|
||||||
enable_dom_renderer: false,
|
enable_dom_renderer: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -106,16 +106,6 @@ export const AFFINE_FLAGS = {
|
|||||||
configurable: isCanaryBuild,
|
configurable: isCanaryBuild,
|
||||||
defaultState: isCanaryBuild,
|
defaultState: isCanaryBuild,
|
||||||
},
|
},
|
||||||
enable_citation: {
|
|
||||||
category: 'blocksuite',
|
|
||||||
bsFlag: 'enable_citation',
|
|
||||||
displayName:
|
|
||||||
'com.affine.settings.workspace.experimental-features.enable-citation.name',
|
|
||||||
description:
|
|
||||||
'com.affine.settings.workspace.experimental-features.enable-citation.description',
|
|
||||||
configurable: isCanaryBuild,
|
|
||||||
defaultState: isCanaryBuild,
|
|
||||||
},
|
|
||||||
enable_link_preview_cache: {
|
enable_link_preview_cache: {
|
||||||
category: 'blocksuite',
|
category: 'blocksuite',
|
||||||
bsFlag: 'enable_link_preview_cache',
|
bsFlag: 'enable_link_preview_cache',
|
||||||
|
|||||||
@@ -5778,14 +5778,6 @@ export function useAFFiNEI18N(): {
|
|||||||
* `Let your words stand out. This also include the callout in the transcription block.`
|
* `Let your words stand out. This also include the callout in the transcription block.`
|
||||||
*/
|
*/
|
||||||
["com.affine.settings.workspace.experimental-features.enable-callout.description"](): string;
|
["com.affine.settings.workspace.experimental-features.enable-callout.description"](): string;
|
||||||
/**
|
|
||||||
* `Citation`
|
|
||||||
*/
|
|
||||||
["com.affine.settings.workspace.experimental-features.enable-citation.name"](): string;
|
|
||||||
/**
|
|
||||||
* `Enable citation feature.`
|
|
||||||
*/
|
|
||||||
["com.affine.settings.workspace.experimental-features.enable-citation.description"](): string;
|
|
||||||
/**
|
/**
|
||||||
* `Link Preview Cache`
|
* `Link Preview Cache`
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1443,8 +1443,6 @@
|
|||||||
"com.affine.settings.workspace.experimental-features.enable-block-meta.description": "Once enabled, all blocks will have created time, updated time, created by and updated by.",
|
"com.affine.settings.workspace.experimental-features.enable-block-meta.description": "Once enabled, all blocks will have created time, updated time, created by and updated by.",
|
||||||
"com.affine.settings.workspace.experimental-features.enable-callout.name": "Callout",
|
"com.affine.settings.workspace.experimental-features.enable-callout.name": "Callout",
|
||||||
"com.affine.settings.workspace.experimental-features.enable-callout.description": "Let your words stand out. This also include the callout in the transcription block.",
|
"com.affine.settings.workspace.experimental-features.enable-callout.description": "Let your words stand out. This also include the callout in the transcription block.",
|
||||||
"com.affine.settings.workspace.experimental-features.enable-citation.name": "Citation",
|
|
||||||
"com.affine.settings.workspace.experimental-features.enable-citation.description": "Enable citation feature.",
|
|
||||||
"com.affine.settings.workspace.experimental-features.enable-link-preview-cache.name": "Link Preview Cache",
|
"com.affine.settings.workspace.experimental-features.enable-link-preview-cache.name": "Link Preview Cache",
|
||||||
"com.affine.settings.workspace.experimental-features.enable-link-preview-cache.description": "Once enabled, the link preview will be cached and cached data will be used when the same link is fetched again. Otherwise, the link preview will be fetched every time.",
|
"com.affine.settings.workspace.experimental-features.enable-link-preview-cache.description": "Once enabled, the link preview will be cached and cached data will be used when the same link is fetched again. Otherwise, the link preview will be fetched every time.",
|
||||||
"com.affine.settings.workspace.experimental-features.enable-embed-iframe-block.name": "Embed Iframe Block",
|
"com.affine.settings.workspace.experimental-features.enable-embed-iframe-block.name": "Embed Iframe Block",
|
||||||
|
|||||||
Reference in New Issue
Block a user