mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 09:52:49 +08:00
chore(editor): add RTL experiement flag for editor (#9882)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||
import { type DocMode, getLastNoteBlock } from '@blocksuite/affine/blocks';
|
||||
import { Slot } from '@blocksuite/affine/global/utils';
|
||||
import type {
|
||||
@@ -7,6 +8,7 @@ import type {
|
||||
PageEditor,
|
||||
} from '@blocksuite/affine/presets';
|
||||
import { type Store } from '@blocksuite/affine/store';
|
||||
import { useLiveData, useService } from '@toeverything/infra';
|
||||
import clsx from 'clsx';
|
||||
import type React from 'react';
|
||||
import {
|
||||
@@ -49,6 +51,8 @@ export const BlocksuiteEditorContainer = forwardRef<
|
||||
const docRef = useRef<PageEditor>(null);
|
||||
const docTitleRef = useRef<DocTitle>(null);
|
||||
const edgelessRef = useRef<EdgelessEditor>(null);
|
||||
const featureFlags = useService(FeatureFlagService).flags;
|
||||
const enableEditorRTL = useLiveData(featureFlags.enable_editor_rtl.$);
|
||||
|
||||
const slots: BlocksuiteEditorContainerRef['slots'] = useMemo(() => {
|
||||
return {
|
||||
@@ -157,6 +161,7 @@ export const BlocksuiteEditorContainer = forwardRef<
|
||||
return (
|
||||
<div
|
||||
data-testid={`editor-${page.id}`}
|
||||
dir={enableEditorRTL ? 'rtl' : 'ltr'}
|
||||
className={clsx(
|
||||
`editor-wrapper ${mode}-mode`,
|
||||
styles.docEditorRoot,
|
||||
|
||||
@@ -250,6 +250,15 @@ export const AFFINE_FLAGS = {
|
||||
configurable: isCanaryBuild,
|
||||
defaultState: isCanaryBuild,
|
||||
},
|
||||
enable_editor_rtl: {
|
||||
category: 'affine',
|
||||
displayName:
|
||||
'com.affine.settings.workspace.experimental-features.enable-editor-rtl.name',
|
||||
description:
|
||||
'com.affine.settings.workspace.experimental-features.enable-editor-rtl.description',
|
||||
configurable: isCanaryBuild,
|
||||
defaultState: false,
|
||||
},
|
||||
} satisfies { [key in string]: FlagInfo };
|
||||
|
||||
// oxlint-disable-next-line no-redeclare
|
||||
|
||||
@@ -1337,6 +1337,8 @@
|
||||
"com.affine.settings.workspace.experimental-features.enable-pdf-embed-preview.description": "Once enabled, you can preview PDF in embed view.",
|
||||
"com.affine.settings.workspace.experimental-features.enable-page-block-header.name": "Page Block Header",
|
||||
"com.affine.settings.workspace.experimental-features.enable-page-block-header.description": "Once enabled, the header of page block will be displayed.",
|
||||
"com.affine.settings.workspace.experimental-features.enable-editor-rtl.name": "Editor RTL",
|
||||
"com.affine.settings.workspace.experimental-features.enable-editor-rtl.description": "Once enabled, the editor will be displayed in RTL mode.",
|
||||
"com.affine.settings.workspace.not-owner": "Only an owner can edit the workspace avatar and name. Changes will be shown for everyone.",
|
||||
"com.affine.settings.workspace.preferences": "Preference",
|
||||
"com.affine.settings.workspace.billing": "Team's Billing",
|
||||
|
||||
Reference in New Issue
Block a user