Skip to content

Commit a9db4e1

Browse files
bring back the flutter support
1 parent 95522a2 commit a9db4e1

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

editor/components/code-editor/monaco-mock-empty.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import React from "react";
2-
export function MonacoEmptyMock() {
2+
export function MonacoEmptyMock({ l = 100 }: { l?: number }) {
33
return (
44
<div
55
style={{
6+
position: "relative",
7+
top: 0,
8+
height: 0,
69
display: "flex",
710
flexDirection: "column",
811
width: "100%",
@@ -11,7 +14,7 @@ export function MonacoEmptyMock() {
1114
background: "#1e1e1e",
1215
}}
1316
>
14-
{Array.from(Array(100).keys()).map((i) => (
17+
{Array.from(Array(l).keys()).map((i) => (
1518
<span
1619
style={{
1720
left: 0,

editor/components/code-editor/monaco.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function MonacoEditor(props: MonacoEditorProps) {
2727
defaultLanguage={
2828
pollyfill_language(props.defaultLanguage) ?? "typescript"
2929
}
30-
loading={<MonacoEmptyMock />}
30+
loading={<MonacoEmptyMock l={5} />}
3131
defaultValue={props.defaultValue ?? "// no content"}
3232
theme="vs-dark"
3333
options={{

editor/scaffolds/code/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { MainImageRepository } from "@design-sdk/core/assets-repository";
1313
import { DesignInput } from "@designto/config/input";
1414
import { useEditorState, useWorkspaceState } from "core/states";
1515

16+
import { utils_dart } from "utils";
17+
1618
import { utils as _design_utils } from "@design-sdk/core";
1719
const designq = _design_utils.query;
1820

@@ -55,15 +57,13 @@ export function CodeSegment() {
5557
const targetted =
5658
designq.find_node_by_id_under_entry(targetId, root?.entry) ?? root?.entry;
5759

58-
const targetStateRef = useRef();
59-
//@ts-ignore
60-
targetStateRef.current = targetted;
61-
6260
const on_result = (result: Result) => {
63-
//@ts-ignore
64-
if (result.id == targetStateRef?.current?.id) {
65-
setResult(result);
61+
if (framework_config.language == "dart") {
62+
// special formatter support for dartlang
63+
result.code.raw = utils_dart.format(result.code.raw);
64+
result.scaffold.raw = utils_dart.format(result.scaffold.raw);
6665
}
66+
setResult(result);
6767
};
6868

6969
useEffect(() => {
@@ -102,7 +102,7 @@ export function CodeSegment() {
102102
.catch(console.error);
103103
}
104104
}
105-
}, [targetted?.id, framework_config?.framework]);
105+
}, [targetted?.id, framework_config]);
106106

107107
const { code, scaffold, name: componentName } = result ?? {};
108108

0 commit comments

Comments
 (0)