Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Knowledge Space WP Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
alg
Knowledge Space WP Plugin
Commits
1916d100
Commit
1916d100
authored
2 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Adjusts interactions for links
parent
5584663f
No related branches found
No related tags found
1 merge request
!2
Implemented editor in the react framework
Pipeline
#56812
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/editor/js/components/editor.tsx
+30
-27
30 additions, 27 deletions
src/editor/js/components/editor.tsx
with
30 additions
and
27 deletions
src/editor/js/components/editor.tsx
+
30
−
27
View file @
1916d100
...
@@ -368,8 +368,11 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
...
@@ -368,8 +368,11 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
}
}
private
handleLinkClick
(
link
:
Link
)
{
private
handleLinkClick
(
link
:
Link
)
{
link
.
delete
();
if
(
this
.
state
.
keys
[
"
Control
"
])
{
this
.
forceUpdate
();
// Delete link when control is pressed
link
.
delete
();
this
.
forceUpdate
();
}
}
}
private
handleEngineStop
()
{
private
handleEngineStop
()
{
...
@@ -391,6 +394,30 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
...
@@ -391,6 +394,30 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
<
h1
>
Interface
</
h1
>
<
h1
>
Interface
</
h1
>
<
SpaceSelect
onLoadSpace
=
{
this
.
loadSpace
}
/>
<
SpaceSelect
onLoadSpace
=
{
this
.
loadSpace
}
/>
<
div
id
=
"content"
>
<
div
id
=
"content"
>
{
this
.
state
.
graph
?
(
<
ReactForceGraph2d
ref
=
{
this
.
renderer
}
graphData
=
{
this
.
state
.
graph
.
data
}
onNodeClick
=
{
this
.
handleNodeClick
}
autoPauseRedraw
=
{
false
}
cooldownTicks
=
{
0
}
warmupTicks
=
{
this
.
warmupTicks
}
onEngineStop
=
{
this
.
handleEngineStop
}
nodeCanvasObject
=
{
this
.
handleNodeCanvasObject
}
nodeCanvasObjectMode
=
{
()
=>
"
after
"
}
linkCanvasObject
=
{
this
.
handleLinkCanvasObject
}
linkCanvasObjectMode
=
{
()
=>
"
replace
"
}
onNodeDrag
=
{
this
.
handleNodeDrag
}
onNodeDragEnd
=
{
this
.
handleNodeDragEnd
}
onLinkClick
=
{
this
.
handleLinkClick
}
onBackgroundClick
=
{
(
event
)
=>
this
.
handleBackgroundClick
(
event
,
this
.
extractPositions
(
event
)
)
}
/>
)
:
undefined
}
<
div
id
=
"sidepanel"
>
<
div
id
=
"sidepanel"
>
<
HistoryNavigator
<
HistoryNavigator
spaceId
=
"space"
spaceId
=
"space"
...
@@ -402,7 +429,7 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
...
@@ -402,7 +429,7 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
<
li
>
Click background to create node
</
li
>
<
li
>
Click background to create node
</
li
>
<
li
>
Click node to select and edit
</
li
>
<
li
>
Click node to select and edit
</
li
>
<
li
>
CTRL+Click node to delete
</
li
>
<
li
>
CTRL+Click node to delete
</
li
>
<
li
>
Click link to delete
</
li
>
<
li
>
CTRL+
Click link to delete
</
li
>
<
li
>
SHIFT+Click a second node to connect
</
li
>
<
li
>
SHIFT+Click a second node to connect
</
li
>
{
this
.
state
.
connectOnDrag
?
(
{
this
.
state
.
connectOnDrag
?
(
<
li
>
<
li
>
...
@@ -466,30 +493,6 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
...
@@ -466,30 +493,6 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
Connect nodes when dragged
Connect nodes when dragged
</
label
>
</
label
>
</
div
>
</
div
>
{
this
.
state
.
graph
?
(
<
ReactForceGraph2d
ref
=
{
this
.
renderer
}
graphData
=
{
this
.
state
.
graph
.
data
}
onNodeClick
=
{
this
.
handleNodeClick
}
autoPauseRedraw
=
{
false
}
cooldownTicks
=
{
0
}
warmupTicks
=
{
this
.
warmupTicks
}
onEngineStop
=
{
this
.
handleEngineStop
}
nodeCanvasObject
=
{
this
.
handleNodeCanvasObject
}
nodeCanvasObjectMode
=
{
()
=>
"
after
"
}
linkCanvasObject
=
{
this
.
handleLinkCanvasObject
}
linkCanvasObjectMode
=
{
()
=>
"
replace
"
}
onNodeDrag
=
{
this
.
handleNodeDrag
}
onNodeDragEnd
=
{
this
.
handleNodeDragEnd
}
onLinkClick
=
{
this
.
handleLinkClick
}
onBackgroundClick
=
{
(
event
)
=>
this
.
handleBackgroundClick
(
event
,
this
.
extractPositions
(
event
)
)
}
/>
)
:
undefined
}
</
div
>
</
div
>
</
div
>
</
div
>
);
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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