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
51bb2af4
Commit
51bb2af4
authored
2 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Implemented alternative connect mechanic
parent
0e479f02
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!2
Implemented editor in the react framework
Pipeline
#56730
passed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/editor/js/components/editor.css
+7
-0
7 additions, 0 deletions
src/editor/js/components/editor.css
src/editor/js/components/editor.tsx
+48
-9
48 additions, 9 deletions
src/editor/js/components/editor.tsx
with
55 additions
and
9 deletions
src/editor/js/components/editor.css
+
7
−
0
View file @
51bb2af4
...
...
@@ -18,6 +18,13 @@ div#ks-editor #sidepanel > * {
margin
:
0.25rem
;
}
div
#ks-editor
#sidepanel
.instruction
{
border-radius
:
4px
;
background-color
:
#EEE
;
padding-left
:
3px
;
padding-right
:
2px
;
}
div
#ks-editor
#content
{
display
:
flex
;
}
...
...
This diff is collapsed.
Click to expand it.
src/editor/js/components/editor.tsx
+
48
−
9
View file @
51bb2af4
...
...
@@ -221,13 +221,28 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
};
}
private
selectNode
(
node
:
Node
)
{
this
.
setState
({
selectedNode
:
node
,
});
}
private
handleNodeClick
(
node
:
Node
)
{
if
(
this
.
state
.
keys
[
"
Control
"
])
{
if
(
this
.
state
.
keys
[
"
Shift
"
])
{
// Connect two nodes when second select while shift is pressed
if
(
this
.
state
.
selectedNode
==
undefined
)
{
// Have no node connected, so select
this
.
selectNode
(
node
);
}
else
if
(
!
this
.
state
.
selectedNode
.
equals
(
node
))
{
// Already have *other* node selected, so connect
this
.
state
.
selectedNode
.
connect
(
node
);
}
}
else
if
(
this
.
state
.
keys
[
"
Control
"
])
{
// Delete node when control is pressed
node
.
delete
();
}
else
{
this
.
setState
({
selectedNode
:
node
,
});
// By default, simply select node
this
.
selectNode
(
node
);
}
this
.
forceUpdate
();
}
...
...
@@ -376,11 +391,35 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> {
/>
<
hr
/>
<
ul
>
<
li
>
Click background to create node
</
li
>
<
li
>
Click node to select and edit
</
li
>
<
li
>
CTRL+Click node to delete
</
li
>
<
li
>
Click link to delete
</
li
>
<
li
>
Drag node close to other node to connect
</
li
>
<
li
>
<
div
className
=
"instruction"
>
Click background to create node
</
div
>
</
li
>
<
li
>
<
div
className
=
"instruction"
>
Click node to select and edit
</
div
>
</
li
>
<
li
>
<
div
className
=
"instruction"
>
CTRL+Click node to delete
</
div
>
</
li
>
<
li
>
<
div
className
=
"instruction"
>
Click link to delete
</
div
>
</
li
>
<
li
>
<
div
className
=
"instruction"
>
SHIFT+Click a second node to connect
</
div
>
or
<
div
className
=
"instruction"
>
Drag node close to other node to connect
</
div
>
</
li
>
</
ul
>
<
hr
/>
<
NodeDetails
...
...
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