@flozy/editor 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,6 +9,7 @@ import withCommon from "./hooks/withCommon";
9
9
  import withCollaborative from "./hooks/withCollaborative";
10
10
  import CommonEditor from "./CommonEditor";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
12
13
  const CollaborativeEditor = props => {
13
14
  const editorRef = useRef(null);
14
15
  const {
@@ -108,6 +109,17 @@ const CollaborativeEditor = props => {
108
109
  setConnected(false);
109
110
  setMessage("Seems your connection is lost... Reload the page to edit the document...");
110
111
  });
112
+
113
+ // const getContent = () => {
114
+ // console.log(editorRef.current.getContent());
115
+ // };
116
+
117
+ // const insertFragments = () => {
118
+ // editorRef.current.insertFragments([
119
+ // { type: "paragraph", children: [{ text: "some fragements to inss" }] },
120
+ // ]);
121
+ // };
122
+
111
123
  if (authenticated.status === "error") {
112
124
  return /*#__PURE__*/_jsx("h1", {
113
125
  "data-status": connected,
@@ -119,18 +131,20 @@ const CollaborativeEditor = props => {
119
131
  children: message || "Loading..."
120
132
  });
121
133
  }
122
- return /*#__PURE__*/_jsx(CommonEditor, {
123
- ref: editorRef,
124
- editor: editor,
125
- id: id,
126
- content: [],
127
- onSave: onSave,
128
- readOnly: authenticated.scope,
129
- otherProps: {
130
- token: user?.token,
131
- API_HOST: apiHOST
132
- },
133
- ...rest
134
+ return /*#__PURE__*/_jsx(_Fragment, {
135
+ children: /*#__PURE__*/_jsx(CommonEditor, {
136
+ ref: editorRef,
137
+ editor: editor,
138
+ id: id,
139
+ content: [],
140
+ onSave: onSave,
141
+ readOnly: authenticated.scope,
142
+ otherProps: {
143
+ token: user?.token,
144
+ API_HOST: apiHOST
145
+ },
146
+ ...rest
147
+ })
134
148
  });
135
149
  };
136
150
  export default CollaborativeEditor;
@@ -89,6 +89,15 @@ const CommonEditor = /*#__PURE__*/forwardRef((props, ref) => {
89
89
  console.log(err);
90
90
  return null;
91
91
  }
92
+ },
93
+ getEditor() {
94
+ return editor;
95
+ },
96
+ getContent() {
97
+ return value;
98
+ },
99
+ insertFragments(fragments) {
100
+ editor.insertNode(fragments);
92
101
  }
93
102
  }));
94
103
  const [htmlAction, setHtmlAction] = useState({
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ const PageSettings = props => {
4
+ const {
5
+ attributes
6
+ } = props;
7
+ return /*#__PURE__*/_jsx("div", {
8
+ ...attributes,
9
+ className: "page-settings",
10
+ contentEditable: false
11
+ });
12
+ };
13
+ export default PageSettings;
@@ -24,6 +24,7 @@ import ImageText from "../Elements/ImageText/ImageText";
24
24
  import ChipText from "../Elements/ChipText/ChipText";
25
25
  import DrawerMenu from "../Elements/DrawerMenu/DrawerMenu";
26
26
  import AppHeader from "../Elements/AppHeader/AppHeader";
27
+ import PageSettings from "../Elements/PageSettings/PageSettings";
27
28
  import { jsx as _jsx } from "react/jsx-runtime";
28
29
  const alignment = ["alignLeft", "alignRight", "alignCenter"];
29
30
  const list_types = ["orderedList", "unorderedList"];
@@ -358,6 +359,10 @@ export const getBlock = props => {
358
359
  return /*#__PURE__*/_jsx(AppHeader, {
359
360
  ...props
360
361
  });
362
+ case "page-settings":
363
+ return /*#__PURE__*/_jsx(PageSettings, {
364
+ ...props
365
+ });
361
366
  default:
362
367
  return /*#__PURE__*/_jsx("div", {
363
368
  ...element.attr,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"