refactor(editor): rename doc to store on block components (#12173)

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

## Summary by CodeRabbit

- **Refactor**
  - Unified internal data access by replacing all references from `doc` to `store` across all components, blocks, widgets, and utilities. This affects how readonly state, block operations, and service retrieval are handled throughout the application.
- **Tests**
  - Updated all test utilities and test cases to use `store` instead of `doc` for document-related operations.
- **Chores**
  - Updated context providers and property names to reflect the change from `doc` to `store` for improved consistency and maintainability.

No user-facing features or behaviors have changed.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Saul-Mirone
2025-05-08 01:01:05 +00:00
parent a45347656e
commit 388641bc89
140 changed files with 480 additions and 456 deletions
@@ -22,7 +22,7 @@ export const embedLoomSlashMenuConfig: SlashMenuConfig = {
action: ({ std, model }) => {
(async () => {
const { host } = std;
const parentModel = host.doc.getParent(model);
const parentModel = host.store.getParent(model);
if (!parentModel) {
return;
}
@@ -60,12 +60,12 @@ export class EmbedLoomBlockComponent extends EmbedBlockComponent<
this._cardStyle = this.model.props.style;
if (!this.model.props.videoId) {
this.doc.withoutTransact(() => {
this.store.withoutTransact(() => {
const url = this.model.props.url;
const urlMatch = url.match(loomUrlRegex);
if (urlMatch) {
const [, videoId] = urlMatch;
this.doc.updateBlock(this.model, {
this.store.updateBlock(this.model, {
videoId,
});
}
@@ -73,7 +73,7 @@ export class EmbedLoomBlockComponent extends EmbedBlockComponent<
}
if (!this.model.props.description && !this.model.props.title) {
this.doc.withoutTransact(() => {
this.store.withoutTransact(() => {
this.refreshData();
});
}
@@ -93,7 +93,7 @@ export class EmbedLoomBlockComponent extends EmbedBlockComponent<
const loading = this.loading;
const theme = this.std.get(ThemeProvider).theme;
const imageProxyService = this.doc.get(ImageProxyService);
const imageProxyService = this.store.get(ImageProxyService);
const { LoadingIcon, EmbedCardBannerIcon } = getEmbedCardIcons(theme);
const titleIcon = loading ? LoadingIcon : LoomIcon;
const titleText = loading ? 'Loading...' : title;
@@ -62,7 +62,7 @@ export async function refreshEmbedLoomUrlData(
if (signal?.aborted) return;
embedLoomElement.doc.updateBlock(embedLoomElement.model, {
embedLoomElement.store.updateBlock(embedLoomElement.model, {
title,
description,
image,