Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax-prosemirror
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wax
wax-prosemirror
Commits
838a136d
Commit
838a136d
authored
8 months ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
editoria file and config
parent
d821b894
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
editors/demo/src/Editoria/Editoria.js
+26
-111
26 additions, 111 deletions
editors/demo/src/Editoria/Editoria.js
editors/demo/src/Editoria/config/config.js
+35
-31
35 additions, 31 deletions
editors/demo/src/Editoria/config/config.js
with
61 additions
and
142 deletions
editors/demo/src/Editoria/Editoria.js
+
26
−
111
View file @
838a136d
import
React
,
{
useLayoutEffect
,
useState
,
useMemo
,
useEffect
,
useRef
,
}
from
'
react
'
;
import
React
,
{
useLayoutEffect
,
useState
,
useMemo
,
useRef
}
from
'
react
'
;
import
{
Wax
}
from
'
wax-prosemirror-core
'
;
...
...
@@ -12,8 +6,6 @@ import { EditoriaLayout, EditoriaMobileLayout } from './layout';
import
{
config
,
configMobile
}
from
'
./config
'
;
import
{
demo
}
from
'
./demo
'
;
import
{
debounce
}
from
'
lodash
'
;
import
{
TablesService
}
from
'
wax-table-service
'
;
import
{
YjsService
}
from
'
wax-prosemirror-services
'
;
const
renderImage
=
file
=>
{
const
reader
=
new
FileReader
();
...
...
@@ -36,9 +28,6 @@ const user = {
const
Editoria
=
()
=>
{
const
[
width
]
=
useWindowSize
();
const
[
myConfig
,
setMyConfig
]
=
useState
(
config
);
const
[
myName
,
setMyName
]
=
useState
(
'
COKO
'
);
const
[
isFirst
,
setFirst
]
=
useState
(
true
);
let
layout
=
EditoriaLayout
;
let
finalConfig
=
config
;
...
...
@@ -51,106 +40,32 @@ const Editoria = () => {
}
const
editorRef
=
useRef
();
// useEffect(() => {
// console.log('sss');
// // const configObj = config(yjsProvider, ydoc, 'christos')
// setTimeout(() => {
// setFirst(false);
// }, 5000);
// // configObj.services = [...configObj.services, new TablesService()]
// }, [isFirst]);
if
(
!
isFirst
)
{
// configObj.services = [...configObj.services, new TablesService()]
// configObj.name = 'ddd';
config
.
name
=
'
Ffdfd
'
;
// setMyConfig({ ...myConfig });
}
return
(
<>
<
button
onClick
=
{()
=>
{
console
.
log
(
myConfig
);
// myConfig.PmPlugins = [];
myConfig
.
services
=
[...
myConfig
.
services
,
new
TablesService
()];
myConfig
.
name
=
'
Ffd1fd
'
;
setMyConfig
({
...
myConfig
});
}}
>
{
'
'
}
change
config
<
/button
>
<
button
onClick
=
{()
=>
{
setMyName
(
'
GIANNIS
'
);
}}
>
{
'
'
}
change
name
<
/button
>
<
Wax
ref
=
{
editorRef
}
key
=
{
key
}
config
=
{
config
}
autoFocus
placeholder
=
"
Type Something...
"
fileUpload
=
{
file
=>
renderImage
(
file
)}
// value={demo}
// readonly
layout
=
{
layout
}
name
=
{
myName
}
// onChange={debounce(source => {
// console.log(JSON.stringify(source));
// }, 200)}
user
=
{
user
}
scrollMargin
=
{
200
}
scrollThreshold
=
{
200
}
value
=
{
'
<p>fdsfsdf<strong>test</strong>ss</p>
'
}
/
>
<
/
>
const
EditoriaComponent
=
useMemo
(
()
=>
(
<>
<
Wax
ref
=
{
editorRef
}
key
=
{
key
}
config
=
{
finalConfig
}
autoFocus
placeholder
=
"
Type Something...
"
fileUpload
=
{
file
=>
renderImage
(
file
)}
value
=
{
demo
}
// readonly
layout
=
{
layout
}
// onChange={debounce(source => {
// console.log(JSON.stringify(source));
// }, 200)}
user
=
{
user
}
scrollMargin
=
{
200
}
scrollThreshold
=
{
200
}
/
>
<
/
>
),
// eslint-disable-next-line react-hooks/exhaustive-deps
[
layout
,
finalConfig
],
);
// const EditoriaComponent = useMemo(
// () => (
// <>
// <button
// onClick={() => {
// console.log(myConfig);
// myConfig.PmPlugins = [];
// myConfig.services = [...myConfig.services, new TablesService()];
// setMyConfig({ ...myConfig });
// }}
// >
// {' '}
// change config
// </button>
// <Wax
// ref={editorRef}
// key={key}
// config={myConfig}
// autoFocus
// placeholder="Type Something..."
// fileUpload={file => renderImage(file)}
// // value={demo}
// // readonly
// layout={layout}
// // onChange={debounce(source => {
// // console.log(JSON.stringify(source));
// // }, 200)}
// user={user}
// scrollMargin={200}
// scrollThreshold={200}
// />
// </>
// ),
// // eslint-disable-next-line react-hooks/exhaustive-deps
// [layout, myConfig],
// );
// return <>{EditoriaComponent}</>;
return
<>
{
EditoriaComponent
}
<
/>
;
};
function
useWindowSize
()
{
...
...
This diff is collapsed.
Click to expand it.
editors/demo/src/Editoria/config/config.js
+
35
−
31
View file @
838a136d
...
...
@@ -26,8 +26,8 @@ import {
disallowPasteImagesPlugin
,
BlockDropDownToolGroupService
,
AskAiContentService
,
YjsService
,
BlockQuoteService
,
YjsService
,
}
from
'
wax-prosemirror-services
'
;
import
{
TablesService
,
tableEditing
,
columnResizing
}
from
'
wax-table-service
'
;
...
...
@@ -53,7 +53,11 @@ async function DummyPromise(userInput, { askKb }) {
}
else
{
// JSON response test
const
json
=
JSON
.
stringify
({
content
:
askKb
?
'
KB will be queried
'
:
'
Just a normal call
'
,
content
:
askKb
?
'
KB will be queried
'
:
`<p>Hello my friend</p>
<strong>this is a strong</strong>
<h1>this a title</h1>`
,
citations
:
[
'
citation 1
'
,
'
citation 2
'
,
'
citation 3
'
],
links
:
[
'
https://coko.foundation/
'
,
'
https://waxjs.net/about/
'
],
});
...
...
@@ -213,7 +217,7 @@ export default {
templateArea
:
'
mainMenuToolBar
'
,
toolGroups
:
[
'
Base
'
,
//
'BlockDropDown',
'
BlockDropDown
'
,
// 'TitleTool',
{
name
:
'
Annotations
'
,
...
...
@@ -228,26 +232,26 @@ export default {
'
BlockQuoteTool
'
,
'
HighlightToolGroup
'
,
'
TransformToolGroup
'
,
//
'CustomTagInline',
'
CustomTagInline
'
,
'
Notes
'
,
'
Lists
'
,
'
Images
'
,
'
SpecialCharacters
'
,
//
'CodeBlock',
'
CodeBlock
'
,
'
ToggleAi
'
,
//
'Tables',
'
Tables
'
,
'
TrackingAndEditing
'
,
'
FullScreen
'
,
],
},
//
{
//
templateArea: 'leftSideBar',
//
toolGroups: ['DisplayText'],
//
},
//
{
//
templateArea: 'commentTrackToolBar',
//
toolGroups: ['TrackCommentOptions'],
//
},
{
templateArea
:
'
leftSideBar
'
,
toolGroups
:
[
'
DisplayText
'
],
},
{
templateArea
:
'
commentTrackToolBar
'
,
toolGroups
:
[
'
TrackCommentOptions
'
],
},
{
templateArea
:
'
BottomRightInfo
'
,
toolGroups
:
[
'
InfoToolGroup
'
],
...
...
@@ -308,13 +312,13 @@ export default {
updateTags
:
saveTags
,
},
YjsService
:
{
// eslint-disable-next-line no-restricted-globals
connectionUrl
:
'
ws://localhost:5010
'
,
// connectionUrl: 'ws://0.tcp.ap.ngrok.io:17607',
docIdentifier
:
'
prosemirror-
2
'
,
YjsType
:
'
prosemirror
'
,
},
//
YjsService: {
//
// eslint-disable-next-line no-restricted-globals
//
connectionUrl: 'ws://localhost:5010',
//
// connectionUrl: 'ws://0.tcp.ap.ngrok.io:17607',
//
docIdentifier: 'prosemirror-
r5dw4q2fe2eedreeeeeweewwewerc
',
//
YjsType: 'prosemirror',
//
},
AskAiContentService
:
{
AskAiContentTransformation
:
DummyPromise
,
...
...
@@ -323,29 +327,29 @@ export default {
// GenerateImages: false,
CustomPromptsOn
:
true
,
FreeTextPromptsOn
:
true
,
CustomPrompts
:
[],
CustomPrompts
:
[
'
custom promt here!!
'
],
},
services
:
[
new
YjsService
(),
// new YjsService(),
new
BlockDropDownToolGroupService
(),
new
BlockQuoteService
(),
// new BlockDropDownToolGroupService(),
new
AskAiContentService
(),
//
new CustomTagService(),
//
new DisplayBlockLevelService(),
//
new TextBlockLevelService(),
new
CustomTagService
(),
new
DisplayBlockLevelService
(),
new
TextBlockLevelService
(),
new
ListsService
(),
new
LinkService
(),
new
InlineAnnotationsService
(),
new
TrackChangeService
(),
//
new CommentsService(),
new
CommentsService
(),
new
ImageService
(),
//
new TablesService(),
new
TablesService
(),
new
BaseService
(),
new
NoteService
(),
//
new CodeBlockService(),
new
CodeBlockService
(),
new
EditingSuggestingService
(),
//
new DisplayTextToolGroupService(),
new
DisplayTextToolGroupService
(),
new
MathService
(),
new
FindAndReplaceService
(),
new
FullScreenService
(),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment