refactor(editor): extract mobile extension builder (#12239)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a new mobile view extension that activates mobile-specific UI features based on the runtime environment.
  - Automatically enables mobile keyboard toolbar and linked document menu features in mobile contexts.

- **Improvements**
  - Simplified code and paragraph block configurations on mobile, including disabling line numbers and adjusting placeholders.
  - Enhanced configuration chaining to include mobile-specific settings by default.
  - Improved extension registration flow with method chaining support.

- **Refactor**
  - Removed deprecated mobile patch classes and configurations, consolidating mobile logic into dedicated extensions.
  - Streamlined mobile-related code for better maintainability and performance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Saul-Mirone
2025-05-12 12:54:51 +00:00
parent 0464e03b92
commit cb550b7b21
11 changed files with 128 additions and 72 deletions

View File

@@ -17,7 +17,7 @@ export type Context<Scope extends string> = {
/** The scope this context is associated with */
scope: Scope;
/** Function to register one or more extensions */
register(extensions: ExtensionType[] | ExtensionType): void;
register(extensions: ExtensionType[] | ExtensionType): Context<Scope>;
};
/**

View File

@@ -75,11 +75,14 @@ export class ExtensionManager<Scope extends string> {
/** @internal */
private readonly _getContextByScope = (scope: Scope): Context<Scope> => {
return {
const context: Context<Scope> = {
scope,
register: (extensions: ExtensionType[] | ExtensionType) =>
this._registerToScope(scope, extensions),
register: (extensions: ExtensionType[] | ExtensionType) => {
this._registerToScope(scope, extensions);
return context;
},
};
return context;
};
/**