@flozy/editor 4.1.8 → 4.1.9

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.
@@ -104,7 +104,6 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
104
104
  w: null,
105
105
  h: null
106
106
  });
107
- const [isScrolling, setIsScrolling] = useState(false);
108
107
  const [isTextSelected, setIsTextSelected] = useState(false);
109
108
  const [breakpoint, setBreakpoint] = useState("");
110
109
  const [size] = useWindowResize();
@@ -376,10 +375,10 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
376
375
  backgroundPosition: "-19px -19px"
377
376
  } : {};
378
377
  const handleScrollStop = useDebouncedCallback(() => {
379
- setIsScrolling(false);
378
+ editorWrapper?.current?.classList.add("hideScroll");
380
379
  }, 200);
381
380
  const handleScroll = () => {
382
- setIsScrolling(true);
381
+ editorWrapper?.current?.classList.remove("hideScroll");
383
382
  handleScrollStop();
384
383
  };
385
384
  const hasTopBanner = () => {
@@ -467,11 +466,9 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
467
466
  children: [/*#__PURE__*/_jsx(DragAndDrop, {
468
467
  children: /*#__PURE__*/_jsxs(Overlay, {
469
468
  children: [/*#__PURE__*/_jsx(Box, {
470
- className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} ${isScrolling ? "" : "hideScroll"} scrollable-content scrollSmooth`,
469
+ className: `${hasTopBanner() ? "has-topbanner" : ""} ${!pageColor ? "no-color" : ""} scrollable-content scrollSmooth`,
471
470
  sx: classes.slateWrapper,
472
- id: "slate-wrapper-scroll-container"
473
- // style={editorWrapperStyle}
474
- ,
471
+ id: "slate-wrapper-scroll-container",
475
472
  ref: editorWrapper,
476
473
  onClick: e => {
477
474
  handleInsertLastElement(e, editor);
@@ -117,6 +117,9 @@ const useFreeGridStyles = ({
117
117
  },
118
118
  "& .fgi_type_button": {
119
119
  height: "100%",
120
+ "& .moreBtnShow": {
121
+ display: "none"
122
+ },
120
123
  "& .editor-btn-wrapper": {
121
124
  height: "100%",
122
125
  "& .editor-btn-wrapper-inner": {
@@ -140,7 +140,6 @@ export function onDropItem(props, parentClass) {
140
140
  // Update grid area
141
141
  const gridArea = `${row} / 1 / ${row + 1} / 2`;
142
142
  const appenBp = breakpoint === "lg" ? "" : `_${breakpoint}`;
143
- console.log(breakpoint, path);
144
143
  Transforms.setNodes(editor, {
145
144
  [`gridArea${appenBp}`]: gridArea,
146
145
  [`left${appenBp}`]: cCalx,
@@ -19,7 +19,6 @@ const VirtualElement = props => {
19
19
  if (virtualRef?.current) {
20
20
  setTimeout(() => {
21
21
  const allData = calculateProps(path, virtualRef?.current, ROOT_ITEM_CLASS, []);
22
- console.log(allData);
23
22
  // it should trigger by auto alignment or on clicking mobile view change
24
23
  updateAutoProps(editor, allData, "xs");
25
24
  }, 0);
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useRef, useState } from "react";
2
- import { Node, Path } from "slate";
2
+ import { Editor, Node, Path, Transforms } from "slate";
3
3
  import { ReactEditor } from "slate-react";
4
4
  import { Box } from "@mui/material";
5
5
  import { Rnd } from "react-rnd";
@@ -163,6 +163,12 @@ const RnD = props => {
163
163
  e.preventDefault();
164
164
  e.stopPropagation();
165
165
  }
166
+
167
+ // to prevent auto scroll to top
168
+ // when no editor.selection
169
+ if (!editor.selection) {
170
+ Transforms.select(editor, Editor.end(editor, []));
171
+ }
166
172
  switch (e.detail) {
167
173
  case 1:
168
174
  if (!enable) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "4.1.8",
3
+ "version": "4.1.9",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"