mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
chore(editor): add edgeless scribbled style feature flag (#11127)
Closes: [BS-2805](https://linear.app/affine-design/issue/BS-2805/下掉线条样式切换功能,需添加-feature-flag)
This commit is contained in:
@@ -209,8 +209,7 @@ export const connectorToolbarConfig = {
|
||||
},
|
||||
{
|
||||
id: 'b.style',
|
||||
// TODO(@fundon): should add a feature flag
|
||||
when: false,
|
||||
when: ctx => ctx.features.getFlag('enable_edgeless_scribbled_style'),
|
||||
content(ctx) {
|
||||
const models = ctx.getSurfaceModelsByType(ConnectorElementModel);
|
||||
if (!models.length) return null;
|
||||
|
||||
@@ -112,6 +112,12 @@ export const shapeToolbarConfig = {
|
||||
const models = ctx.getSurfaceModelsByType(ShapeElementModel);
|
||||
if (!models.length) return null;
|
||||
|
||||
const shapeStyle = ctx.features.getFlag(
|
||||
'enable_edgeless_scribbled_style'
|
||||
)
|
||||
? (getMostCommonValue(models, 'shapeStyle') ?? ShapeStyle.General)
|
||||
: ShapeStyle.General;
|
||||
|
||||
const shapeName =
|
||||
getMostCommonValue<ShapeToolOption, 'shapeName'>(
|
||||
models.map(model => ({
|
||||
@@ -139,8 +145,10 @@ export const shapeToolbarConfig = {
|
||||
items: ShapeComponentConfig.map(item => ({
|
||||
key: item.tooltip,
|
||||
value: item.name,
|
||||
// TODO(@fundon): should add a feature flag to switch style
|
||||
icon: item.generalIcon,
|
||||
icon:
|
||||
shapeStyle === ShapeStyle.General
|
||||
? item.generalIcon
|
||||
: item.scribbledIcon,
|
||||
disabled: item.disabled,
|
||||
})),
|
||||
currentValue: shapeName,
|
||||
@@ -150,8 +158,7 @@ export const shapeToolbarConfig = {
|
||||
},
|
||||
{
|
||||
id: 'd.style',
|
||||
// TODO(@fundon): should add a feature flag
|
||||
when: false,
|
||||
when: ctx => ctx.features.getFlag('enable_edgeless_scribbled_style'),
|
||||
content(ctx) {
|
||||
const models = ctx.getSurfaceModelsByType(ShapeElementModel);
|
||||
if (!models.length) return null;
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface BlockSuiteFlags {
|
||||
enable_block_meta: boolean;
|
||||
enable_callout: boolean;
|
||||
enable_embed_iframe_block: boolean;
|
||||
enable_edgeless_scribbled_style: boolean;
|
||||
}
|
||||
|
||||
export class FeatureFlagService extends StoreExtension {
|
||||
@@ -42,6 +43,7 @@ export class FeatureFlagService extends StoreExtension {
|
||||
enable_block_meta: false,
|
||||
enable_callout: false,
|
||||
enable_embed_iframe_block: false,
|
||||
enable_edgeless_scribbled_style: false,
|
||||
});
|
||||
|
||||
setFlag(key: keyof BlockSuiteFlags, value: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user