Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

move text editor to wrapper component

Oleg Isonen35c5475c00f4
diff --git a/app/canvas/canvas.tsx b/app/canvas/canvas.tsx
index 9af0639327..91550b375d 100644
--- a/app/canvas/canvas.tsx
+++ b/app/canvas/canvas.tsx
@@ -50,7 +50,10 @@ import {
import { registerContainers } from "./shared/immerhin";
import { useTrackHoveredElement } from "./shared/use-track-hovered-element";
import { usePublishScrollState } from "./shared/use-publish-scroll-state";
-import { LexicalComposer, config } from "~/shared/text-editor";
+import {
+ LexicalComposer,
+ config,
+} from "~/canvas/features/wrapper-component/text-editor";
registerContainers();
diff --git a/app/shared/text-editor/config.ts b/app/canvas/features/wrapper-component/text-editor/config.ts
similarity index 100%
rename from app/shared/text-editor/config.ts
rename to app/canvas/features/wrapper-component/text-editor/config.ts
diff --git a/app/shared/text-editor/content-editable.tsx b/app/canvas/features/wrapper-component/text-editor/content-editable.tsx
similarity index 100%
rename from app/shared/text-editor/content-editable.tsx
rename to app/canvas/features/wrapper-component/text-editor/content-editable.tsx
diff --git a/app/canvas/features/wrapper-component/editor/editor.tsx b/app/canvas/features/wrapper-component/text-editor/editor.tsx
similarity index 91%
rename from app/canvas/features/wrapper-component/editor/editor.tsx
rename to app/canvas/features/wrapper-component/text-editor/editor.tsx
index b41a708fd4..e7b592d9d8 100644
--- a/app/canvas/features/wrapper-component/editor/editor.tsx
+++ b/app/canvas/features/wrapper-component/text-editor/editor.tsx
@@ -5,7 +5,7 @@ import {
InstancePlugin,
ToolbarConnectorPlugin,
OnChangePlugin,
-} from "~/shared/text-editor";
+} from "~/canvas/features/wrapper-component/text-editor";
type EditorProps = {
editable: JSX.Element;
diff --git a/app/shared/text-editor/example-text-editor.stories.tsx b/app/canvas/features/wrapper-component/text-editor/example-text-editor.stories.tsx
similarity index 100%
rename from app/shared/text-editor/example-text-editor.stories.tsx
rename to app/canvas/features/wrapper-component/text-editor/example-text-editor.stories.tsx
diff --git a/app/shared/text-editor/example-text-editor.tsx b/app/canvas/features/wrapper-component/text-editor/example-text-editor.tsx
similarity index 97%
rename from app/shared/text-editor/example-text-editor.tsx
rename to app/canvas/features/wrapper-component/text-editor/example-text-editor.tsx
index 7cbc60430d..04f31aa956 100644
--- a/app/shared/text-editor/example-text-editor.tsx
+++ b/app/canvas/features/wrapper-component/text-editor/example-text-editor.tsx
@@ -13,7 +13,7 @@ import { OnChangePlugin } from "./plugins/plugin-on-change";
import { InstancePlugin } from "./plugins/plugin-instance";
import { TreeViewPlugin } from "./plugins/tree-view-plugin";
import { config } from "./config";
-import { createInstance } from "../tree-utils";
+import { createInstance } from "../../../../shared/tree-utils";
type ExampleTextEditorProps = {
onChange: (state: ChildrenUpdates) => void;
diff --git a/app/shared/text-editor/index.ts b/app/canvas/features/wrapper-component/text-editor/index.ts
similarity index 100%
rename from app/shared/text-editor/index.ts
rename to app/canvas/features/wrapper-component/text-editor/index.ts
diff --git a/app/shared/text-editor/lexical.ts b/app/canvas/features/wrapper-component/text-editor/lexical.ts
similarity index 100%
rename from app/shared/text-editor/lexical.ts
rename to app/canvas/features/wrapper-component/text-editor/lexical.ts
diff --git a/app/shared/text-editor/nodes/node-instance.tsx b/app/canvas/features/wrapper-component/text-editor/nodes/node-instance.tsx
similarity index 97%
rename from app/shared/text-editor/nodes/node-instance.tsx
rename to app/canvas/features/wrapper-component/text-editor/nodes/node-instance.tsx
index 00c3115f3e..3331c34279 100644
--- a/app/shared/text-editor/nodes/node-instance.tsx
+++ b/app/canvas/features/wrapper-component/text-editor/nodes/node-instance.tsx
@@ -3,7 +3,7 @@ import { render } from "react-dom";
import { useMemo } from "react";
import { useCss } from "~/canvas/features/wrapper-component/use-css";
import { useBreakpoints } from "~/shared/nano-states";
-import { primitives } from "../../canvas-components";
+import { primitives } from "../../../../../shared/canvas-components";
import {
type EditorConfig,
type SerializedTextNode,
diff --git a/app/shared/text-editor/plugins/plugin-instance.tsx b/app/canvas/features/wrapper-component/text-editor/plugins/plugin-instance.tsx
similarity index 100%
rename from app/shared/text-editor/plugins/plugin-instance.tsx
rename to app/canvas/features/wrapper-component/text-editor/plugins/plugin-instance.tsx
diff --git a/app/shared/text-editor/plugins/plugin-on-change.tsx b/app/canvas/features/wrapper-component/text-editor/plugins/plugin-on-change.tsx
similarity index 100%
rename from app/shared/text-editor/plugins/plugin-on-change.tsx
rename to app/canvas/features/wrapper-component/text-editor/plugins/plugin-on-change.tsx
diff --git a/app/shared/text-editor/plugins/plugin-toolbar-connector.tsx b/app/canvas/features/wrapper-component/text-editor/plugins/plugin-toolbar-connector.tsx
similarity index 100%
rename from app/shared/text-editor/plugins/plugin-toolbar-connector.tsx
rename to app/canvas/features/wrapper-component/text-editor/plugins/plugin-toolbar-connector.tsx
diff --git a/app/shared/text-editor/plugins/tree-view-plugin.tsx b/app/canvas/features/wrapper-component/text-editor/plugins/tree-view-plugin.tsx
similarity index 100%
rename from app/shared/text-editor/plugins/tree-view-plugin.tsx
rename to app/canvas/features/wrapper-component/text-editor/plugins/tree-view-plugin.tsx
diff --git a/app/shared/text-editor/styles.css b/app/canvas/features/wrapper-component/text-editor/styles.css
similarity index 100%
rename from app/shared/text-editor/styles.css
rename to app/canvas/features/wrapper-component/text-editor/styles.css
diff --git a/app/canvas/features/wrapper-component/editor/use-is-editing.ts b/app/canvas/features/wrapper-component/text-editor/use-is-editing.ts
similarity index 100%
rename from app/canvas/features/wrapper-component/editor/use-is-editing.ts
rename to app/canvas/features/wrapper-component/text-editor/use-is-editing.ts
diff --git a/app/shared/text-editor/utils/to-lexical-nodes.tsx b/app/canvas/features/wrapper-component/text-editor/utils/to-lexical-nodes.tsx
similarity index 100%
rename from app/shared/text-editor/utils/to-lexical-nodes.tsx
rename to app/canvas/features/wrapper-component/text-editor/utils/to-lexical-nodes.tsx
diff --git a/app/shared/text-editor/utils/to-updates.test.ts b/app/canvas/features/wrapper-component/text-editor/utils/to-updates.test.ts
similarity index 100%
rename from app/shared/text-editor/utils/to-updates.test.ts
rename to app/canvas/features/wrapper-component/text-editor/utils/to-updates.test.ts
diff --git a/app/shared/text-editor/utils/to-updates.ts b/app/canvas/features/wrapper-component/text-editor/utils/to-updates.ts
similarity index 100%
rename from app/shared/text-editor/utils/to-updates.ts
rename to app/canvas/features/wrapper-component/text-editor/utils/to-updates.ts
diff --git a/app/canvas/features/wrapper-component/wrapper-component.tsx b/app/canvas/features/wrapper-component/wrapper-component.tsx
index d2066a28c4..8f24b34bca 100644
--- a/app/canvas/features/wrapper-component/wrapper-component.tsx
+++ b/app/canvas/features/wrapper-component/wrapper-component.tsx
@@ -10,9 +10,9 @@ import { primitives } from "~/shared/canvas-components";
import { useCss } from "./use-css";
import { useDraggable } from "./use-draggable";
import { useEnsureFocus } from "./use-ensure-focus";
-import { Editor } from "./editor/editor";
-import { useIsEditing } from "./editor/use-is-editing";
-import { useContentEditable } from "~/shared/text-editor";
+import { Editor } from "./text-editor/editor";
+import { useIsEditing } from "./text-editor/use-is-editing";
+import { useContentEditable } from "~/canvas/features/wrapper-component/text-editor";
import noop from "lodash.noop";
type WrapperComponentDevProps = {