mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-12 15:46:29 +08:00
refactor(editor): move text toolbar config and components to its package (#11083)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { frameToolbarExtension } from '@blocksuite/affine-block-frame';
|
||||
import { textToolbarConfig } from '@blocksuite/affine-gfx-text';
|
||||
import { ToolbarModuleExtension } from '@blocksuite/affine-shared/services';
|
||||
import { BlockFlavourIdentifier } from '@blocksuite/block-std';
|
||||
import type { ExtensionType } from '@blocksuite/store';
|
||||
@@ -10,7 +11,6 @@ import { builtinGroupToolbarConfig } from './group';
|
||||
import { builtinMindmapToolbarConfig } from './mindmap';
|
||||
import { builtinLockedToolbarConfig, builtinMiscToolbarConfig } from './misc';
|
||||
import { builtinShapeToolbarConfig } from './shape';
|
||||
import { builtinTextToolbarConfig } from './text';
|
||||
|
||||
export const EdgelessElementToolbarExtension: ExtensionType[] = [
|
||||
frameToolbarExtension,
|
||||
@@ -37,7 +37,7 @@ export const EdgelessElementToolbarExtension: ExtensionType[] = [
|
||||
|
||||
ToolbarModuleExtension({
|
||||
id: BlockFlavourIdentifier('affine:surface:text'),
|
||||
config: builtinTextToolbarConfig,
|
||||
config: textToolbarConfig,
|
||||
}),
|
||||
|
||||
ToolbarModuleExtension({
|
||||
|
||||
@@ -55,7 +55,6 @@ import { OverlayScrollbar } from './edgeless/components/toolbar/template/overlay
|
||||
import { AffineTemplateLoading } from './edgeless/components/toolbar/template/template-loading.js';
|
||||
import { EdgelessTemplatePanel } from './edgeless/components/toolbar/template/template-panel.js';
|
||||
import { EdgelessTemplateButton } from './edgeless/components/toolbar/template/template-tool-button.js';
|
||||
import { EdgelessTextMenu } from './edgeless/components/toolbar/text/text-menu.js';
|
||||
import {
|
||||
AffineImageToolbarWidget,
|
||||
AffineModalWidget,
|
||||
@@ -174,7 +173,6 @@ function registerEdgelessToolbarComponents() {
|
||||
customElements.define('edgeless-frame-menu', EdgelessFrameMenu);
|
||||
customElements.define('edgeless-mindmap-menu', EdgelessMindmapMenu);
|
||||
customElements.define('edgeless-note-menu', EdgelessNoteMenu);
|
||||
customElements.define('edgeless-text-menu', EdgelessTextMenu);
|
||||
customElements.define('edgeless-slide-menu', EdgelessSlideMenu);
|
||||
|
||||
// Toolbar components
|
||||
@@ -318,7 +316,6 @@ declare global {
|
||||
'overlay-scrollbar': OverlayScrollbar;
|
||||
'affine-template-loading': AffineTemplateLoading;
|
||||
'edgeless-templates-panel': EdgelessTemplatePanel;
|
||||
'edgeless-text-menu': EdgelessTextMenu;
|
||||
'affine-page-root': PageRootBlockComponent;
|
||||
'zoom-bar-toggle-button': ZoomBarToggleButton;
|
||||
'edgeless-zoom-toolbar': EdgelessZoomToolbar;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export * from './config';
|
||||
export * from './icons';
|
||||
export * from './shape';
|
||||
export * from './shape-menu-config';
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"@blocksuite/affine-model": "workspace:*",
|
||||
"@blocksuite/affine-rich-text": "workspace:*",
|
||||
"@blocksuite/affine-shared": "workspace:*",
|
||||
"@blocksuite/affine-widget-edgeless-toolbar": "workspace:*",
|
||||
"@blocksuite/block-std": "workspace:*",
|
||||
"@blocksuite/global": "workspace:*",
|
||||
"@blocksuite/icons": "^2.2.6",
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { EdgelessTextEditor } from './edgeless-text-editor';
|
||||
import { EdgelessTextMenu } from './toolbar/text-menu';
|
||||
|
||||
export function effects() {
|
||||
customElements.define('edgeless-text-editor', EdgelessTextEditor);
|
||||
customElements.define('edgeless-text-menu', EdgelessTextMenu);
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
'edgeless-text-editor': EdgelessTextEditor;
|
||||
'edgeless-text-menu': EdgelessTextMenu;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './edgeless-text-editor';
|
||||
export * from './mount-text-editor';
|
||||
export * from './tool';
|
||||
export * from './toolbar';
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import { type ToolbarModuleConfig } from '@blocksuite/affine-shared/services';
|
||||
import { createTextActions } from '@blocksuite/affine-widget-edgeless-toolbar';
|
||||
import { Bound } from '@blocksuite/global/gfx';
|
||||
|
||||
export const builtinTextToolbarConfig = {
|
||||
export const textToolbarConfig = {
|
||||
actions: createTextActions(TextElementModel, 'text', (ctx, model, props) => {
|
||||
// No need to adjust element bounds
|
||||
if (props['textAlign']) {
|
||||
@@ -0,0 +1 @@
|
||||
export * from './config';
|
||||
@@ -13,6 +13,7 @@
|
||||
{ "path": "../../model" },
|
||||
{ "path": "../../rich-text" },
|
||||
{ "path": "../../shared" },
|
||||
{ "path": "../../widgets/widget-edgeless-toolbar" },
|
||||
{ "path": "../../../framework/block-std" },
|
||||
{ "path": "../../../framework/global" },
|
||||
{ "path": "../../../framework/store" }
|
||||
|
||||
@@ -464,6 +464,7 @@ export const PackageList = [
|
||||
'blocksuite/affine/model',
|
||||
'blocksuite/affine/rich-text',
|
||||
'blocksuite/affine/shared',
|
||||
'blocksuite/affine/widgets/widget-edgeless-toolbar',
|
||||
'blocksuite/framework/block-std',
|
||||
'blocksuite/framework/global',
|
||||
'blocksuite/framework/store',
|
||||
|
||||
@@ -3011,6 +3011,7 @@ __metadata:
|
||||
"@blocksuite/affine-model": "workspace:*"
|
||||
"@blocksuite/affine-rich-text": "workspace:*"
|
||||
"@blocksuite/affine-shared": "workspace:*"
|
||||
"@blocksuite/affine-widget-edgeless-toolbar": "workspace:*"
|
||||
"@blocksuite/block-std": "workspace:*"
|
||||
"@blocksuite/global": "workspace:*"
|
||||
"@blocksuite/icons": "npm:^2.2.6"
|
||||
|
||||
Reference in New Issue
Block a user