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
1339f5f5
Commit
1339f5f5
authored
2 years ago
by
chris
Browse files
Options
Downloads
Patches
Plain Diff
add alt overlay in service
parent
9c8cec92
No related branches found
No related tags found
1 merge request
!413
Image alt text
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
wax-prosemirror-services/src/ImageService/AltComponent.js
+29
-0
29 additions, 0 deletions
wax-prosemirror-services/src/ImageService/AltComponent.js
wax-prosemirror-services/src/ImageService/ImageService.js
+14
-0
14 additions, 0 deletions
wax-prosemirror-services/src/ImageService/ImageService.js
with
43 additions
and
0 deletions
wax-prosemirror-services/src/ImageService/AltComponent.js
0 → 100644
+
29
−
0
View file @
1339f5f5
/* eslint-disable react/prop-types */
import
React
,
{
useContext
,
useLayoutEffect
}
from
'
react
'
;
import
styled
from
'
styled-components
'
;
import
{
WaxContext
}
from
'
wax-prosemirror-core
'
;
export
default
({
setPosition
,
position
})
=>
{
const
context
=
useContext
(
WaxContext
);
const
{
activeView
,
pmViews
:
{
main
},
}
=
context
;
const
isEditable
=
main
.
props
.
editable
(
editable
=>
{
return
editable
;
});
const
readOnly
=
!
isEditable
;
useLayoutEffect
(()
=>
{
const
WaxSurface
=
activeView
.
dom
.
getBoundingClientRect
();
const
left
=
300
;
const
top
=
500
;
setPosition
({
...
position
,
left
,
top
});
},
[
position
.
left
]);
if
(
!
readOnly
)
{
return
<
input
type
=
"
text
"
/>
;
}
};
This diff is collapsed.
Click to expand it.
wax-prosemirror-services/src/ImageService/ImageService.js
+
14
−
0
View file @
1339f5f5
...
@@ -7,6 +7,7 @@ import { PlaceHolderPlugin, captionPlugin } from 'wax-prosemirror-plugins';
...
@@ -7,6 +7,7 @@ import { PlaceHolderPlugin, captionPlugin } from 'wax-prosemirror-plugins';
import
Service
from
'
../Service
'
;
import
Service
from
'
../Service
'
;
import
Image
from
'
./Image
'
;
import
Image
from
'
./Image
'
;
import
'
./image.css
'
;
import
'
./image.css
'
;
import
AltComponent
from
'
./AltComponent
'
;
class
ImageService
extends
Service
{
class
ImageService
extends
Service
{
name
=
'
ImageService
'
;
name
=
'
ImageService
'
;
...
@@ -22,6 +23,7 @@ class ImageService extends Service {
...
@@ -22,6 +23,7 @@ class ImageService extends Service {
register
()
{
register
()
{
this
.
container
.
bind
(
'
Image
'
).
to
(
Image
);
this
.
container
.
bind
(
'
Image
'
).
to
(
Image
);
const
createNode
=
this
.
container
.
get
(
'
CreateNode
'
);
const
createNode
=
this
.
container
.
get
(
'
CreateNode
'
);
const
createOverlay
=
this
.
container
.
get
(
'
CreateOverlay
'
);
createNode
({
createNode
({
figure
:
figureNode
,
figure
:
figureNode
,
});
});
...
@@ -39,6 +41,18 @@ class ImageService extends Service {
...
@@ -39,6 +41,18 @@ class ImageService extends Service {
// ,
// ,
// { toWaxSchema: true },
// { toWaxSchema: true },
);
);
createOverlay
(
AltComponent
,
{},
{
nodeType
:
'
image
'
,
findInParent
:
false
,
markType
:
''
,
followCursor
:
false
,
selection
:
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