@wipco/sdui-editor 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -6
- package/dist/styles.css +8 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10118,8 +10118,10 @@ function EditorView2({
|
|
|
10118
10118
|
alive = false;
|
|
10119
10119
|
};
|
|
10120
10120
|
}, [store]);
|
|
10121
|
+
const docIdRef = useRef(null);
|
|
10121
10122
|
useEffect(() => {
|
|
10122
10123
|
if (!id) return;
|
|
10124
|
+
docIdRef.current = null;
|
|
10123
10125
|
setLoaded(null);
|
|
10124
10126
|
setLoadError(null);
|
|
10125
10127
|
setConflict(false);
|
|
@@ -10147,6 +10149,7 @@ function EditorView2({
|
|
|
10147
10149
|
setDraftRestored(false);
|
|
10148
10150
|
setBaseVersion(record.version);
|
|
10149
10151
|
}
|
|
10152
|
+
docIdRef.current = id;
|
|
10150
10153
|
let openedSpec;
|
|
10151
10154
|
try {
|
|
10152
10155
|
openedSpec = JSON.parse(opened);
|
|
@@ -10373,7 +10376,9 @@ function EditorView2({
|
|
|
10373
10376
|
const parsedRef = useRef(parsed);
|
|
10374
10377
|
parsedRef.current = parsed;
|
|
10375
10378
|
const overrideSpec = useCallback(
|
|
10376
|
-
|
|
10379
|
+
// docIdRef 가드 — 문서 전환 1프레임의 "새 id + 이전 파싱본"을 조각으로 내보내지
|
|
10380
|
+
// 않는다(위 docIdRef 주석). 그동안은 스토어 read가 맡는다.
|
|
10381
|
+
(specId) => specId === id && docIdRef.current === id ? parsedRef.current.spec ?? void 0 : void 0,
|
|
10377
10382
|
[id]
|
|
10378
10383
|
);
|
|
10379
10384
|
const useSpec = useMemo(() => createEditorUseSpec(store, overrideSpec), [store, overrideSpec]);
|
|
@@ -10627,12 +10632,14 @@ function ViewerView({
|
|
|
10627
10632
|
error: null,
|
|
10628
10633
|
seq: 0
|
|
10629
10634
|
});
|
|
10635
|
+
const loadedForRef = useRef(null);
|
|
10630
10636
|
const load = useCallback(() => {
|
|
10631
|
-
store.read(id).then(
|
|
10632
|
-
|
|
10637
|
+
store.read(id).then((record) => {
|
|
10638
|
+
loadedForRef.current = record ? id : null;
|
|
10639
|
+
setState(
|
|
10633
10640
|
(prev) => record ? { spec: record.spec, error: null, seq: prev.seq + 1 } : { spec: null, error: "\uD398\uC774\uC9C0\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4", seq: prev.seq + 1 }
|
|
10634
|
-
)
|
|
10635
|
-
).catch(
|
|
10641
|
+
);
|
|
10642
|
+
}).catch(
|
|
10636
10643
|
(err) => setState((prev) => ({ spec: null, error: messageOf(err, "\uD398\uC774\uC9C0\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4"), seq: prev.seq + 1 }))
|
|
10637
10644
|
);
|
|
10638
10645
|
}, [store, id]);
|
|
@@ -10641,6 +10648,7 @@ function ViewerView({
|
|
|
10641
10648
|
setState((prev) => ({ spec: null, error: "\uD398\uC774\uC9C0 id\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.", seq: prev.seq + 1 }));
|
|
10642
10649
|
return;
|
|
10643
10650
|
}
|
|
10651
|
+
loadedForRef.current = null;
|
|
10644
10652
|
setState((prev) => ({ spec: null, error: null, seq: prev.seq + 1 }));
|
|
10645
10653
|
load();
|
|
10646
10654
|
}, [id, load]);
|
|
@@ -10678,7 +10686,8 @@ function ViewerView({
|
|
|
10678
10686
|
const specRef = useRef(state.spec);
|
|
10679
10687
|
specRef.current = state.spec;
|
|
10680
10688
|
const overrideSpec = useCallback(
|
|
10681
|
-
|
|
10689
|
+
// loadedForRef 가드 — id 전환 1프레임의 "새 id + 이전 스펙"을 조각으로 내보내지 않는다.
|
|
10690
|
+
(specId) => specId === id && loadedForRef.current === id ? specRef.current ?? void 0 : void 0,
|
|
10682
10691
|
[id]
|
|
10683
10692
|
);
|
|
10684
10693
|
const useSpec = useMemo(() => createEditorUseSpec(store, overrideSpec), [store, overrideSpec]);
|
package/dist/styles.css
CHANGED
|
@@ -122,7 +122,11 @@
|
|
|
122
122
|
background: var(--wp-slate-25);
|
|
123
123
|
}
|
|
124
124
|
.sdui-editor-preview__notice { font-size: 12px; color: var(--wp-text-info); }
|
|
125
|
-
|
|
125
|
+
/* contain: paint — 미리본 다이얼로그의 오버레이(SduiDialog 래퍼가 position:fixed로
|
|
126
|
+
뷰포트에 고정)를 이 상자의 컨테이닝 블록에 가둔다. 없으면 오버레이가 편집기
|
|
127
|
+
전체를 덮어 시딩 버튼·패널이 마우스로 조작 불가였다(0.17.1 검수 실측:
|
|
128
|
+
elementFromPoint=wp-overlay, 클릭 타임아웃). */
|
|
129
|
+
.sdui-editor-preview__body { flex: 1; overflow-y: auto; padding: 24px; position: relative; contain: paint; }
|
|
126
130
|
.sdui-editor-preview__body .sdui-root { display: flex; flex-direction: column; gap: var(--wp-space-4); }
|
|
127
131
|
|
|
128
132
|
/* ---------- 도움말 패널 ---------- */
|
|
@@ -164,7 +168,9 @@
|
|
|
164
168
|
border-bottom: 1px solid var(--wp-border-subtle);
|
|
165
169
|
}
|
|
166
170
|
.sdui-editor-viewer__id { color: var(--wp-text-subtle); }
|
|
167
|
-
|
|
171
|
+
/* contain: paint — 위 .sdui-editor-preview__body와 같은 이유. 뷰어도 다이얼로그
|
|
172
|
+
스펙을 열린 채 그리므로 오버레이가 상단 바·시딩 패널을 덮으면 안 된다. */
|
|
173
|
+
.sdui-editor-viewer__body { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 28px 24px 48px; contain: paint; }
|
|
168
174
|
.sdui-editor-viewer__body .sdui-root { display: flex; flex-direction: column; gap: var(--wp-space-4); }
|
|
169
175
|
|
|
170
176
|
@media (max-width: 900px) {
|