diff --git a/editors/demo/src/Editoria/Editoria.js b/editors/demo/src/Editoria/Editoria.js index e35f93c22ab3676f47c63ca8835efee49858f7f3..370982c84c5ae3f860e3989c3364dc9aeb6d03bb 100644 --- a/editors/demo/src/Editoria/Editoria.js +++ b/editors/demo/src/Editoria/Editoria.js @@ -1,4 +1,10 @@ -import React, { useLayoutEffect, useState, useMemo, useRef } from 'react'; +import React, { + useLayoutEffect, + useState, + useMemo, + useRef, + useEffect, +} from 'react'; import { Wax } from 'wax-prosemirror-core'; @@ -30,7 +36,48 @@ const Editoria = () => { const [width] = useWindowSize(); let layout = EditoriaLayout; - let finalConfig = config; + const comments = [ + { + id: 'c6863c3e-cfb1-4465-a46e-e89718e10245', + from: 83, + to: 94, + data: { + type: 'comment', + pmFrom: 83, + pmTo: 94, + conversation: [ + { + content: '345345435', + displayName: 'admin', + userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', + timestamp: 1721647289866, + }, + { + content: '111', + displayName: 'admin', + userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', + timestamp: 1721647292430, + }, + { + content: '222', + displayName: 'admin', + userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', + timestamp: 1721647294920, + }, + { + content: '444', + displayName: 'admin', + userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', + timestamp: 1721647307447, + }, + ], + title: '353443', + group: 'main', + viewId: 'main', + }, + }, + ]; + let finalConfig = config(comments); let key = 'editoria'; if (width < 600) { @@ -40,6 +87,8 @@ const Editoria = () => { } const editorRef = useRef(); + useEffect(() => {}, []); + const EditoriaComponent = useMemo( () => ( <> diff --git a/editors/demo/src/Editoria/config/config.js b/editors/demo/src/Editoria/config/config.js index 7fa44359dc42d458e7018f346090d316a7945171..024e55ddfcfc89a27155f92101d4ec500e44c618 100644 --- a/editors/demo/src/Editoria/config/config.js +++ b/editors/demo/src/Editoria/config/config.js @@ -76,127 +76,8 @@ const getComments = comments => { console.log(comments); }; -const setComments = ( - comments = [ - // { - // id: 'a1', - // from: 5, - // to: 10, - // data: { - // type: 'comment', - // yjsFrom: 5, - // yjsTo: 10, - // pmFrom: 5, - // pmTo: 10, - // conversation: [ - // { - // content: '1111', - // displayName: 'admin', - // userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', - // timestamp: 1710501980537, - // }, - // ], - // title: '111', - // group: 'main', - // viewId: 'main', - // }, - // endHeight: 362.3579406738281, - // }, - // { - // id: 'a2', - // from: 8, - // to: 15, - // data: { - // type: 'comment', - // yjsFrom: 8, - // yjsTo: 15, - // pmFrom: 8, - // pmTo: 15, - // conversation: [ - // { - // content: '222', - // displayName: 'admin', - // userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', - // timestamp: 1710501987197, - // }, - // ], - // title: '222', - // group: 'main', - // viewId: 'main', - // }, - // endHeight: 266.3579406738281, - // }, - // { - // id: 'b8d907d4-1859-49a9-abcd-13788d497758', - // from: { - // type: { - // client: 2887320119, - // clock: 150, - // }, - // tname: null, - // item: { - // client: 2887320119, - // clock: 185, - // }, - // assoc: 0, - // }, - // to: { - // type: { - // client: 2887320119, - // clock: 150, - // }, - // tname: null, - // item: { - // client: 2887320119, - // clock: 195, - // }, - // assoc: 0, - // }, - // data: { - // yjsFrom: { - // type: { - // client: 2887320119, - // clock: 150, - // }, - // tname: null, - // item: { - // client: 2887320119, - // clock: 185, - // }, - // assoc: 0, - // }, - // yjsTo: { - // type: { - // client: 2887320119, - // clock: 150, - // }, - // tname: null, - // item: { - // client: 2887320119, - // clock: 195, - // }, - // assoc: 0, - // }, - // pmFrom: 164, - // pmTo: 174, - // type: 'comment', - // conversation: [ - // { - // content: 'dfgdfgd', - // displayName: 'admin', - // userId: 'b3cfc28e-0f2e-45b5-b505-e66783d4f946', - // timestamp: 1713699155995, - // }, - // ], - // title: 'dgfdgf', - // group: 'main', - // viewId: 'main', - // }, - // endHeight: 406.734375, - // }, - ], -) => { - return comments; +const setComments = () => { + return []; }; const saveTags = tags => { @@ -211,7 +92,7 @@ const onWarning = message => { alert(message); }; -export default { +const config = comments => ({ MenuService: [ { templateArea: 'mainMenuToolBar', @@ -298,7 +179,9 @@ export default { CommentsService: { showTitle: true, getComments, - setComments, + setComments: () => { + return comments; + }, }, CustomTagService: { @@ -356,4 +239,10 @@ export default { new BottomInfoService(), new TransformService(), ], -}; +}); + +export default config; + +// export default { + +// };