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
251ed7e4
Commit
251ed7e4
authored
2 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
keep all section headings
parent
5f063550
No related branches found
No related tags found
1 merge request
!407
Hhmi fixes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
editors/demo/src/OEN/OEN.js
+4
-7
4 additions, 7 deletions
editors/demo/src/OEN/OEN.js
wax-prosemirror-services/src/OENContainersService/PopulateHeadingsComponent.js
+11
-0
11 additions, 0 deletions
...ces/src/OENContainersService/PopulateHeadingsComponent.js
with
15 additions
and
7 deletions
editors/demo/src/OEN/OEN.js
+
4
−
7
View file @
251ed7e4
...
@@ -25,10 +25,7 @@ const user = {
...
@@ -25,10 +25,7 @@ const user = {
username
:
'
admin
'
,
username
:
'
admin
'
,
};
};
const
val
=
`<h3>33333</h3><section class="section"><div class="introduction" data-type="content_structure_element"><p>Intro</p></div>
const
val
=
`<p>first paragraph</p><section class=\"whatever\"><h2>Section 1 heading 2</h2><p class=\"paragraph\">normal text</p></section><section class=\"whatever\"><h2>Section 2 heading 2</h2><p class=\"paragraph\">normal text</p></section><section class=\"whatever\"><p class=\"paragraph\">dfsfsdfs</p><p class=\"paragraph\">normal text</p></section><section class=\"whatever\"><h2>Section 4 heading 2</h2><p class=\"paragraph\">normal text</p></section><p class=\"paragraph\">some text</p><div class=\"outline\" data-type=\"content_structure_element\"><p class=\"paragraph\"></p></div>`
;
<div class="outline" data-type="content_structure_element"><h1>heading when i click note</h1><p>some text when i click note</p></div></section>
<section class="section"><div class="introduction" data-type="content_structure_element"><p>Intro</p></div>
<div class="outline" data-type="content_structure_element"><p>outline</p></div></section>`
;
const
Oen
=
()
=>
{
const
Oen
=
()
=>
{
const
editorRef
=
useRef
();
const
editorRef
=
useRef
();
...
@@ -43,9 +40,9 @@ const Oen = () => {
...
@@ -43,9 +40,9 @@ const Oen = () => {
value
=
{
val
}
value
=
{
val
}
// readonly
// readonly
layout
=
{
OenLayout
}
layout
=
{
OenLayout
}
//
onChange={debounce(source => {
onChange
=
{
debounce
(
source
=>
{
//
console.log(JSON.stringify(source));
console
.
log
(
JSON
.
stringify
(
source
));
//
}, 200)}
},
200
)}
user
=
{
user
}
user
=
{
user
}
/
>
/
>
);
);
...
...
This diff is collapsed.
Click to expand it.
wax-prosemirror-services/src/OENContainersService/PopulateHeadingsComponent.js
+
11
−
0
View file @
251ed7e4
...
@@ -80,6 +80,7 @@ export default ({ setPosition, position }) => {
...
@@ -80,6 +80,7 @@ export default ({ setPosition, position }) => {
}
=
main
.
state
;
}
=
main
.
state
;
const
allSectionNodes
=
[];
const
allSectionNodes
=
[];
const
sectionHeadings
=
{};
doc
.
descendants
((
editorNode
,
index
)
=>
{
doc
.
descendants
((
editorNode
,
index
)
=>
{
if
(
editorNode
.
type
.
name
===
'
oen_section
'
)
{
if
(
editorNode
.
type
.
name
===
'
oen_section
'
)
{
...
@@ -87,6 +88,16 @@ export default ({ setPosition, position }) => {
...
@@ -87,6 +88,16 @@ export default ({ setPosition, position }) => {
}
}
});
});
allSectionNodes
.
forEach
((
node
,
index
)
=>
{
node
.
content
.
content
.
forEach
(
contentNode
=>
{
if
(
contentNode
.
type
.
name
===
'
heading2
'
)
{
sectionHeadings
[
index
]
=
[
contentNode
.
textContent
];
}
else
if
(
!
sectionHeadings
[
index
])
{
sectionHeadings
[
index
]
=
[
'
untitled
'
];
}
});
});
let
sectionNode
;
let
sectionNode
;
let
sectionNodePosition
;
let
sectionNodePosition
;
...
...
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