Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chg(lexical): move loro lexical schema into lexical-core (#3127)

teo2d768450456a
diff --git a/.github/actions/setup-reqs-web/action.yml b/.github/actions/setup-reqs-web/action.yml
index e8ecfa1096..b2d9b7484e 100644
--- a/.github/actions/setup-reqs-web/action.yml
+++ b/.github/actions/setup-reqs-web/action.yml
@@ -9,6 +9,19 @@ inputs:
runs:
using: composite
steps:
+ - name: Add Nix to PATH
+ shell: bash
+ run: echo "/nix/var/nix/profiles/default/bin" >> "$GITHUB_PATH"
+
+ - name: Enter Nix dev shell
+ shell: bash
+ run: |
+ set -euo pipefail
+ nix print-dev-env --accept-flake-config > /tmp/dev-env
+ echo "BASH_ENV=/tmp/dev-env" >> "$GITHUB_ENV"
+ source /tmp/dev-env
+ printf '%s\n' "$PATH" | tr ':' '\n' >> "$GITHUB_PATH"
+
- name: Setup bunfig.toml
working-directory: js
shell: bash
diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml
index b5750b5b52..c5d39b1c74 100644
--- a/.github/workflows/deploy-preview.yml
+++ b/.github/workflows/deploy-preview.yml
@@ -23,7 +23,7 @@ env:
jobs:
deploy:
- runs-on: linux-latest-beefy
+ runs-on: linux-extra-beefy
permissions:
contents: read
pull-requests: write
diff --git a/.github/workflows/deploy-web-app.yml b/.github/workflows/deploy-web-app.yml
index e5da00cbf3..67632a6cec 100644
--- a/.github/workflows/deploy-web-app.yml
+++ b/.github/workflows/deploy-web-app.yml
@@ -49,7 +49,7 @@ concurrency:
jobs:
build-deploy:
- runs-on: linux-latest-beefy
+ runs-on: linux-extra-beefy
env:
CI: "true"
steps:
diff --git a/.github/workflows/release-production.yml b/.github/workflows/release-production.yml
index 74e9ea8112..596af48d47 100644
--- a/.github/workflows/release-production.yml
+++ b/.github/workflows/release-production.yml
@@ -39,7 +39,7 @@ jobs:
build:
name: Build
needs: [deploy-cloud-storage]
- runs-on: linux-latest-beefy
+ runs-on: linux-extra-beefy
env:
CI: "true"
steps:
@@ -65,7 +65,7 @@ jobs:
deploy:
name: Deploy Web App
- runs-on: linux-latest-beefy
+ runs-on: linux-extra-beefy
needs: [build]
env:
CI: "true"
diff --git a/js/app/packages/block-md/definition.ts b/js/app/packages/block-md/definition.ts
index 25fc0a690d..37be138d0a 100644
--- a/js/app/packages/block-md/definition.ts
+++ b/js/app/packages/block-md/definition.ts
@@ -9,7 +9,7 @@ import { rawStateToLoroSnapshot } from '@core/collab/utils';
import { serializedStateFromBlob } from '@core/component/LexicalMarkdown/collaboration/utils';
import { ENABLE_MARKDOWN_LIVE_COLLABORATION } from '@core/constant/featureFlags';
import { isErr, ok } from '@core/util/maybeResult';
-import { type SchemaType, schema } from '@loro-mirror/packages/core/src';
+import { MARKDOWN_LORO_SCHEMA } from '@lexical-core/markdown-loro-schema';
import { storageServiceClient } from '@service-storage/client';
import { fetchBinary } from '@service-storage/util/fetchBinary';
import { makeFileFromBlob } from '@service-storage/util/makeFileFromBlob';
@@ -20,37 +20,6 @@ import { createStore } from 'solid-js/store';
import MarkdownBlock from './component/Block';
import type { MarkdownRewriteOutput } from './signal/rewriteSignal';
-const nodeSchema = schema.LoroMap({
- $: schema.LoroMap({} as any, {
- required: false,
- }),
- text: schema.LoroText({
- required: false,
- }),
- ids: schema.LoroList(schema.String(), (idStr) => idStr, {
- required: false,
- }),
- children: schema.LoroMovableList(
- {} as SchemaType,
- (item) => {
- const id = item?.$?.id;
- if (!id) {
- console.error('no id for item', item);
- }
- return id;
- },
- {
- required: false,
- }
- ),
-});
-
-nodeSchema.definition.children.itemSchema = nodeSchema;
-
-export const MARKDOWN_LORO_SCHEMA = schema({
- root: nodeSchema,
-});
-
/** 5 second cache timeout */
const CACHE_THRESHOLD = 5000;
const [existsCache, setExistsCache] = createStore<
diff --git a/js/app/packages/core/util/create.ts b/js/app/packages/core/util/create.ts
index 8f1d1c14af..0af8e4c748 100644
--- a/js/app/packages/core/util/create.ts
+++ b/js/app/packages/core/util/create.ts
@@ -1,6 +1,5 @@
import { DEFAULT_CHAT_NAME } from '@block-chat/definition';
import type { CodeFileExtension } from '@block-code/util/languageSupport';
-import { MARKDOWN_LORO_SCHEMA } from '@block-md/definition';
import { rawStateToLoroSnapshot } from '@core/collab/utils';
import { createMarkdownStateFromContent } from '@core/component/LexicalMarkdown/collaboration/utils';
import {
@@ -9,6 +8,7 @@ import {
} from '@core/component/Properties/constants';
import { PaywallKey, usePaywallState } from '@core/constant/PaywallState';
import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';
+import { MARKDOWN_LORO_SCHEMA } from '@lexical-core/markdown-loro-schema';
import {
authKeys,
invalidateUserQuota,
diff --git a/js/app/packages/queries/storage/instructions-md.ts b/js/app/packages/queries/storage/instructions-md.ts
index 430f159223..18c9fa74cc 100644
--- a/js/app/packages/queries/storage/instructions-md.ts
+++ b/js/app/packages/queries/storage/instructions-md.ts
@@ -1,4 +1,3 @@
-import { MARKDOWN_LORO_SCHEMA } from '@block-md/definition';
import { rawStateToLoroSnapshot } from '@core/collab/utils';
import { createMarkdownStateFromContent } from '@core/component/LexicalMarkdown/collaboration/utils';
import { createLexicalWrapper } from '@core/component/LexicalMarkdown/context/LexicalWrapperContext';
@@ -7,6 +6,7 @@ import {
initializeEditorWithState,
} from '@core/component/LexicalMarkdown/utils';
import { isOk } from '@core/util/maybeResult';
+import { MARKDOWN_LORO_SCHEMA } from '@lexical-core/markdown-loro-schema';
import { storageServiceClient } from '@service-storage/client';
import { syncServiceClient } from '@service-sync/client';
import { useQuery } from '@tanstack/solid-query';
diff --git a/js/lexical-core/markdown-loro-schema.ts b/js/lexical-core/markdown-loro-schema.ts
new file mode 100644
index 0000000000..c0f564d1df
--- /dev/null
+++ b/js/lexical-core/markdown-loro-schema.ts
@@ -0,0 +1,32 @@
+import { type SchemaType, schema } from '../loro-mirror/packages/core/src';
+
+const markdownNodeSchema = schema.LoroMap({
+ $: schema.LoroMap({} as any, {
+ required: false,
+ }),
+ text: schema.LoroText({
+ required: false,
+ }),
+ ids: schema.LoroList(schema.String(), (idStr) => idStr, {
+ required: false,
+ }),
+ children: schema.LoroMovableList(
+ {} as SchemaType,
+ (item) => {
+ const id = item?.$?.id;
+ if (!id) {
+ console.error('no id for item', item);
+ }
+ return id;
+ },
+ {
+ required: false,
+ }
+ ),
+});
+
+markdownNodeSchema.definition.children.itemSchema = markdownNodeSchema;
+
+export const MARKDOWN_LORO_SCHEMA = schema({
+ root: markdownNodeSchema,
+});