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
5a43643c
Commit
5a43643c
authored
3 years ago
by
Maximilian Giller
Browse files
Options
Downloads
Patches
Plain Diff
Implemented image preview of node menu
parent
5a903086
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
editor/css/editor.css
+0
-1
0 additions, 1 deletion
editor/css/editor.css
editor/editor.php
+1
-1
1 addition, 1 deletion
editor/editor.php
editor/js/tools/menus/selectmenu.js
+15
-2
15 additions, 2 deletions
editor/js/tools/menus/selectmenu.js
with
16 additions
and
4 deletions
editor/css/editor.css
+
0
−
1
View file @
5a43643c
...
@@ -46,5 +46,4 @@ div#ks-editor textarea {
...
@@ -46,5 +46,4 @@ div#ks-editor textarea {
div
#ks-editor
img
#node-image-preview
{
div
#ks-editor
img
#node-image-preview
{
max-width
:
5rem
;
max-width
:
5rem
;
height
:
auto
;
height
:
auto
;
border-radius
:
50%
;
}
}
This diff is collapsed.
Click to expand it.
editor/editor.php
+
1
−
1
View file @
5a43643c
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
<input
type=
"text"
id=
"node-name"
name=
"node-name"
placeholder=
"Enter name"
class=
"bottom-space"
></input>
<input
type=
"text"
id=
"node-name"
name=
"node-name"
placeholder=
"Enter name"
class=
"bottom-space"
></input>
<label
for=
"node-image"
>
Image
</label>
<label
for=
"node-image"
>
Image
</label>
<img
id=
"node-image-preview"
src=
"
https://via.placeholder.com/150
"
/>
<img
id=
"node-image-preview"
src=
""
/>
<input
type=
"text"
id=
"node-image"
name=
"node-image"
placeholder=
"Enter file name"
class=
"medium-width bottom-space"
/>
<input
type=
"text"
id=
"node-image"
name=
"node-image"
placeholder=
"Enter file name"
class=
"medium-width bottom-space"
/>
<label
for=
"node-description"
>
Description
</label>
<label
for=
"node-description"
>
Description
</label>
...
...
This diff is collapsed.
Click to expand it.
editor/js/tools/menus/selectmenu.js
+
15
−
2
View file @
5a43643c
...
@@ -10,6 +10,7 @@ const CONTEXT_NOTHING = "#nothing-selected";
...
@@ -10,6 +10,7 @@ const CONTEXT_NOTHING = "#nothing-selected";
const
CONTEXT_NODE
=
"
#node-selected
"
;
const
CONTEXT_NODE
=
"
#node-selected
"
;
const
CONTEXT_LINK
=
"
#link-selected
"
;
const
CONTEXT_LINK
=
"
#link-selected
"
;
const
NODE_IMG_PREVIEW
=
"
#node-image-preview
"
;
const
NODE_NAME_ID
=
"
#node-name
"
;
const
NODE_NAME_ID
=
"
#node-name
"
;
const
NODE_IMG_ID
=
"
#node-image
"
;
const
NODE_IMG_ID
=
"
#node-image
"
;
const
NODE_DESC_ID
=
"
#node-description
"
;
const
NODE_DESC_ID
=
"
#node-description
"
;
...
@@ -49,11 +50,9 @@ export class SelectMenu extends ToolMenu {
...
@@ -49,11 +50,9 @@ export class SelectMenu extends ToolMenu {
hookMenu
()
{
hookMenu
()
{
MENU
.
forEach
((
menu
)
=>
{
MENU
.
forEach
((
menu
)
=>
{
console
.
log
(
this
.
find
(
menu
));
// Subscribes to change event for each menu element
// Subscribes to change event for each menu element
this
.
find
(
menu
).
on
(
"
change
"
,
(
e
)
=>
{
this
.
find
(
menu
).
on
(
"
change
"
,
(
e
)
=>
{
var
newValue
=
e
.
target
.
value
;
var
newValue
=
e
.
target
.
value
;
console
.
log
(
newValue
);
// Modify stored selection
// Modify stored selection
this
.
values
[
SELECTION_KEY
][
this
.
toProperty
(
menu
)]
=
newValue
;
this
.
values
[
SELECTION_KEY
][
this
.
toProperty
(
menu
)]
=
newValue
;
...
@@ -65,6 +64,20 @@ export class SelectMenu extends ToolMenu {
...
@@ -65,6 +64,20 @@ export class SelectMenu extends ToolMenu {
);
);
});
});
});
});
// Special hook for image, to update the shown image with every change
this
.
find
(
NODE_IMG_ID
).
on
(
"
change
"
,
(
e
)
=>
{
var
fileName
=
e
.
target
.
value
;
var
previewImage
=
this
.
find
(
NODE_IMG_PREVIEW
);
// Show default empty image
if
(
fileName
===
""
)
{
previewImage
.
attr
(
"
src
"
,
""
);
}
else
{
var
url
=
Graph
.
IMAGE_SRC
+
fileName
;
previewImage
.
attr
(
"
src
"
,
url
);
}
});
}
}
toProperty
(
menu
)
{
toProperty
(
menu
)
{
...
...
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