@qwanyx/ai-editor 1.5.3 → 1.5.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"PageEditor.d.ts","sourceRoot":"","sources":["../../src/components/PageEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EAUb,MAAM,eAAe,CAAA;AA0uBtB,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,wBAAgB,UAAU,CAAC,EACzB,eAAe,EACf,QAAQ,EACR,SAAS,EACT,SAAgB,GACjB,EAAE,eAAe,2CAYjB;AAED,eAAe,UAAU,CAAA"}
1
+ {"version":3,"file":"PageEditor.d.ts","sourceRoot":"","sources":["../../src/components/PageEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EAUb,MAAM,eAAe,CAAA;AA8uBtB,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAA;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,wBAAgB,UAAU,CAAC,EACzB,eAAe,EACf,QAAQ,EACR,SAAS,EACT,SAAgB,GACjB,EAAE,eAAe,2CAYjB;AAED,eAAe,UAAU,CAAA"}
@@ -319,14 +319,18 @@ function PageEditorInner() {
319
319
  // Scroll to newly added section
320
320
  (0, react_1.useEffect)(() => {
321
321
  if (newSectionId && pageContainerRef.current) {
322
- const sectionElement = pageContainerRef.current.querySelector(`[data-section-id="${newSectionId}"]`);
323
- if (sectionElement) {
324
- sectionElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
325
- selectSection(newSectionId);
322
+ // Small delay to ensure DOM is updated
323
+ const timer = setTimeout(() => {
324
+ const sectionElement = pageContainerRef.current?.querySelector(`[data-section-id="${newSectionId}"]`);
325
+ if (sectionElement) {
326
+ sectionElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
327
+ selectSection(newSectionId);
328
+ }
326
329
  setNewSectionId(null);
327
- }
330
+ }, 100);
331
+ return () => clearTimeout(timer);
328
332
  }
329
- }, [newSectionId, document.sections, selectSection]);
333
+ }, [newSectionId]); // eslint-disable-line react-hooks/exhaustive-deps
330
334
  const handleAddSection = (0, react_1.useCallback)((layoutType) => {
331
335
  const defaultContent = (0, layouts_1.getLayoutDefaultContent)(layoutType);
332
336
  if (defaultContent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwanyx/ai-editor",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "AI-powered WYSIWYG rich text editor",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",