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
538d2857
Commit
538d2857
authored
1 year ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
add config title
parent
67b1d0d7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!516
Title dropdown
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wax-prosemirror-services/src/WaxToolGroups/BlockDropDownToolGroupService/BlockDropDownComponent.js
+37
-9
37 additions, 9 deletions
...s/BlockDropDownToolGroupService/BlockDropDownComponent.js
with
37 additions
and
9 deletions
wax-prosemirror-services/src/WaxToolGroups/BlockDropDownToolGroupService/BlockDropDownComponent.js
+
37
−
9
View file @
538d2857
...
...
@@ -10,7 +10,12 @@ import React, {
import
{
isEmpty
}
from
'
lodash
'
;
import
styled
from
'
styled-components
'
;
import
{
useTranslation
}
from
'
react-i18next
'
;
import
{
WaxContext
,
Icon
,
useOnClickOutside
}
from
'
wax-prosemirror-core
'
;
import
{
DocumentHelpers
,
WaxContext
,
Icon
,
useOnClickOutside
,
}
from
'
wax-prosemirror-core
'
;
const
Wrapper
=
styled
.
div
`
opacity:
${
props
=>
(
props
.
disabled
?
'
0.4
'
:
'
1
'
)}
;
...
...
@@ -76,12 +81,6 @@ const StyledIcon = styled(Icon)`
const
BlockDropDownComponent
=
({
view
,
tools
})
=>
{
const
{
t
,
i18n
}
=
useTranslation
();
const
context
=
useContext
(
WaxContext
);
const
{
activeView
,
activeViewId
,
pmViews
:
{
main
},
}
=
context
;
const
translatedLabel
=
(
translation
,
defaultLabel
)
=>
{
return
!
isEmpty
(
i18n
)
&&
i18n
.
exists
(
translation
)
...
...
@@ -89,8 +88,6 @@ const BlockDropDownComponent = ({ view, tools }) => {
:
defaultLabel
;
};
const
[
label
,
setLabel
]
=
useState
(
null
);
const
dropDownOptions
=
[
{
label
:
translatedLabel
(
`Wax.BlockLevel.Title (H1)`
,
'
Title
'
),
...
...
@@ -119,6 +116,37 @@ const BlockDropDownComponent = ({ view, tools }) => {
},
];
const
context
=
useContext
(
WaxContext
);
const
{
app
,
activeView
,
activeViewId
,
pmViews
:
{
main
},
}
=
context
;
const
[
label
,
setLabel
]
=
useState
(
null
);
const
{
dispatch
,
state
}
=
view
;
/* Chapter Title */
const
titleNode
=
DocumentHelpers
.
findChildrenByType
(
state
.
doc
,
state
.
config
.
schema
.
nodes
.
title
,
true
,
);
const
titleConfig
=
app
.
config
.
get
(
'
config.TitleService
'
);
let
chapterTitle
=
''
;
if
(
titleNode
[
0
])
chapterTitle
=
titleNode
[
0
].
node
.
textContent
;
useEffect
(()
=>
{
if
(
titleConfig
)
{
if
(
titleNode
[
0
])
{
titleConfig
.
updateTitle
(
titleNode
[
0
].
node
.
textContent
);
}
else
{
titleConfig
.
updateTitle
(
''
);
}
}
},
[
chapterTitle
]);
const
itemRefs
=
useRef
([]);
const
wrapperRef
=
useRef
();
const
[
isOpen
,
setIsOpen
]
=
useState
(
false
);
...
...
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