@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(
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
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,
|