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 { type DocMode, getLastNoteBlock } from '@blocksuite/affine/blocks';
|
||||||
import { Slot } from '@blocksuite/affine/global/utils';
|
import { Slot } from '@blocksuite/affine/global/utils';
|
||||||
import type {
|
import type {
|
||||||
@@ -7,6 +8,7 @@ import type {
|
|||||||
PageEditor,
|
PageEditor,
|
||||||
} from '@blocksuite/affine/presets';
|
} from '@blocksuite/affine/presets';
|
||||||
import { type Store } from '@blocksuite/affine/store';
|
import { type Store } from '@blocksuite/affine/store';
|
||||||
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import {
|
import {
|
||||||
@@ -49,6 +51,8 @@ export const BlocksuiteEditorContainer = forwardRef<
|
|||||||
const docRef = useRef<PageEditor>(null);
|
const docRef = useRef<PageEditor>(null);
|
||||||
const docTitleRef = useRef<DocTitle>(null);
|
const docTitleRef = useRef<DocTitle>(null);
|
||||||
const edgelessRef = useRef<EdgelessEditor>(null);
|
const edgelessRef = useRef<EdgelessEditor>(null);
|
||||||
|
const featureFlags = useService(FeatureFlagService).flags;
|
||||||
|
const enableEditorRTL = useLiveData(featureFlags.enable_editor_rtl.$);
|
||||||
|
|
||||||
const slots: BlocksuiteEditorContainerRef['slots'] = useMemo(() => {
|
const slots: BlocksuiteEditorContainerRef['slots'] = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
@@ -157,6 +161,7 @@ export const BlocksuiteEditorContainer = forwardRef<
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-testid={`editor-${page.id}`}
|
data-testid={`editor-${page.id}`}
|
||||||
|
dir={enableEditorRTL ? 'rtl' : 'ltr'}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
`editor-wrapper ${mode}-mode`,
|
`editor-wrapper ${mode}-mode`,
|
||||||
styles.docEditorRoot,
|
styles.docEditorRoot,
|
||||||
|
|||||||
@@ -250,6 +250,15 @@ export const AFFINE_FLAGS = {
|
|||||||
configurable: isCanaryBuild,
|
configurable: isCanaryBuild,
|
||||||
defaultState: 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 };
|
} satisfies { [key in string]: FlagInfo };
|
||||||
|
|
||||||
// oxlint-disable-next-line no-redeclare
|
// 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-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.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-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.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.preferences": "Preference",
|
||||||
"com.affine.settings.workspace.billing": "Team's Billing",
|
"com.affine.settings.workspace.billing": "Team's Billing",
|
||||||
|
|||||||
Reference in New Issue
Block a user